WCHAR szPath[MAX_PATH];
WCHAR szTmp[MAX_PATH];
HRESULT hr;
+ BOOL result = TRUE;
if (!GetStorageDirectory(szPath, sizeof(szPath) / sizeof(szPath[0])))
return FALSE;
if (FAILED(hr))
return FALSE;
- if (GetFileAttributesW(szCabPath) != INVALID_FILE_ATTRIBUTES)
- {
- if (!DeleteFileW(szCabPath))
- return FALSE;
- }
+ result = result && DeleteFileW(szCabPath);
hr = StringCbCatW(szPath, sizeof(szPath), L"\\rapps\\");
if (FAILED(hr))
hFind = FindFirstFileW(szSearchPath, &FindFileData);
if (hFind == INVALID_HANDLE_VALUE)
- return TRUE;
+ return result;
do
{
hr = StringCbPrintfW(szTmp, sizeof(szTmp),
L"%ls%ls",
szPath, FindFileData.cFileName);
- if (FAILED(hr) || !DeleteFileW(szTmp))
- {
- FindClose(hFind);
- return FALSE;
- }
- }
- while (FindNextFileW(hFind, &FindFileData) != 0);
+ if (FAILED(hr))
+ continue;
+ result = result && DeleteFileW(szTmp);
+ } while (FindNextFileW(hFind, &FindFileData) != 0);
FindClose(hFind);
- return TRUE;
+ return result;
}
HRESULT hr;
if (!GetStorageDirectory(szPath, sizeof(szPath) / sizeof(szPath[0])))
- {
return FALSE;
- }
hr = StringCbPrintfW(szCabPath, sizeof(szCabPath),
L"%ls\\rappmgr.cab",
return FALSE;
}
- GetLocaleInfoW(GetUserDefaultLCID(), LOCALE_ILANGUAGE, szLocale, sizeof(szLocale) / sizeof(WCHAR));
- hr = StringCbCatW(szSectionLocale, sizeof(szSectionLocale), szLocale);
- if (FAILED(hr))
- return FALSE;
-
hr = StringCbCatW(szPath, sizeof(szPath), L"*.txt");
if (FAILED(hr))
return FALSE;
return FALSE;
}
+ if (!GetLocaleInfoW(GetUserDefaultLCID(), LOCALE_ILANGUAGE,
+ szLocale, sizeof(szLocale) / sizeof(WCHAR)))
+ {
+ return FALSE;
+ }
+
+ hr = StringCbCatW(szSectionLocale, sizeof(szSectionLocale), szLocale);
+ if (FAILED(hr))
+ return FALSE;
+
#define GET_STRING1(a, b) \
if (!ParserGetString(szSectionLocale, a, b, MAX_PATH, FindFileData.cFileName)) \
if (!ParserGetString(L"Section", a, b, MAX_PATH, FindFileData.cFileName)) \
GET_STRING2(L"CDPath", Info.szCDPath);
if (!lpEnumProc(Info)) break;
- }
- while (FindNextFileW(hFind, &FindFileData) != 0);
+ } while (FindNextFileW(hFind, &FindFileData) != 0);
FindClose(hFind);
{
HRESULT hr;
- if(OpenClipboard(NULL))
+ if (OpenClipboard(NULL))
{
HGLOBAL ClipBuffer;
WCHAR *Buffer;
EmptyClipboard();
cchBuffer = wcslen(lpszText) + 1;
ClipBuffer = GlobalAlloc(GMEM_DDESHARE, cchBuffer * sizeof(WCHAR));
- Buffer = (WCHAR*)GlobalLock(ClipBuffer);
+ Buffer = GlobalLock(ClipBuffer);
hr = StringCchCopyW(Buffer, cchBuffer, lpszText);
GlobalUnlock(ClipBuffer);
if (!create) return NULL;
cch = wcslen(section_name) + 1;
*section = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(SECTION, name) + cch * sizeof(WCHAR));
- if(*section == NULL) return NULL;
+ if (*section == NULL) return NULL;
StringCchCopyW((*section)->name, cch, section_name);
(*section)->next = NULL;
cch = wcslen(key_name) + 1;
ItemsArray[i]->encoding = ENCODING_UTF8;
}
- GetStorageDirectory(szDir, sizeof(szDir) / sizeof(szDir[0]));
+ if (!GetStorageDirectory(szDir, sizeof(szDir) / sizeof(szDir[0])))
+ return FALSE;
- StringCbPrintfW(buffer, sizeof(buffer),
- L"%ls\\rapps\\%ls",
- szDir, filename);
+ if (FAILED(StringCbPrintfW(buffer, sizeof(buffer),
+ L"%ls\\rapps\\%ls",
+ szDir, filename)))
+ {
+ return FALSE;
+ }
hFile = CreateFileW(buffer, GENERIC_READ | (write_access ? GENERIC_WRITE : 0),
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL,
{
if (pLink) HeapFree(GetProcessHeap(), 0, pLink);
- pLink = (PWSTR) HeapAlloc(GetProcessHeap(),
- 0,
- (max(Link->chrg.cpMin, Link->chrg.cpMax) -
- min(Link->chrg.cpMin, Link->chrg.cpMax) + 1) * sizeof(WCHAR));
+ pLink = HeapAlloc(GetProcessHeap(),
+ 0,
+ (max(Link->chrg.cpMin, Link->chrg.cpMax) -
+ min(Link->chrg.cpMin, Link->chrg.cpMax) + 1) * sizeof(WCHAR));
if (!pLink)
{
/* TODO: Error message */
HKEY hKey;
DWORD dwSize;
- if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\ReactOS\\rapps", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
+ if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\ReactOS\\rapps", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
{
dwSize = sizeof(SETTINGS_INFO);
if (RegQueryValueExW(hKey, L"Settings", NULL, NULL, (LPBYTE)&SettingsInfo, &dwSize) == ERROR_SUCCESS)
SettingsInfo.Maximized = (IsZoomed(hwnd) || (wp.flags & WPF_RESTORETOMAXIMIZED));
}
- if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, L"Software\\ReactOS\\rapps", 0, NULL,
+ if (RegCreateKeyExW(HKEY_CURRENT_USER, L"Software\\ReactOS\\rapps", 0, NULL,
REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS)
{
RegSetValueExW(hKey, L"Settings", 0, REG_BINARY, (LPBYTE)&SettingsInfo, sizeof(SETTINGS_INFO));
Index = ListViewAddItem(ItemIndex, 0, lpName, (LPARAM)ItemInfo);
/* Get version info */
- GetApplicationString((HKEY)ItemInfo->hSubKey, L"DisplayVersion", szText);
+ GetApplicationString(ItemInfo->hSubKey, L"DisplayVersion", szText);
ListView_SetItemText(hListView, Index, 1, szText);
/* Get comments */
- GetApplicationString((HKEY)ItemInfo->hSubKey, L"Comments", szText);
+ GetApplicationString(ItemInfo->hSubKey, L"Comments", szText);
ListView_SetItemText(hListView, Index, 2, szText);
return TRUE;
if (!InitControls(hwnd))
PostMessage(hwnd, WM_CLOSE, 0, 0);
- if (SettingsInfo.bUpdateAtStart)
- UpdateAppsDB();
break;
case WM_COMMAND:
if (!hMainWnd) goto Exit;
/* Show it */
- ShowWindow(hMainWnd, SW_SHOW);
+ ShowWindow(hMainWnd, nShowCmd);
UpdateWindow(hMainWnd);
+ if (SettingsInfo.bUpdateAtStart)
+ UpdateAppsDB();
+
/* Message Loop */
while (GetMessage(&Msg, NULL, 0, 0))
{