kernel32/tests: Fix synchronization tests compilation with __WINESRC__ defined.

This commit is contained in:
Dmitry Timoshkov 2013-10-21 17:02:35 +09:00 committed by Alexandre Julliard
parent a18087e5d1
commit 31917bfa73
1 changed files with 23 additions and 23 deletions

View File

@ -54,7 +54,7 @@ static void test_signalandwait(void)
DWORD r; DWORD r;
HANDLE event[2], semaphore[2], file; HANDLE event[2], semaphore[2], file;
kernel32 = GetModuleHandle("kernel32"); kernel32 = GetModuleHandleA("kernel32.dll");
pSignalObjectAndWait = (void*) GetProcAddress(kernel32, "SignalObjectAndWait"); pSignalObjectAndWait = (void*) GetProcAddress(kernel32, "SignalObjectAndWait");
if (!pSignalObjectAndWait) if (!pSignalObjectAndWait)
@ -69,8 +69,8 @@ static void test_signalandwait(void)
} }
ok( r == WAIT_FAILED, "should fail\n"); ok( r == WAIT_FAILED, "should fail\n");
event[0] = CreateEvent(NULL, 0, 0, NULL); event[0] = CreateEventW(NULL, 0, 0, NULL);
event[1] = CreateEvent(NULL, 1, 1, NULL); event[1] = CreateEventW(NULL, 1, 1, NULL);
ok( event[0] && event[1], "failed to create event flags\n"); ok( event[0] && event[1], "failed to create event flags\n");
@ -105,8 +105,8 @@ static void test_signalandwait(void)
CloseHandle(event[1]); CloseHandle(event[1]);
/* semaphores */ /* semaphores */
semaphore[0] = CreateSemaphore( NULL, 0, 1, NULL ); semaphore[0] = CreateSemaphoreW( NULL, 0, 1, NULL );
semaphore[1] = CreateSemaphore( NULL, 1, 1, NULL ); semaphore[1] = CreateSemaphoreW( NULL, 1, 1, NULL );
ok( semaphore[0] && semaphore[1], "failed to create semaphore\n"); ok( semaphore[0] && semaphore[1], "failed to create semaphore\n");
r = pSignalObjectAndWait(semaphore[0], semaphore[1], 0, FALSE); r = pSignalObjectAndWait(semaphore[0], semaphore[1], 0, FALSE);
@ -125,7 +125,7 @@ static void test_signalandwait(void)
CloseHandle(semaphore[1]); CloseHandle(semaphore[1]);
/* try a registry key */ /* try a registry key */
file = CreateFile("x", GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, file = CreateFileA("x", GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE, NULL); FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE, NULL);
r = pSignalObjectAndWait(file, file, 0, FALSE); r = pSignalObjectAndWait(file, file, 0, FALSE);
ok( r == WAIT_FAILED, "should fail\n"); ok( r == WAIT_FAILED, "should fail\n");
@ -143,23 +143,23 @@ static void test_mutex(void)
DWORD failed = 0; DWORD failed = 0;
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
hOpened = OpenMutex(0, FALSE, "WineTestMutex"); hOpened = OpenMutexA(0, FALSE, "WineTestMutex");
ok(hOpened == NULL, "OpenMutex succeeded\n"); ok(hOpened == NULL, "OpenMutex succeeded\n");
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "wrong error %u\n", GetLastError()); ok(GetLastError() == ERROR_FILE_NOT_FOUND, "wrong error %u\n", GetLastError());
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
hCreated = CreateMutex(NULL, FALSE, "WineTestMutex"); hCreated = CreateMutexA(NULL, FALSE, "WineTestMutex");
ok(hCreated != NULL, "CreateMutex failed with error %d\n", GetLastError()); ok(hCreated != NULL, "CreateMutex failed with error %d\n", GetLastError());
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
hOpened = OpenMutex(0, FALSE, "WineTestMutex"); hOpened = OpenMutexA(0, FALSE, "WineTestMutex");
todo_wine todo_wine
ok(hOpened == NULL, "OpenMutex succeeded\n"); ok(hOpened == NULL, "OpenMutex succeeded\n");
todo_wine todo_wine
ok(GetLastError() == ERROR_ACCESS_DENIED, "wrong error %u\n", GetLastError()); ok(GetLastError() == ERROR_ACCESS_DENIED, "wrong error %u\n", GetLastError());
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
hOpened = OpenMutex(GENERIC_EXECUTE, FALSE, "WineTestMutex"); hOpened = OpenMutexA(GENERIC_EXECUTE, FALSE, "WineTestMutex");
ok(hOpened != NULL, "OpenMutex failed with error %d\n", GetLastError()); ok(hOpened != NULL, "OpenMutex failed with error %d\n", GetLastError());
wait_ret = WaitForSingleObject(hOpened, INFINITE); wait_ret = WaitForSingleObject(hOpened, INFINITE);
ok(wait_ret == WAIT_OBJECT_0, "WaitForSingleObject failed with error %d\n", GetLastError()); ok(wait_ret == WAIT_OBJECT_0, "WaitForSingleObject failed with error %d\n", GetLastError());
@ -172,7 +172,7 @@ todo_wine
} }
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
hOpened = OpenMutex(GENERIC_READ | GENERIC_WRITE, FALSE, "WineTestMutex"); hOpened = OpenMutexA(GENERIC_READ | GENERIC_WRITE, FALSE, "WineTestMutex");
ok(hOpened != NULL, "OpenMutex failed with error %d\n", GetLastError()); ok(hOpened != NULL, "OpenMutex failed with error %d\n", GetLastError());
wait_ret = WaitForSingleObject(hOpened, INFINITE); wait_ret = WaitForSingleObject(hOpened, INFINITE);
ok(wait_ret == WAIT_FAILED, "WaitForSingleObject succeeded\n"); ok(wait_ret == WAIT_FAILED, "WaitForSingleObject succeeded\n");
@ -181,7 +181,7 @@ todo_wine
for (i = 0; i < 32; i++) for (i = 0; i < 32; i++)
{ {
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
hOpened = OpenMutex(0x1 << i, FALSE, "WineTestMutex"); hOpened = OpenMutexA(0x1 << i, FALSE, "WineTestMutex");
if(hOpened != NULL) if(hOpened != NULL)
{ {
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
@ -211,23 +211,23 @@ todo_wine
/* test case sensitivity */ /* test case sensitivity */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
hOpened = OpenMutex(READ_CONTROL, FALSE, "WINETESTMUTEX"); hOpened = OpenMutexA(READ_CONTROL, FALSE, "WINETESTMUTEX");
ok(!hOpened, "OpenMutex succeeded\n"); ok(!hOpened, "OpenMutex succeeded\n");
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "wrong error %u\n", GetLastError()); ok(GetLastError() == ERROR_FILE_NOT_FOUND, "wrong error %u\n", GetLastError());
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
hOpened = OpenMutex(READ_CONTROL, FALSE, "winetestmutex"); hOpened = OpenMutexA(READ_CONTROL, FALSE, "winetestmutex");
ok(!hOpened, "OpenMutex succeeded\n"); ok(!hOpened, "OpenMutex succeeded\n");
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "wrong error %u\n", GetLastError()); ok(GetLastError() == ERROR_FILE_NOT_FOUND, "wrong error %u\n", GetLastError());
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
hOpened = CreateMutex(NULL, FALSE, "WineTestMutex"); hOpened = CreateMutexA(NULL, FALSE, "WineTestMutex");
ok(hOpened != NULL, "CreateMutex failed with error %d\n", GetLastError()); ok(hOpened != NULL, "CreateMutex failed with error %d\n", GetLastError());
ok(GetLastError() == ERROR_ALREADY_EXISTS, "wrong error %u\n", GetLastError()); ok(GetLastError() == ERROR_ALREADY_EXISTS, "wrong error %u\n", GetLastError());
CloseHandle(hOpened); CloseHandle(hOpened);
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
hOpened = CreateMutex(NULL, FALSE, "WINETESTMUTEX"); hOpened = CreateMutexA(NULL, FALSE, "WINETESTMUTEX");
ok(hOpened != NULL, "CreateMutex failed with error %d\n", GetLastError()); ok(hOpened != NULL, "CreateMutex failed with error %d\n", GetLastError());
ok(GetLastError() == 0, "wrong error %u\n", GetLastError()); ok(GetLastError() == 0, "wrong error %u\n", GetLastError());
CloseHandle(hOpened); CloseHandle(hOpened);
@ -254,7 +254,7 @@ static void test_slist(void)
PSLIST_ENTRY (WINAPI *pInterlockedPushEntrySList)(PSLIST_HEADER,PSLIST_ENTRY); PSLIST_ENTRY (WINAPI *pInterlockedPushEntrySList)(PSLIST_HEADER,PSLIST_ENTRY);
HMODULE kernel32; HMODULE kernel32;
kernel32 = GetModuleHandle("KERNEL32.DLL"); kernel32 = GetModuleHandleA("KERNEL32.DLL");
pInitializeSListHead = (void*) GetProcAddress(kernel32, "InitializeSListHead"); pInitializeSListHead = (void*) GetProcAddress(kernel32, "InitializeSListHead");
pQueryDepthSList = (void*) GetProcAddress(kernel32, "QueryDepthSList"); pQueryDepthSList = (void*) GetProcAddress(kernel32, "QueryDepthSList");
pInterlockedFlushSList = (void*) GetProcAddress(kernel32, "InterlockedFlushSList"); pInterlockedFlushSList = (void*) GetProcAddress(kernel32, "InterlockedFlushSList");
@ -536,7 +536,7 @@ static void test_iocp_callback(void)
return; return;
} }
sem = CreateSemaphore(NULL, 0, 1, NULL); sem = CreateSemaphoreW(NULL, 0, 1, NULL);
ok(sem != INVALID_HANDLE_VALUE, "Creating a semaphore failed\n"); ok(sem != INVALID_HANDLE_VALUE, "Creating a semaphore failed\n");
ret = GetTempPathA(MAX_PATH, temp_path); ret = GetTempPathA(MAX_PATH, temp_path);
@ -813,9 +813,9 @@ static void test_timer_queue(void)
ok(n5 == 1, "Timer callback 5 expected 1 got %d\n", n5); ok(n5 == 1, "Timer callback 5 expected 1 got %d\n", n5);
/* Test synchronous deletion of the timer/queue with event trigger. */ /* Test synchronous deletion of the timer/queue with event trigger. */
e = CreateEvent(NULL, TRUE, FALSE, NULL); e = CreateEventW(NULL, TRUE, FALSE, NULL);
et1 = CreateEvent(NULL, TRUE, FALSE, NULL); et1 = CreateEventW(NULL, TRUE, FALSE, NULL);
et2 = CreateEvent(NULL, TRUE, FALSE, NULL); et2 = CreateEventW(NULL, TRUE, FALSE, NULL);
if (!e || !et1 || !et2) if (!e || !et1 || !et2)
{ {
skip("Failed to create timer queue descruction event\n"); skip("Failed to create timer queue descruction event\n");
@ -1123,7 +1123,7 @@ static void test_WaitForMultipleObjects(void)
* we can wait on that many */ * we can wait on that many */
for (i=0; i<MAXIMUM_WAIT_OBJECTS; i++) for (i=0; i<MAXIMUM_WAIT_OBJECTS; i++)
{ {
maxevents[i] = CreateEvent(NULL, i==0, TRUE, NULL); maxevents[i] = CreateEventW(NULL, i==0, TRUE, NULL);
ok( maxevents[i] != 0, "should create enough events\n"); ok( maxevents[i] != 0, "should create enough events\n");
} }
@ -1653,7 +1653,7 @@ static void test_condvars_base(void) {
START_TEST(sync) START_TEST(sync)
{ {
HMODULE hdll = GetModuleHandle("kernel32"); HMODULE hdll = GetModuleHandleA("kernel32.dll");
pChangeTimerQueueTimer = (void*)GetProcAddress(hdll, "ChangeTimerQueueTimer"); pChangeTimerQueueTimer = (void*)GetProcAddress(hdll, "ChangeTimerQueueTimer");
pCreateTimerQueue = (void*)GetProcAddress(hdll, "CreateTimerQueue"); pCreateTimerQueue = (void*)GetProcAddress(hdll, "CreateTimerQueue");
pCreateTimerQueueTimer = (void*)GetProcAddress(hdll, "CreateTimerQueueTimer"); pCreateTimerQueueTimer = (void*)GetProcAddress(hdll, "CreateTimerQueueTimer");