shell32: Handle NULL return icon parameters in SHDefExtractIcon.
This commit is contained in:
parent
5a28d37fe6
commit
e083dc831c
|
@ -817,8 +817,14 @@ HRESULT WINAPI SHDefExtractIconW(LPCWSTR pszIconFile, int iIndex, UINT uFlags,
|
||||||
if (ret == 0xFFFFFFFF)
|
if (ret == 0xFFFFFFFF)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
*phiconLarge = hIcons[0];
|
if (phiconLarge)
|
||||||
*phiconSmall = hIcons[1];
|
*phiconLarge = hIcons[0];
|
||||||
|
else
|
||||||
|
DestroyIcon(hIcons[0]);
|
||||||
|
if (phiconSmall)
|
||||||
|
*phiconSmall = hIcons[1];
|
||||||
|
else
|
||||||
|
DestroyIcon(hIcons[1]);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
|
|
|
@ -40,10 +40,12 @@
|
||||||
typedef void (WINAPI *fnILFree)(LPITEMIDLIST);
|
typedef void (WINAPI *fnILFree)(LPITEMIDLIST);
|
||||||
typedef BOOL (WINAPI *fnILIsEqual)(LPCITEMIDLIST, LPCITEMIDLIST);
|
typedef BOOL (WINAPI *fnILIsEqual)(LPCITEMIDLIST, LPCITEMIDLIST);
|
||||||
typedef HRESULT (WINAPI *fnSHILCreateFromPath)(LPCWSTR, LPITEMIDLIST *,DWORD*);
|
typedef HRESULT (WINAPI *fnSHILCreateFromPath)(LPCWSTR, LPITEMIDLIST *,DWORD*);
|
||||||
|
typedef HRESULT (WINAPI *fnSHDefExtractIconA)(LPCSTR, int, UINT, HICON*, HICON*, UINT);
|
||||||
|
|
||||||
static fnILFree pILFree;
|
static fnILFree pILFree;
|
||||||
static fnILIsEqual pILIsEqual;
|
static fnILIsEqual pILIsEqual;
|
||||||
static fnSHILCreateFromPath pSHILCreateFromPath;
|
static fnSHILCreateFromPath pSHILCreateFromPath;
|
||||||
|
static fnSHDefExtractIconA pSHDefExtractIconA;
|
||||||
|
|
||||||
static DWORD (WINAPI *pGetLongPathNameA)(LPCSTR, LPSTR, DWORD);
|
static DWORD (WINAPI *pGetLongPathNameA)(LPCSTR, LPSTR, DWORD);
|
||||||
|
|
||||||
|
@ -708,6 +710,34 @@ static void test_datalink(void)
|
||||||
IShellLinkW_Release( sl );
|
IShellLinkW_Release( sl );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_shdefextracticon(void)
|
||||||
|
{
|
||||||
|
HICON hiconlarge=NULL, hiconsmall=NULL;
|
||||||
|
HRESULT res;
|
||||||
|
|
||||||
|
if (!pSHDefExtractIconA)
|
||||||
|
{
|
||||||
|
win_skip("SHDefExtractIconA is unavailable\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
res = pSHDefExtractIconA("shell32.dll", 0, 0, &hiconlarge, &hiconsmall, MAKELONG(16,24));
|
||||||
|
ok(SUCCEEDED(res), "SHDefExtractIconA failed, res=%x\n", res);
|
||||||
|
ok(hiconlarge != NULL, "got null hiconlarge\n");
|
||||||
|
ok(hiconsmall != NULL, "got null hiconsmall\n");
|
||||||
|
DestroyIcon(hiconlarge);
|
||||||
|
DestroyIcon(hiconsmall);
|
||||||
|
|
||||||
|
hiconsmall = NULL;
|
||||||
|
res = pSHDefExtractIconA("shell32.dll", 0, 0, NULL, &hiconsmall, MAKELONG(16,24));
|
||||||
|
ok(SUCCEEDED(res), "SHDefExtractIconA failed, res=%x\n", res);
|
||||||
|
ok(hiconsmall != NULL, "got null hiconsmall\n");
|
||||||
|
DestroyIcon(hiconsmall);
|
||||||
|
|
||||||
|
res = pSHDefExtractIconA("shell32.dll", 0, 0, NULL, NULL, MAKELONG(16,24));
|
||||||
|
ok(SUCCEEDED(res), "SHDefExtractIconA failed, res=%x\n", res);
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(shelllink)
|
START_TEST(shelllink)
|
||||||
{
|
{
|
||||||
HRESULT r;
|
HRESULT r;
|
||||||
|
@ -717,6 +747,7 @@ START_TEST(shelllink)
|
||||||
pILFree = (fnILFree) GetProcAddress(hmod, (LPSTR)155);
|
pILFree = (fnILFree) GetProcAddress(hmod, (LPSTR)155);
|
||||||
pILIsEqual = (fnILIsEqual) GetProcAddress(hmod, (LPSTR)21);
|
pILIsEqual = (fnILIsEqual) GetProcAddress(hmod, (LPSTR)21);
|
||||||
pSHILCreateFromPath = (fnSHILCreateFromPath) GetProcAddress(hmod, (LPSTR)28);
|
pSHILCreateFromPath = (fnSHILCreateFromPath) GetProcAddress(hmod, (LPSTR)28);
|
||||||
|
pSHDefExtractIconA = (fnSHDefExtractIconA) GetProcAddress(hmod, "SHDefExtractIconA");
|
||||||
|
|
||||||
pGetLongPathNameA = (void *)GetProcAddress(hkernel32, "GetLongPathNameA");
|
pGetLongPathNameA = (void *)GetProcAddress(hkernel32, "GetLongPathNameA");
|
||||||
|
|
||||||
|
@ -728,6 +759,7 @@ START_TEST(shelllink)
|
||||||
test_get_set();
|
test_get_set();
|
||||||
test_load_save();
|
test_load_save();
|
||||||
test_datalink();
|
test_datalink();
|
||||||
|
test_shdefextracticon();
|
||||||
|
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue