[3/6] kernel32/tests: Fix virtual memory tests compilation with __WINESRC__ defined.

Dmitry Timoshkov dmitry at baikal.ru
Wed Oct 16 21:45:32 CDT 2013


---
 dlls/kernel32/tests/virtual.c | 54 +++++++++++++++++++++----------------------
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c
index 99d3286..a77fdb9 100644
--- a/dlls/kernel32/tests/virtual.c
+++ b/dlls/kernel32/tests/virtual.c
@@ -49,12 +49,12 @@ static HANDLE create_target_process(const char *arg)
     char cmdline[MAX_PATH];
     PROCESS_INFORMATION pi;
     BOOL ret;
-    STARTUPINFO si = { 0 };
+    STARTUPINFOA si = { 0 };
     si.cb = sizeof(si);
 
     winetest_get_mainargs( &argv );
     sprintf(cmdline, "%s %s %s", argv[0], argv[1], arg);
-    ret = CreateProcess(NULL, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
+    ret = CreateProcessA(NULL, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
     ok(ret, "error: %u\n", GetLastError());
     ret = CloseHandle(pi.hThread);
     ok(ret, "error %u\n", GetLastError());
@@ -586,17 +586,17 @@ static void test_MapViewOfFile(void)
 
     SetLastError(0xdeadbeef);
     name = "Local\\Foo";
-    file = CreateFileMapping( INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 4096, name );
+    file = CreateFileMappingA( INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 4096, name );
     /* nt4 doesn't have Local\\ */
     if (!file && GetLastError() == ERROR_PATH_NOT_FOUND)
     {
         name = "Foo";
-        file = CreateFileMapping( INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 4096, name );
+        file = CreateFileMappingA( INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 4096, name );
     }
     ok( file != 0, "CreateFileMapping PAGE_READWRITE error %u\n", GetLastError() );
 
     SetLastError(0xdeadbeef);
-    mapping = OpenFileMapping( FILE_MAP_READ, FALSE, name );
+    mapping = OpenFileMappingA( FILE_MAP_READ, FALSE, name );
     ok( mapping != 0, "OpenFileMapping FILE_MAP_READ error %u\n", GetLastError() );
     SetLastError(0xdeadbeef);
     ptr = MapViewOfFile( mapping, FILE_MAP_WRITE, 0, 0, 0 );
@@ -623,7 +623,7 @@ static void test_MapViewOfFile(void)
     CloseHandle( mapping );
 
     SetLastError(0xdeadbeef);
-    mapping = OpenFileMapping( FILE_MAP_WRITE, FALSE, name );
+    mapping = OpenFileMappingA( FILE_MAP_WRITE, FALSE, name );
     ok( mapping != 0, "OpenFileMapping FILE_MAP_WRITE error %u\n", GetLastError() );
     SetLastError(0xdeadbeef);
     ptr = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, 0 );
@@ -1283,7 +1283,7 @@ static void test_write_watch(void)
         "wrong error %u\n", GetLastError() );
 
     SetLastError( 0xdeadbeef );
-    ret = pGetWriteWatch( 0, GetModuleHandle(0), size, results, &count, &pagesize );
+    ret = pGetWriteWatch( 0, GetModuleHandleW(NULL), size, results, &count, &pagesize );
     if (ret)
     {
         ok( ret == ~0u, "GetWriteWatch succeeded %u\n", ret );
@@ -1459,7 +1459,7 @@ static void test_write_watch(void)
         ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
 
         SetLastError( 0xdeadbeef );
-        ret = pResetWriteWatch( GetModuleHandle(0), size );
+        ret = pResetWriteWatch( GetModuleHandleW(NULL), size );
         ok( ret == ~0u, "ResetWriteWatch succeeded %u\n", ret );
         ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
     }
@@ -1486,7 +1486,7 @@ static void test_write_watch(void)
         ret = pResetWriteWatch( base, 0 );
         ok( !ret, "ResetWriteWatch failed %u\n", ret );
 
-        ret = pResetWriteWatch( GetModuleHandle(0), size );
+        ret = pResetWriteWatch( GetModuleHandleW(NULL), size );
         ok( !ret, "ResetWriteWatch failed %u\n", ret );
     }
 
@@ -1861,11 +1861,11 @@ static void test_CreateFileMapping_protection(void)
     GetSystemInfo(&si);
     trace("system page size %#x\n", si.dwPageSize);
 
-    GetTempPath(MAX_PATH, temp_path);
-    GetTempFileName(temp_path, "map", 0, file_name);
+    GetTempPathA(MAX_PATH, temp_path);
+    GetTempFileNameA(temp_path, "map", 0, file_name);
 
     SetLastError(0xdeadbeef);
-    hfile = CreateFile(file_name, GENERIC_READ|GENERIC_WRITE|GENERIC_EXECUTE, 0, NULL, CREATE_ALWAYS, 0, 0);
+    hfile = CreateFileA(file_name, GENERIC_READ|GENERIC_WRITE|GENERIC_EXECUTE, 0, NULL, CREATE_ALWAYS, 0, 0);
     ok(hfile != INVALID_HANDLE_VALUE, "CreateFile(%s) error %d\n", file_name, GetLastError());
     SetFilePointer(hfile, si.dwPageSize, NULL, FILE_BEGIN);
     SetEndOfFile(hfile);
@@ -1873,7 +1873,7 @@ static void test_CreateFileMapping_protection(void)
     for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
     {
         SetLastError(0xdeadbeef);
-        hmap = CreateFileMapping(hfile, NULL, td[i].prot | SEC_COMMIT, 0, si.dwPageSize, NULL);
+        hmap = CreateFileMappingW(hfile, NULL, td[i].prot | SEC_COMMIT, 0, si.dwPageSize, NULL);
 
         if (td[i].success)
         {
@@ -1954,7 +1954,7 @@ todo_wine
     if (page_exec_supported) alloc_prot = PAGE_EXECUTE_READWRITE;
     else alloc_prot = PAGE_READWRITE;
     SetLastError(0xdeadbeef);
-    hmap = CreateFileMapping(hfile, NULL, alloc_prot, 0, si.dwPageSize, NULL);
+    hmap = CreateFileMappingW(hfile, NULL, alloc_prot, 0, si.dwPageSize, NULL);
     ok(hmap != 0, "%d: CreateFileMapping error %d\n", i, GetLastError());
 
     SetLastError(0xdeadbeef);
@@ -2065,7 +2065,7 @@ todo_wine
     CloseHandle(hmap);
 
     CloseHandle(hfile);
-    DeleteFile(file_name);
+    DeleteFileA(file_name);
 }
 
 #define ACCESS_READ      0x01
@@ -2252,11 +2252,11 @@ static void test_mapping(void)
     GetSystemInfo(&si);
     trace("system page size %#x\n", si.dwPageSize);
 
-    GetTempPath(MAX_PATH, temp_path);
-    GetTempFileName(temp_path, "map", 0, file_name);
+    GetTempPathA(MAX_PATH, temp_path);
+    GetTempFileNameA(temp_path, "map", 0, file_name);
 
     SetLastError(0xdeadbeef);
-    hfile = CreateFile(file_name, GENERIC_READ|GENERIC_WRITE|GENERIC_EXECUTE, 0, NULL, CREATE_ALWAYS, 0, 0);
+    hfile = CreateFileA(file_name, GENERIC_READ|GENERIC_WRITE|GENERIC_EXECUTE, 0, NULL, CREATE_ALWAYS, 0, 0);
     ok(hfile != INVALID_HANDLE_VALUE, "CreateFile(%s) error %d\n", file_name, GetLastError());
     SetFilePointer(hfile, si.dwPageSize, NULL, FILE_BEGIN);
     SetEndOfFile(hfile);
@@ -2264,7 +2264,7 @@ static void test_mapping(void)
     for (i = 0; i < sizeof(page_prot)/sizeof(page_prot[0]); i++)
     {
         SetLastError(0xdeadbeef);
-        hmap = CreateFileMapping(hfile, NULL, page_prot[i] | SEC_COMMIT, 0, si.dwPageSize, NULL);
+        hmap = CreateFileMappingW(hfile, NULL, page_prot[i] | SEC_COMMIT, 0, si.dwPageSize, NULL);
 
         if (page_prot[i] == PAGE_NOACCESS)
         {
@@ -2275,7 +2275,7 @@ static void test_mapping(void)
 
             /* A trick to create a not accessible mapping */
             SetLastError(0xdeadbeef);
-            hmap = CreateFileMapping(hfile, NULL, PAGE_READWRITE | SEC_COMMIT, 0, si.dwPageSize, NULL);
+            hmap = CreateFileMappingW(hfile, NULL, PAGE_READWRITE | SEC_COMMIT, 0, si.dwPageSize, NULL);
             ok(hmap != 0, "CreateFileMapping(PAGE_READWRITE) error %d\n", GetLastError());
             SetLastError(0xdeadbeef);
             ret = DuplicateHandle(GetCurrentProcess(), hmap, GetCurrentProcess(), &hmap2, 0, FALSE, 0);
@@ -2442,7 +2442,7 @@ todo_wine
     }
 
     CloseHandle(hfile);
-    DeleteFile(file_name);
+    DeleteFileA(file_name);
 }
 
 static void test_shared_memory(int is_child)
@@ -2451,7 +2451,7 @@ static void test_shared_memory(int is_child)
     LONG *p;
 
     SetLastError(0xdeadbef);
-    mapping = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 4096, "winetest_virtual.c");
+    mapping = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 4096, "winetest_virtual.c");
     ok(mapping != 0, "CreateFileMapping error %d\n", GetLastError());
     if (is_child)
         ok(GetLastError() == ERROR_ALREADY_EXISTS, "expected ERROR_ALREADY_EXISTS, got %d\n", GetLastError());
@@ -2469,14 +2469,14 @@ static void test_shared_memory(int is_child)
         char **argv;
         char cmdline[MAX_PATH];
         PROCESS_INFORMATION pi;
-        STARTUPINFO si = { sizeof(si) };
+        STARTUPINFOA si = { sizeof(si) };
         DWORD ret;
 
         *p = 0x1a2b3c4d;
 
         winetest_get_mainargs(&argv);
         sprintf(cmdline, "\"%s\" virtual sharedmem", argv[0]);
-        ret = CreateProcess(argv[0], cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
+        ret = CreateProcessA(argv[0], cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
         ok(ret, "CreateProcess(%s) error %d\n", cmdline, GetLastError());
         winetest_wait_child_process(pi.hProcess);
         CloseHandle(pi.hThread);
@@ -2525,10 +2525,10 @@ START_TEST(virtual)
     pVirtualFreeEx = (void *) GetProcAddress(hkernel32, "VirtualFreeEx");
     pGetWriteWatch = (void *) GetProcAddress(hkernel32, "GetWriteWatch");
     pResetWriteWatch = (void *) GetProcAddress(hkernel32, "ResetWriteWatch");
-    pNtAreMappedFilesTheSame = (void *)GetProcAddress( GetModuleHandle("ntdll.dll"),
+    pNtAreMappedFilesTheSame = (void *)GetProcAddress( GetModuleHandleA("ntdll.dll"),
                                                        "NtAreMappedFilesTheSame" );
-    pNtMapViewOfSection = (void *)GetProcAddress(GetModuleHandle("ntdll.dll"), "NtMapViewOfSection");
-    pNtUnmapViewOfSection = (void *)GetProcAddress(GetModuleHandle("ntdll.dll"), "NtUnmapViewOfSection");
+    pNtMapViewOfSection = (void *)GetProcAddress(GetModuleHandleA("ntdll.dll"), "NtMapViewOfSection");
+    pNtUnmapViewOfSection = (void *)GetProcAddress(GetModuleHandleA("ntdll.dll"), "NtUnmapViewOfSection");
 
     test_shared_memory(0);
     test_mapping();
-- 
1.8.4.1




More information about the wine-patches mailing list