mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 02:36:13 +00:00
[desk.cpl]
- Add a missing error check svn path=/trunk/; revision=58798
This commit is contained in:
parent
78cb9a84f2
commit
ade6d5011a
1 changed files with 44 additions and 42 deletions
|
@ -123,60 +123,62 @@ AddListViewItems(HWND hwndDlg, PDATA pData)
|
||||||
pData->listViewItemCount++;
|
pData->listViewItemCount++;
|
||||||
|
|
||||||
/* Add current wallpaper if any */
|
/* Add current wallpaper if any */
|
||||||
RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Control Panel\\Desktop"), 0, KEY_ALL_ACCESS, ®Key);
|
result = RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Control Panel\\Desktop"), 0, KEY_ALL_ACCESS, ®Key);
|
||||||
|
if (result == ERROR_SUCCESS)
|
||||||
result = RegQueryValueEx(regKey, TEXT("Wallpaper"), 0, &varType, (LPBYTE)wallpaperFilename, &bufferSize);
|
|
||||||
if ((result == ERROR_SUCCESS) && (_tcslen(wallpaperFilename) > 0))
|
|
||||||
{
|
{
|
||||||
/* Allow environment variables in file name */
|
result = RegQueryValueEx(regKey, TEXT("Wallpaper"), 0, &varType, (LPBYTE)wallpaperFilename, &bufferSize);
|
||||||
if (ExpandEnvironmentStrings(wallpaperFilename, buffer, MAX_PATH))
|
if ((result == ERROR_SUCCESS) && (_tcslen(wallpaperFilename) > 0))
|
||||||
{
|
{
|
||||||
_tcscpy(wallpaperFilename, buffer);
|
/* Allow environment variables in file name */
|
||||||
}
|
if (ExpandEnvironmentStrings(wallpaperFilename, buffer, MAX_PATH))
|
||||||
|
|
||||||
himl = (HIMAGELIST)SHGetFileInfo(wallpaperFilename,
|
|
||||||
0,
|
|
||||||
&sfi,
|
|
||||||
sizeof(sfi),
|
|
||||||
SHGFI_SYSICONINDEX | SHGFI_SMALLICON |
|
|
||||||
SHGFI_DISPLAYNAME);
|
|
||||||
|
|
||||||
if (himl != NULL)
|
|
||||||
{
|
|
||||||
if (i++ == 0)
|
|
||||||
{
|
{
|
||||||
(void)ListView_SetImageList(hwndBackgroundList, himl, LVSIL_SMALL);
|
_tcscpy(wallpaperFilename, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
backgroundItem = &pData->backgroundItems[pData->listViewItemCount];
|
himl = (HIMAGELIST)SHGetFileInfo(wallpaperFilename,
|
||||||
|
0,
|
||||||
|
&sfi,
|
||||||
|
sizeof(sfi),
|
||||||
|
SHGFI_SYSICONINDEX | SHGFI_SMALLICON |
|
||||||
|
SHGFI_DISPLAYNAME);
|
||||||
|
|
||||||
backgroundItem->bWallpaper = TRUE;
|
if (himl != NULL)
|
||||||
|
{
|
||||||
|
if (i++ == 0)
|
||||||
|
{
|
||||||
|
(void)ListView_SetImageList(hwndBackgroundList, himl, LVSIL_SMALL);
|
||||||
|
}
|
||||||
|
|
||||||
_tcscpy(backgroundItem->szDisplayName, sfi.szDisplayName);
|
backgroundItem = &pData->backgroundItems[pData->listViewItemCount];
|
||||||
p = _tcsrchr(backgroundItem->szDisplayName, _T('.'));
|
|
||||||
if (p)
|
|
||||||
*p = (TCHAR)0;
|
|
||||||
_tcscpy(backgroundItem->szFilename, wallpaperFilename);
|
|
||||||
|
|
||||||
ZeroMemory(&listItem, sizeof(LV_ITEM));
|
backgroundItem->bWallpaper = TRUE;
|
||||||
listItem.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE | LVIF_IMAGE;
|
|
||||||
listItem.state = 0;
|
|
||||||
listItem.pszText = backgroundItem->szDisplayName;
|
|
||||||
listItem.iImage = sfi.iIcon;
|
|
||||||
listItem.iItem = pData->listViewItemCount;
|
|
||||||
listItem.lParam = pData->listViewItemCount;
|
|
||||||
|
|
||||||
(void)ListView_InsertItem(hwndBackgroundList, &listItem);
|
_tcscpy(backgroundItem->szDisplayName, sfi.szDisplayName);
|
||||||
ListView_SetItemState(hwndBackgroundList,
|
p = _tcsrchr(backgroundItem->szDisplayName, _T('.'));
|
||||||
pData->listViewItemCount,
|
if (p)
|
||||||
LVIS_SELECTED,
|
*p = (TCHAR)0;
|
||||||
LVIS_SELECTED);
|
_tcscpy(backgroundItem->szFilename, wallpaperFilename);
|
||||||
|
|
||||||
pData->listViewItemCount++;
|
ZeroMemory(&listItem, sizeof(LV_ITEM));
|
||||||
|
listItem.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE | LVIF_IMAGE;
|
||||||
|
listItem.state = 0;
|
||||||
|
listItem.pszText = backgroundItem->szDisplayName;
|
||||||
|
listItem.iImage = sfi.iIcon;
|
||||||
|
listItem.iItem = pData->listViewItemCount;
|
||||||
|
listItem.lParam = pData->listViewItemCount;
|
||||||
|
|
||||||
|
(void)ListView_InsertItem(hwndBackgroundList, &listItem);
|
||||||
|
ListView_SetItemState(hwndBackgroundList,
|
||||||
|
pData->listViewItemCount,
|
||||||
|
LVIS_SELECTED,
|
||||||
|
LVIS_SELECTED);
|
||||||
|
|
||||||
|
pData->listViewItemCount++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
RegCloseKey(regKey);
|
RegCloseKey(regKey);
|
||||||
|
}
|
||||||
|
|
||||||
/* Add all the images in the C:\ReactOS directory. */
|
/* Add all the images in the C:\ReactOS directory. */
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue