Nikolay Sivov : setupapi: Make default context structure layout compatible.
Alexandre Julliard
julliard at winehq.org
Mon May 12 15:35:48 CDT 2014
Module: wine
Branch: master
Commit: dcab5fe61bed87b291901ceff686894a64871d98
URL: http://source.winehq.org/git/wine.git/?a=commit;h=dcab5fe61bed87b291901ceff686894a64871d98
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Mon May 12 01:59:33 2014 +0400
setupapi: Make default context structure layout compatible.
---
dlls/setupapi/queue.c | 13 ++++++++----
dlls/setupapi/tests/misc.c | 47 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 56 insertions(+), 4 deletions(-)
diff --git a/dlls/setupapi/queue.c b/dlls/setupapi/queue.c
index 1855e99..d57f8e1 100644
--- a/dlls/setupapi/queue.c
+++ b/dlls/setupapi/queue.c
@@ -39,9 +39,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
/* context structure for the default queue callback */
struct default_callback_context
{
- HWND owner;
- HWND progress;
- UINT message;
+ DWORD magic;
+ HWND owner;
+ DWORD unk1[4];
+ DWORD_PTR unk2[7];
+ HWND progress;
+ UINT message;
+ DWORD_PTR unk3[5];
};
struct file_op
@@ -1482,8 +1486,9 @@ PVOID WINAPI SetupInitDefaultQueueCallbackEx( HWND owner, HWND progress, UINT ms
{
struct default_callback_context *context;
- if ((context = HeapAlloc( GetProcessHeap(), 0, sizeof(*context) )))
+ if ((context = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*context) )))
{
+ context->magic = 0x43515053; /* "SPQC" */
context->owner = owner;
context->progress = progress;
context->message = msg;
diff --git a/dlls/setupapi/tests/misc.c b/dlls/setupapi/tests/misc.c
index db74fcb..cfe888b 100644
--- a/dlls/setupapi/tests/misc.c
+++ b/dlls/setupapi/tests/misc.c
@@ -731,6 +731,51 @@ static void test_SetupUninstallOEMInf(void)
}
}
+struct default_callback_context
+{
+ DWORD magic;
+ HWND owner;
+ DWORD unk1[4];
+ DWORD_PTR unk2[7];
+ HWND progress;
+ UINT message;
+ DWORD_PTR unk3[5];
+};
+
+static void test_defaultcallback(void)
+{
+ struct default_callback_context *ctxt;
+ static const DWORD magic = 0x43515053; /* "SPQC" */
+ HWND owner, progress;
+
+ owner = (HWND)0x123;
+ progress = (HWND)0x456;
+ ctxt = SetupInitDefaultQueueCallbackEx(owner, progress, WM_USER, 0, NULL);
+ ok(ctxt != NULL, "got %p\n", ctxt);
+
+ ok(ctxt->magic == magic || broken(ctxt->magic != magic) /* win2000 */, "got magic 0x%08x\n", ctxt->magic);
+ if (ctxt->magic == magic)
+ {
+ ok(ctxt->owner == owner, "got %p, expected %p\n", ctxt->owner, owner);
+ ok(ctxt->progress == progress, "got %p, expected %p\n", ctxt->progress, progress);
+ ok(ctxt->message == WM_USER, "got %d, expected %d\n", ctxt->message, WM_USER);
+ SetupTermDefaultQueueCallback(ctxt);
+ }
+ else
+ {
+ win_skip("Skipping tests on old systems.\n");
+ SetupTermDefaultQueueCallback(ctxt);
+ return;
+ }
+
+ ctxt = SetupInitDefaultQueueCallback(owner);
+ ok(ctxt->magic == magic, "got magic 0x%08x\n", ctxt->magic);
+ ok(ctxt->owner == owner, "got %p, expected %p\n", ctxt->owner, owner);
+ ok(ctxt->progress == NULL, "got %p, expected %p\n", ctxt->progress, progress);
+ ok(ctxt->message == 0, "got %d\n", ctxt->message);
+ SetupTermDefaultQueueCallback(ctxt);
+}
+
START_TEST(misc)
{
HMODULE hsetupapi = GetModuleHandleA("setupapi.dll");
@@ -760,4 +805,6 @@ START_TEST(misc)
test_SetupUninstallOEMInf();
else
win_skip("SetupUninstallOEMInfA is not available\n");
+
+ test_defaultcallback();
}
More information about the wine-cvs
mailing list