Dynamically load StrRetToBufW(). This lets shell32_test.exe run on
systems that have version 4.72 of shlwapi.dll.
This commit is contained in:
parent
1fddb3ff20
commit
7f65f6a4e2
|
@ -43,18 +43,26 @@ static IMalloc *ppM;
|
||||||
|
|
||||||
static HRESULT (WINAPI *pSHBindToParent)(LPCITEMIDLIST, REFIID, LPVOID*, LPCITEMIDLIST*);
|
static HRESULT (WINAPI *pSHBindToParent)(LPCITEMIDLIST, REFIID, LPVOID*, LPCITEMIDLIST*);
|
||||||
static BOOL (WINAPI *pSHGetSpecialFolderPathW)(HWND, LPWSTR, int, BOOL);
|
static BOOL (WINAPI *pSHGetSpecialFolderPathW)(HWND, LPWSTR, int, BOOL);
|
||||||
|
static HRESULT (WINAPI *pStrRetToBufW)(STRRET*,LPCITEMIDLIST,LPWSTR,UINT);
|
||||||
|
|
||||||
static void init_function_pointers(void)
|
static void init_function_pointers(void)
|
||||||
{
|
{
|
||||||
HMODULE hmod = GetModuleHandleA("shell32.dll");
|
HMODULE hmod;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
|
hmod = GetModuleHandleA("shell32.dll");
|
||||||
if(hmod)
|
if(hmod)
|
||||||
{
|
{
|
||||||
pSHBindToParent = (void*)GetProcAddress(hmod, "SHBindToParent");
|
pSHBindToParent = (void*)GetProcAddress(hmod, "SHBindToParent");
|
||||||
pSHGetSpecialFolderPathW = (void*)GetProcAddress(hmod, "SHGetSpecialFolderPathW");
|
pSHGetSpecialFolderPathW = (void*)GetProcAddress(hmod, "SHGetSpecialFolderPathW");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hmod = GetModuleHandleA("shlwapi.dll");
|
||||||
|
if(hmod)
|
||||||
|
{
|
||||||
|
pStrRetToBufW = (void*)GetProcAddress(hmod, "StrRetToBufW");
|
||||||
|
}
|
||||||
|
|
||||||
hr = SHGetMalloc(&ppM);
|
hr = SHGetMalloc(&ppM);
|
||||||
ok(hr == S_OK, "SHGetMalloc failed %08lx\n", hr);
|
ok(hr == S_OK, "SHGetMalloc failed %08lx\n", hr);
|
||||||
}
|
}
|
||||||
|
@ -370,9 +378,12 @@ static void test_GetDisplayName(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = StrRetToBufW(&strret, pidlLast, wszTestFile2, MAX_PATH);
|
if (pStrRetToBufW)
|
||||||
|
{
|
||||||
|
hr = pStrRetToBufW(&strret, pidlLast, wszTestFile2, MAX_PATH);
|
||||||
ok (SUCCEEDED(hr), "StrRetToBufW failed! hr = %08lx\n", hr);
|
ok (SUCCEEDED(hr), "StrRetToBufW failed! hr = %08lx\n", hr);
|
||||||
ok (!lstrcmpiW(wszTestFile, wszTestFile2), "GetDisplayNameOf returns incorrect path!\n");
|
ok (!lstrcmpiW(wszTestFile, wszTestFile2), "GetDisplayNameOf returns incorrect path!\n");
|
||||||
|
}
|
||||||
|
|
||||||
IShellFolder_Release(psfDesktop);
|
IShellFolder_Release(psfDesktop);
|
||||||
IShellFolder_Release(psfPersonal);
|
IShellFolder_Release(psfPersonal);
|
||||||
|
@ -661,10 +672,13 @@ static void test_SHGetPathFromIDList(void)
|
||||||
IMalloc_Free(ppM, pidlTestFile);
|
IMalloc_Free(ppM, pidlTestFile);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
StrRetToBufW(&strret, pidlTestFile, wszPath, MAX_PATH);
|
if (pStrRetToBufW)
|
||||||
|
{
|
||||||
|
pStrRetToBufW(&strret, pidlTestFile, wszPath, MAX_PATH);
|
||||||
ok(0 == lstrcmpW(wszFileName, wszPath),
|
ok(0 == lstrcmpW(wszFileName, wszPath),
|
||||||
"Desktop->GetDisplayNameOf(pidlTestFile, SHGDN_FORPARSING) "
|
"Desktop->GetDisplayNameOf(pidlTestFile, SHGDN_FORPARSING) "
|
||||||
"returned incorrect path for file placed on desktop\n");
|
"returned incorrect path for file placed on desktop\n");
|
||||||
|
}
|
||||||
|
|
||||||
result = SHGetPathFromIDListW(pidlTestFile, wszPath);
|
result = SHGetPathFromIDListW(pidlTestFile, wszPath);
|
||||||
ok(result, "SHGetPathFromIDListW failed! Last error: %08lx\n", GetLastError());
|
ok(result, "SHGetPathFromIDListW failed! Last error: %08lx\n", GetLastError());
|
||||||
|
|
Loading…
Reference in New Issue