Skip to content

Commit d055c9f

Browse files
committed
[NTDLL_WINETESTS] Fix the test so that it works on W2K3
It's an addendum to ad547c9
1 parent 43a6843 commit d055c9f

File tree

1 file changed

+9
-10
lines changed
  • modules/rostests/winetests/ntdll

1 file changed

+9
-10
lines changed

modules/rostests/winetests/ntdll/info.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1883,20 +1883,21 @@ static void test_queryvirtualmemory(void)
18831883
{
18841884
NTSTATUS status;
18851885
SIZE_T readcount;
1886-
#ifndef __REACTOS__
18871886
static const WCHAR windowsW[] = {'w','i','n','d','o','w','s'};
1888-
#endif
18891887
static const char teststring[] = "test string";
18901888
static char datatestbuf[42] = "abc";
18911889
static char rwtestbuf[42];
18921890
MEMORY_BASIC_INFORMATION mbi;
18931891
char stackbuf[42];
18941892
HMODULE module;
18951893
char buffer_name[sizeof(MEMORY_SECTION_NAME) + MAX_PATH * sizeof(WCHAR)];
1896-
MEMORY_SECTION_NAME *msn = (MEMORY_SECTION_NAME *)buffer_name;
18971894
#ifndef __REACTOS__
1895+
MEMORY_SECTION_NAME *msn = (MEMORY_SECTION_NAME *)buffer_name;
1896+
#endif
18981897
BOOL found;
18991898
int i;
1899+
#ifdef __REACTOS__
1900+
MEMORY_SECTION_NAME *msn = HeapAlloc(GetProcessHeap(), 0, sizeof(buffer_name));
19001901
#endif
19011902

19021903
module = GetModuleHandleA( "ntdll.dll" );
@@ -1998,26 +1999,24 @@ static void test_queryvirtualmemory(void)
19981999
memset(buffer_name, 0x77, sizeof(buffer_name));
19992000
readcount = 0;
20002001
status = pNtQueryVirtualMemory(NtCurrentProcess(), module, MemorySectionName, msn, sizeof(buffer_name), &readcount);
2001-
#ifndef __REACTOS__
20022002
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
20032003
ok( readcount > 0, "Expected readcount to be > 0\n");
20042004
trace ("Section Name: %s\n", wine_dbgstr_w(msn->SectionFileName.Buffer));
20052005
pRtlDowncaseUnicodeString( &msn->SectionFileName, &msn->SectionFileName, FALSE );
20062006
for (found = FALSE, i = (msn->SectionFileName.Length - sizeof(windowsW)) / sizeof(WCHAR); i >= 0; i--)
20072007
found |= !memcmp( &msn->SectionFileName.Buffer[i], windowsW, sizeof(windowsW) );
20082008
ok( found, "Section name does not contain \"Windows\"\n");
2009-
#else
2010-
/* W2K3 will return this, because the buffer is not ULONG-aligned */
2011-
ok( status == STATUS_DATATYPE_MISALIGNMENT, "Expected STATUS_DATATYPE_MISALIGNMENT, got %08x\n", status);
2012-
ok( readcount == 0, "Expected readcount to be 0: %ld\n", readcount);
2013-
#endif
20142009

20152010
trace("Check section name of non mapped memory\n");
2016-
memset(msn, 0, sizeof(*msn));
2011+
memset(msn, 0, sizeof(buffer_name));
20172012
readcount = 0;
20182013
status = pNtQueryVirtualMemory(NtCurrentProcess(), &buffer_name, MemorySectionName, msn, sizeof(buffer_name), &readcount);
20192014
ok( status == STATUS_INVALID_ADDRESS, "Expected STATUS_INVALID_ADDRESS, got %08x\n", status);
20202015
ok( readcount == 0 || broken(readcount != 0) /* wow64 */, "Expected readcount to be 0\n");
2016+
2017+
#ifdef __REACTOS__
2018+
HeapFree(GetProcessHeap(), 0, msn);
2019+
#endif
20212020
}
20222021

20232022
static void test_affinity(void)

0 commit comments

Comments
 (0)