[SHELL32]

- Use StringCbCopyW

[PROGMAN]
- Use StringCbCopyW: CID #1363712.
- Don't read registry values in a registry key if we failed to open it. CID #514350.

svn path=/trunk/; revision=71912
This commit is contained in:
Hermès Bélusca-Maïto 2016-07-12 23:00:50 +00:00
parent 4ef92827aa
commit a5b76eb779
2 changed files with 36 additions and 30 deletions

View file

@ -516,7 +516,7 @@ EnumPickIconResourceProc(HMODULE hModule, LPCWSTR lpszType, LPWSTR lpszName, LON
if (IS_INTRESOURCE(lpszName))
swprintf(szName, L"%u", lpszName);
else
wcscpy(szName, lpszName);
StringCbCopyW(szName, sizeof(szName), lpszName);
hIcon = (HICON)LoadImageW(hModule, lpszName, IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR);
if (hIcon == NULL)
@ -1026,6 +1026,9 @@ VOID DIALOG_Execute(VOID)
DWORD dwSize;
DWORD dwType;
ExecuteContext.hKeyPMRecentFilesList = NULL;
ExecuteContext.bCheckBinaryType = TRUE;
lRet = RegCreateKeyExW(Globals.hKeyProgMan,
L"Recent File List",
0,
@ -1035,7 +1038,8 @@ VOID DIALOG_Execute(VOID)
NULL,
&ExecuteContext.hKeyPMRecentFilesList,
NULL);
if (lRet == ERROR_SUCCESS)
{
dwSize = sizeof(ExecuteContext.dwMaxFiles);
lRet = RegQueryValueExW(ExecuteContext.hKeyPMRecentFilesList,
L"Max Files",
@ -1066,8 +1070,10 @@ VOID DIALOG_Execute(VOID)
{
ExecuteContext.bCheckBinaryType = TRUE;
}
}
DialogBoxParamW(Globals.hInstance, MAKEINTRESOURCEW(IDD_EXECUTE), Globals.hMainWnd, DIALOG_EXECUTE_DlgProc, (LPARAM)&ExecuteContext);
if (ExecuteContext.hKeyPMRecentFilesList)
RegCloseKey(ExecuteContext.hKeyPMRecentFilesList);
}

View file

@ -64,7 +64,7 @@ BOOL CALLBACK EnumPickIconResourceProc(HMODULE hModule,
if (IS_INTRESOURCE(lpszName))
swprintf(szName, L"%u", (DWORD)lpszName);
else
wcscpy(szName, (WCHAR*)lpszName);
StringCbCopyW(szName, sizeof(szName), lpszName);
hIcon = LoadIconW(hModule, lpszName);
if (hIcon == NULL)