shlwapi: Some SHCreateWorkerWindowA tests.
This commit is contained in:
parent
02aef1c3b8
commit
803dea3326
|
@ -2595,21 +2595,21 @@ HRESULT WINAPI IUnknown_GetSite(LPUNKNOWN lpUnknown, REFIID iid, PVOID *lppSite)
|
||||||
* dwExStyle [I] Extra style flags
|
* dwExStyle [I] Extra style flags
|
||||||
* dwStyle [I] Style flags
|
* dwStyle [I] Style flags
|
||||||
* hMenu [I] Window menu
|
* hMenu [I] Window menu
|
||||||
* z [I] Unknown
|
* msg_result [I] New DWLP_MSGRESULT value
|
||||||
*
|
*
|
||||||
* RETURNS
|
* RETURNS
|
||||||
* Success: The window handle of the newly created window.
|
* Success: The window handle of the newly created window.
|
||||||
* Failure: 0.
|
* Failure: 0.
|
||||||
*/
|
*/
|
||||||
HWND WINAPI SHCreateWorkerWindowA(LONG wndProc, HWND hWndParent, DWORD dwExStyle,
|
HWND WINAPI SHCreateWorkerWindowA(LONG wndProc, HWND hWndParent, DWORD dwExStyle,
|
||||||
DWORD dwStyle, HMENU hMenu, LONG z)
|
DWORD dwStyle, HMENU hMenu, LONG msg_result)
|
||||||
{
|
{
|
||||||
static const char szClass[] = "WorkerA";
|
static const char szClass[] = "WorkerA";
|
||||||
WNDCLASSA wc;
|
WNDCLASSA wc;
|
||||||
HWND hWnd;
|
HWND hWnd;
|
||||||
|
|
||||||
TRACE("(0x%08x,%p,0x%08x,0x%08x,%p,0x%08x)\n",
|
TRACE("(0x%08x, %p, 0x%08x, 0x%08x, %p, 0x%08x)\n",
|
||||||
wndProc, hWndParent, dwExStyle, dwStyle, hMenu, z);
|
wndProc, hWndParent, dwExStyle, dwStyle, hMenu, msg_result);
|
||||||
|
|
||||||
/* Create Window class */
|
/* Create Window class */
|
||||||
wc.style = 0;
|
wc.style = 0;
|
||||||
|
@ -2623,19 +2623,17 @@ HWND WINAPI SHCreateWorkerWindowA(LONG wndProc, HWND hWndParent, DWORD dwExStyle
|
||||||
wc.lpszMenuName = NULL;
|
wc.lpszMenuName = NULL;
|
||||||
wc.lpszClassName = szClass;
|
wc.lpszClassName = szClass;
|
||||||
|
|
||||||
SHRegisterClassA(&wc); /* Register class */
|
SHRegisterClassA(&wc);
|
||||||
|
|
||||||
/* FIXME: Set extra bits in dwExStyle */
|
|
||||||
|
|
||||||
hWnd = CreateWindowExA(dwExStyle, szClass, 0, dwStyle, 0, 0, 0, 0,
|
hWnd = CreateWindowExA(dwExStyle, szClass, 0, dwStyle, 0, 0, 0, 0,
|
||||||
hWndParent, hMenu, shlwapi_hInstance, 0);
|
hWndParent, hMenu, shlwapi_hInstance, 0);
|
||||||
if (hWnd)
|
if (hWnd)
|
||||||
{
|
{
|
||||||
SetWindowLongPtrW(hWnd, DWLP_MSGRESULT, z);
|
SetWindowLongPtrW(hWnd, DWLP_MSGRESULT, msg_result);
|
||||||
|
|
||||||
if (wndProc)
|
if (wndProc) SetWindowLongPtrA(hWnd, GWLP_WNDPROC, wndProc);
|
||||||
SetWindowLongPtrA(hWnd, GWLP_WNDPROC, wndProc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return hWnd;
|
return hWnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2893,20 +2891,20 @@ DWORD WINAPI WhichPlatform(void)
|
||||||
* Unicode version of SHCreateWorkerWindowA.
|
* Unicode version of SHCreateWorkerWindowA.
|
||||||
*/
|
*/
|
||||||
HWND WINAPI SHCreateWorkerWindowW(LONG wndProc, HWND hWndParent, DWORD dwExStyle,
|
HWND WINAPI SHCreateWorkerWindowW(LONG wndProc, HWND hWndParent, DWORD dwExStyle,
|
||||||
DWORD dwStyle, HMENU hMenu, LONG z)
|
DWORD dwStyle, HMENU hMenu, LONG msg_result)
|
||||||
{
|
{
|
||||||
static const WCHAR szClass[] = { 'W', 'o', 'r', 'k', 'e', 'r', 'W', 0 };
|
static const WCHAR szClass[] = { 'W', 'o', 'r', 'k', 'e', 'r', 'W', 0 };
|
||||||
WNDCLASSW wc;
|
WNDCLASSW wc;
|
||||||
HWND hWnd;
|
HWND hWnd;
|
||||||
|
|
||||||
TRACE("(0x%08x,%p,0x%08x,0x%08x,%p,0x%08x)\n",
|
TRACE("(0x%08x, %p, 0x%08x, 0x%08x, %p, 0x%08x)\n",
|
||||||
wndProc, hWndParent, dwExStyle, dwStyle, hMenu, z);
|
wndProc, hWndParent, dwExStyle, dwStyle, hMenu, msg_result);
|
||||||
|
|
||||||
/* If our OS is natively ANSI, use the ANSI version */
|
/* If our OS is natively ANSI, use the ANSI version */
|
||||||
if (GetVersion() & 0x80000000) /* not NT */
|
if (GetVersion() & 0x80000000) /* not NT */
|
||||||
{
|
{
|
||||||
TRACE("fallback to ANSI, ver 0x%08x\n", GetVersion());
|
TRACE("fallback to ANSI, ver 0x%08x\n", GetVersion());
|
||||||
return SHCreateWorkerWindowA(wndProc, hWndParent, dwExStyle, dwStyle, hMenu, z);
|
return SHCreateWorkerWindowA(wndProc, hWndParent, dwExStyle, dwStyle, hMenu, msg_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create Window class */
|
/* Create Window class */
|
||||||
|
@ -2921,19 +2919,17 @@ HWND WINAPI SHCreateWorkerWindowW(LONG wndProc, HWND hWndParent, DWORD dwExStyle
|
||||||
wc.lpszMenuName = NULL;
|
wc.lpszMenuName = NULL;
|
||||||
wc.lpszClassName = szClass;
|
wc.lpszClassName = szClass;
|
||||||
|
|
||||||
SHRegisterClassW(&wc); /* Register class */
|
SHRegisterClassW(&wc);
|
||||||
|
|
||||||
/* FIXME: Set extra bits in dwExStyle */
|
|
||||||
|
|
||||||
hWnd = CreateWindowExW(dwExStyle, szClass, 0, dwStyle, 0, 0, 0, 0,
|
hWnd = CreateWindowExW(dwExStyle, szClass, 0, dwStyle, 0, 0, 0, 0,
|
||||||
hWndParent, hMenu, shlwapi_hInstance, 0);
|
hWndParent, hMenu, shlwapi_hInstance, 0);
|
||||||
if (hWnd)
|
if (hWnd)
|
||||||
{
|
{
|
||||||
SetWindowLongPtrW(hWnd, DWLP_MSGRESULT, z);
|
SetWindowLongPtrW(hWnd, DWLP_MSGRESULT, msg_result);
|
||||||
|
|
||||||
if (wndProc)
|
if (wndProc) SetWindowLongPtrW(hWnd, GWLP_WNDPROC, wndProc);
|
||||||
SetWindowLongPtrW(hWnd, GWLP_WNDPROC, wndProc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return hWnd;
|
return hWnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
|
|
||||||
/* Function ptrs for ordinal calls */
|
/* Function ptrs for ordinal calls */
|
||||||
static HMODULE hShlwapi;
|
static HMODULE hShlwapi;
|
||||||
|
static BOOL is_win2k_and_lower;
|
||||||
|
|
||||||
static int (WINAPI *pSHSearchMapInt)(const int*,const int*,int,int);
|
static int (WINAPI *pSHSearchMapInt)(const int*,const int*,int,int);
|
||||||
static HRESULT (WINAPI *pGetAcceptLanguagesA)(LPSTR,LPDWORD);
|
static HRESULT (WINAPI *pGetAcceptLanguagesA)(LPSTR,LPDWORD);
|
||||||
|
|
||||||
|
@ -53,6 +55,7 @@ static DWORD (WINAPI *pSHGetObjectCompatFlags)(IUnknown*, const CLSID*);
|
||||||
static BOOL (WINAPI *pGUIDFromStringA)(LPSTR, CLSID *);
|
static BOOL (WINAPI *pGUIDFromStringA)(LPSTR, CLSID *);
|
||||||
static HRESULT (WINAPI *pIUnknown_QueryServiceExec)(IUnknown*, REFIID, const GUID*, DWORD, DWORD, VARIANT*, VARIANT*);
|
static HRESULT (WINAPI *pIUnknown_QueryServiceExec)(IUnknown*, REFIID, const GUID*, DWORD, DWORD, VARIANT*, VARIANT*);
|
||||||
static HRESULT (WINAPI *pIUnknown_ProfferService)(IUnknown*, REFGUID, IServiceProvider*, DWORD*);
|
static HRESULT (WINAPI *pIUnknown_ProfferService)(IUnknown*, REFGUID, IServiceProvider*, DWORD*);
|
||||||
|
static HWND (WINAPI *pSHCreateWorkerWindowA)(LONG, HWND, DWORD, DWORD, HMENU, LONG);
|
||||||
|
|
||||||
static HMODULE hmlang;
|
static HMODULE hmlang;
|
||||||
static HRESULT (WINAPI *pLcidToRfc1766A)(LCID, LPSTR, INT);
|
static HRESULT (WINAPI *pLcidToRfc1766A)(LCID, LPSTR, INT);
|
||||||
|
@ -2139,7 +2142,6 @@ static const IServiceProviderVtbl IServiceProviderImpl_Vtbl =
|
||||||
static void test_IUnknown_QueryServiceExec(void)
|
static void test_IUnknown_QueryServiceExec(void)
|
||||||
{
|
{
|
||||||
IServiceProvider *provider = IServiceProviderImpl_Construct();
|
IServiceProvider *provider = IServiceProviderImpl_Construct();
|
||||||
void *test_ptr = (void*)GetProcAddress(hShlwapi, "StrChrNW");
|
|
||||||
static const GUID dummy_serviceid = { 0xdeadbeef };
|
static const GUID dummy_serviceid = { 0xdeadbeef };
|
||||||
static const GUID dummy_groupid = { 0xbeefbeef };
|
static const GUID dummy_groupid = { 0xbeefbeef };
|
||||||
call_trace_t trace_expected;
|
call_trace_t trace_expected;
|
||||||
|
@ -2147,7 +2149,7 @@ static void test_IUnknown_QueryServiceExec(void)
|
||||||
|
|
||||||
/* on <=W2K platforms same ordinal used for another export with different
|
/* on <=W2K platforms same ordinal used for another export with different
|
||||||
prototype, so skipping using this indirect condition */
|
prototype, so skipping using this indirect condition */
|
||||||
if (!test_ptr)
|
if (is_win2k_and_lower)
|
||||||
{
|
{
|
||||||
win_skip("IUnknown_QueryServiceExec is not available\n");
|
win_skip("IUnknown_QueryServiceExec is not available\n");
|
||||||
return;
|
return;
|
||||||
|
@ -2250,7 +2252,6 @@ static const IProfferServiceVtbl IProfferServiceImpl_Vtbl =
|
||||||
|
|
||||||
static void test_IUnknown_ProfferService(void)
|
static void test_IUnknown_ProfferService(void)
|
||||||
{
|
{
|
||||||
void *test_ptr = (void*)GetProcAddress(hShlwapi, "StrChrNW");
|
|
||||||
IServiceProvider *provider = IServiceProviderImpl_Construct();
|
IServiceProvider *provider = IServiceProviderImpl_Construct();
|
||||||
IProfferService *proff = IProfferServiceImpl_Construct();
|
IProfferService *proff = IProfferServiceImpl_Construct();
|
||||||
static const GUID dummy_serviceid = { 0xdeadbeef };
|
static const GUID dummy_serviceid = { 0xdeadbeef };
|
||||||
|
@ -2260,7 +2261,7 @@ static void test_IUnknown_ProfferService(void)
|
||||||
|
|
||||||
/* on <=W2K platforms same ordinal used for another export with different
|
/* on <=W2K platforms same ordinal used for another export with different
|
||||||
prototype, so skipping using this indirect condition */
|
prototype, so skipping using this indirect condition */
|
||||||
if (!test_ptr)
|
if (is_win2k_and_lower)
|
||||||
{
|
{
|
||||||
win_skip("IUnknown_ProfferService is not available\n");
|
win_skip("IUnknown_ProfferService is not available\n");
|
||||||
return;
|
return;
|
||||||
|
@ -2312,6 +2313,62 @@ static void test_IUnknown_ProfferService(void)
|
||||||
IProfferService_Release(proff);
|
IProfferService_Release(proff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_SHCreateWorkerWindowA(void)
|
||||||
|
{
|
||||||
|
WNDCLASSA cliA;
|
||||||
|
char classA[20];
|
||||||
|
HWND hwnd;
|
||||||
|
LONG ret;
|
||||||
|
BOOL res;
|
||||||
|
|
||||||
|
if (is_win2k_and_lower)
|
||||||
|
{
|
||||||
|
win_skip("SHCreateWorkerWindowA not available\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
hwnd = pSHCreateWorkerWindowA(0, NULL, 0, 0, 0, 0);
|
||||||
|
ok(hwnd != 0, "expected window\n");
|
||||||
|
|
||||||
|
GetClassName(hwnd, classA, 20);
|
||||||
|
ok(lstrcmpA(classA, "WorkerA") == 0, "expected WorkerA class, got %s\n", classA);
|
||||||
|
|
||||||
|
ret = GetWindowLongA(hwnd, DWLP_MSGRESULT);
|
||||||
|
ok(ret == 0, "got %d\n", ret);
|
||||||
|
|
||||||
|
/* class info */
|
||||||
|
memset(&cliA, 0, sizeof(cliA));
|
||||||
|
res = GetClassInfoA(GetModuleHandle("shlwapi.dll"), "WorkerA", &cliA);
|
||||||
|
ok(res, "failed to get class info\n");
|
||||||
|
ok(cliA.style == 0, "got 0x%08x\n", cliA.style);
|
||||||
|
ok(cliA.cbClsExtra == 0, "got %d\n", cliA.cbClsExtra);
|
||||||
|
ok(cliA.cbWndExtra == 4, "got %d\n", cliA.cbWndExtra);
|
||||||
|
ok(cliA.lpszMenuName == 0, "got %s\n", cliA.lpszMenuName);
|
||||||
|
|
||||||
|
DestroyWindow(hwnd);
|
||||||
|
|
||||||
|
/* set DWLP_MSGRESULT */
|
||||||
|
hwnd = pSHCreateWorkerWindowA(0, NULL, 0, 0, 0, 0xdeadbeef);
|
||||||
|
ok(hwnd != 0, "expected window\n");
|
||||||
|
|
||||||
|
GetClassName(hwnd, classA, 20);
|
||||||
|
ok(lstrcmpA(classA, "WorkerA") == 0, "expected WorkerA class, got %s\n", classA);
|
||||||
|
|
||||||
|
ret = GetWindowLongA(hwnd, DWLP_MSGRESULT);
|
||||||
|
ok(ret == 0xdeadbeef, "got %d\n", ret);
|
||||||
|
|
||||||
|
/* test exstyle */
|
||||||
|
ret = GetWindowLongA(hwnd, GWL_EXSTYLE);
|
||||||
|
ok(ret == WS_EX_WINDOWEDGE, "0x%08x\n", ret);
|
||||||
|
|
||||||
|
DestroyWindow(hwnd);
|
||||||
|
|
||||||
|
hwnd = pSHCreateWorkerWindowA(0, NULL, WS_EX_TOOLWINDOW, 0, 0, 0);
|
||||||
|
ret = GetWindowLongA(hwnd, GWL_EXSTYLE);
|
||||||
|
ok(ret == (WS_EX_WINDOWEDGE|WS_EX_TOOLWINDOW), "0x%08x\n", ret);
|
||||||
|
DestroyWindow(hwnd);
|
||||||
|
}
|
||||||
|
|
||||||
static void init_pointers(void)
|
static void init_pointers(void)
|
||||||
{
|
{
|
||||||
#define MAKEFUNC(f, ord) (p##f = (void*)GetProcAddress(hShlwapi, (LPSTR)(ord)))
|
#define MAKEFUNC(f, ord) (p##f = (void*)GetProcAddress(hShlwapi, (LPSTR)(ord)))
|
||||||
|
@ -2323,6 +2380,7 @@ static void init_pointers(void)
|
||||||
MAKEFUNC(SHSetWindowBits, 165);
|
MAKEFUNC(SHSetWindowBits, 165);
|
||||||
MAKEFUNC(ConnectToConnectionPoint, 168);
|
MAKEFUNC(ConnectToConnectionPoint, 168);
|
||||||
MAKEFUNC(SHSearchMapInt, 198);
|
MAKEFUNC(SHSearchMapInt, 198);
|
||||||
|
MAKEFUNC(SHCreateWorkerWindowA, 257);
|
||||||
MAKEFUNC(GUIDFromStringA, 269);
|
MAKEFUNC(GUIDFromStringA, 269);
|
||||||
MAKEFUNC(SHPackDispParams, 282);
|
MAKEFUNC(SHPackDispParams, 282);
|
||||||
MAKEFUNC(IConnectionPoint_InvokeWithCancel, 283);
|
MAKEFUNC(IConnectionPoint_InvokeWithCancel, 283);
|
||||||
|
@ -2339,6 +2397,7 @@ static void init_pointers(void)
|
||||||
START_TEST(ordinal)
|
START_TEST(ordinal)
|
||||||
{
|
{
|
||||||
hShlwapi = GetModuleHandleA("shlwapi.dll");
|
hShlwapi = GetModuleHandleA("shlwapi.dll");
|
||||||
|
is_win2k_and_lower = GetProcAddress(hShlwapi, "StrChrNW") == 0;
|
||||||
|
|
||||||
init_pointers();
|
init_pointers();
|
||||||
|
|
||||||
|
@ -2359,4 +2418,5 @@ START_TEST(ordinal)
|
||||||
test_SHGetObjectCompatFlags();
|
test_SHGetObjectCompatFlags();
|
||||||
test_IUnknown_QueryServiceExec();
|
test_IUnknown_QueryServiceExec();
|
||||||
test_IUnknown_ProfferService();
|
test_IUnknown_ProfferService();
|
||||||
|
test_SHCreateWorkerWindowA();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue