[PATCH] Some SHCreateWorkerWindowA tests
Nikolay Sivov
nsivov at codeweavers.com
Mon Mar 29 15:24:35 CDT 2010
---
dlls/shlwapi/ordinal.c | 36 ++++++++++------------
dlls/shlwapi/tests/ordinal.c | 68 +++++++++++++++++++++++++++++++++++++++--
2 files changed, 80 insertions(+), 24 deletions(-)
diff --git a/dlls/shlwapi/ordinal.c b/dlls/shlwapi/ordinal.c
index 8209217..a72dba3 100644
--- a/dlls/shlwapi/ordinal.c
+++ b/dlls/shlwapi/ordinal.c
@@ -2595,21 +2595,21 @@ HRESULT WINAPI IUnknown_GetSite(LPUNKNOWN lpUnknown, REFIID iid, PVOID *lppSite)
* dwExStyle [I] Extra style flags
* dwStyle [I] Style flags
* hMenu [I] Window menu
- * z [I] Unknown
+ * msg_result [I] New DWLP_MSGRESULT value
*
* RETURNS
* Success: The window handle of the newly created window.
* Failure: 0.
*/
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";
WNDCLASSA wc;
HWND hWnd;
- TRACE("(0x%08x,%p,0x%08x,0x%08x,%p,0x%08x)\n",
- wndProc, hWndParent, dwExStyle, dwStyle, hMenu, z);
+ TRACE("(0x%08x, %p, 0x%08x, 0x%08x, %p, 0x%08x)\n",
+ wndProc, hWndParent, dwExStyle, dwStyle, hMenu, msg_result);
/* Create Window class */
wc.style = 0;
@@ -2623,19 +2623,17 @@ HWND WINAPI SHCreateWorkerWindowA(LONG wndProc, HWND hWndParent, DWORD dwExStyle
wc.lpszMenuName = NULL;
wc.lpszClassName = szClass;
- SHRegisterClassA(&wc); /* Register class */
-
- /* FIXME: Set extra bits in dwExStyle */
+ SHRegisterClassA(&wc);
hWnd = CreateWindowExA(dwExStyle, szClass, 0, dwStyle, 0, 0, 0, 0,
hWndParent, hMenu, shlwapi_hInstance, 0);
if (hWnd)
{
- SetWindowLongPtrW(hWnd, DWLP_MSGRESULT, z);
+ SetWindowLongPtrW(hWnd, DWLP_MSGRESULT, msg_result);
- if (wndProc)
- SetWindowLongPtrA(hWnd, GWLP_WNDPROC, wndProc);
+ if (wndProc) SetWindowLongPtrA(hWnd, GWLP_WNDPROC, wndProc);
}
+
return hWnd;
}
@@ -2893,20 +2891,20 @@ DWORD WINAPI WhichPlatform(void)
* Unicode version of SHCreateWorkerWindowA.
*/
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 };
WNDCLASSW wc;
HWND hWnd;
- TRACE("(0x%08x,%p,0x%08x,0x%08x,%p,0x%08x)\n",
- wndProc, hWndParent, dwExStyle, dwStyle, hMenu, z);
+ TRACE("(0x%08x, %p, 0x%08x, 0x%08x, %p, 0x%08x)\n",
+ wndProc, hWndParent, dwExStyle, dwStyle, hMenu, msg_result);
/* If our OS is natively ANSI, use the ANSI version */
if (GetVersion() & 0x80000000) /* not NT */
{
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 */
@@ -2921,19 +2919,17 @@ HWND WINAPI SHCreateWorkerWindowW(LONG wndProc, HWND hWndParent, DWORD dwExStyle
wc.lpszMenuName = NULL;
wc.lpszClassName = szClass;
- SHRegisterClassW(&wc); /* Register class */
-
- /* FIXME: Set extra bits in dwExStyle */
+ SHRegisterClassW(&wc);
hWnd = CreateWindowExW(dwExStyle, szClass, 0, dwStyle, 0, 0, 0, 0,
hWndParent, hMenu, shlwapi_hInstance, 0);
if (hWnd)
{
- SetWindowLongPtrW(hWnd, DWLP_MSGRESULT, z);
+ SetWindowLongPtrW(hWnd, DWLP_MSGRESULT, msg_result);
- if (wndProc)
- SetWindowLongPtrW(hWnd, GWLP_WNDPROC, wndProc);
+ if (wndProc) SetWindowLongPtrW(hWnd, GWLP_WNDPROC, wndProc);
}
+
return hWnd;
}
diff --git a/dlls/shlwapi/tests/ordinal.c b/dlls/shlwapi/tests/ordinal.c
index 6f518e9..1c25f12 100644
--- a/dlls/shlwapi/tests/ordinal.c
+++ b/dlls/shlwapi/tests/ordinal.c
@@ -34,6 +34,8 @@
/* Function ptrs for ordinal calls */
static HMODULE hShlwapi;
+static BOOL is_win2k_and_lower;
+
static int (WINAPI *pSHSearchMapInt)(const int*,const int*,int,int);
static HRESULT (WINAPI *pGetAcceptLanguagesA)(LPSTR,LPDWORD);
@@ -53,6 +55,7 @@ static DWORD (WINAPI *pSHGetObjectCompatFlags)(IUnknown*, const CLSID*);
static BOOL (WINAPI *pGUIDFromStringA)(LPSTR, CLSID *);
static HRESULT (WINAPI *pIUnknown_QueryServiceExec)(IUnknown*, REFIID, const GUID*, DWORD, DWORD, VARIANT*, VARIANT*);
static HRESULT (WINAPI *pIUnknown_ProfferService)(IUnknown*, REFGUID, IServiceProvider*, DWORD*);
+static HWND (WINAPI *pSHCreateWorkerWindowA)(LONG, HWND, DWORD, DWORD, HMENU, LONG);
static HMODULE hmlang;
static HRESULT (WINAPI *pLcidToRfc1766A)(LCID, LPSTR, INT);
@@ -2139,7 +2142,6 @@ static const IServiceProviderVtbl IServiceProviderImpl_Vtbl =
static void test_IUnknown_QueryServiceExec(void)
{
IServiceProvider *provider = IServiceProviderImpl_Construct();
- void *test_ptr = (void*)GetProcAddress(hShlwapi, "StrChrNW");
static const GUID dummy_serviceid = { 0xdeadbeef };
static const GUID dummy_groupid = { 0xbeefbeef };
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
prototype, so skipping using this indirect condition */
- if (!test_ptr)
+ if (is_win2k_and_lower)
{
win_skip("IUnknown_QueryServiceExec is not available\n");
return;
@@ -2250,7 +2252,6 @@ static const IProfferServiceVtbl IProfferServiceImpl_Vtbl =
static void test_IUnknown_ProfferService(void)
{
- void *test_ptr = (void*)GetProcAddress(hShlwapi, "StrChrNW");
IServiceProvider *provider = IServiceProviderImpl_Construct();
IProfferService *proff = IProfferServiceImpl_Construct();
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
prototype, so skipping using this indirect condition */
- if (!test_ptr)
+ if (is_win2k_and_lower)
{
win_skip("IUnknown_ProfferService is not available\n");
return;
@@ -2312,6 +2313,62 @@ static void test_IUnknown_ProfferService(void)
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)
{
#define MAKEFUNC(f, ord) (p##f = (void*)GetProcAddress(hShlwapi, (LPSTR)(ord)))
@@ -2323,6 +2380,7 @@ static void init_pointers(void)
MAKEFUNC(SHSetWindowBits, 165);
MAKEFUNC(ConnectToConnectionPoint, 168);
MAKEFUNC(SHSearchMapInt, 198);
+ MAKEFUNC(SHCreateWorkerWindowA, 257);
MAKEFUNC(GUIDFromStringA, 269);
MAKEFUNC(SHPackDispParams, 282);
MAKEFUNC(IConnectionPoint_InvokeWithCancel, 283);
@@ -2339,6 +2397,7 @@ static void init_pointers(void)
START_TEST(ordinal)
{
hShlwapi = GetModuleHandleA("shlwapi.dll");
+ is_win2k_and_lower = GetProcAddress(hShlwapi, "StrChrNW") == 0;
init_pointers();
@@ -2359,4 +2418,5 @@ START_TEST(ordinal)
test_SHGetObjectCompatFlags();
test_IUnknown_QueryServiceExec();
test_IUnknown_ProfferService();
+ test_SHCreateWorkerWindowA();
}
--
1.5.6.5
--=-RqDwoHzm7DLr/7xJTpWu--
More information about the wine-patches
mailing list