mirror of
https://github.com/reactos/reactos.git
synced 2025-04-21 12:40:33 +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;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
szString = L"---";
|
StringCchCopyW(szString, MAX_PATH, L"---");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,13 +65,13 @@ InstalledVersion(ATL::CStringW& szVersionResult, const ATL::CStringW& RegName, B
|
||||||
szPath.GetString(), 0, keyWow | KEY_READ,
|
szPath.GetString(), 0, keyWow | KEY_READ,
|
||||||
&hKey) == ERROR_SUCCESS)
|
&hKey) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
DWORD dwSize = MAX_PATH;
|
DWORD dwSize = MAX_PATH * sizeof(WCHAR);
|
||||||
DWORD dwType = REG_SZ;
|
DWORD dwType = REG_SZ;
|
||||||
if (RegQueryValueExW(hKey,
|
if (RegQueryValueExW(hKey,
|
||||||
L"DisplayVersion",
|
L"DisplayVersion",
|
||||||
NULL,
|
NULL,
|
||||||
&dwType,
|
&dwType,
|
||||||
(LPBYTE) szVersion.GetBuffer(dwSize),
|
(LPBYTE) szVersion.GetBuffer(MAX_PATH),
|
||||||
&dwSize) == ERROR_SUCCESS)
|
&dwSize) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
szVersion.ReleaseBuffer();
|
szVersion.ReleaseBuffer();
|
||||||
|
@ -126,11 +126,11 @@ UninstallApplication(INT Index, BOOL bModify)
|
||||||
if (!ListView_GetItem(hListView, &Item))
|
if (!ListView_GetItem(hListView, &Item))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
ItemInfo = (PINSTALLED_INFO)Item.lParam;
|
ItemInfo = (PINSTALLED_INFO) Item.lParam;
|
||||||
hKey = ItemInfo->hSubKey;
|
hKey = ItemInfo->hSubKey;
|
||||||
|
|
||||||
dwType = REG_SZ;
|
dwType = REG_SZ;
|
||||||
dwSize = sizeof(szPath);
|
dwSize = MAX_PATH * sizeof(WCHAR);
|
||||||
if (RegQueryValueExW(hKey,
|
if (RegQueryValueExW(hKey,
|
||||||
bModify ? szModify : szUninstall,
|
bModify ? szModify : szUninstall,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -208,11 +208,14 @@ RemoveAppFromRegistry(INT Index)
|
||||||
|
|
||||||
if (MessageBoxW(hMainWnd, szMsgText, szMsgTitle, MB_YESNO | MB_ICONQUESTION) == IDYES)
|
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)
|
if (RegDeleteKeyW(Info->hRootKey, szFullName) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
(VOID) ListView_DeleteItem(hListView, ItemIndex);
|
ListView_DeleteItem(hListView, ItemIndex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,21 +270,22 @@ EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumProc)
|
||||||
}
|
}
|
||||||
|
|
||||||
dwType = REG_SZ;
|
dwType = REG_SZ;
|
||||||
dwSize = MAX_PATH;
|
dwSize = MAX_PATH * sizeof(WCHAR);
|
||||||
bIsUpdate = (RegQueryValueExW(Info.hSubKey,
|
bIsUpdate = (RegQueryValueExW(Info.hSubKey,
|
||||||
L"ParentKeyName",
|
L"ParentKeyName",
|
||||||
NULL,
|
NULL,
|
||||||
&dwType,
|
&dwType,
|
||||||
(LPBYTE) szParentKeyName.GetBuffer(dwSize),
|
(LPBYTE) szParentKeyName.GetBuffer(MAX_PATH),
|
||||||
&dwSize) == ERROR_SUCCESS);
|
&dwSize) == ERROR_SUCCESS);
|
||||||
szParentKeyName.ReleaseBuffer();
|
szParentKeyName.ReleaseBuffer();
|
||||||
|
|
||||||
dwSize = sizeof(szDisplayName);
|
dwType = REG_SZ;
|
||||||
|
dwSize = MAX_PATH * sizeof(WCHAR);
|
||||||
if (RegQueryValueExW(Info.hSubKey,
|
if (RegQueryValueExW(Info.hSubKey,
|
||||||
L"DisplayName",
|
L"DisplayName",
|
||||||
NULL,
|
NULL,
|
||||||
&dwType,
|
&dwType,
|
||||||
(LPBYTE) szDisplayName.GetBuffer(dwSize),
|
(LPBYTE) szDisplayName.GetBuffer(MAX_PATH),
|
||||||
&dwSize) == ERROR_SUCCESS)
|
&dwSize) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
szDisplayName.ReleaseBuffer();
|
szDisplayName.ReleaseBuffer();
|
||||||
|
|
|
@ -367,7 +367,7 @@ ThreadFunc(LPVOID Context)
|
||||||
memset(&urlComponents, 0, sizeof(urlComponents));
|
memset(&urlComponents, 0, sizeof(urlComponents));
|
||||||
urlComponents.dwStructSize = sizeof(urlComponents);
|
urlComponents.dwStructSize = sizeof(urlComponents);
|
||||||
|
|
||||||
if (FAILED(StringCbLengthW(AppInfo->szUrlDownload, sizeof(AppInfo->szUrlDownload), &urlLength)))
|
if (AppInfo->szUrlDownload.GetLength() > urlLength)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
urlLength /= sizeof(WCHAR);
|
urlLength /= sizeof(WCHAR);
|
||||||
|
|
|
@ -493,10 +493,3 @@ UINT ParserGetInt(const ATL::CStringW& KeyName, const ATL::CStringW& FileName)
|
||||||
|
|
||||||
return (UINT) Result;
|
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)
|
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();
|
szText.ReleaseBuffer();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -69,7 +69,10 @@ FillDefaultSettings(PSETTINGS_INFO pSettingsInfo)
|
||||||
szDownloadDir.ReleaseBuffer();
|
szDownloadDir.ReleaseBuffer();
|
||||||
|
|
||||||
szDownloadDir += L"\\RAPPS Downloads";
|
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->bDelInstaller = FALSE;
|
||||||
pSettingsInfo->Maximized = FALSE;
|
pSettingsInfo->Maximized = FALSE;
|
||||||
|
@ -79,8 +82,8 @@ FillDefaultSettings(PSETTINGS_INFO pSettingsInfo)
|
||||||
pSettingsInfo->Height = 450;
|
pSettingsInfo->Height = 450;
|
||||||
pSettingsInfo->Proxy = 0;
|
pSettingsInfo->Proxy = 0;
|
||||||
|
|
||||||
StringCbCopyW(pSettingsInfo->szProxyServer, sizeof(pSettingsInfo->szProxyServer), L"");
|
pSettingsInfo->szProxyServer[0] = UNICODE_NULL;
|
||||||
StringCbCopyW(pSettingsInfo->szNoProxyFor, sizeof(pSettingsInfo->szNoProxyFor), L"");
|
pSettingsInfo->szNoProxyFor[0] = UNICODE_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL
|
static BOOL
|
||||||
|
|
Loading…
Reference in a new issue