Commit 2803516d authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

ole32: Round the extected size in the marshal and moniker tests using the…

ole32: Round the extected size in the marshal and moniker tests using the results of sizing a global, not a heap pointer. The rounding isn't the same on Win9x, and the size being compared to is that of a global handle.
parent 88cb399a
...@@ -2040,17 +2040,17 @@ static void test_WM_QUIT_handling(void) ...@@ -2040,17 +2040,17 @@ static void test_WM_QUIT_handling(void)
} }
} }
static SIZE_T round_heap_size(SIZE_T size) static SIZE_T round_global_size(SIZE_T size)
{ {
static SIZE_T heap_size_alignment = -1; static SIZE_T global_size_alignment = -1;
if (heap_size_alignment == -1) if (global_size_alignment == -1)
{ {
void *p = HeapAlloc(GetProcessHeap(), 0, 1); void *p = GlobalAlloc(GMEM_FIXED, 1);
heap_size_alignment = HeapSize(GetProcessHeap(), 0, p); global_size_alignment = GlobalSize(p);
HeapFree(GetProcessHeap(), 0, p); GlobalFree(p);
} }
return ((size + heap_size_alignment - 1) & ~(heap_size_alignment - 1)); return ((size + global_size_alignment - 1) & ~(global_size_alignment - 1));
} }
static void test_freethreadedmarshaldata(IStream *pStream, MSHCTX mshctx, void *ptr, DWORD mshlflags) static void test_freethreadedmarshaldata(IStream *pStream, MSHCTX mshctx, void *ptr, DWORD mshlflags)
...@@ -2069,9 +2069,9 @@ static void test_freethreadedmarshaldata(IStream *pStream, MSHCTX mshctx, void * ...@@ -2069,9 +2069,9 @@ static void test_freethreadedmarshaldata(IStream *pStream, MSHCTX mshctx, void *
if (mshctx == MSHCTX_INPROC) if (mshctx == MSHCTX_INPROC)
{ {
DWORD expected_size = round_heap_size(3*sizeof(DWORD) + sizeof(GUID)); DWORD expected_size = round_global_size(3*sizeof(DWORD) + sizeof(GUID));
ok(size == expected_size || ok(size == expected_size ||
broken(size == round_heap_size(2*sizeof(DWORD))) /* Win9x & NT4 */, broken(size == round_global_size(2*sizeof(DWORD))) /* Win9x & NT4 */,
"size should have been %d instead of %d\n", expected_size, size); "size should have been %d instead of %d\n", expected_size, size);
ok(*(DWORD *)marshal_data == mshlflags, "expected 0x%x, but got 0x%x for mshctx\n", mshlflags, *(DWORD *)marshal_data); ok(*(DWORD *)marshal_data == mshlflags, "expected 0x%x, but got 0x%x for mshctx\n", mshlflags, *(DWORD *)marshal_data);
......
...@@ -82,17 +82,17 @@ static void UnlockModule(void) ...@@ -82,17 +82,17 @@ static void UnlockModule(void)
InterlockedDecrement(&cLocks); InterlockedDecrement(&cLocks);
} }
static SIZE_T round_heap_size(SIZE_T size) static SIZE_T round_global_size(SIZE_T size)
{ {
static SIZE_T heap_size_alignment = -1; static SIZE_T global_size_alignment = -1;
if (heap_size_alignment == -1) if (global_size_alignment == -1)
{ {
void *p = HeapAlloc(GetProcessHeap(), 0, 1); void *p = GlobalAlloc(GMEM_FIXED, 1);
heap_size_alignment = HeapSize(GetProcessHeap(), 0, p); global_size_alignment = GlobalSize(p);
HeapFree(GetProcessHeap(), 0, p); GlobalFree(p);
} }
return ((size + heap_size_alignment - 1) & ~(heap_size_alignment - 1)); return ((size + global_size_alignment - 1) & ~(global_size_alignment - 1));
} }
static HRESULT WINAPI Test_IClassFactory_QueryInterface( static HRESULT WINAPI Test_IClassFactory_QueryInterface(
...@@ -1220,12 +1220,12 @@ static void test_moniker( ...@@ -1220,12 +1220,12 @@ static void test_moniker(
moniker_data = GlobalLock(hglobal); moniker_data = GlobalLock(hglobal);
/* first check we have the right amount of data */ /* first check we have the right amount of data */
ok(moniker_size == round_heap_size(sizeof_expected_moniker_saved_data), ok(moniker_size == round_global_size(sizeof_expected_moniker_saved_data),
"%s: Size of saved data differs (expected %d, actual %d)\n", "%s: Size of saved data differs (expected %d, actual %d)\n",
testname, (DWORD)round_heap_size(sizeof_expected_moniker_saved_data), moniker_size); testname, (DWORD)round_global_size(sizeof_expected_moniker_saved_data), moniker_size);
/* then do a byte-by-byte comparison */ /* then do a byte-by-byte comparison */
for (i = 0; i < min(moniker_size, round_heap_size(sizeof_expected_moniker_saved_data)); i++) for (i = 0; i < min(moniker_size, round_global_size(sizeof_expected_moniker_saved_data)); i++)
{ {
if (expected_moniker_saved_data[i] != moniker_data[i]) if (expected_moniker_saved_data[i] != moniker_data[i])
{ {
...@@ -1266,14 +1266,14 @@ static void test_moniker( ...@@ -1266,14 +1266,14 @@ static void test_moniker(
moniker_data = GlobalLock(hglobal); moniker_data = GlobalLock(hglobal);
/* first check we have the right amount of data */ /* first check we have the right amount of data */
ok(moniker_size == round_heap_size(sizeof_expected_moniker_marshal_data), ok(moniker_size == round_global_size(sizeof_expected_moniker_marshal_data),
"%s: Size of marshaled data differs (expected %d, actual %d)\n", "%s: Size of marshaled data differs (expected %d, actual %d)\n",
testname, (DWORD)round_heap_size(sizeof_expected_moniker_marshal_data), moniker_size); testname, (DWORD)round_global_size(sizeof_expected_moniker_marshal_data), moniker_size);
/* then do a byte-by-byte comparison */ /* then do a byte-by-byte comparison */
if (expected_moniker_marshal_data) if (expected_moniker_marshal_data)
{ {
for (i = 0; i < min(moniker_size, round_heap_size(sizeof_expected_moniker_marshal_data)); i++) for (i = 0; i < min(moniker_size, round_global_size(sizeof_expected_moniker_marshal_data)); i++)
{ {
if (expected_moniker_marshal_data[i] != moniker_data[i]) if (expected_moniker_marshal_data[i] != moniker_data[i])
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment