mirror of
https://github.com/reactos/reactos.git
synced 2025-04-20 04:20:46 +00:00
[RAPPS] Some fixes
- winmain.cpp, loaddlg.cpp, installed.cpp: Changed string-related opreations - installed.cpp: Fixed buffer sizing when calling RegQueryValueExW() - misc.cpp: Removed unused function - rosui.h: Made use of GetWindowTextLength() svn path=/branches/GSoC_2017/rapps/; revision=75316
This commit is contained in:
parent
cf469e4f74
commit
c8a43ce2d1
5 changed files with 33 additions and 32 deletions
|
@ -32,7 +32,7 @@ GetApplicationString(HKEY hKey, LPCWSTR lpKeyName, LPWSTR szString)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
szString = L"---";
|
||||
StringCchCopyW(szString, MAX_PATH, L"---");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -65,13 +65,13 @@ InstalledVersion(ATL::CStringW& szVersionResult, const ATL::CStringW& RegName, B
|
|||
szPath.GetString(), 0, keyWow | KEY_READ,
|
||||
&hKey) == ERROR_SUCCESS)
|
||||
{
|
||||
DWORD dwSize = MAX_PATH;
|
||||
DWORD dwSize = MAX_PATH * sizeof(WCHAR);
|
||||
DWORD dwType = REG_SZ;
|
||||
if (RegQueryValueExW(hKey,
|
||||
L"DisplayVersion",
|
||||
NULL,
|
||||
&dwType,
|
||||
(LPBYTE) szVersion.GetBuffer(dwSize),
|
||||
(LPBYTE) szVersion.GetBuffer(MAX_PATH),
|
||||
&dwSize) == ERROR_SUCCESS)
|
||||
{
|
||||
szVersion.ReleaseBuffer();
|
||||
|
@ -126,11 +126,11 @@ UninstallApplication(INT Index, BOOL bModify)
|
|||
if (!ListView_GetItem(hListView, &Item))
|
||||
return FALSE;
|
||||
|
||||
ItemInfo = (PINSTALLED_INFO)Item.lParam;
|
||||
ItemInfo = (PINSTALLED_INFO) Item.lParam;
|
||||
hKey = ItemInfo->hSubKey;
|
||||
|
||||
dwType = REG_SZ;
|
||||
dwSize = sizeof(szPath);
|
||||
dwSize = MAX_PATH * sizeof(WCHAR);
|
||||
if (RegQueryValueExW(hKey,
|
||||
bModify ? szModify : szUninstall,
|
||||
NULL,
|
||||
|
@ -208,11 +208,14 @@ RemoveAppFromRegistry(INT Index)
|
|||
|
||||
if (MessageBoxW(hMainWnd, szMsgText, szMsgTitle, MB_YESNO | MB_ICONQUESTION) == IDYES)
|
||||
{
|
||||
wcsncat(szFullName, Info->szKeyName.GetString(), MAX_PATH - wcslen(szFullName));
|
||||
ATL::CStringW::CopyChars(szFullName,
|
||||
MAX_PATH,
|
||||
Info->szKeyName.GetString(),
|
||||
MAX_PATH - wcslen(szFullName));
|
||||
|
||||
if (RegDeleteKeyW(Info->hRootKey, szFullName) == ERROR_SUCCESS)
|
||||
{
|
||||
(VOID) ListView_DeleteItem(hListView, ItemIndex);
|
||||
ListView_DeleteItem(hListView, ItemIndex);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -267,21 +270,22 @@ EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumProc)
|
|||
}
|
||||
|
||||
dwType = REG_SZ;
|
||||
dwSize = MAX_PATH;
|
||||
dwSize = MAX_PATH * sizeof(WCHAR);
|
||||
bIsUpdate = (RegQueryValueExW(Info.hSubKey,
|
||||
L"ParentKeyName",
|
||||
NULL,
|
||||
&dwType,
|
||||
(LPBYTE) szParentKeyName.GetBuffer(dwSize),
|
||||
(LPBYTE) szParentKeyName.GetBuffer(MAX_PATH),
|
||||
&dwSize) == ERROR_SUCCESS);
|
||||
szParentKeyName.ReleaseBuffer();
|
||||
|
||||
dwSize = sizeof(szDisplayName);
|
||||
dwType = REG_SZ;
|
||||
dwSize = MAX_PATH * sizeof(WCHAR);
|
||||
if (RegQueryValueExW(Info.hSubKey,
|
||||
L"DisplayName",
|
||||
NULL,
|
||||
&dwType,
|
||||
(LPBYTE) szDisplayName.GetBuffer(dwSize),
|
||||
(LPBYTE) szDisplayName.GetBuffer(MAX_PATH),
|
||||
&dwSize) == ERROR_SUCCESS)
|
||||
{
|
||||
szDisplayName.ReleaseBuffer();
|
||||
|
|
|
@ -367,7 +367,7 @@ ThreadFunc(LPVOID Context)
|
|||
memset(&urlComponents, 0, sizeof(urlComponents));
|
||||
urlComponents.dwStructSize = sizeof(urlComponents);
|
||||
|
||||
if (FAILED(StringCbLengthW(AppInfo->szUrlDownload, sizeof(AppInfo->szUrlDownload), &urlLength)))
|
||||
if (AppInfo->szUrlDownload.GetLength() > urlLength)
|
||||
goto end;
|
||||
|
||||
urlLength /= sizeof(WCHAR);
|
||||
|
|
|
@ -493,10 +493,3 @@ UINT ParserGetInt(const ATL::CStringW& KeyName, const ATL::CStringW& FileName)
|
|||
|
||||
return (UINT) Result;
|
||||
}
|
||||
|
||||
LPWSTR HeapBufferFromCStringW(const ATL::CStringW& String)
|
||||
{
|
||||
LPWSTR szBuffer = (LPWSTR) HeapAlloc(GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR));
|
||||
ATL::CString::CopyChars(szBuffer, MAX_PATH, String.GetString(), String.GetLength() + 1);
|
||||
return szBuffer;
|
||||
}
|
|
@ -495,7 +495,8 @@ public:
|
|||
|
||||
void GetWindowTextW(ATL::CStringW& szText)
|
||||
{
|
||||
CWindow::GetWindowText(szText.GetBuffer(MAX_STR_LEN), MAX_STR_LEN);
|
||||
INT length = CWindow::GetWindowTextLengthW();
|
||||
CWindow::GetWindowText(szText.GetBuffer(length), length);
|
||||
szText.ReleaseBuffer();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -69,7 +69,10 @@ FillDefaultSettings(PSETTINGS_INFO pSettingsInfo)
|
|||
szDownloadDir.ReleaseBuffer();
|
||||
|
||||
szDownloadDir += L"\\RAPPS Downloads";
|
||||
StringCchCopyW(pSettingsInfo->szDownloadDir, _countof(pSettingsInfo->szDownloadDir), szDownloadDir.GetString());
|
||||
ATL::CStringW::CopyChars(pSettingsInfo->szDownloadDir,
|
||||
_countof(pSettingsInfo->szDownloadDir),
|
||||
szDownloadDir.GetString(),
|
||||
szDownloadDir.GetLength() + 1);
|
||||
|
||||
pSettingsInfo->bDelInstaller = FALSE;
|
||||
pSettingsInfo->Maximized = FALSE;
|
||||
|
@ -79,8 +82,8 @@ FillDefaultSettings(PSETTINGS_INFO pSettingsInfo)
|
|||
pSettingsInfo->Height = 450;
|
||||
pSettingsInfo->Proxy = 0;
|
||||
|
||||
StringCbCopyW(pSettingsInfo->szProxyServer, sizeof(pSettingsInfo->szProxyServer), L"");
|
||||
StringCbCopyW(pSettingsInfo->szNoProxyFor, sizeof(pSettingsInfo->szNoProxyFor), L"");
|
||||
pSettingsInfo->szProxyServer[0] = UNICODE_NULL;
|
||||
pSettingsInfo->szNoProxyFor[0] = UNICODE_NULL;
|
||||
}
|
||||
|
||||
static BOOL
|
||||
|
|
Loading…
Reference in a new issue