Add trailing '\n's to ok() calls.

This commit is contained in:
Francois Gouget 2004-02-06 05:24:34 +00:00 committed by Alexandre Julliard
parent 21d591ec4f
commit afd3c257bd
9 changed files with 546 additions and 546 deletions

View File

@ -135,7 +135,7 @@ static void test_FindFirstChangeNotification(void)
lstrcatA(dirname1, "dir");
ret = CreateDirectoryA(dirname1, NULL);
ok(ret, "CreateDirectoryA error: %ld", GetLastError());
ok(ret, "CreateDirectoryA error: %ld\n", GetLastError());
/* What if we remove the directory we registered notification for? */
thread = StartNotificationThread(dirname1, FALSE, FILE_NOTIFY_CHANGE_DIR_NAME);

View File

@ -33,57 +33,57 @@ START_TEST(heap)
/* Heap*() functions */
mem = HeapAlloc(GetProcessHeap(), 0, 0);
ok(mem != NULL, "memory not allocated for size 0");
ok(mem != NULL, "memory not allocated for size 0\n");
mem = HeapReAlloc(GetProcessHeap(), 0, NULL, 10);
ok(mem == NULL, "memory allocated by HeapReAlloc");
ok(mem == NULL, "memory allocated by HeapReAlloc\n");
/* Global*() functions */
gbl = GlobalAlloc(GMEM_MOVEABLE, 0);
ok(gbl != NULL, "global memory not allocated for size 0");
ok(gbl != NULL, "global memory not allocated for size 0\n");
gbl = GlobalReAlloc(gbl, 10, GMEM_MOVEABLE);
ok(gbl != NULL, "Can't realloc global memory");
ok(gbl != NULL, "Can't realloc global memory\n");
size = GlobalSize(gbl);
ok(size >= 10 && size <= 16, "Memory not resized to size 10, instead size=%ld", size);
ok(size >= 10 && size <= 16, "Memory not resized to size 10, instead size=%ld\n", size);
todo_wine
{
gbl = GlobalReAlloc(gbl, 0, GMEM_MOVEABLE);
ok(gbl != NULL, "GlobalReAlloc should not fail on size 0");
ok(gbl != NULL, "GlobalReAlloc should not fail on size 0\n");
}
size = GlobalSize(gbl);
ok(size == 0, "Memory not resized to size 0, instead size=%ld", size);
ok(GlobalFree(gbl) == NULL, "Memory not freed");
ok(size == 0, "Memory not resized to size 0, instead size=%ld\n", size);
ok(GlobalFree(gbl) == NULL, "Memory not freed\n");
size = GlobalSize(gbl);
ok(size == 0, "Memory should have been freed, size=%ld", size);
ok(size == 0, "Memory should have been freed, size=%ld\n", size);
gbl = GlobalReAlloc(0, 10, GMEM_MOVEABLE);
ok(gbl == NULL, "global realloc allocated memory");
ok(gbl == NULL, "global realloc allocated memory\n");
/* Local*() functions */
gbl = LocalAlloc(GMEM_MOVEABLE, 0);
ok(gbl != NULL, "local memory not allocated for size 0");
ok(gbl != NULL, "local memory not allocated for size 0\n");
gbl = LocalReAlloc(gbl, 10, GMEM_MOVEABLE);
ok(gbl != NULL, "Can't realloc local memory");
ok(gbl != NULL, "Can't realloc local memory\n");
size = LocalSize(gbl);
ok(size >= 10 && size <= 16, "Memory not resized to size 10, instead size=%ld", size);
ok(size >= 10 && size <= 16, "Memory not resized to size 10, instead size=%ld\n", size);
todo_wine
{
gbl = LocalReAlloc(gbl, 0, GMEM_MOVEABLE);
ok(gbl != NULL, "LocalReAlloc should not fail on size 0");
ok(gbl != NULL, "LocalReAlloc should not fail on size 0\n");
}
size = LocalSize(gbl);
ok(size == 0, "Memory not resized to size 0, instead size=%ld", size);
ok(LocalFree(gbl) == NULL, "Memory not freed");
ok(size == 0, "Memory not resized to size 0, instead size=%ld\n", size);
ok(LocalFree(gbl) == NULL, "Memory not freed\n");
size = LocalSize(gbl);
ok(size == 0, "Memory should have been freed, size=%ld", size);
ok(size == 0, "Memory should have been freed, size=%ld\n", size);
gbl = LocalReAlloc(0, 10, GMEM_MOVEABLE);
ok(gbl == NULL, "local realloc allocated memory");
ok(gbl == NULL, "local realloc allocated memory\n");
}

View File

@ -118,7 +118,7 @@ char GlobalBuffer[BUFFER_SIZE]; /* Buffer used by callback function */
#define STRINGSA(x,y) strcpy(input, x); strcpy(Expected, y); SetLastError(0); buffer[0] = '\0'
#define EXPECT_LENA EXPECT_LEN((int)strlen(Expected)+1)
#define EXPECT_EQA ok(strncmp(buffer, Expected, strlen(Expected)) == 0, \
"Expected '%s', got '%s'", Expected, buffer)
"Expected '%s', got '%s'\n", Expected, buffer)
#define STRINGSW(x,y) MultiByteToWideChar(CP_ACP,0,x,-1,input,COUNTOF(input)); \
MultiByteToWideChar(CP_ACP,0,y,-1,Expected,COUNTOF(Expected)); \
@ -791,141 +791,141 @@ static void test_CompareStringA()
ok(!ret, "CompareStringA must fail with invalid flag\n");
ret = lstrcmpA("", "");
ok (!ret, "lstrcmpA(\"\", \"\") should return 0, got %d", ret);
ok (!ret, "lstrcmpA(\"\", \"\") should return 0, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT,0,"EndDialog",-1,"_Property",-1);
ok( ret == 3, "EndDialog vs _Property ... expected 3, got %d", ret);
ok( ret == 3, "EndDialog vs _Property ... expected 3, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT,0,"osp_vba.sreg0070",-1,"_IEWWBrowserComp",-1);
ok( ret == 3, "osp_vba.sreg0070 vs _IEWWBrowserComp ... expected 3, got %d", ret);
ok( ret == 3, "osp_vba.sreg0070 vs _IEWWBrowserComp ... expected 3, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT,0,"r",-1,"\\",-1);
ok( ret == 3, "r vs \\ ... expected 3, got %d", ret);
ok( ret == 3, "r vs \\ ... expected 3, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT,0,"osp_vba.sreg0031", -1, "OriginalDatabase", -1 );
ok( ret == 3, "osp_vba.sreg0031 vs OriginalDatabase ... expected 3, got %d", ret);
ok( ret == 3, "osp_vba.sreg0031 vs OriginalDatabase ... expected 3, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "AAA", -1, "aaa", -1 );
ok( ret == 3, "AAA vs aaa expected 3, got %d", ret);
ok( ret == 3, "AAA vs aaa expected 3, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "AAA", -1, "aab", -1 );
ok( ret == 1, "AAA vs aab expected 1, got %d", ret);
ok( ret == 1, "AAA vs aab expected 1, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "AAA", -1, "Aab", -1 );
ok( ret == 1, "AAA vs Aab expected 1, got %d", ret);
ok( ret == 1, "AAA vs Aab expected 1, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, ".AAA", -1, "Aab", -1 );
ok( ret == 1, ".AAA vs Aab expected 1, got %d", ret);
ok( ret == 1, ".AAA vs Aab expected 1, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, ".AAA", -1, "A.ab", -1 );
ok( ret == 1, ".AAA vs A.ab expected 1, got %d", ret);
ok( ret == 1, ".AAA vs A.ab expected 1, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "aa", -1, "AB", -1 );
ok( ret == 1, "aa vs AB expected 1, got %d", ret);
ok( ret == 1, "aa vs AB expected 1, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "aa", -1, "Aab", -1 );
ok( ret == 1, "aa vs Aab expected 1, got %d", ret);
ok( ret == 1, "aa vs Aab expected 1, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "aB", -1, "Aab", -1 );
ok( ret == 3, "aB vs Aab expected 3, got %d", ret);
ok( ret == 3, "aB vs Aab expected 3, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "Ba", -1, "bab", -1 );
ok( ret == 1, "Ba vs bab expected 1, got %d", ret);
ok( ret == 1, "Ba vs bab expected 1, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "{100}{83}{71}{71}{71}", -1, "Global_DataAccess_JRO", -1 );
ok( ret == 1, "{100}{83}{71}{71}{71} vs Global_DataAccess_JRO expected 1, got %d", ret);
ok( ret == 1, "{100}{83}{71}{71}{71} vs Global_DataAccess_JRO expected 1, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "a", -1, "{", -1 );
ok( ret == 3, "a vs { expected 3, got %d", ret);
ok( ret == 3, "a vs { expected 3, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "A", -1, "{", -1 );
ok( ret == 3, "A vs { expected 3, got %d", ret);
ok( ret == 3, "A vs { expected 3, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "3.5", 0, "4.0", -1 );
ok(ret == 1, "3.5/0 vs 4.0/-1 expected 1, got %d", ret);
ok(ret == 1, "3.5/0 vs 4.0/-1 expected 1, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "3.5", -1, "4.0", -1 );
ok(ret == 1, "3.5 vs 4.0 expected 1, got %d", ret);
ok(ret == 1, "3.5 vs 4.0 expected 1, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "3.520.4403.2", -1, "4.0.2927.10", -1 );
ok(ret == 1, "3.520.4403.2 vs 4.0.2927.10 expected 1, got %d", ret);
ok(ret == 1, "3.520.4403.2 vs 4.0.2927.10 expected 1, got %d\n", ret);
/* hyphen and apostrophe are treated differently depending on
* whether SORT_STRINGSORT specified or not
*/
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "-o", -1, "/m", -1 );
ok(ret == 3, "-o vs /m expected 3, got %d", ret);
ok(ret == 3, "-o vs /m expected 3, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "/m", -1, "-o", -1 );
ok(ret == 1, "/m vs -o expected 1, got %d", ret);
ok(ret == 1, "/m vs -o expected 1, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, SORT_STRINGSORT, "-o", -1, "/m", -1 );
ok(ret == 1, "-o vs /m expected 1, got %d", ret);
ok(ret == 1, "-o vs /m expected 1, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, SORT_STRINGSORT, "/m", -1, "-o", -1 );
ok(ret == 3, "/m vs -o expected 3, got %d", ret);
ok(ret == 3, "/m vs -o expected 3, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "'o", -1, "/m", -1 );
ok(ret == 3, "'o vs /m expected 3, got %d", ret);
ok(ret == 3, "'o vs /m expected 3, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "/m", -1, "'o", -1 );
ok(ret == 1, "/m vs 'o expected 1, got %d", ret);
ok(ret == 1, "/m vs 'o expected 1, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, SORT_STRINGSORT, "'o", -1, "/m", -1 );
ok(ret == 1, "'o vs /m expected 1, got %d", ret);
ok(ret == 1, "'o vs /m expected 1, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, SORT_STRINGSORT, "/m", -1, "'o", -1 );
ok(ret == 3, "/m vs 'o expected 3, got %d", ret);
ok(ret == 3, "/m vs 'o expected 3, got %d\n", ret);
#if 0 /* this requires collation table patch to make it MS compatible */
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "'o", -1, "-o", -1 );
ok(ret == 1, "'o vs -o expected 1, got %d", ret);
ok(ret == 1, "'o vs -o expected 1, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, SORT_STRINGSORT, "'o", -1, "-o", -1 );
ok(ret == 1, "'o vs -o expected 1, got %d", ret);
ok(ret == 1, "'o vs -o expected 1, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "'", -1, "-", -1 );
ok(ret == 1, "' vs - expected 1, got %d", ret);
ok(ret == 1, "' vs - expected 1, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, SORT_STRINGSORT, "'", -1, "-", -1 );
ok(ret == 1, "' vs - expected 1, got %d", ret);
ok(ret == 1, "' vs - expected 1, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "`o", -1, "/m", -1 );
ok(ret == 3, "`o vs /m expected 3, got %d", ret);
ok(ret == 3, "`o vs /m expected 3, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "/m", -1, "`o", -1 );
ok(ret == 1, "/m vs `o expected 1, got %d", ret);
ok(ret == 1, "/m vs `o expected 1, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, SORT_STRINGSORT, "`o", -1, "/m", -1 );
ok(ret == 3, "`o vs /m expected 3, got %d", ret);
ok(ret == 3, "`o vs /m expected 3, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, SORT_STRINGSORT, "/m", -1, "`o", -1 );
ok(ret == 1, "/m vs `o expected 1, got %d", ret);
ok(ret == 1, "/m vs `o expected 1, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "`o", -1, "-m", -1 );
ok(ret == 1, "`o vs -m expected 1, got %d", ret);
ok(ret == 1, "`o vs -m expected 1, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "-m", -1, "`o", -1 );
ok(ret == 3, "-m vs `o expected 3, got %d", ret);
ok(ret == 3, "-m vs `o expected 3, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, SORT_STRINGSORT, "`o", -1, "-m", -1 );
ok(ret == 3, "`o vs -m expected 3, got %d", ret);
ok(ret == 3, "`o vs -m expected 3, got %d\n", ret);
ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, SORT_STRINGSORT, "-m", -1, "`o", -1 );
ok(ret == 1, "-m vs `o expected 1, got %d", ret);
ok(ret == 1, "-m vs `o expected 1, got %d\n", ret);
#endif
ret = CompareStringA(LOCALE_USER_DEFAULT, 0, "aLuZkUtZ", 8, "aLuZkUtZ", 9);
ok(ret == 2, "aLuZkUtZ vs aLuZkUtZ\\0 expected 2, got %d", ret);
ok(ret == 2, "aLuZkUtZ vs aLuZkUtZ\\0 expected 2, got %d\n", ret);
ret = CompareStringA(LOCALE_USER_DEFAULT, 0, "aLuZkUtZ", 7, "aLuZkUtZ\0A", 10);
ok(ret == 1, "aLuZkUtZ vs aLuZkUtZ\\0A expected 1, got %d", ret);
ok(ret == 1, "aLuZkUtZ vs aLuZkUtZ\\0A expected 1, got %d\n", ret);
ret = CompareStringA(LOCALE_USER_DEFAULT, 0, "aLuZkUtZ", 8, "aLuZkUtZ\0A", 10);
ok(ret == 2, "aLuZkUtZ vs aLuZkUtZ\\0A expected 2, got %d", ret);
ok(ret == 2, "aLuZkUtZ vs aLuZkUtZ\\0A expected 2, got %d\n", ret);
ret = CompareStringA(LOCALE_USER_DEFAULT, 0, "aLu\0ZkUtZ", 8, "aLu\0ZkUtZ\0A", 10);
ok(ret == 2, "aLu\\0ZkUtZ vs aLu\\0ZkUtZ\\0A expected 2, got %d", ret);
ok(ret == 2, "aLu\\0ZkUtZ vs aLu\\0ZkUtZ\\0A expected 2, got %d\n", ret);
}
void test_LCMapStringA(void)
@ -1085,7 +1085,7 @@ void test_LCMapStringA(void)
/* test srclen = 0 */
SetLastError(0xdeadbeef);
ret = LCMapStringA(LOCALE_USER_DEFAULT, 0, upper_case, 0, buf, sizeof(buf));
ok(!ret, "LCMapStringA should fail with srclen = 0");
ok(!ret, "LCMapStringA should fail with srclen = 0\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"unexpected error code %ld\n", GetLastError());
}
@ -1244,7 +1244,7 @@ void test_LCMapStringW(void)
/* test srclen = 0 */
SetLastError(0xdeadbeef);
ret = LCMapStringW(LOCALE_USER_DEFAULT, 0, upper_case, 0, buf, sizeof(buf));
ok(!ret, "LCMapStringW should fail with srclen = 0");
ok(!ret, "LCMapStringW should fail with srclen = 0\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"unexpected error code %ld\n", GetLastError());
}
@ -1841,7 +1841,7 @@ static void test_FoldStringW(void)
ret = pFoldStringW(MAP_EXPAND_LIGATURES, ligatures_src, -1, dst, 256);
EXPECT_LEN(sizeof(ligatures_dst)/sizeof(ligatures_dst[0])); EXPECT_VALID;
ok(!memcmp(dst, ligatures_dst, sizeof(ligatures_dst)),
"MAP_EXPAND_LIGATURES: Expanded incorrrectly\n");
"MAP_EXPAND_LIGATURES: Expanded incorrectly\n");
for (i = 1; i <= 0xffff; i++)
{
if (!strchrW(ligatures_src, i))

View File

@ -46,81 +46,81 @@ int mailslot_test()
/* sanity check on GetMailslotInfo */
dwMax = dwNext = dwMsgCount = dwTimeout = 0;
ok( !GetMailslotInfo( INVALID_HANDLE_VALUE, &dwMax, &dwNext,
&dwMsgCount, &dwTimeout ), "getmailslotinfo succeeded");
&dwMsgCount, &dwTimeout ), "getmailslotinfo succeeded\n");
/* open a mailslot that doesn't exist */
hWriter = CreateFile(szmspath, GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
ok( hWriter == INVALID_HANDLE_VALUE, "non-existing mailslot");
ok( hWriter == INVALID_HANDLE_VALUE, "non-existing mailslot\n");
/* open a mailslot without the right name */
hSlot = CreateMailslot( "blah", 0, 0, NULL );
ok( hSlot == INVALID_HANDLE_VALUE,
"Created mailslot with invalid name");
"Created mailslot with invalid name\n");
todo_wine
{
ok( GetLastError() == ERROR_INVALID_NAME,
"error should be ERROR_INVALID_NAME");
"error should be ERROR_INVALID_NAME\n");
}
/* open a mailslot with a null name */
hSlot = CreateMailslot( NULL, 0, 0, NULL );
ok( hSlot == INVALID_HANDLE_VALUE,
"Created mailslot with invalid name");
"Created mailslot with invalid name\n");
todo_wine
{
ok( GetLastError() == ERROR_PATH_NOT_FOUND,
"error should be ERROR_PATH_NOT_FOUND");
"error should be ERROR_PATH_NOT_FOUND\n");
}
todo_wine
{
/* valid open, but with wacky parameters ... then check them */
hSlot = CreateMailslot( szmspath, -1, -1, NULL );
ok( hSlot != INVALID_HANDLE_VALUE , "mailslot with valid name failed");
ok( hSlot != INVALID_HANDLE_VALUE , "mailslot with valid name failed\n");
dwMax = dwNext = dwMsgCount = dwTimeout = 0;
ok( GetMailslotInfo( hSlot, &dwMax, &dwNext, &dwMsgCount, &dwTimeout ),
"getmailslotinfo failed");
ok( dwMax == -1, "dwMax incorrect");
ok( dwNext == MAILSLOT_NO_MESSAGE, "dwNext incorrect");
"getmailslotinfo failed\n");
ok( dwMax == -1, "dwMax incorrect\n");
ok( dwNext == MAILSLOT_NO_MESSAGE, "dwNext incorrect\n");
}
ok( dwMsgCount == 0, "dwMsgCount incorrect");
ok( dwMsgCount == 0, "dwMsgCount incorrect\n");
todo_wine
{
ok( dwTimeout == -1, "dwTimeout incorrect");
ok( dwTimeout == -1, "dwTimeout incorrect\n");
ok( GetMailslotInfo( hSlot, NULL, NULL, NULL, NULL ),
"getmailslotinfo failed");
ok( CloseHandle(hSlot), "failed to close mailslot");
"getmailslotinfo failed\n");
ok( CloseHandle(hSlot), "failed to close mailslot\n");
}
todo_wine
{
/* now open it for real */
hSlot = CreateMailslot( szmspath, 0, 0, NULL );
ok( hSlot != INVALID_HANDLE_VALUE , "valid mailslot failed");
ok( hSlot != INVALID_HANDLE_VALUE , "valid mailslot failed\n");
}
/* try and read/write to it */
count = 0;
memset(buffer, 0, sizeof buffer);
ok( !ReadFile( hSlot, buffer, sizeof buffer, &count, NULL),
"slot read");
"slot read\n");
ok( !WriteFile( hSlot, buffer, sizeof buffer, &count, NULL),
"slot write");
"slot write\n");
/* now try and openthe client, but with the wrong sharing mode */
hWriter = CreateFile(szmspath, GENERIC_READ|GENERIC_WRITE,
0, NULL, OPEN_EXISTING, 0, NULL);
ok( hWriter == INVALID_HANDLE_VALUE, "bad sharing mode");
ok( hWriter == INVALID_HANDLE_VALUE, "bad sharing mode\n");
todo_wine
{
ok( GetLastError() == ERROR_SHARING_VIOLATION,
"error should be ERROR_SHARING_VIOLATION");
"error should be ERROR_SHARING_VIOLATION\n");
/* now open the client with the correct sharing mode */
hWriter = CreateFile(szmspath, GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
ok( hWriter != INVALID_HANDLE_VALUE, "existing mailslot");
ok( hWriter != INVALID_HANDLE_VALUE, "existing mailslot\n");
}
/*
@ -128,23 +128,23 @@ int mailslot_test()
* whether we can read or write the mailslot
*/
ok( !ReadFile( hSlot, buffer, sizeof buffer/2, &count, NULL),
"slot read");
"slot read\n");
ok( !WriteFile( hSlot, buffer, sizeof buffer/2, &count, NULL),
"slot write");
"slot write\n");
/*
* we can't read from this client,
* but we should be able to write to it
*/
ok( !ReadFile( hWriter, buffer, sizeof buffer/2, &count, NULL),
"can read client");
"can read client\n");
todo_wine
{
ok( WriteFile( hWriter, buffer, sizeof buffer/2, &count, NULL),
"can't write client");
"can't write client\n");
}
ok( !ReadFile( hWriter, buffer, sizeof buffer/2, &count, NULL),
"can read client");
"can read client\n");
/*
* seeing as there's something in the slot,
@ -153,37 +153,37 @@ int mailslot_test()
todo_wine
{
ok( ReadFile( hSlot, buffer, sizeof buffer, &count, NULL),
"slot read");
ok( count == (sizeof buffer/2), "short read" );
"slot read\n");
ok( count == (sizeof buffer/2), "short read\n" );
}
/* but not again */
ok( !ReadFile( hSlot, buffer, sizeof buffer, &count, NULL),
"slot read");
"slot read\n");
/* now try open another writer... should fail */
hWriter2 = CreateFile(szmspath, GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
ok( hWriter2 == INVALID_HANDLE_VALUE, "two writers");
ok( hWriter2 == INVALID_HANDLE_VALUE, "two writers\n");
/* now try open another as a reader ... also fails */
hWriter2 = CreateFile(szmspath, GENERIC_READ,
FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
ok( hWriter2 == INVALID_HANDLE_VALUE, "writer + reader");
ok( hWriter2 == INVALID_HANDLE_VALUE, "writer + reader\n");
/* now try open another as a writer ... still fails */
hWriter2 = CreateFile(szmspath, GENERIC_WRITE,
FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
ok( hWriter2 == INVALID_HANDLE_VALUE, "writer");
ok( hWriter2 == INVALID_HANDLE_VALUE, "writer\n");
/* now open another one */
hSlot2 = CreateMailslot( szmspath, 0, 0, NULL );
ok( hSlot2 == INVALID_HANDLE_VALUE , "opened two mailslots");
ok( hSlot2 == INVALID_HANDLE_VALUE , "opened two mailslots\n");
todo_wine
{
/* close the client again */
ok( CloseHandle( hWriter ), "closing the client");
ok( CloseHandle( hWriter ), "closing the client\n");
/*
* now try reopen it with slightly different permissions ...
@ -191,7 +191,7 @@ int mailslot_test()
*/
hWriter = CreateFile(szmspath, GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
ok( hWriter != INVALID_HANDLE_VALUE, "sharing writer");
ok( hWriter != INVALID_HANDLE_VALUE, "sharing writer\n");
}
/*
@ -200,61 +200,61 @@ int mailslot_test()
*/
hWriter2 = CreateFile(szmspath, GENERIC_WRITE,
FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
ok( hWriter2 == INVALID_HANDLE_VALUE, "greedy writer succeeded");
ok( hWriter2 == INVALID_HANDLE_VALUE, "greedy writer succeeded\n");
todo_wine
{
/* now try open another as a writer ... and share with the first */
hWriter2 = CreateFile(szmspath, GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
ok( hWriter2 != INVALID_HANDLE_VALUE, "2nd sharing writer");
ok( hWriter2 != INVALID_HANDLE_VALUE, "2nd sharing writer\n");
/* check the mailslot info */
dwMax = dwNext = dwMsgCount = dwTimeout = 0;
ok( GetMailslotInfo( hSlot, &dwMax, &dwNext, &dwMsgCount, &dwTimeout ),
"getmailslotinfo failed");
ok( dwNext == MAILSLOT_NO_MESSAGE, "dwNext incorrect");
"getmailslotinfo failed\n");
ok( dwNext == MAILSLOT_NO_MESSAGE, "dwNext incorrect\n");
}
ok( dwMax == 0, "dwMax incorrect");
ok( dwMsgCount == 0, "dwMsgCount incorrect");
ok( dwTimeout == 0, "dwTimeout incorrect");
ok( dwMax == 0, "dwMax incorrect\n");
ok( dwMsgCount == 0, "dwMsgCount incorrect\n");
ok( dwTimeout == 0, "dwTimeout incorrect\n");
/* check there's still no data */
ok( !ReadFile( hSlot, buffer, sizeof buffer, &count, NULL), "slot read");
ok( !ReadFile( hSlot, buffer, sizeof buffer, &count, NULL), "slot read\n");
/* write two messages */
todo_wine
{
buffer[0] = 'a';
ok( WriteFile( hWriter, buffer, 1, &count, NULL), "1st write failed");
ok( WriteFile( hWriter, buffer, 1, &count, NULL), "1st write failed\n");
/* check the mailslot info */
dwNext = dwMsgCount = 0;
ok( GetMailslotInfo( hSlot, NULL, &dwNext, &dwMsgCount, NULL ),
"getmailslotinfo failed");
ok( dwNext == 1, "dwNext incorrect");
ok( dwMsgCount == 1, "dwMsgCount incorrect");
"getmailslotinfo failed\n");
ok( dwNext == 1, "dwNext incorrect\n");
ok( dwMsgCount == 1, "dwMsgCount incorrect\n");
buffer[0] = 'b';
buffer[1] = 'c';
ok( WriteFile( hWriter2, buffer, 2, &count, NULL), "2nd write failed");
ok( WriteFile( hWriter2, buffer, 2, &count, NULL), "2nd write failed\n");
/* check the mailslot info */
dwNext = dwMsgCount = 0;
ok( GetMailslotInfo( hSlot, NULL, &dwNext, &dwMsgCount, NULL ),
"getmailslotinfo failed");
ok( dwNext == 1, "dwNext incorrect");
ok( dwMsgCount == 2, "dwMsgCount incorrect");
"getmailslotinfo failed\n");
ok( dwNext == 1, "dwNext incorrect\n");
ok( dwMsgCount == 2, "dwMsgCount incorrect\n");
/* write a 3rd message with zero size */
ok( WriteFile( hWriter2, buffer, 0, &count, NULL), "3rd write failed");
ok( WriteFile( hWriter2, buffer, 0, &count, NULL), "3rd write failed\n");
/* check the mailslot info */
dwNext = dwMsgCount = 0;
ok( GetMailslotInfo( hSlot, NULL, &dwNext, &dwMsgCount, NULL ),
"getmailslotinfo failed");
ok( dwNext == 1, "dwNext incorrect");
ok( dwMsgCount == 3, "dwMsgCount incorrect");
"getmailslotinfo failed\n");
ok( dwNext == 1, "dwNext incorrect\n");
ok( dwMsgCount == 3, "dwMsgCount incorrect\n");
buffer[0]=buffer[1]=0;
@ -263,38 +263,38 @@ int mailslot_test()
* then the slot is empty
*/
ok( ReadFile( hSlot, buffer, sizeof buffer, &count, NULL),
"1st slot read failed");
ok( count == 1, "failed to get 1st message");
ok( buffer[0] == 'a', "1st message wrong");
"1st slot read failed\n");
ok( count == 1, "failed to get 1st message\n");
ok( buffer[0] == 'a', "1st message wrong\n");
/* check the mailslot info */
dwNext = dwMsgCount = 0;
ok( GetMailslotInfo( hSlot, NULL, &dwNext, &dwMsgCount, NULL ),
"getmailslotinfo failed");
ok( dwNext == 2, "dwNext incorrect");
ok( dwMsgCount == 2, "dwMsgCount incorrect");
"getmailslotinfo failed\n");
ok( dwNext == 2, "dwNext incorrect\n");
ok( dwMsgCount == 2, "dwMsgCount incorrect\n");
/* read the second message */
ok( ReadFile( hSlot, buffer, sizeof buffer, &count, NULL),
"2nd slot read failed");
ok( count == 2, "failed to get 2nd message");
ok( ( buffer[0] == 'b' ) && ( buffer[1] == 'c' ), "2nd message wrong");
"2nd slot read failed\n");
ok( count == 2, "failed to get 2nd message\n");
ok( ( buffer[0] == 'b' ) && ( buffer[1] == 'c' ), "2nd message wrong\n");
/* check the mailslot info */
dwNext = dwMsgCount = 0;
ok( GetMailslotInfo( hSlot, NULL, &dwNext, &dwMsgCount, NULL ),
"getmailslotinfo failed");
"getmailslotinfo failed\n");
}
ok( dwNext == 0, "dwNext incorrect");
ok( dwNext == 0, "dwNext incorrect\n");
todo_wine
{
ok( dwMsgCount == 1, "dwMsgCount incorrect");
ok( dwMsgCount == 1, "dwMsgCount incorrect\n");
/* read the 3rd (zero length) message */
ok( ReadFile( hSlot, buffer, sizeof buffer, &count, NULL),
"3rd slot read failed");
"3rd slot read failed\n");
}
ok( count == 0, "failed to get 3rd message");
ok( count == 0, "failed to get 3rd message\n");
/*
* now there should be no more messages
@ -304,21 +304,21 @@ int mailslot_test()
{
dwNext = dwMsgCount = 0;
ok( GetMailslotInfo( hSlot, NULL, &dwNext, &dwMsgCount, NULL ),
"getmailslotinfo failed");
ok( dwNext == MAILSLOT_NO_MESSAGE, "dwNext incorrect");
"getmailslotinfo failed\n");
ok( dwNext == MAILSLOT_NO_MESSAGE, "dwNext incorrect\n");
}
ok( dwMsgCount == 0, "dwMsgCount incorrect");
ok( dwMsgCount == 0, "dwMsgCount incorrect\n");
/* check that reads fail */
ok( !ReadFile( hSlot, buffer, sizeof buffer, &count, NULL),
"3rd slot read succeeded");
"3rd slot read succeeded\n");
/* finally close the mailslot and its client */
todo_wine
{
ok( CloseHandle( hWriter2 ), "closing 2nd client");
ok( CloseHandle( hWriter ), "closing the client");
ok( CloseHandle( hSlot ), "closing the mailslot");
ok( CloseHandle( hWriter2 ), "closing 2nd client\n");
ok( CloseHandle( hWriter ), "closing the client\n");
ok( CloseHandle( hSlot ), "closing the mailslot\n");
}
return 0;

View File

@ -89,16 +89,16 @@ static void test_ValidPathA(CHAR *curdir, CHAR *subdir, CHAR *filename,
/* GetLongPathNameA is only supported on Win2k+ and Win98+ */
if(pGetLongPathNameA) {
ok((len=pGetLongPathNameA(curdir,curdirlong,MAX_PATH)),
"%s: GetLongPathNameA failed",errstr);
"%s: GetLongPathNameA failed\n",errstr);
/*GetLongPathNameA can return a trailing '\\' but shouldn't do so here */
ok(! HAS_TRAIL_SLASH_A(curdirlong),
"%s: GetLongPathNameA should not have a trailing \\",errstr);
"%s: GetLongPathNameA should not have a trailing \\\n",errstr);
}
ok((len=GetShortPathNameA(curdir,curdirshort,MAX_PATH)),
"%s: GetShortPathNameA failed",errstr);
"%s: GetShortPathNameA failed\n",errstr);
/*GetShortPathNameA can return a trailing '\\' but shouldn't do so here */
ok(! HAS_TRAIL_SLASH_A(curdirshort),
"%s: GetShortPathNameA should not have a trailing \\",errstr);
"%s: GetShortPathNameA should not have a trailing \\\n",errstr);
/* build relative and absolute paths from inputs */
if(lstrlenA(subdir)) {
sprintf(subpath,"%s\\%s",subdir,filename);
@ -110,26 +110,26 @@ static void test_ValidPathA(CHAR *curdir, CHAR *subdir, CHAR *filename,
sprintf(fullpathlong,"%s\\%s",curdirlong,subpath);
/* Test GetFullPathNameA functionality */
len=GetFullPathNameA(subpath,MAX_PATH,tmpstr,&strptr);
ok(len, "GetFullPathNameA failed for: '%s'",subpath);
ok(len, "GetFullPathNameA failed for: '%s'\n",subpath);
if(HAS_TRAIL_SLASH_A(subpath)) {
ok(strptr==NULL,
"%s: GetFullPathNameA should not return a filename ptr",errstr);
"%s: GetFullPathNameA should not return a filename ptr\n",errstr);
ok(lstrcmpiA(fullpath,tmpstr)==0,
"%s: GetFullPathNameA returned '%s' instead of '%s'",
"%s: GetFullPathNameA returned '%s' instead of '%s'\n",
errstr,tmpstr,fullpath);
} else {
ok(lstrcmpiA(strptr,filename)==0,
"%s: GetFullPathNameA returned '%s' instead of '%s'",
"%s: GetFullPathNameA returned '%s' instead of '%s'\n",
errstr,strptr,filename);
ok(lstrcmpiA(fullpath,tmpstr)==0,
"%s: GetFullPathNameA returned '%s' instead of '%s'",
"%s: GetFullPathNameA returned '%s' instead of '%s'\n",
errstr,tmpstr,fullpath);
}
/* Test GetShortPathNameA functionality */
SetLastError(0);
len=GetShortPathNameA(fullpathshort,shortstr,MAX_PATH);
if(passfail==NULL) {
ok(len, "%s: GetShortPathNameA failed",errstr);
ok(len, "%s: GetShortPathNameA failed\n",errstr);
} else {
passfail->shortlen=len;
passfail->shorterror=GetLastError();
@ -143,9 +143,9 @@ static void test_ValidPathA(CHAR *curdir, CHAR *subdir, CHAR *filename,
len=pGetLongPathNameA(shortstr,tmpstr,MAX_PATH);
if(passfail==NULL) {
ok(len,
"%s: GetLongPathNameA failed during Short->Long conversion", errstr);
"%s: GetLongPathNameA failed during Short->Long conversion\n", errstr);
ok(lstrcmpiA(fullpathlong,tmpstr)==0,
"%s: GetLongPathNameA returned '%s' instead of '%s'",
"%s: GetLongPathNameA returned '%s' instead of '%s'\n",
errstr,tmpstr,fullpathlong);
} else {
passfail->s2llen=len;
@ -155,14 +155,14 @@ static void test_ValidPathA(CHAR *curdir, CHAR *subdir, CHAR *filename,
SetLastError(0);
len=pGetLongPathNameA(fullpath,tmpstr,MAX_PATH);
if(passfail==NULL) {
ok(len, "%s: GetLongPathNameA failed",errstr);
ok(len, "%s: GetLongPathNameA failed\n",errstr);
if(HAS_TRAIL_SLASH_A(fullpath)) {
ok(lstrcmpiA(fullpathlong,tmpstr)==0,
"%s: GetLongPathNameA returned '%s' instead of '%s'",
"%s: GetLongPathNameA returned '%s' instead of '%s'\n",
errstr,tmpstr,fullpathlong);
} else {
ok(lstrcmpiA(fullpathlong,tmpstr)==0,
"%s: GetLongPathNameA returned '%s' instead of '%s'",
"%s: GetLongPathNameA returned '%s' instead of '%s'\n",
errstr,tmpstr,fullpathlong);
}
} else {
@ -193,7 +193,7 @@ static void test_SplitShortPathA(CHAR *path,CHAR *dir,CHAR *eight,CHAR *three) {
}
}
/* Check that we didn't find a trailing '\\' or multiple '.' */
ok(!error,"Illegal file found in 8.3 path '%s'",path);
ok(!error,"Illegal file found in 8.3 path '%s'\n",path);
/* Separate dir, root, and extension */
if(ext!=len) lstrcpyA(three,path+ext+1); else lstrcpyA(three,"");
if(fil!=len) {
@ -205,7 +205,7 @@ static void test_SplitShortPathA(CHAR *path,CHAR *dir,CHAR *eight,CHAR *three) {
}
/* Validate that root and extension really are 8.3 */
ok(lstrlenA(eight)<=8 && lstrlenA(three)<=3,
"GetShortPathNAmeA did not return an 8.3 path");
"GetShortPathNAmeA did not return an 8.3 path\n");
}
/* Check that GetShortPathNameA returns a valid 8.3 path */
@ -215,9 +215,9 @@ static void test_LongtoShortA(CHAR *teststr,CHAR *goodstr,
test_SplitShortPathA(teststr,dir,eight,three);
ok(lstrcmpiA(dir,goodstr)==0,
"GetShortPathNameA returned '%s' instead of '%s'",dir,goodstr);
"GetShortPathNameA returned '%s' instead of '%s'\n",dir,goodstr);
ok(lstrcmpiA(three,ext)==0,
"GetShortPathNameA returned '%s' with incorrect extension",three);
"GetShortPathNameA returned '%s' with incorrect extension\n",three);
}
/* Test that Get(Short|Long|Full)PathNameA work correctly with interesting
@ -241,14 +241,14 @@ static void test_FunnyChars(CHAR *curdir,CHAR *filename,
ok((passfail.shortlen==0 &&
(passfail.shorterror==ERROR_FILE_NOT_FOUND || passfail.shorterror==ERROR_PATH_NOT_FOUND || !passfail.shorterror)) ||
(passfail.shortlen==strlen(tmpstr1) && lstrcmpiA(tmpstr,tmpstr1)==0),
"%s: GetShortPathNameA error: len=%ld error=%ld tmpstr=[%s]",
"%s: GetShortPathNameA error: len=%ld error=%ld tmpstr=[%s]\n",
errstr,passfail.shortlen,passfail.shorterror,tmpstr);
}
} else {
ok((passfail.shortlen==0 &&
(passfail.shorterror==ERROR_FILE_NOT_FOUND || passfail.shorterror==ERROR_PATH_NOT_FOUND || !passfail.shorterror)) ||
(passfail.shortlen==strlen(tmpstr1) && lstrcmpiA(tmpstr,tmpstr1)==0),
"%s: GetShortPathNameA error: len=%ld error=%ld tmpstr=[%s]",
"%s: GetShortPathNameA error: len=%ld error=%ld tmpstr=[%s]\n",
errstr,passfail.shortlen,passfail.shorterror,tmpstr);
}
} else {
@ -257,26 +257,26 @@ static void test_FunnyChars(CHAR *curdir,CHAR *filename,
/* Win2k returns ERROR_INVALID_NAME, Win98, wine return ERROR_FILE_NOT_FOUND, NT4 doesn't set last error */
ok(passfail.shortlen==0 &&
(passfail.shorterror==ERROR_INVALID_NAME || passfail.shorterror==ERROR_FILE_NOT_FOUND || !passfail.shorterror),
"%s: GetShortPathA should have failed len=%ld, error=%ld",
"%s: GetShortPathA should have failed len=%ld, error=%ld\n",
errstr,passfail.shortlen,passfail.shorterror);
}
} else {
ok(passfail.shortlen==0 &&
(passfail.shorterror==ERROR_INVALID_NAME || passfail.shorterror==ERROR_FILE_NOT_FOUND || !passfail.shorterror),
"%s: GetShortPathA should have failed len=%ld, error=%ld",
"%s: GetShortPathA should have failed len=%ld, error=%ld\n",
errstr,passfail.shortlen,passfail.shorterror);
}
}
if(pGetLongPathNameA) {
ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have");
ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have\n");
if(valid) {
ok(passfail.longerror==ERROR_FILE_NOT_FOUND,
"%s: GetLongPathA returned %ld and not %d",
"%s: GetLongPathA returned %ld and not %d\n",
errstr,passfail.longerror,ERROR_FILE_NOT_FOUND);
} else {
ok(passfail.longerror==ERROR_INVALID_NAME ||
passfail.longerror==ERROR_FILE_NOT_FOUND,
"%s: GetLongPathA returned %ld and not %d or %d'",
"%s: GetLongPathA returned %ld and not %d or %d'\n",
errstr, passfail.longerror,ERROR_INVALID_NAME,ERROR_FILE_NOT_FOUND);
}
}
@ -295,25 +295,25 @@ static void test_setdir(CHAR *olddir,CHAR *newdir,
if(pass) {
dirptr=(cmprstr==NULL) ? newdir : cmprstr;
chklen=lstrlenA(dirptr);
ok(val,"%s: SetCurrentDirectoryA failed",errstr);
ok(val,"%s: SetCurrentDirectoryA failed\n",errstr);
ok(len==chklen,
"%s: SetCurrentDirectory did not change the directory, though it passed",
"%s: SetCurrentDirectory did not change the directory, though it passed\n",
errstr);
ok(lstrcmpiA(dirptr,tmppath)==0,
"%s: SetCurrentDirectory did not change the directory, though it passed",
"%s: SetCurrentDirectory did not change the directory, though it passed\n",
errstr);
ok(SetCurrentDirectoryA(olddir),
"%s: Couldn't set directory to it's original value",errstr);
"%s: Couldn't set directory to it's original value\n",errstr);
} else {
/* else thest that it fails correctly */
chklen=lstrlenA(olddir);
ok(val==0,
"%s: SetCurrentDirectoryA passed when it should have failed",errstr);
"%s: SetCurrentDirectoryA passed when it should have failed\n",errstr);
ok(len==chklen,
"%s: SetCurrentDirectory changed the directory, though it failed",
"%s: SetCurrentDirectory changed the directory, though it failed\n",
errstr);
ok(lstrcmpiA(olddir,tmppath)==0,
"%s: SetCurrentDirectory changed the directory, though it failed",
"%s: SetCurrentDirectory changed the directory, though it failed\n",
errstr);
}
}
@ -336,25 +336,25 @@ static void test_InitPathA(CHAR *newdir, CHAR *curDrive, CHAR *otherDrive)
/* Test GetTempPathA */
len=GetTempPathA(MAX_PATH,tmppath);
ok(len!=0 && len < MAX_PATH,"GetTempPathA failed");
ok(len!=0 && len < MAX_PATH,"GetTempPathA failed\n");
ok(HAS_TRAIL_SLASH_A(tmppath),
"GetTempPathA returned a path that did not end in '\\'");
"GetTempPathA returned a path that did not end in '\\'\n");
lstrcpyA(tmpstr,"aaaaaaaa");
len1=GetTempPathA(len,tmpstr);
ok(len1==len+1,
"GetTempPathA should return string length %ld instead of %ld",len+1,len1);
"GetTempPathA should return string length %ld instead of %ld\n",len+1,len1);
/* Test GetTmpFileNameA
The only test we do here is whether GetTempFileNameA passes or not.
We do not thoroughly test this function yet (specifically, whether
it behaves correctly when 'unique' is non zero)
*/
ok((id=GetTempFileNameA(tmppath,"path",0,newdir)),"GetTempFileNameA failed");
ok((id=GetTempFileNameA(tmppath,"path",0,newdir)),"GetTempFileNameA failed\n");
sprintf(tmpstr,"pat%.4x.tmp",id & 0xffff);
sprintf(tmpstr1,"pat%x.tmp",id & 0xffff);
ok(lstrcmpiA(newdir+lstrlenA(tmppath),tmpstr)==0 ||
lstrcmpiA(newdir+lstrlenA(tmppath),tmpstr1)==0,
"GetTempPath returned '%s' which doesn't match '%s' or '%s'. id=%x",
"GetTempPath returned '%s' which doesn't match '%s' or '%s'. id=%x\n",
newdir,tmpstr,tmpstr1,id);
/* Find first valid drive letter that is neither newdir[0] nor curDrive */
@ -372,36 +372,36 @@ static void test_InitPathA(CHAR *newdir, CHAR *curDrive, CHAR *otherDrive)
More formal tests should be done along with CreateFile tests
*/
ok(CreateDirectoryA(newdir,NULL)==0,
"CreateDirectoryA succeeded even though a file of the same name exists");
ok(DeleteFileA(newdir),"Couldn't delete the temporary file we just created");
ok(CreateDirectoryA(newdir,NULL),"CreateDirectoryA failed");
"CreateDirectoryA succeeded even though a file of the same name exists\n");
ok(DeleteFileA(newdir),"Couldn't delete the temporary file we just created\n");
ok(CreateDirectoryA(newdir,NULL),"CreateDirectoryA failed\n");
/* Create some files to test other functions. Note, we will test CreateFileA
at some later point
*/
sprintf(tmpstr,"%s\\%s",newdir,SHORTDIR);
ok(CreateDirectoryA(tmpstr,NULL),"CreateDirectoryA failed");
ok(CreateDirectoryA(tmpstr,NULL),"CreateDirectoryA failed\n");
sprintf(tmpstr,"%s\\%s",newdir,LONGDIR);
ok(CreateDirectoryA(tmpstr,NULL),"CreateDirectoryA failed");
ok(CreateDirectoryA(tmpstr,NULL),"CreateDirectoryA failed\n");
sprintf(tmpstr,"%s\\%s\\%s",newdir,SHORTDIR,SHORTFILE);
hndl=CreateFileA(tmpstr,GENERIC_WRITE,0,NULL,
CREATE_NEW,FILE_ATTRIBUTE_NORMAL,NULL);
ok(hndl!=INVALID_HANDLE_VALUE,"CreateFileA failed");
ok(CloseHandle(hndl),"CloseHandle failed");
ok(hndl!=INVALID_HANDLE_VALUE,"CreateFileA failed\n");
ok(CloseHandle(hndl),"CloseHandle failed\n");
sprintf(tmpstr,"%s\\%s\\%s",newdir,SHORTDIR,LONGFILE);
hndl=CreateFileA(tmpstr,GENERIC_WRITE,0,NULL,
CREATE_NEW,FILE_ATTRIBUTE_NORMAL,NULL);
ok(hndl!=INVALID_HANDLE_VALUE,"CreateFileA failed");
ok(CloseHandle(hndl),"CloseHandle failed");
ok(hndl!=INVALID_HANDLE_VALUE,"CreateFileA failed\n");
ok(CloseHandle(hndl),"CloseHandle failed\n");
sprintf(tmpstr,"%s\\%s\\%s",newdir,LONGDIR,SHORTFILE);
hndl=CreateFileA(tmpstr,GENERIC_WRITE,0,NULL,
CREATE_NEW,FILE_ATTRIBUTE_NORMAL,NULL);
ok(hndl!=INVALID_HANDLE_VALUE,"CreateFileA failed");
ok(CloseHandle(hndl),"CloseHandle failed");
ok(hndl!=INVALID_HANDLE_VALUE,"CreateFileA failed\n");
ok(CloseHandle(hndl),"CloseHandle failed\n");
sprintf(tmpstr,"%s\\%s\\%s",newdir,LONGDIR,LONGFILE);
hndl=CreateFileA(tmpstr,GENERIC_WRITE,0,NULL,
CREATE_NEW,FILE_ATTRIBUTE_NORMAL,NULL);
ok(hndl!=INVALID_HANDLE_VALUE,"CreateFileA failed");
ok(CloseHandle(hndl),"CloseHandle failed");
ok(hndl!=INVALID_HANDLE_VALUE,"CreateFileA failed\n");
ok(CloseHandle(hndl),"CloseHandle failed\n");
}
/* Test GetCurrentDirectory & SetCurrentDirectory */
@ -413,17 +413,17 @@ static void test_CurrentDirectoryA(CHAR *origdir, CHAR *newdir)
of the test
*/
len=GetCurrentDirectoryA(MAX_PATH,origdir);
ok(len!=0 && len < MAX_PATH,"GetCurrentDirectoryA failed");
ok(len!=0 && len < MAX_PATH,"GetCurrentDirectoryA failed\n");
ok(lstrcmpiA(origdir+(len-1),"\\")!=0,
"GetCurrentDirectoryA should not have a trailing \\");
"GetCurrentDirectoryA should not have a trailing \\\n");
/* Make sure that CetCurrentDirectoryA doesn't overwrite the buffer when the
buffer size is too small to hold the current directory
*/
lstrcpyA(tmpstr,"aaaaaaa");
len1=GetCurrentDirectoryA(len,tmpstr);
ok(len1==len+1, "GetCurrentDirectoryA returned %ld instead of %ld",len1,len+1);
ok(len1==len+1, "GetCurrentDirectoryA returned %ld instead of %ld\n",len1,len+1);
ok(lstrcmpiA(tmpstr,"aaaaaaa")==0,
"GetCurrentDirectoryA should not have modified the buffer");
"GetCurrentDirectoryA should not have modified the buffer\n");
/* SetCurrentDirectoryA shouldn't care whether the string has a
trailing '\\' or not
*/
@ -464,19 +464,19 @@ static void test_CleanupPathA(CHAR *origdir, CHAR *curdir)
{
CHAR tmpstr[MAX_PATH];
sprintf(tmpstr,"%s\\%s\\%s",curdir,SHORTDIR,SHORTFILE);
ok(DeleteFileA(tmpstr),"DeleteFileA failed");
ok(DeleteFileA(tmpstr),"DeleteFileA failed\n");
sprintf(tmpstr,"%s\\%s\\%s",curdir,SHORTDIR,LONGFILE);
ok(DeleteFileA(tmpstr),"DeleteFileA failed");
ok(DeleteFileA(tmpstr),"DeleteFileA failed\n");
sprintf(tmpstr,"%s\\%s\\%s",curdir,LONGDIR,SHORTFILE);
ok(DeleteFileA(tmpstr),"DeleteFileA failed");
ok(DeleteFileA(tmpstr),"DeleteFileA failed\n");
sprintf(tmpstr,"%s\\%s\\%s",curdir,LONGDIR,LONGFILE);
ok(DeleteFileA(tmpstr),"DeleteFileA failed");
ok(DeleteFileA(tmpstr),"DeleteFileA failed\n");
sprintf(tmpstr,"%s\\%s",curdir,SHORTDIR);
ok(RemoveDirectoryA(tmpstr),"RemoveDirectoryA failed");
ok(RemoveDirectoryA(tmpstr),"RemoveDirectoryA failed\n");
sprintf(tmpstr,"%s\\%s",curdir,LONGDIR);
ok(RemoveDirectoryA(tmpstr),"RemoveDirectoryA failed");
ok(SetCurrentDirectoryA(origdir),"SetCurrentDirectoryA failed");
ok(RemoveDirectoryA(curdir),"RemoveDirectoryA failed");
ok(RemoveDirectoryA(tmpstr),"RemoveDirectoryA failed\n");
ok(SetCurrentDirectoryA(origdir),"SetCurrentDirectoryA failed\n");
ok(RemoveDirectoryA(curdir),"RemoveDirectoryA failed\n");
}
/* This routine will test Get(Full|Short|Long)PathNameA */
@ -493,15 +493,15 @@ static void test_PathNameA(CHAR *curdir, CHAR curDrive, CHAR otherDrive)
/* Get the short form of the current directory */
ok((len=GetShortPathNameA(curdir,curdir_short,MAX_PATH)),
"GetShortPathNameA failed");
"GetShortPathNameA failed\n");
ok(!HAS_TRAIL_SLASH_A(curdir_short),
"GetShortPathNameA should not have a trailing \\");
"GetShortPathNameA should not have a trailing \\\n");
/* Get the short form of the absolute-path to LONGDIR */
sprintf(tmpstr,"%s\\%s",curdir_short,LONGDIR);
ok((len=GetShortPathNameA(tmpstr,longdir_short,MAX_PATH)),
"GetShortPathNameA failed");
"GetShortPathNameA failed\n");
ok(lstrcmpiA(longdir_short+(len-1),"\\")!=0,
"GetShortPathNameA should not have a trailing \\");
"GetShortPathNameA should not have a trailing \\\n");
if (pGetLongPathNameA) {
DWORD rc1,rc2;
@ -509,13 +509,13 @@ static void test_PathNameA(CHAR *curdir, CHAR curDrive, CHAR otherDrive)
rc1=(*pGetLongPathNameA)(tmpstr,NULL,0);
rc2=(*pGetLongPathNameA)(curdir,NULL,0);
ok((rc1-strlen(tmpstr))==(rc2-strlen(curdir)),
"GetLongPathNameA: wrong return code, %ld instead of %d",
"GetLongPathNameA: wrong return code, %ld instead of %d\n",
rc1, strlen(tmpstr)+1);
sprintf(dir,"%c:",curDrive);
rc1=(*pGetLongPathNameA)(dir,tmpstr,sizeof(tmpstr));
ok(strcmp(dir,tmpstr)==0,
"GetLongPathNameA: returned '%s' instead of '%s' (rc=%ld)",
"GetLongPathNameA: returned '%s' instead of '%s' (rc=%ld)\n",
tmpstr,dir,rc1);
}
@ -524,7 +524,7 @@ static void test_PathNameA(CHAR *curdir, CHAR curDrive, CHAR otherDrive)
test_ValidPathA(curdir,SHORTDIR,SHORTFILE,tmpstr,NULL,"test1");
sprintf(tmpstr1,"%s\\%s\\%s",curdir_short,SHORTDIR,SHORTFILE);
ok(lstrcmpiA(tmpstr,tmpstr1)==0,
"GetShortPathNameA returned '%s' instead of '%s'",tmpstr,tmpstr1);
"GetShortPathNameA returned '%s' instead of '%s'\n",tmpstr,tmpstr1);
/* Now try a 8.3 directory, long file name */
test_ValidPathA(curdir,SHORTDIR,LONGFILE,tmpstr,NULL,"test2");
sprintf(tmpstr1,"%s\\%s",curdir_short,SHORTDIR);
@ -533,7 +533,7 @@ static void test_PathNameA(CHAR *curdir, CHAR curDrive, CHAR otherDrive)
test_ValidPathA(curdir,LONGDIR,SHORTFILE,tmpstr,NULL,"test3");
sprintf(tmpstr1,"%s\\%s",longdir_short,SHORTFILE);
ok(lstrcmpiA(tmpstr,tmpstr1)==0,
"GetShortPathNameA returned '%s' instead of '%s'",tmpstr,tmpstr1);
"GetShortPathNameA returned '%s' instead of '%s'\n",tmpstr,tmpstr1);
/*Lastly a long directory, long file */
test_ValidPathA(curdir,LONGDIR,LONGFILE,tmpstr,NULL,"test4");
test_LongtoShortA(tmpstr,longdir_short,"PAT","test4");
@ -546,24 +546,24 @@ static void test_PathNameA(CHAR *curdir, CHAR curDrive, CHAR otherDrive)
(passfail.shorterror==ERROR_PATH_NOT_FOUND ||
passfail.shorterror==ERROR_FILE_NOT_FOUND)) ||
(passfail.shortlen==strlen(tmpstr1) && lstrcmpiA(tmpstr,tmpstr1)==0),
"GetShortPathNameA error: len=%ld error=%ld tmpstr=[%s]",
"GetShortPathNameA error: len=%ld error=%ld tmpstr=[%s]\n",
passfail.shortlen,passfail.shorterror,tmpstr);
if(pGetLongPathNameA) {
ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have");
ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have\n");
ok(passfail.longerror==ERROR_FILE_NOT_FOUND,
"GetlongPathA should have returned 'ERROR_FILE_NOT_FOUND'");
"GetlongPathA should have returned 'ERROR_FILE_NOT_FOUND'\n");
}
/* Now try a 8.3 directory, long file name */
test_ValidPathA(curdir,SHORTDIR,NONFILE_LONG,tmpstr,&passfail,"test6");
ok(passfail.shortlen==0,"GetShortPathNameA passed when it shouldn't have");
ok(passfail.shortlen==0,"GetShortPathNameA passed when it shouldn't have\n");
ok(passfail.shorterror==ERROR_PATH_NOT_FOUND ||
passfail.shorterror==ERROR_FILE_NOT_FOUND ||
!passfail.shorterror,
"GetShortPathA should have returned 'ERROR_FILE_NOT_FOUND'");
"GetShortPathA should have returned 'ERROR_FILE_NOT_FOUND'\n");
if(pGetLongPathNameA) {
ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have");
ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have\n");
ok(passfail.longerror==ERROR_FILE_NOT_FOUND,
"GetlongPathA should have returned 'ERROR_FILE_NOT_FOUND'");
"GetlongPathA should have returned 'ERROR_FILE_NOT_FOUND'\n");
}
/* Next is a long directory, 8.3 file */
test_ValidPathA(curdir,LONGDIR,NONFILE_SHORT,tmpstr,&passfail,"test7");
@ -574,24 +574,24 @@ static void test_PathNameA(CHAR *curdir, CHAR curDrive, CHAR otherDrive)
(passfail.shorterror==ERROR_PATH_NOT_FOUND ||
passfail.shorterror==ERROR_FILE_NOT_FOUND)) ||
(passfail.shortlen==strlen(tmpstr1) && lstrcmpiA(tmpstr,tmpstr1)==0),
"GetShortPathNameA error: len=%ld error=%ld tmpstr=[%s]",
"GetShortPathNameA error: len=%ld error=%ld tmpstr=[%s]\n",
passfail.shortlen,passfail.shorterror,tmpstr);
if(pGetLongPathNameA) {
ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have");
ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have\n");
ok(passfail.longerror==ERROR_FILE_NOT_FOUND,
"GetlongPathA should have returned 'ERROR_FILE_NOT_FOUND'");
"GetlongPathA should have returned 'ERROR_FILE_NOT_FOUND'\n");
}
/*Lastly a long directory, long file */
test_ValidPathA(curdir,LONGDIR,NONFILE_LONG,tmpstr,&passfail,"test8");
ok(passfail.shortlen==0,"GetShortPathNameA passed when it shouldn't have");
ok(passfail.shortlen==0,"GetShortPathNameA passed when it shouldn't have\n");
ok(passfail.shorterror==ERROR_PATH_NOT_FOUND ||
passfail.shorterror==ERROR_FILE_NOT_FOUND ||
!passfail.shorterror,
"GetShortPathA should have returned 'ERROR_FILE_NOT_FOUND'");
"GetShortPathA should have returned 'ERROR_FILE_NOT_FOUND'\n");
if(pGetLongPathNameA) {
ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have");
ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have\n");
ok(passfail.longerror==ERROR_FILE_NOT_FOUND,
"GetlongPathA should have returned 'ERROR_FILE_NOT_FOUND'");
"GetlongPathA should have returned 'ERROR_FILE_NOT_FOUND'\n");
}
/* Now try again with directories that don't exist */
/* 8.3 directory, 8.3 filename */
@ -601,58 +601,58 @@ static void test_PathNameA(CHAR *curdir, CHAR curDrive, CHAR otherDrive)
(passfail.shorterror==ERROR_PATH_NOT_FOUND ||
passfail.shorterror==ERROR_FILE_NOT_FOUND)) ||
(passfail.shortlen==strlen(tmpstr1) && lstrcmpiA(tmpstr,tmpstr1)==0),
"GetShortPathNameA error: len=%ld error=%ld tmpstr=[%s]",
"GetShortPathNameA error: len=%ld error=%ld tmpstr=[%s]\n",
passfail.shortlen,passfail.shorterror,tmpstr);
if(pGetLongPathNameA) {
ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have");
ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have\n");
ok(passfail.longerror==ERROR_PATH_NOT_FOUND ||
passfail.longerror==ERROR_FILE_NOT_FOUND,
"GetLongPathA returned %ld and not 'ERROR_PATH_NOT_FOUND'",
"GetLongPathA returned %ld and not 'ERROR_PATH_NOT_FOUND'\n",
passfail.longerror);
}
/* Now try a 8.3 directory, long file name */
test_ValidPathA(curdir,NONDIR_SHORT,LONGFILE,tmpstr,&passfail,"test10");
ok(passfail.shortlen==0,"GetShortPathNameA passed when it shouldn't have");
ok(passfail.shortlen==0,"GetShortPathNameA passed when it shouldn't have\n");
ok(passfail.shorterror==ERROR_PATH_NOT_FOUND ||
passfail.shorterror==ERROR_FILE_NOT_FOUND ||
!passfail.shorterror,
"GetShortPathA returned %ld and not 'ERROR_PATH_NOT_FOUND'",
"GetShortPathA returned %ld and not 'ERROR_PATH_NOT_FOUND'\n",
passfail.shorterror);
if(pGetLongPathNameA) {
ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have");
ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have\n");
ok(passfail.longerror==ERROR_PATH_NOT_FOUND ||
passfail.longerror==ERROR_FILE_NOT_FOUND,
"GetLongPathA returned %ld and not 'ERROR_PATH_NOT_FOUND'",
"GetLongPathA returned %ld and not 'ERROR_PATH_NOT_FOUND'\n",
passfail.longerror);
}
/* Next is a long directory, 8.3 file */
test_ValidPathA(curdir,NONDIR_LONG,SHORTFILE,tmpstr,&passfail,"test11");
ok(passfail.shortlen==0,"GetShortPathNameA passed when it shouldn't have");
ok(passfail.shortlen==0,"GetShortPathNameA passed when it shouldn't have\n");
ok(passfail.shorterror==ERROR_PATH_NOT_FOUND ||
passfail.shorterror==ERROR_FILE_NOT_FOUND ||
!passfail.shorterror,
"GetShortPathA returned %ld and not 'ERROR_PATH_NOT_FOUND'",
"GetShortPathA returned %ld and not 'ERROR_PATH_NOT_FOUND'\n",
passfail.shorterror);
if(pGetLongPathNameA) {
ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have");
ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have\n");
ok(passfail.longerror==ERROR_PATH_NOT_FOUND ||
passfail.longerror==ERROR_FILE_NOT_FOUND,
"GetLongPathA returned %ld and not 'ERROR_PATH_NOT_FOUND'",
"GetLongPathA returned %ld and not 'ERROR_PATH_NOT_FOUND'\n",
passfail.longerror);
}
/*Lastly a long directory, long file */
test_ValidPathA(curdir,NONDIR_LONG,LONGFILE,tmpstr,&passfail,"test12");
ok(passfail.shortlen==0,"GetShortPathNameA passed when it shouldn't have");
ok(passfail.shortlen==0,"GetShortPathNameA passed when it shouldn't have\n");
ok(passfail.shorterror==ERROR_PATH_NOT_FOUND ||
passfail.shorterror==ERROR_FILE_NOT_FOUND ||
!passfail.shorterror,
"GetShortPathA returned %ld and not 'ERROR_PATH_NOT_FOUND'",
"GetShortPathA returned %ld and not 'ERROR_PATH_NOT_FOUND'\n",
passfail.shorterror);
if(pGetLongPathNameA) {
ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have");
ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have\n");
ok(passfail.longerror==ERROR_PATH_NOT_FOUND ||
passfail.longerror==ERROR_FILE_NOT_FOUND,
"GetLongPathA returned %ld and not 'ERROR_PATH_NOT_FOUND'",
"GetLongPathA returned %ld and not 'ERROR_PATH_NOT_FOUND'\n",
passfail.longerror);
}
/* Next try directories ending with '\\' */
@ -669,116 +669,116 @@ static void test_PathNameA(CHAR *curdir, CHAR curDrive, CHAR otherDrive)
(passfail.shorterror==ERROR_PATH_NOT_FOUND ||
passfail.shorterror==ERROR_FILE_NOT_FOUND)) ||
(passfail.shortlen==strlen(tmpstr2) && lstrcmpiA(tmpstr1,tmpstr2)==0),
"GetShortPathNameA error: len=%ld error=%ld tmpstr=[%s]",
"GetShortPathNameA error: len=%ld error=%ld tmpstr=[%s]\n",
passfail.shortlen,passfail.shorterror,tmpstr);
if(pGetLongPathNameA) {
ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have");
ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have\n");
ok(passfail.longerror==ERROR_FILE_NOT_FOUND,
"GetLongPathA returned %ld and not 'ERROR_FILE_NOT_FOUND'",
"GetLongPathA returned %ld and not 'ERROR_FILE_NOT_FOUND'\n",
passfail.longerror);
}
sprintf(tmpstr,"%s\\",NONDIR_LONG);
test_ValidPathA(curdir,"",tmpstr,tmpstr1,&passfail,"test16");
ok(passfail.shortlen==0,"GetShortPathNameA passed when it shouldn't have");
ok(passfail.shortlen==0,"GetShortPathNameA passed when it shouldn't have\n");
ok(passfail.shorterror==ERROR_PATH_NOT_FOUND ||
passfail.shorterror==ERROR_FILE_NOT_FOUND ||
!passfail.shorterror,
"GetShortPathA returned %ld and not 'ERROR_FILE_NOT_FOUND'",
"GetShortPathA returned %ld and not 'ERROR_FILE_NOT_FOUND'\n",
passfail.shorterror);
if(pGetLongPathNameA) {
ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have");
ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have\n");
ok(passfail.longerror==ERROR_FILE_NOT_FOUND,
"GetLongPathA returned %ld and not 'ERROR_FILE_NOT_FOUND'",
"GetLongPathA returned %ld and not 'ERROR_FILE_NOT_FOUND'\n",
passfail.longerror);
}
/* Test GetFullPathNameA with drive letters */
if( curDrive != NOT_A_VALID_DRIVE) {
sprintf(tmpstr,"%c:",curdir[0]);
ok(GetFullPathNameA(tmpstr,MAX_PATH,tmpstr2,&strptr),
"GetFullPathNameA(%c:) failed", curdir[0]);
"GetFullPathNameA(%c:) failed\n", curdir[0]);
GetCurrentDirectoryA(MAX_PATH,tmpstr);
sprintf(tmpstr1,"%s\\",tmpstr);
ok(lstrcmpiA(tmpstr,tmpstr2)==0 || lstrcmpiA(tmpstr1,tmpstr2)==0,
"GetFullPathNameA(%c:) returned '%s' instead of '%s' or '%s'",
"GetFullPathNameA(%c:) returned '%s' instead of '%s' or '%s'\n",
curdir[0],tmpstr2,tmpstr,tmpstr1);
sprintf(tmpstr,"%c:\\%s\\%s",curDrive,SHORTDIR,SHORTFILE);
ok(GetFullPathNameA(tmpstr,MAX_PATH,tmpstr1,&strptr),"GetFullPathNameA failed");
ok(GetFullPathNameA(tmpstr,MAX_PATH,tmpstr1,&strptr),"GetFullPathNameA failed\n");
ok(lstrcmpiA(tmpstr,tmpstr1)==0,
"GetFullPathNameA returned '%s' instead of '%s'",tmpstr1,tmpstr);
"GetFullPathNameA returned '%s' instead of '%s'\n",tmpstr1,tmpstr);
ok(lstrcmpiA(SHORTFILE,strptr)==0,
"GetFullPathNameA returned part '%s' instead of '%s'",strptr,SHORTFILE);
"GetFullPathNameA returned part '%s' instead of '%s'\n",strptr,SHORTFILE);
}
/* Without a leading slash, insert the current directory if on the current drive */
sprintf(tmpstr,"%c:%s\\%s",curdir[0],SHORTDIR,SHORTFILE);
ok(GetFullPathNameA(tmpstr,MAX_PATH,tmpstr1,&strptr),"GetFullPathNameA failed");
ok(GetFullPathNameA(tmpstr,MAX_PATH,tmpstr1,&strptr),"GetFullPathNameA failed\n");
sprintf(tmpstr,"%s\\%s\\%s",curdir,SHORTDIR,SHORTFILE);
ok(lstrcmpiA(tmpstr,tmpstr1)==0,
"GetFullPathNameA returned '%s' instead of '%s'",tmpstr1,tmpstr);
"GetFullPathNameA returned '%s' instead of '%s'\n",tmpstr1,tmpstr);
ok(lstrcmpiA(SHORTFILE,strptr)==0,
"GetFullPathNameA returned part '%s' instead of '%s'",strptr,SHORTFILE);
"GetFullPathNameA returned part '%s' instead of '%s'\n",strptr,SHORTFILE);
/* Otherwise insert the missing leading slash */
if( otherDrive != NOT_A_VALID_DRIVE) {
sprintf(tmpstr,"%c:%s\\%s",otherDrive,SHORTDIR,SHORTFILE);
ok(GetFullPathNameA(tmpstr,MAX_PATH,tmpstr1,&strptr),"GetFullPathNameA failed for %s", tmpstr);
ok(GetFullPathNameA(tmpstr,MAX_PATH,tmpstr1,&strptr),"GetFullPathNameA failed for %s\n", tmpstr);
sprintf(tmpstr,"%c:\\%s\\%s",otherDrive,SHORTDIR,SHORTFILE);
ok(lstrcmpiA(tmpstr,tmpstr1)==0,
"GetFullPathNameA returned '%s' instead of '%s'",tmpstr1,tmpstr);
"GetFullPathNameA returned '%s' instead of '%s'\n",tmpstr1,tmpstr);
ok(lstrcmpiA(SHORTFILE,strptr)==0,
"GetFullPathNameA returned part '%s' instead of '%s'",strptr,SHORTFILE);
"GetFullPathNameA returned part '%s' instead of '%s'\n",strptr,SHORTFILE);
}
/* Xilinx tools like to mix Unix and DOS formats, which Windows handles fine.
So test for them. */
if( curDrive != NOT_A_VALID_DRIVE) {
sprintf(tmpstr,"%c:/%s\\%s",curDrive,SHORTDIR,SHORTFILE);
ok(GetFullPathNameA(tmpstr,MAX_PATH,tmpstr1,&strptr),"GetFullPathNameA failed");
ok(GetFullPathNameA(tmpstr,MAX_PATH,tmpstr1,&strptr),"GetFullPathNameA failed\n");
sprintf(tmpstr,"%c:\\%s\\%s",curDrive,SHORTDIR,SHORTFILE);
ok(lstrcmpiA(tmpstr,tmpstr1)==0,
"GetFullPathNameA returned '%s' instead of '%s'",tmpstr1,tmpstr);
"GetFullPathNameA returned '%s' instead of '%s'\n",tmpstr1,tmpstr);
ok(lstrcmpiA(SHORTFILE,strptr)==0,
"GetFullPathNameA returned part '%s' instead of '%s'",strptr,SHORTFILE);
"GetFullPathNameA returned part '%s' instead of '%s'\n",strptr,SHORTFILE);
}
/**/
sprintf(tmpstr,"%c:%s/%s",curdir[0],SHORTDIR,SHORTFILE);
ok(GetFullPathNameA(tmpstr,MAX_PATH,tmpstr1,&strptr),"GetFullPathNameA failed");
ok(GetFullPathNameA(tmpstr,MAX_PATH,tmpstr1,&strptr),"GetFullPathNameA failed\n");
sprintf(tmpstr,"%s\\%s\\%s",curdir,SHORTDIR,SHORTFILE);
ok(lstrcmpiA(tmpstr,tmpstr1)==0,
"GetFullPathNameA returned '%s' instead of '%s'",tmpstr1,tmpstr);
"GetFullPathNameA returned '%s' instead of '%s'\n",tmpstr1,tmpstr);
ok(lstrcmpiA(SHORTFILE,strptr)==0,
"GetFullPathNameA returned part '%s' instead of '%s'",strptr,SHORTFILE);
"GetFullPathNameA returned part '%s' instead of '%s'\n",strptr,SHORTFILE);
/* Windows will insert a drive letter in front of an absolute UNIX path, but
Wine probably shouldn't. */
sprintf(tmpstr,"/%s/%s",SHORTDIR,SHORTFILE);
ok(GetFullPathNameA(tmpstr,MAX_PATH,tmpstr1,&strptr),"GetFullPathNameA failed");
ok(GetFullPathNameA(tmpstr,MAX_PATH,tmpstr1,&strptr),"GetFullPathNameA failed\n");
todo_wine {
if( curDrive != NOT_A_VALID_DRIVE) {
sprintf(tmpstr,"C:\\%s\\%s",SHORTDIR,SHORTFILE);
ok(lstrcmpiA(tmpstr,tmpstr1)==0,
"GetFullPathNameA returned '%s' instead of '%s'",tmpstr1,tmpstr);
"GetFullPathNameA returned '%s' instead of '%s'\n",tmpstr1,tmpstr);
}
}
/* This passes in Wine because it still contains the pointer from the previous test */
ok(lstrcmpiA(SHORTFILE,strptr)==0,
"GetFullPathNameA returned part '%s' instead of '%s'",strptr,SHORTFILE);
"GetFullPathNameA returned part '%s' instead of '%s'\n",strptr,SHORTFILE);
/* Now try some relative paths */
ok(GetShortPathNameA(LONGDIR,tmpstr,MAX_PATH),"GetShortPathNameA failed");
ok(GetShortPathNameA(LONGDIR,tmpstr,MAX_PATH),"GetShortPathNameA failed\n");
test_SplitShortPathA(tmpstr,dir,eight,three);
if(pGetLongPathNameA) {
ok(pGetLongPathNameA(tmpstr,tmpstr1,MAX_PATH),"GetLongPathNameA failed");
ok(pGetLongPathNameA(tmpstr,tmpstr1,MAX_PATH),"GetLongPathNameA failed\n");
ok(lstrcmpiA(tmpstr1,LONGDIR)==0,
"GetLongPathNameA returned '%s' instead of '%s'",tmpstr1,LONGDIR);
"GetLongPathNameA returned '%s' instead of '%s'\n",tmpstr1,LONGDIR);
}
sprintf(tmpstr,".\\%s",LONGDIR);
ok(GetShortPathNameA(tmpstr,tmpstr1,MAX_PATH),"GetShortPathNameA failed");
ok(GetShortPathNameA(tmpstr,tmpstr1,MAX_PATH),"GetShortPathNameA failed\n");
test_SplitShortPathA(tmpstr1,dir,eight,three);
ok(lstrcmpiA(dir,".")==0 || dir[0]=='\0',
"GetShortPathNameA did not keep relative directory [%s]",tmpstr1);
"GetShortPathNameA did not keep relative directory [%s]\n",tmpstr1);
if(pGetLongPathNameA) {
ok(pGetLongPathNameA(tmpstr1,tmpstr1,MAX_PATH),"GetLongPathNameA failed %s",
ok(pGetLongPathNameA(tmpstr1,tmpstr1,MAX_PATH),"GetLongPathNameA failed %s\n",
tmpstr);
ok(lstrcmpiA(tmpstr1,tmpstr)==0,
"GetLongPathNameA returned '%s' instead of '%s'",tmpstr1,tmpstr);
"GetLongPathNameA returned '%s' instead of '%s'\n",tmpstr1,tmpstr);
}
/* Check out Get*PathNameA on some funny characters */
for(i=0;i<lstrlenA(funny_chars);i++) {
@ -818,9 +818,9 @@ static void test_GetTempPathA(char* tmp_dir)
lstrcpyA(buf, "foo");
len = GetTempPathA(MAX_PATH, buf);
ok(len <= MAX_PATH, "should fit into MAX_PATH");
ok(lstrcmpiA(buf, tmp_dir) == 0, "expected [%s], got [%s]",tmp_dir,buf);
ok(len == strlen(buf), "returned length should be equal to the length of string");
ok(len <= MAX_PATH, "should fit into MAX_PATH\n");
ok(lstrcmpiA(buf, tmp_dir) == 0, "expected [%s], got [%s]\n",tmp_dir,buf);
ok(len == strlen(buf), "returned length should be equal to the length of string\n");
/* Some versions of Windows touch the buffer, some don't so we don't
* test that. Also, NT sometimes exagerates the required buffer size
@ -830,18 +830,18 @@ static void test_GetTempPathA(char* tmp_dir)
* of len_with_null.
*/
len = GetTempPathA(1, buf);
ok(len >= len_with_null, "Expected >= %lu, got %lu", len_with_null, len);
ok(len >= len_with_null, "Expected >= %lu, got %lu\n", len_with_null, len);
len = GetTempPathA(0, NULL);
ok(len >= len_with_null, "Expected >= %lu, got %lu", len_with_null, len);
ok(len >= len_with_null, "Expected >= %lu, got %lu\n", len_with_null, len);
/* The call above gave us the buffer size that Windows thinks is needed
* so the next call should work
*/
lstrcpyA(buf, "foo");
len = GetTempPathA(len, buf);
ok(lstrcmpiA(buf, tmp_dir) == 0, "expected [%s], got [%s]",tmp_dir,buf);
ok(len == strlen(buf), "returned length should be equal to the length of string");
ok(lstrcmpiA(buf, tmp_dir) == 0, "expected [%s], got [%s]\n",tmp_dir,buf);
ok(len == strlen(buf), "returned length should be equal to the length of string\n");
}
static void test_GetTempPathW(char* tmp_dir)
@ -867,21 +867,21 @@ static void test_GetTempPathW(char* tmp_dir)
len = GetTempPathW(MAX_PATH, buf);
if (len==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
return;
ok(lstrcmpiW(buf, tmp_dirW) == 0, "GetTempPathW returned an incorrect temporary path");
ok(len == lstrlenW(buf), "returned length should be equal to the length of string");
ok(lstrcmpiW(buf, tmp_dirW) == 0, "GetTempPathW returned an incorrect temporary path\n");
ok(len == lstrlenW(buf), "returned length should be equal to the length of string\n");
lstrcpyW(buf, fooW);
len = GetTempPathW(1, buf);
ok(buf[0] == 0, "unicode version should truncate the buffer to zero size");
ok(len >= len_with_null, "Expected >= %lu, got %lu", len_with_null, len);
ok(buf[0] == 0, "unicode version should truncate the buffer to zero size\n");
ok(len >= len_with_null, "Expected >= %lu, got %lu\n", len_with_null, len);
len = GetTempPathW(0, NULL);
ok(len >= len_with_null, "Expected >= %lu, got %lu", len_with_null, len);
ok(len >= len_with_null, "Expected >= %lu, got %lu\n", len_with_null, len);
lstrcpyW(buf, fooW);
len = GetTempPathW(len, buf);
ok(lstrcmpiW(buf, tmp_dirW) == 0, "GetTempPathW returned an incorrect temporary path");
ok(len == lstrlenW(buf), "returned length should be equal to the length of string");
ok(lstrcmpiW(buf, tmp_dirW) == 0, "GetTempPathW returned an incorrect temporary path\n");
ok(len == lstrlenW(buf), "returned length should be equal to the length of string\n");
}
static void test_GetTempPath(void)

View File

@ -71,22 +71,22 @@ void test_CreateNamedPipe(void)
if (hnp == INVALID_HANDLE_VALUE && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) {
/* Is this the right way to notify user of skipped tests? */
ok(hnp == INVALID_HANDLE_VALUE && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED,
"CreateNamedPipe not supported on this platform, skipping tests.");
"CreateNamedPipe not supported on this platform, skipping tests.\n");
return;
}
ok(hnp == INVALID_HANDLE_VALUE && GetLastError() == ERROR_INVALID_NAME,
"CreateNamedPipe should fail if name doesn't start with \\\\.\\pipe");
"CreateNamedPipe should fail if name doesn't start with \\\\.\\pipe\n");
hnp = CreateNamedPipe(NULL,
PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_WAIT,
1, 1024, 1024, NMPWAIT_USE_DEFAULT_WAIT, NULL);
ok(hnp == INVALID_HANDLE_VALUE && GetLastError() == ERROR_PATH_NOT_FOUND,
"CreateNamedPipe should fail if name is NULL");
"CreateNamedPipe should fail if name is NULL\n");
hFile = CreateFileA(PIPENAME, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0);
ok(hFile == INVALID_HANDLE_VALUE
&& GetLastError() == ERROR_FILE_NOT_FOUND,
"connecting to nonexistent named pipe should fail with ERROR_FILE_NOT_FOUND");
"connecting to nonexistent named pipe should fail with ERROR_FILE_NOT_FOUND\n");
/* Functional checks */
@ -96,10 +96,10 @@ void test_CreateNamedPipe(void)
/* nInBufSize */ 1024,
/* nDefaultWait */ NMPWAIT_USE_DEFAULT_WAIT,
/* lpSecurityAttrib */ NULL);
ok(hnp != INVALID_HANDLE_VALUE, "CreateNamedPipe failed");
ok(hnp != INVALID_HANDLE_VALUE, "CreateNamedPipe failed\n");
hFile = CreateFileA(PIPENAME, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0);
ok(hFile != INVALID_HANDLE_VALUE, "CreateFile failed");
ok(hFile != INVALID_HANDLE_VALUE, "CreateFile failed\n");
/* don't try to do i/o if one side couldn't be opened, as it hangs */
if (hFile != INVALID_HANDLE_VALUE) {
@ -107,18 +107,18 @@ void test_CreateNamedPipe(void)
/* Make sure we can read and write a few bytes in both directions */
memset(ibuf, 0, sizeof(ibuf));
ok(WriteFile(hnp, obuf, sizeof(obuf), &written, NULL), "WriteFile");
ok(written == sizeof(obuf), "write file len");
ok(ReadFile(hFile, ibuf, sizeof(obuf), &readden, NULL), "ReadFile");
ok(readden == sizeof(obuf), "read file len");
ok(memcmp(obuf, ibuf, written) == 0, "content check");
ok(WriteFile(hnp, obuf, sizeof(obuf), &written, NULL), "WriteFile\n");
ok(written == sizeof(obuf), "write file len\n");
ok(ReadFile(hFile, ibuf, sizeof(obuf), &readden, NULL), "ReadFile\n");
ok(readden == sizeof(obuf), "read file len\n");
ok(memcmp(obuf, ibuf, written) == 0, "content check\n");
memset(ibuf, 0, sizeof(ibuf));
ok(WriteFile(hFile, obuf, sizeof(obuf), &written, NULL), "WriteFile");
ok(written == sizeof(obuf), "write file len");
ok(ReadFile(hnp, ibuf, sizeof(obuf), &readden, NULL), "ReadFile");
ok(readden == sizeof(obuf), "read file len");
ok(memcmp(obuf, ibuf, written) == 0, "content check");
ok(WriteFile(hFile, obuf, sizeof(obuf), &written, NULL), "WriteFile\n");
ok(written == sizeof(obuf), "write file len\n");
ok(ReadFile(hnp, ibuf, sizeof(obuf), &readden, NULL), "ReadFile\n");
ok(readden == sizeof(obuf), "read file len\n");
ok(memcmp(obuf, ibuf, written) == 0, "content check\n");
/* Picky conformance tests */
@ -129,27 +129,27 @@ void test_CreateNamedPipe(void)
*/
hFile2 = CreateFileA(PIPENAME, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0);
ok(hFile2 == INVALID_HANDLE_VALUE,
"connecting to named pipe after other client closes but before DisconnectNamedPipe should fail");
"connecting to named pipe after other client closes but before DisconnectNamedPipe should fail\n");
ok(GetLastError() == ERROR_PIPE_BUSY,
"connecting to named pipe before other client closes should fail with ERROR_PIPE_BUSY");
"connecting to named pipe before other client closes should fail with ERROR_PIPE_BUSY\n");
ok(CloseHandle(hFile), "CloseHandle");
ok(CloseHandle(hFile), "CloseHandle\n");
/* case 2: other client already closed */
hFile = CreateFileA(PIPENAME, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0);
ok(hFile == INVALID_HANDLE_VALUE,
"connecting to named pipe after other client closes but before DisconnectNamedPipe should fail");
"connecting to named pipe after other client closes but before DisconnectNamedPipe should fail\n");
ok(GetLastError() == ERROR_PIPE_BUSY,
"connecting to named pipe after other client closes but before DisconnectNamedPipe should fail with ERROR_PIPE_BUSY");
"connecting to named pipe after other client closes but before DisconnectNamedPipe should fail with ERROR_PIPE_BUSY\n");
ok(DisconnectNamedPipe(hnp), "DisconnectNamedPipe");
ok(DisconnectNamedPipe(hnp), "DisconnectNamedPipe\n");
/* case 3: server has called DisconnectNamedPipe but not ConnectNamed Pipe */
hFile = CreateFileA(PIPENAME, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0);
ok(hFile == INVALID_HANDLE_VALUE,
"connecting to named pipe after other client closes but before DisconnectNamedPipe should fail");
"connecting to named pipe after other client closes but before DisconnectNamedPipe should fail\n");
ok(GetLastError() == ERROR_PIPE_BUSY,
"connecting to named pipe after other client closes but before ConnectNamedPipe should fail with ERROR_PIPE_BUSY");
"connecting to named pipe after other client closes but before ConnectNamedPipe should fail with ERROR_PIPE_BUSY\n");
/* to be complete, we'd call ConnectNamedPipe here and loop,
* but by default that's blocking, so we'd either have
@ -158,7 +158,7 @@ void test_CreateNamedPipe(void)
*/
}
ok(CloseHandle(hnp), "CloseHandle");
ok(CloseHandle(hnp), "CloseHandle\n");
trace("test_CreateNamedPipe returning\n");
}
@ -174,7 +174,7 @@ void test_CreateNamedPipe_instances_must_match(void)
/* nInBufSize */ 1024,
/* nDefaultWait */ NMPWAIT_USE_DEFAULT_WAIT,
/* lpSecurityAttrib */ NULL);
ok(hnp != INVALID_HANDLE_VALUE, "CreateNamedPipe failed");
ok(hnp != INVALID_HANDLE_VALUE, "CreateNamedPipe failed\n");
hnp2 = CreateNamedPipe(PIPENAME, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_WAIT,
/* nMaxInstances */ 2,
@ -182,10 +182,10 @@ void test_CreateNamedPipe_instances_must_match(void)
/* nInBufSize */ 1024,
/* nDefaultWait */ NMPWAIT_USE_DEFAULT_WAIT,
/* lpSecurityAttrib */ NULL);
ok(hnp2 != INVALID_HANDLE_VALUE, "CreateNamedPipe failed");
ok(hnp2 != INVALID_HANDLE_VALUE, "CreateNamedPipe failed\n");
ok(CloseHandle(hnp), "CloseHandle");
ok(CloseHandle(hnp2), "CloseHandle");
ok(CloseHandle(hnp), "CloseHandle\n");
ok(CloseHandle(hnp2), "CloseHandle\n");
/* Check nMaxInstances */
hnp = CreateNamedPipe(PIPENAME, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_WAIT,
@ -194,7 +194,7 @@ void test_CreateNamedPipe_instances_must_match(void)
/* nInBufSize */ 1024,
/* nDefaultWait */ NMPWAIT_USE_DEFAULT_WAIT,
/* lpSecurityAttrib */ NULL);
ok(hnp != INVALID_HANDLE_VALUE, "CreateNamedPipe failed");
ok(hnp != INVALID_HANDLE_VALUE, "CreateNamedPipe failed\n");
hnp2 = CreateNamedPipe(PIPENAME, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_WAIT,
/* nMaxInstances */ 1,
@ -203,9 +203,9 @@ void test_CreateNamedPipe_instances_must_match(void)
/* nDefaultWait */ NMPWAIT_USE_DEFAULT_WAIT,
/* lpSecurityAttrib */ NULL);
ok(hnp2 == INVALID_HANDLE_VALUE
&& GetLastError() == ERROR_PIPE_BUSY, "nMaxInstances not obeyed");
&& GetLastError() == ERROR_PIPE_BUSY, "nMaxInstances not obeyed\n");
ok(CloseHandle(hnp), "CloseHandle");
ok(CloseHandle(hnp), "CloseHandle\n");
/* Check PIPE_ACCESS_* */
hnp = CreateNamedPipe(PIPENAME, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_WAIT,
@ -214,7 +214,7 @@ void test_CreateNamedPipe_instances_must_match(void)
/* nInBufSize */ 1024,
/* nDefaultWait */ NMPWAIT_USE_DEFAULT_WAIT,
/* lpSecurityAttrib */ NULL);
ok(hnp != INVALID_HANDLE_VALUE, "CreateNamedPipe failed");
ok(hnp != INVALID_HANDLE_VALUE, "CreateNamedPipe failed\n");
hnp2 = CreateNamedPipe(PIPENAME, PIPE_ACCESS_INBOUND, PIPE_TYPE_BYTE | PIPE_WAIT,
/* nMaxInstances */ 1,
@ -223,9 +223,9 @@ void test_CreateNamedPipe_instances_must_match(void)
/* nDefaultWait */ NMPWAIT_USE_DEFAULT_WAIT,
/* lpSecurityAttrib */ NULL);
ok(hnp2 == INVALID_HANDLE_VALUE
&& GetLastError() == ERROR_ACCESS_DENIED, "PIPE_ACCESS_* mismatch allowed");
&& GetLastError() == ERROR_ACCESS_DENIED, "PIPE_ACCESS_* mismatch allowed\n");
ok(CloseHandle(hnp), "CloseHandle");
ok(CloseHandle(hnp), "CloseHandle\n");
/* etc, etc */
}
@ -236,7 +236,7 @@ static DWORD CALLBACK alarmThreadMain(LPVOID arg)
DWORD timeout = (DWORD) arg;
trace("alarmThreadMain\n");
Sleep(timeout);
ok(FALSE, "alarm");
ok(FALSE, "alarm\n");
ExitProcess(1);
return 1;
}
@ -258,7 +258,7 @@ static DWORD CALLBACK serverThreadMain1(LPVOID arg)
/* nDefaultWait */ NMPWAIT_USE_DEFAULT_WAIT,
/* lpSecurityAttrib */ NULL);
ok(hnp != INVALID_HANDLE_VALUE, "CreateNamedPipe failed");
ok(hnp != INVALID_HANDLE_VALUE, "CreateNamedPipe failed\n");
for (i = 0; ; i++) {
char buf[512];
DWORD written;
@ -268,7 +268,7 @@ static DWORD CALLBACK serverThreadMain1(LPVOID arg)
/* Wait for client to connect */
trace("Server calling ConnectNamedPipe...\n");
ok(ConnectNamedPipe(hnp, NULL)
|| GetLastError() == ERROR_PIPE_CONNECTED, "ConnectNamedPipe");
|| GetLastError() == ERROR_PIPE_CONNECTED, "ConnectNamedPipe\n");
trace("ConnectNamedPipe returned.\n");
/* Echo bytes once */
@ -277,18 +277,18 @@ static DWORD CALLBACK serverThreadMain1(LPVOID arg)
trace("Server reading...\n");
success = ReadFile(hnp, buf, sizeof(buf), &readden, NULL);
trace("Server done reading.\n");
ok(success, "ReadFile");
ok(readden, "short read");
ok(success, "ReadFile\n");
ok(readden, "short read\n");
trace("Server writing...\n");
ok(WriteFile(hnp, buf, readden, &written, NULL), "WriteFile");
ok(WriteFile(hnp, buf, readden, &written, NULL), "WriteFile\n");
trace("Server done writing.\n");
ok(written == readden, "write file len");
ok(written == readden, "write file len\n");
/* finish this connection, wait for next one */
ok(FlushFileBuffers(hnp), "FlushFileBuffers");
ok(FlushFileBuffers(hnp), "FlushFileBuffers\n");
trace("Server done flushing.\n");
ok(DisconnectNamedPipe(hnp), "DisconnectNamedPipe");
ok(DisconnectNamedPipe(hnp), "DisconnectNamedPipe\n");
trace("Server done disconnecting.\n");
}
}
@ -308,7 +308,7 @@ static DWORD CALLBACK serverThreadMain2(LPVOID arg)
/* nInBufSize */ 1024,
/* nDefaultWait */ NMPWAIT_USE_DEFAULT_WAIT,
/* lpSecurityAttrib */ NULL);
ok(hnp != INVALID_HANDLE_VALUE, "CreateNamedPipe failed");
ok(hnp != INVALID_HANDLE_VALUE, "CreateNamedPipe failed\n");
for (i = 0; ; i++) {
char buf[512];
@ -319,7 +319,7 @@ static DWORD CALLBACK serverThreadMain2(LPVOID arg)
/* Wait for client to connect */
trace("Server calling ConnectNamedPipe...\n");
ok(ConnectNamedPipe(hnp, NULL)
|| GetLastError() == ERROR_PIPE_CONNECTED, "ConnectNamedPipe");
|| GetLastError() == ERROR_PIPE_CONNECTED, "ConnectNamedPipe\n");
trace("ConnectNamedPipe returned.\n");
/* Echo bytes once */
@ -328,16 +328,16 @@ static DWORD CALLBACK serverThreadMain2(LPVOID arg)
trace("Server reading...\n");
success = ReadFile(hnp, buf, sizeof(buf), &readden, NULL);
trace("Server done reading.\n");
ok(success, "ReadFile");
ok(success, "ReadFile\n");
trace("Server writing...\n");
ok(WriteFile(hnp, buf, readden, &written, NULL), "WriteFile");
ok(WriteFile(hnp, buf, readden, &written, NULL), "WriteFile\n");
trace("Server done writing.\n");
ok(written == readden, "write file len");
ok(written == readden, "write file len\n");
/* finish this connection, wait for next one */
ok(FlushFileBuffers(hnp), "FlushFileBuffers");
ok(DisconnectNamedPipe(hnp), "DisconnectNamedPipe");
ok(FlushFileBuffers(hnp), "FlushFileBuffers\n");
ok(DisconnectNamedPipe(hnp), "DisconnectNamedPipe\n");
/* Set up next echo server */
hnpNext =
@ -349,9 +349,9 @@ static DWORD CALLBACK serverThreadMain2(LPVOID arg)
/* nDefaultWait */ NMPWAIT_USE_DEFAULT_WAIT,
/* lpSecurityAttrib */ NULL);
ok(hnpNext != INVALID_HANDLE_VALUE, "CreateNamedPipe failed");
ok(hnpNext != INVALID_HANDLE_VALUE, "CreateNamedPipe failed\n");
ok(CloseHandle(hnp), "CloseHandle");
ok(CloseHandle(hnp), "CloseHandle\n");
hnp = hnpNext;
}
}
@ -371,13 +371,13 @@ static DWORD CALLBACK serverThreadMain3(LPVOID arg)
/* nInBufSize */ 1024,
/* nDefaultWait */ NMPWAIT_USE_DEFAULT_WAIT,
/* lpSecurityAttrib */ NULL);
ok(hnp != INVALID_HANDLE_VALUE, "CreateNamedPipe failed");
ok(hnp != INVALID_HANDLE_VALUE, "CreateNamedPipe failed\n");
hEvent = CreateEvent(NULL, /* security attribute */
TRUE, /* manual reset event */
FALSE, /* initial state */
NULL); /* name */
ok(hEvent != NULL, "CreateEvent");
ok(hEvent != NULL, "CreateEvent\n");
for (i = 0; ; i++) {
char buf[512];
@ -398,16 +398,16 @@ static DWORD CALLBACK serverThreadMain3(LPVOID arg)
success = ConnectNamedPipe(hnp, &oOverlap);
err = GetLastError();
ok(success || err == ERROR_IO_PENDING
|| err == ERROR_PIPE_CONNECTED, "overlapped ConnectNamedPipe");
|| err == ERROR_PIPE_CONNECTED, "overlapped ConnectNamedPipe\n");
trace("overlapped ConnectNamedPipe returned.\n");
if (!success && (err == ERROR_IO_PENDING) && letWFSOEwait)
ok(WaitForSingleObjectEx(hEvent, INFINITE, TRUE) == 0, "wait ConnectNamedPipe");
ok(WaitForSingleObjectEx(hEvent, INFINITE, TRUE) == 0, "wait ConnectNamedPipe\n");
success = GetOverlappedResult(hnp, &oOverlap, &dummy, letGORwait);
if (!letGORwait && !letWFSOEwait && !success) {
ok(GetLastError() == ERROR_IO_INCOMPLETE, "GetOverlappedResult");
ok(GetLastError() == ERROR_IO_INCOMPLETE, "GetOverlappedResult\n");
success = GetOverlappedResult(hnp, &oOverlap, &dummy, TRUE);
}
ok(success, "GetOverlappedResult ConnectNamedPipe");
ok(success, "GetOverlappedResult ConnectNamedPipe\n");
trace("overlapped ConnectNamedPipe operation complete.\n");
/* Echo bytes once */
@ -417,38 +417,38 @@ static DWORD CALLBACK serverThreadMain3(LPVOID arg)
success = ReadFile(hnp, buf, sizeof(buf), NULL, &oOverlap);
trace("Server ReadFile returned...\n");
err = GetLastError();
ok(success || err == ERROR_IO_PENDING, "overlapped ReadFile");
ok(success || err == ERROR_IO_PENDING, "overlapped ReadFile\n");
trace("overlapped ReadFile returned.\n");
if (!success && (err == ERROR_IO_PENDING) && letWFSOEwait)
ok(WaitForSingleObjectEx(hEvent, INFINITE, TRUE) == 0, "wait ReadFile");
ok(WaitForSingleObjectEx(hEvent, INFINITE, TRUE) == 0, "wait ReadFile\n");
success = GetOverlappedResult(hnp, &oOverlap, &readden, letGORwait);
if (!letGORwait && !letWFSOEwait && !success) {
ok(GetLastError() == ERROR_IO_INCOMPLETE, "GetOverlappedResult");
ok(GetLastError() == ERROR_IO_INCOMPLETE, "GetOverlappedResult\n");
success = GetOverlappedResult(hnp, &oOverlap, &readden, TRUE);
}
trace("Server done reading.\n");
ok(success, "overlapped ReadFile");
ok(success, "overlapped ReadFile\n");
trace("Server writing...\n");
success = WriteFile(hnp, buf, readden, NULL, &oOverlap);
trace("Server WriteFile returned...\n");
err = GetLastError();
ok(success || err == ERROR_IO_PENDING, "overlapped WriteFile");
ok(success || err == ERROR_IO_PENDING, "overlapped WriteFile\n");
trace("overlapped WriteFile returned.\n");
if (!success && (err == ERROR_IO_PENDING) && letWFSOEwait)
ok(WaitForSingleObjectEx(hEvent, INFINITE, TRUE) == 0, "wait WriteFile");
ok(WaitForSingleObjectEx(hEvent, INFINITE, TRUE) == 0, "wait WriteFile\n");
success = GetOverlappedResult(hnp, &oOverlap, &written, letGORwait);
if (!letGORwait && !letWFSOEwait && !success) {
ok(GetLastError() == ERROR_IO_INCOMPLETE, "GetOverlappedResult");
ok(GetLastError() == ERROR_IO_INCOMPLETE, "GetOverlappedResult\n");
success = GetOverlappedResult(hnp, &oOverlap, &written, TRUE);
}
trace("Server done writing.\n");
ok(success, "overlapped WriteFile");
ok(written == readden, "write file len");
ok(success, "overlapped WriteFile\n");
ok(written == readden, "write file len\n");
/* finish this connection, wait for next one */
ok(FlushFileBuffers(hnp), "FlushFileBuffers");
ok(DisconnectNamedPipe(hnp), "DisconnectNamedPipe");
ok(FlushFileBuffers(hnp), "FlushFileBuffers\n");
ok(DisconnectNamedPipe(hnp), "DisconnectNamedPipe\n");
}
}
@ -475,29 +475,29 @@ static void exercizeServer(const char *pipename, HANDLE serverThread)
break;
err = GetLastError();
if (loop == 0)
ok(err == ERROR_PIPE_BUSY || err == ERROR_FILE_NOT_FOUND, "connecting to pipe");
ok(err == ERROR_PIPE_BUSY || err == ERROR_FILE_NOT_FOUND, "connecting to pipe\n");
else
ok(err == ERROR_PIPE_BUSY, "connecting to pipe");
ok(err == ERROR_PIPE_BUSY, "connecting to pipe\n");
trace("connect failed, retrying\n");
Sleep(200);
}
ok(hFile != INVALID_HANDLE_VALUE, "client opening named pipe");
ok(hFile != INVALID_HANDLE_VALUE, "client opening named pipe\n");
/* Make sure it can echo */
memset(ibuf, 0, sizeof(ibuf));
trace("Client writing...\n");
ok(WriteFile(hFile, obuf, sizeof(obuf), &written, NULL), "WriteFile to client end of pipe");
ok(written == sizeof(obuf), "write file len");
ok(WriteFile(hFile, obuf, sizeof(obuf), &written, NULL), "WriteFile to client end of pipe\n");
ok(written == sizeof(obuf), "write file len\n");
trace("Client reading...\n");
ok(ReadFile(hFile, ibuf, sizeof(obuf), &readden, NULL), "ReadFile from client end of pipe");
ok(readden == sizeof(obuf), "read file len");
ok(memcmp(obuf, ibuf, written) == 0, "content check");
ok(ReadFile(hFile, ibuf, sizeof(obuf), &readden, NULL), "ReadFile from client end of pipe\n");
ok(readden == sizeof(obuf), "read file len\n");
ok(memcmp(obuf, ibuf, written) == 0, "content check\n");
trace("Client closing...\n");
ok(CloseHandle(hFile), "CloseHandle");
ok(CloseHandle(hFile), "CloseHandle\n");
}
ok(TerminateThread(serverThread, 0), "TerminateThread");
ok(TerminateThread(serverThread, 0), "TerminateThread\n");
CloseHandle(hnp);
trace("exercizeServer returning\n");
}
@ -520,23 +520,23 @@ void test_NamedPipe_2(void)
/* Try server #1 */
serverThread = CreateThread(NULL, 0, serverThreadMain1, 0, 0, &serverThreadId);
ok(serverThread != INVALID_HANDLE_VALUE, "CreateThread");
ok(serverThread != INVALID_HANDLE_VALUE, "CreateThread\n");
exercizeServer(PIPENAME "serverThreadMain1", serverThread);
/* Try server #2 */
serverThread = CreateThread(NULL, 0, serverThreadMain2, 0, 0, &serverThreadId);
ok(serverThread != INVALID_HANDLE_VALUE, "CreateThread");
ok(serverThread != INVALID_HANDLE_VALUE, "CreateThread\n");
exercizeServer(PIPENAME "serverThreadMain2", serverThread);
if( 0 ) /* overlapped pipe server doesn't work yet - it randomly fails */
{
/* Try server #3 */
serverThread = CreateThread(NULL, 0, serverThreadMain3, 0, 0, &serverThreadId);
ok(serverThread != INVALID_HANDLE_VALUE, "CreateThread");
ok(serverThread != INVALID_HANDLE_VALUE, "CreateThread\n");
exercizeServer(PIPENAME "serverThreadMain3", serverThread);
}
ok(TerminateThread(alarmThread, 0), "TerminateThread");
ok(TerminateThread(alarmThread, 0), "TerminateThread\n");
trace("test_NamedPipe_2 returning\n");
}
@ -555,15 +555,15 @@ void test_DisconnectNamedPipe(void)
/* nInBufSize */ 1024,
/* nDefaultWait */ NMPWAIT_USE_DEFAULT_WAIT,
/* lpSecurityAttrib */ NULL);
ok(hnp != INVALID_HANDLE_VALUE, "CreateNamedPipe failed");
ok(hnp != INVALID_HANDLE_VALUE, "CreateNamedPipe failed\n");
ok(WriteFile(hnp, obuf, sizeof(obuf), &written, NULL) == 0
&& GetLastError() == ERROR_PIPE_LISTENING, "WriteFile to not-yet-connected pipe");
&& GetLastError() == ERROR_PIPE_LISTENING, "WriteFile to not-yet-connected pipe\n");
ok(ReadFile(hnp, ibuf, sizeof(ibuf), &readden, NULL) == 0
&& GetLastError() == ERROR_PIPE_LISTENING, "ReadFile from not-yet-connected pipe");
&& GetLastError() == ERROR_PIPE_LISTENING, "ReadFile from not-yet-connected pipe\n");
hFile = CreateFileA(PIPENAME, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0);
ok(hFile != INVALID_HANDLE_VALUE, "CreateFile failed");
ok(hFile != INVALID_HANDLE_VALUE, "CreateFile failed\n");
/* don't try to do i/o if one side couldn't be opened, as it hangs */
if (hFile != INVALID_HANDLE_VALUE) {
@ -572,18 +572,18 @@ void test_DisconnectNamedPipe(void)
* when there are bytes in the pipe
*/
ok(WriteFile(hFile, obuf, sizeof(obuf), &written, NULL), "WriteFile");
ok(written == sizeof(obuf), "write file len");
ok(DisconnectNamedPipe(hnp), "DisconnectNamedPipe while messages waiting");
ok(WriteFile(hFile, obuf, sizeof(obuf), &written, NULL), "WriteFile\n");
ok(written == sizeof(obuf), "write file len\n");
ok(DisconnectNamedPipe(hnp), "DisconnectNamedPipe while messages waiting\n");
ok(WriteFile(hFile, obuf, sizeof(obuf), &written, NULL) == 0
&& GetLastError() == ERROR_PIPE_NOT_CONNECTED, "WriteFile to disconnected pipe");
&& GetLastError() == ERROR_PIPE_NOT_CONNECTED, "WriteFile to disconnected pipe\n");
ok(ReadFile(hnp, ibuf, sizeof(ibuf), &readden, NULL) == 0
&& GetLastError() == ERROR_PIPE_NOT_CONNECTED,
"ReadFile from disconnected pipe with bytes waiting");
ok(CloseHandle(hFile), "CloseHandle");
"ReadFile from disconnected pipe with bytes waiting\n");
ok(CloseHandle(hFile), "CloseHandle\n");
}
ok(CloseHandle(hnp), "CloseHandle");
ok(CloseHandle(hnp), "CloseHandle\n");
}

View File

@ -327,13 +327,13 @@ static void doChild(const char* file, const char* option)
childPrintf(hFile, "OutputMode=%ld\n", modeOut);
/* now that we have written all relevant information, let's change it */
ok(SetConsoleCP(1252), "Setting CP");
ok(SetConsoleOutputCP(1252), "Setting SB CP");
ok(SetConsoleMode(hConIn, modeIn ^ 1), "Setting mode (%ld)", GetLastError());
ok(SetConsoleMode(hConOut, modeOut ^ 1), "Setting mode (%ld)", GetLastError());
ok(SetConsoleCP(1252), "Setting CP\n");
ok(SetConsoleOutputCP(1252), "Setting SB CP\n");
ok(SetConsoleMode(hConIn, modeIn ^ 1), "Setting mode (%ld)\n", GetLastError());
ok(SetConsoleMode(hConOut, modeOut ^ 1), "Setting mode (%ld)\n", GetLastError());
sbi.dwCursorPosition.X ^= 1;
sbi.dwCursorPosition.Y ^= 1;
ok(SetConsoleCursorPosition(hConOut, sbi.dwCursorPosition), "Setting cursor position (%ld)", GetLastError());
ok(SetConsoleCursorPosition(hConOut, sbi.dwCursorPosition), "Setting cursor position (%ld)\n", GetLastError());
}
if (option && strcmp(option, "stdhandle") == 0)
{
@ -345,9 +345,9 @@ static void doChild(const char* file, const char* option)
char buf[1024];
DWORD r, w;
ok(ReadFile(hStdIn, buf, sizeof(buf), &r, NULL) && r > 0, "Reading message from input pipe");
ok(ReadFile(hStdIn, buf, sizeof(buf), &r, NULL) && r > 0, "Reading message from input pipe\n");
childPrintf(hFile, "[StdHandle]\nmsg=%s\n\n", encodeA(buf));
ok(WriteFile(hStdOut, buf, r, &w, NULL) && w == r, "Writing message to output pipe");
ok(WriteFile(hStdOut, buf, r, &w, NULL) && w == r, "Writing message to output pipe\n");
}
}
@ -403,13 +403,13 @@ static int strCmp(const char* s1, const char* s2, BOOL sensitive)
#define okChildString(sect, key, expect) \
do { \
char* result = getChildString((sect), (key)); \
ok(strCmp(result, expect, 1) == 0, "%s:%s expected '%s', got '%s'", (sect), (key), (expect)?(expect):"(null)", result); \
ok(strCmp(result, expect, 1) == 0, "%s:%s expected '%s', got '%s'\n", (sect), (key), (expect)?(expect):"(null)", result); \
} while (0)
#define okChildIString(sect, key, expect) \
do { \
char* result = getChildString(sect, key); \
ok(strCmp(result, expect, 0) == 0, "%s:%s expected '%s', got '%s'", sect, key, expect, result); \
ok(strCmp(result, expect, 0) == 0, "%s:%s expected '%s', got '%s'\n", sect, key, expect, result); \
} while (0)
/* using !expect insures that the test will fail if the sect/key isn't present
@ -418,7 +418,7 @@ static int strCmp(const char* s1, const char* s2, BOOL sensitive)
#define okChildInt(sect, key, expect) \
do { \
UINT result = GetPrivateProfileIntA((sect), (key), !(expect), resfile); \
ok(result == expect, "%s:%s expected %d, but got %d", (sect), (key), (int)(expect), result); \
ok(result == expect, "%s:%s expected %d, but got %d\n", (sect), (key), (int)(expect), result); \
} while (0)
static void test_Startup(void)
@ -435,9 +435,9 @@ static void test_Startup(void)
get_file_name(resfile);
sprintf(buffer, "%s tests/process.c %s", selfname, resfile);
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess");
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n");
/* wait for child to terminate */
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination");
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
/* child process has changed result file, so let profile functions know about it */
WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
@ -474,9 +474,9 @@ static void test_Startup(void)
get_file_name(resfile);
sprintf(buffer, "%s tests/process.c %s", selfname, resfile);
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess");
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n");
/* wait for child to terminate */
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination");
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
/* child process has changed result file, so let profile functions know about it */
WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
@ -512,9 +512,9 @@ static void test_Startup(void)
get_file_name(resfile);
sprintf(buffer, "%s tests/process.c %s", selfname, resfile);
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess");
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n");
/* wait for child to terminate */
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination");
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
/* child process has changed result file, so let profile functions know about it */
WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
@ -550,9 +550,9 @@ static void test_Startup(void)
get_file_name(resfile);
sprintf(buffer, "%s tests/process.c %s", selfname, resfile);
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess");
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n");
/* wait for child to terminate */
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination");
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
/* child process has changed result file, so let profile functions know about it */
WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
@ -588,9 +588,9 @@ static void test_Startup(void)
get_file_name(resfile);
sprintf(buffer, "%s tests/process.c %s", selfname, resfile);
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess");
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n");
/* wait for child to terminate */
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination");
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
/* child process has changed result file, so let profile functions know about it */
WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
@ -626,9 +626,9 @@ static void test_Startup(void)
get_file_name(resfile);
sprintf(buffer, "%s tests/process.c %s", selfname, resfile);
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess");
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n");
/* wait for child to terminate */
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination");
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
/* child process has changed result file, so let profile functions know about it */
WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
@ -664,9 +664,9 @@ static void test_Startup(void)
get_file_name(resfile);
sprintf(buffer, "%s tests/process.c %s", selfname, resfile);
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess");
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n");
/* wait for child to terminate */
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination");
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
/* child process has changed result file, so let profile functions know about it */
WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
@ -702,9 +702,9 @@ static void test_CommandLine(void)
/* the basics */
get_file_name(resfile);
sprintf(buffer, "%s tests/process.c %s \"C:\\Program Files\\my nice app.exe\"", selfname, resfile);
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess");
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n");
/* wait for child to terminate */
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination");
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
/* child process has changed result file, so let profile functions know about it */
WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
@ -723,9 +723,9 @@ static void test_CommandLine(void)
/* from Frangois */
get_file_name(resfile);
sprintf(buffer, "%s tests/process.c %s \"a\\\"b\\\\\" c\\\" d", selfname, resfile);
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess");
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n");
/* wait for child to terminate */
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination");
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
/* child process has changed result file, so let profile functions know about it */
WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
@ -755,9 +755,9 @@ static void test_Directory(void)
get_file_name(resfile);
sprintf(buffer, "%s tests/process.c %s", selfname, resfile);
GetWindowsDirectoryA( windir, sizeof(windir) );
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, windir, &startup, &info), "CreateProcess");
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, windir, &startup, &info), "CreateProcess\n");
/* wait for child to terminate */
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination");
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
/* child process has changed result file, so let profile functions know about it */
WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
@ -798,7 +798,7 @@ static void cmpEnvironment(const char* gesA)
break;
}
found = i < clen;
ok(found, "Parent-env string %s isn't in child process", ptrA);
ok(found, "Parent-env string %s isn't in child process\n", ptrA);
ptrA += strlen(ptrA) + 1;
release_memory();
@ -823,7 +823,7 @@ static void cmpEnvironment(const char* gesA)
if (!is_str_env_drive_dir(res))
{
found = ptrA != NULL;
ok(found, "Child-env string %s isn't in parent process", res);
ok(found, "Child-env string %s isn't in parent process\n", res);
}
/* else => should also test we get the right per drive default directory here... */
}
@ -846,9 +846,9 @@ static void test_Environment(void)
/* the basics */
get_file_name(resfile);
sprintf(buffer, "%s tests/process.c %s", selfname, resfile);
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess");
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n");
/* wait for child to terminate */
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination");
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
/* child process has changed result file, so let profile functions know about it */
WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
@ -889,9 +889,9 @@ static void test_Environment(void)
}
}
*ptr = '\0';
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, child_env, NULL, &startup, &info), "CreateProcess");
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, child_env, NULL, &startup, &info), "CreateProcess\n");
/* wait for child to terminate */
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination");
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
/* child process has changed result file, so let profile functions know about it */
WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
@ -916,15 +916,15 @@ static void test_SuspendFlag(void)
get_file_name(resfile);
sprintf(buffer, "%s tests/process.c %s", selfname, resfile);
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, CREATE_SUSPENDED, NULL, NULL, &startup, &info), "CreateProcess");
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, CREATE_SUSPENDED, NULL, NULL, &startup, &info), "CreateProcess\n");
ok(GetExitCodeThread(info.hThread, &exit_status) && exit_status == STILL_ACTIVE, "thread still running");
ok(GetExitCodeThread(info.hThread, &exit_status) && exit_status == STILL_ACTIVE, "thread still running\n");
Sleep(8000);
ok(GetExitCodeThread(info.hThread, &exit_status) && exit_status == STILL_ACTIVE, "thread still running");
ok(ResumeThread(info.hThread) == 1, "Resuming thread");
ok(GetExitCodeThread(info.hThread, &exit_status) && exit_status == STILL_ACTIVE, "thread still running\n");
ok(ResumeThread(info.hThread) == 1, "Resuming thread\n");
/* wait for child to terminate */
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination");
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
/* child process has changed result file, so let profile functions know about it */
WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
@ -960,19 +960,19 @@ static void test_DebuggingFlag(void)
get_file_name(resfile);
sprintf(buffer, "%s tests/process.c %s", selfname, resfile);
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, DEBUG_PROCESS, NULL, NULL, &startup, &info), "CreateProcess");
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, DEBUG_PROCESS, NULL, NULL, &startup, &info), "CreateProcess\n");
/* get all startup events up to the entry point break exception */
do
{
ok(WaitForDebugEvent(&de, INFINITE), "reading debug event");
ok(WaitForDebugEvent(&de, INFINITE), "reading debug event\n");
ContinueDebugEvent(de.dwProcessId, de.dwThreadId, DBG_CONTINUE);
if (de.dwDebugEventCode != EXCEPTION_DEBUG_EVENT) dbg++;
} while (de.dwDebugEventCode != EXIT_PROCESS_DEBUG_EVENT);
ok(dbg, "I have seen a debug event");
ok(dbg, "I have seen a debug event\n");
/* wait for child to terminate */
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination");
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
/* child process has changed result file, so let profile functions know about it */
WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
@ -1027,29 +1027,29 @@ static void test_Console(void)
startup.hStdOutput = CreateFileA("CONOUT$", GENERIC_READ|GENERIC_WRITE, 0, &sa, OPEN_EXISTING, 0, 0);
}
/* now verify everything's ok */
ok(startup.hStdInput != INVALID_HANDLE_VALUE, "Opening ConIn");
ok(startup.hStdOutput != INVALID_HANDLE_VALUE, "Opening ConOut");
ok(startup.hStdInput != INVALID_HANDLE_VALUE, "Opening ConIn\n");
ok(startup.hStdOutput != INVALID_HANDLE_VALUE, "Opening ConOut\n");
startup.hStdError = startup.hStdOutput;
ok(GetConsoleScreenBufferInfo(startup.hStdOutput, &sbi), "Getting sb info");
ok(GetConsoleScreenBufferInfo(startup.hStdOutput, &sbi), "Getting sb info\n");
ok(GetConsoleMode(startup.hStdInput, &modeIn) &&
GetConsoleMode(startup.hStdOutput, &modeOut), "Getting console modes");
GetConsoleMode(startup.hStdOutput, &modeOut), "Getting console modes\n");
cpIn = GetConsoleCP();
cpOut = GetConsoleOutputCP();
get_file_name(resfile);
sprintf(buffer, "%s tests/process.c %s console", selfname, resfile);
ok(CreateProcessA(NULL, buffer, NULL, NULL, TRUE, 0, NULL, NULL, &startup, &info), "CreateProcess");
ok(CreateProcessA(NULL, buffer, NULL, NULL, TRUE, 0, NULL, NULL, &startup, &info), "CreateProcess\n");
/* wait for child to terminate */
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination");
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
/* child process has changed result file, so let profile functions know about it */
WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
/* now get the modification the child has made, and resets parents expected values */
ok(GetConsoleScreenBufferInfo(startup.hStdOutput, &sbiC), "Getting sb info");
ok(GetConsoleScreenBufferInfo(startup.hStdOutput, &sbiC), "Getting sb info\n");
ok(GetConsoleMode(startup.hStdInput, &modeInC) &&
GetConsoleMode(startup.hStdOutput, &modeOutC), "Getting console modes");
GetConsoleMode(startup.hStdOutput, &modeOutC), "Getting console modes\n");
SetConsoleMode(startup.hStdInput, modeIn);
SetConsoleMode(startup.hStdOutput, modeOut);
@ -1092,26 +1092,26 @@ static void test_Console(void)
okChildInt("Console", "InputMode", modeIn);
okChildInt("Console", "OutputMode", modeOut);
todo_wine ok(cpInC == 1252, "Wrong console CP (expected 1252 got %ld/%ld)", cpInC, cpIn);
todo_wine ok(cpOutC == 1252, "Wrong console-SB CP (expected 1252 got %ld/%ld)", cpOutC, cpOut);
ok(modeInC == (modeIn ^ 1), "Wrong console mode");
ok(modeOutC == (modeOut ^ 1), "Wrong console-SB mode");
ok(sbiC.dwCursorPosition.X == (sbi.dwCursorPosition.X ^ 1), "Wrong cursor position");
ok(sbiC.dwCursorPosition.Y == (sbi.dwCursorPosition.Y ^ 1), "Wrong cursor position");
todo_wine ok(cpInC == 1252, "Wrong console CP (expected 1252 got %ld/%ld)\n", cpInC, cpIn);
todo_wine ok(cpOutC == 1252, "Wrong console-SB CP (expected 1252 got %ld/%ld)\n", cpOutC, cpOut);
ok(modeInC == (modeIn ^ 1), "Wrong console mode\n");
ok(modeOutC == (modeOut ^ 1), "Wrong console-SB mode\n");
ok(sbiC.dwCursorPosition.X == (sbi.dwCursorPosition.X ^ 1), "Wrong cursor position\n");
ok(sbiC.dwCursorPosition.Y == (sbi.dwCursorPosition.Y ^ 1), "Wrong cursor position\n");
release_memory();
assert(DeleteFileA(resfile) != 0);
ok(CreatePipe(&hParentIn, &hChildOut, NULL, 0), "Creating parent-input pipe");
ok(CreatePipe(&hParentIn, &hChildOut, NULL, 0), "Creating parent-input pipe\n");
ok(DuplicateHandle(GetCurrentProcess(), hChildOut, GetCurrentProcess(),
&hChildOutInh, 0, TRUE, DUPLICATE_SAME_ACCESS),
"Duplicating as inheritable child-output pipe");
"Duplicating as inheritable child-output pipe\n");
CloseHandle(hChildOut);
ok(CreatePipe(&hChildIn, &hParentOut, NULL, 0), "Creating parent-output pipe");
ok(CreatePipe(&hChildIn, &hParentOut, NULL, 0), "Creating parent-output pipe\n");
ok(DuplicateHandle(GetCurrentProcess(), hChildIn, GetCurrentProcess(),
&hChildInInh, 0, TRUE, DUPLICATE_SAME_ACCESS),
"Duplicating as inheritable child-input pipe");
"Duplicating as inheritable child-input pipe\n");
CloseHandle(hChildIn);
memset(&startup, 0, sizeof(startup));
@ -1124,19 +1124,19 @@ static void test_Console(void)
get_file_name(resfile);
sprintf(buffer, "%s tests/process.c %s stdhandle", selfname, resfile);
ok(CreateProcessA(NULL, buffer, NULL, NULL, TRUE, DETACHED_PROCESS, NULL, NULL, &startup, &info), "CreateProcess");
ok(CloseHandle(hChildInInh), "Closing handle");
ok(CloseHandle(hChildOutInh), "Closing handle");
ok(CreateProcessA(NULL, buffer, NULL, NULL, TRUE, DETACHED_PROCESS, NULL, NULL, &startup, &info), "CreateProcess\n");
ok(CloseHandle(hChildInInh), "Closing handle\n");
ok(CloseHandle(hChildOutInh), "Closing handle\n");
msg_len = strlen(msg) + 1;
ok(WriteFile(hParentOut, msg, msg_len, &w, NULL), "Writing to child");
ok(w == msg_len, "Should have written %u bytes, actually wrote %lu", msg_len, w);
ok(WriteFile(hParentOut, msg, msg_len, &w, NULL), "Writing to child\n");
ok(w == msg_len, "Should have written %u bytes, actually wrote %lu\n", msg_len, w);
memset(buffer, 0, sizeof(buffer));
ok(ReadFile(hParentIn, buffer, sizeof(buffer), &w, NULL), "Reading from child");
ok(strcmp(buffer, msg) == 0, "Should have received '%s'", msg);
ok(ReadFile(hParentIn, buffer, sizeof(buffer), &w, NULL), "Reading from child\n");
ok(strcmp(buffer, msg) == 0, "Should have received '%s'\n", msg);
/* wait for child to terminate */
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination");
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
/* child process has changed result file, so let profile functions know about it */
WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
@ -1161,14 +1161,14 @@ static void test_ExitCode(void)
get_file_name(resfile);
sprintf(buffer, "%s tests/process.c %s exit_code", selfname, resfile);
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0, NULL, NULL, &startup, &info), "CreateProcess");
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0, NULL, NULL, &startup, &info), "CreateProcess\n");
/* wait for child to terminate */
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination");
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
/* child process has changed result file, so let profile functions know about it */
WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
ok(GetExitCodeProcess(info.hProcess, &code), "Getting exit code");
ok(GetExitCodeProcess(info.hProcess, &code), "Getting exit code\n");
okChildInt("ExitCode", "value", code);
release_memory();
@ -1178,7 +1178,7 @@ static void test_ExitCode(void)
START_TEST(process)
{
int b = init();
ok(b, "Basic init of CreateProcess test");
ok(b, "Basic init of CreateProcess test\n");
if (!b) return;
if (myARGC >= 3)

View File

@ -79,7 +79,7 @@ static void test_profile_int(void)
res = GetPrivateProfileIntA(profileInt[i].section, profileInt[i].key,
profileInt[i].defaultVal, profileInt[i].iniFile);
ok(res == profileInt[i].result, "test<%02d>: ret<%010u> exp<%010u>",
ok(res == profileInt[i].result, "test<%02d>: ret<%010u> exp<%010u>\n",
i, res, profileInt[i].result);
}

View File

@ -92,7 +92,7 @@ VOID WINAPI threadFunc1(t1Struct *tstruct)
/* write our thread # into shared memory */
tstruct->threadmem[tstruct->threadnum]=GetCurrentThreadId();
ok(TlsSetValue(tlsIndex,(LPVOID)(tstruct->threadnum+1))!=0,
"TlsSetValue failed");
"TlsSetValue failed\n");
/* The threads synchronize before terminating. This is done by
Signaling an event, and waiting for all events to occur
*/
@ -106,7 +106,7 @@ VOID WINAPI threadFunc1(t1Struct *tstruct)
}
/* Check that noone cahnged our tls memory */
ok((int)TlsGetValue(tlsIndex)-1==tstruct->threadnum,
"TlsGetValue failed");
"TlsGetValue failed\n");
ExitThread(NUM_THREADS+tstruct->threadnum);
}
@ -164,7 +164,7 @@ VOID test_CreateThread_basic()
/* Retrieve current Thread ID for later comparisons */
curthreadId=GetCurrentThreadId();
/* Allocate some local storage */
ok((tlsIndex=TlsAlloc())!=TLS_OUT_OF_INDEXES,"TlsAlloc failed");
ok((tlsIndex=TlsAlloc())!=TLS_OUT_OF_INDEXES,"TlsAlloc failed\n");
/* Create events for thread synchronization */
for(i=0;i<NUM_THREADS;i++) {
threadmem[i]=0;
@ -181,17 +181,17 @@ VOID test_CreateThread_basic()
for(i=0;i<NUM_THREADS;i++) {
thread[i] = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)threadFunc1,
&tstruct[i],0,&threadid[i]);
ok(thread[i]!=NULL,"Create Thread failed.");
ok(thread[i]!=NULL,"Create Thread failed\n");
}
/* Test that the threads actually complete */
for(i=0;i<NUM_THREADS;i++) {
error=WaitForSingleObject(thread[i],5000);
ok(error==WAIT_OBJECT_0, "Thread did not complete within timelimit");
ok(error==WAIT_OBJECT_0, "Thread did not complete within timelimit\n");
if(error!=WAIT_OBJECT_0) {
TerminateThread(thread[i],i+NUM_THREADS);
}
ok(GetExitCodeThread(thread[i],&exitCode),"Could not retrieve ext code");
ok(exitCode==i+NUM_THREADS,"Thread returned an incorrect exit code");
ok(GetExitCodeThread(thread[i],&exitCode),"Could not retrieve ext code\n");
ok(exitCode==i+NUM_THREADS,"Thread returned an incorrect exit code\n");
}
/* Test that each thread executed in its parent's address space
(it was able to change threadmem and pass that change back to its parent)
@ -207,10 +207,10 @@ VOID test_CreateThread_basic()
}
}
ok(!error && threadmem[i]==threadid[i] && threadmem[i]!=curthreadId,
"Thread did not execute successfully");
ok(CloseHandle(thread[i])!=0,"CloseHandle failed");
"Thread did not execute successfully\n");
ok(CloseHandle(thread[i])!=0,"CloseHandle failed\n");
}
ok(TlsFree(tlsIndex)!=0,"TlsFree failed");
ok(TlsFree(tlsIndex)!=0,"TlsFree failed\n");
}
/* Check that using the CREATE_SUSPENDED flag works */
@ -222,24 +222,24 @@ VOID test_CreateThread_suspended()
thread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)threadFunc2,NULL,
CREATE_SUSPENDED,&threadId);
ok(thread!=NULL,"Create Thread failed.");
ok(thread!=NULL,"Create Thread failed\n");
/* Check that the thread is suspended */
ok(SuspendThread(thread)==1,"Thread did not start suspended");
ok(ResumeThread(thread)==2,"Resume thread returned an invalid value");
ok(SuspendThread(thread)==1,"Thread did not start suspended\n");
ok(ResumeThread(thread)==2,"Resume thread returned an invalid value\n");
/* Check that resume thread didn't actually start the thread. I can't think
of a better way of checking this than just waiting. I am not sure if this
will work on slow computers.
*/
ok(WaitForSingleObject(thread,1000)==WAIT_TIMEOUT,
"ResumeThread should not have actually started the thread");
"ResumeThread should not have actually started the thread\n");
/* Now actually resume the thread and make sure that it actually completes*/
ok(ResumeThread(thread)==1,"Resume thread returned an invalid value");
ok(ResumeThread(thread)==1,"Resume thread returned an invalid value\n");
ok((error=WaitForSingleObject(thread,1000))==WAIT_OBJECT_0,
"Thread did not resume");
"Thread did not resume\n");
if(error!=WAIT_OBJECT_0) {
TerminateThread(thread,1);
}
ok(CloseHandle(thread)!=0,"CloseHandle failed");
ok(CloseHandle(thread)!=0,"CloseHandle failed\n");
}
/* Check that SuspendThread and ResumeThread work */
@ -251,7 +251,7 @@ VOID test_SuspendThread()
thread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)threadFunc3,NULL,
0,&threadId);
ok(thread!=NULL,"Create Thread failed.");
ok(thread!=NULL,"Create Thread failed\n");
/* Check that the thread is suspended */
/* Note that this is a polling method, and there is a race between
SuspendThread being called (in the child, and the loop below timing out,
@ -266,36 +266,36 @@ VOID test_SuspendThread()
i++;
}
}
ok(error==1,"SuspendThread did not work");
ok(error==1,"SuspendThread did not work\n");
/* check that access restrictions are obeyed */
if (pOpenThread) {
access_thread=pOpenThread(THREAD_ALL_ACCESS & (~THREAD_SUSPEND_RESUME),
0,threadId);
ok(access_thread!=NULL,"OpenThread returned an invalid handle");
ok(access_thread!=NULL,"OpenThread returned an invalid handle\n");
if (access_thread!=NULL) {
ok(SuspendThread(access_thread)==-1,
"SuspendThread did not obey access restrictions");
"SuspendThread did not obey access restrictions\n");
ok(ResumeThread(access_thread)==-1,
"ResumeThread did not obey access restrictions");
ok(CloseHandle(access_thread)!=0,"CloseHandle Failed");
"ResumeThread did not obey access restrictions\n");
ok(CloseHandle(access_thread)!=0,"CloseHandle Failed\n");
}
}
/* Double check that the thread really is suspended */
ok((error=GetExitCodeThread(thread,&exitCode))!=0 && exitCode==STILL_ACTIVE,
"Thread did not really suspend");
"Thread did not really suspend\n");
/* Resume the thread, and make sure it actually completes */
ok(ResumeThread(thread)==1,"Resume thread returned an invalid value");
ok(ResumeThread(thread)==1,"Resume thread returned an invalid value\n");
ok((error=WaitForSingleObject(thread,1000))==WAIT_OBJECT_0,
"Thread did not resume");
"Thread did not resume\n");
if(error!=WAIT_OBJECT_0) {
TerminateThread(thread,1);
}
/* Trying to suspend a terminated thread should fail */
error=SuspendThread(thread);
ok(error==0xffffffff, "wrong return code: %d", error);
ok(GetLastError()==ERROR_ACCESS_DENIED || GetLastError()==ERROR_NO_MORE_ITEMS, "unexpected error code: %ld", GetLastError());
ok(error==0xffffffff, "wrong return code: %d\n", error);
ok(GetLastError()==ERROR_ACCESS_DENIED || GetLastError()==ERROR_NO_MORE_ITEMS, "unexpected error code: %ld\n", GetLastError());
ok(CloseHandle(thread)!=0,"CloseHandle Failed");
ok(CloseHandle(thread)!=0,"CloseHandle Failed\n");
}
/* Check that TerminateThread works properly
@ -309,33 +309,33 @@ VOID test_TerminateThread()
event=CreateEventA(NULL,TRUE,FALSE,NULL);
thread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)threadFunc4,
(LPVOID)event, 0,&threadId);
ok(thread!=NULL,"Create Thread failed.");
ok(thread!=NULL,"Create Thread failed\n");
/* Terminate thread has a race condition in Wine. If the thread is terminated
before it starts, it leaves a process behind. Therefore, we wait for the
thread to signal that it has started. There is no easy way to force the
race to occur, so we don't try to find it.
*/
ok(WaitForSingleObject(event,5000)==WAIT_OBJECT_0,
"TerminateThread didn't work");
"TerminateThread didn't work\n");
/* check that access restrictions are obeyed */
if (pOpenThread) {
access_thread=pOpenThread(THREAD_ALL_ACCESS & (~THREAD_TERMINATE),
0,threadId);
ok(access_thread!=NULL,"OpenThread returned an invalid handle");
ok(access_thread!=NULL,"OpenThread returned an invalid handle\n");
if (access_thread!=NULL) {
ok(TerminateThread(access_thread,99)==0,
"TerminateThread did not obey access restrictions");
ok(CloseHandle(access_thread)!=0,"CloseHandle Failed");
"TerminateThread did not obey access restrictions\n");
ok(CloseHandle(access_thread)!=0,"CloseHandle Failed\n");
}
}
/* terminate a job and make sure it terminates */
ok(TerminateThread(thread,99)!=0,"TerminateThread failed");
ok(TerminateThread(thread,99)!=0,"TerminateThread failed\n");
ok(WaitForSingleObject(thread,5000)==WAIT_OBJECT_0,
"TerminateThread didn't work");
"TerminateThread didn't work\n");
ok(GetExitCodeThread(thread,&exitCode)!=STILL_ACTIVE,
"TerminateThread should not leave the thread 'STILL_ACTIVE'");
ok(exitCode==99, "TerminateThread returned invalid exit code");
ok(CloseHandle(thread)!=0,"Error Closing thread handle");
"TerminateThread should not leave the thread 'STILL_ACTIVE'\n");
ok(exitCode==99, "TerminateThread returned invalid exit code\n");
ok(CloseHandle(thread)!=0,"Error Closing thread handle\n");
}
/* Check if CreateThread obeys the specified stack size. This code does
@ -356,14 +356,14 @@ VOID test_CreateThread_stack()
SYSTEM_INFO sysInfo;
sysInfo.dwPageSize=0;
GetSystemInfo(&sysInfo);
ok(sysInfo.dwPageSize>0,"GetSystemInfo should return a valid page size");
ok(sysInfo.dwPageSize>0,"GetSystemInfo should return a valid page size\n");
thread = CreateThread(NULL,sysInfo.dwPageSize,
(LPTHREAD_START_ROUTINE)threadFunc5,&exitCode,
0,&threadId);
ok(WaitForSingleObject(thread,5000)==WAIT_OBJECT_0,
"TerminateThread didn't work");
ok(exitCode==1,"CreateThread did not obey stack-size-limit");
ok(CloseHandle(thread)!=0,"CloseHandle failed");
"TerminateThread didn't work\n");
ok(exitCode==1,"CreateThread did not obey stack-size-limit\n");
ok(CloseHandle(thread)!=0,"CloseHandle failed\n");
#endif
}
@ -385,28 +385,28 @@ VOID test_thread_priority()
anyway, enable USE_EXTENDED_PRIORITIES
*/
ok(GetThreadPriority(curthread)==THREAD_PRIORITY_NORMAL,
"GetThreadPriority Failed");
"GetThreadPriority Failed\n");
if (pOpenThread) {
/* check that access control is obeyed */
access_thread=pOpenThread(THREAD_ALL_ACCESS &
(~THREAD_QUERY_INFORMATION) & (~THREAD_SET_INFORMATION),
0,curthreadId);
ok(access_thread!=NULL,"OpenThread returned an invalid handle");
ok(access_thread!=NULL,"OpenThread returned an invalid handle\n");
if (access_thread!=NULL) {
ok(SetThreadPriority(access_thread,1)==0,
"SetThreadPriority did not obey access restrictions");
"SetThreadPriority did not obey access restrictions\n");
ok(GetThreadPriority(access_thread)==THREAD_PRIORITY_ERROR_RETURN,
"GetThreadPriority did not obey access restrictions");
"GetThreadPriority did not obey access restrictions\n");
if (pSetThreadPriorityBoost)
ok(pSetThreadPriorityBoost(access_thread,1)==0,
"SetThreadPriorityBoost did not obey access restrictions");
"SetThreadPriorityBoost did not obey access restrictions\n");
if (pGetThreadPriorityBoost)
ok(pGetThreadPriorityBoost(access_thread,&disabled)==0,
"GetThreadPriorityBoost did not obey access restrictions");
"GetThreadPriorityBoost did not obey access restrictions\n");
ok(GetExitCodeThread(access_thread,&exitCode)==0,
"GetExitCodeThread did not obey access restrictions");
ok(CloseHandle(access_thread),"Error Closing thread handle");
"GetExitCodeThread did not obey access restrictions\n");
ok(CloseHandle(access_thread),"Error Closing thread handle\n");
}
#if USE_EXTENDED_PRIORITIES
min_priority=-7; max_priority=6;
@ -414,19 +414,19 @@ VOID test_thread_priority()
}
for(i=min_priority;i<=max_priority;i++) {
ok(SetThreadPriority(curthread,i)!=0,
"SetThreadPriority Failed for priority: %d",i);
"SetThreadPriority Failed for priority: %d\n",i);
ok(GetThreadPriority(curthread)==i,
"GetThreadPriority Failed for priority: %d",i);
"GetThreadPriority Failed for priority: %d\n",i);
}
ok(SetThreadPriority(curthread,THREAD_PRIORITY_TIME_CRITICAL)!=0,
"SetThreadPriority Failed");
"SetThreadPriority Failed\n");
ok(GetThreadPriority(curthread)==THREAD_PRIORITY_TIME_CRITICAL,
"GetThreadPriority Failed");
"GetThreadPriority Failed\n");
ok(SetThreadPriority(curthread,THREAD_PRIORITY_IDLE)!=0,
"SetThreadPriority Failed");
"SetThreadPriority Failed\n");
ok(GetThreadPriority(curthread)==THREAD_PRIORITY_IDLE,
"GetThreadPriority Failed");
ok(SetThreadPriority(curthread,0)!=0,"SetThreadPriority Failed");
"GetThreadPriority Failed\n");
ok(SetThreadPriority(curthread,0)!=0,"SetThreadPriority Failed\n");
/* Check thread priority boost */
if (pGetThreadPriorityBoost && pSetThreadPriorityBoost) {
@ -435,19 +435,19 @@ VOID test_thread_priority()
SetLastError(0);
rc=pGetThreadPriorityBoost(curthread,&disabled);
if (rc!=0 || GetLastError()!=ERROR_CALL_NOT_IMPLEMENTED) {
ok(rc!=0,"error=%ld",GetLastError());
ok(rc!=0,"error=%ld\n",GetLastError());
ok(pSetThreadPriorityBoost(curthread,1)!=0,
"error=%ld",GetLastError());
"error=%ld\n",GetLastError());
rc=pGetThreadPriorityBoost(curthread,&disabled);
ok(rc!=0 && disabled==1,
"rc=%d error=%ld disabled=%d",rc,GetLastError(),disabled);
"rc=%d error=%ld disabled=%d\n",rc,GetLastError(),disabled);
ok(pSetThreadPriorityBoost(curthread,0)!=0,
"error=%ld",GetLastError());
"error=%ld\n",GetLastError());
rc=pGetThreadPriorityBoost(curthread,&disabled);
ok(rc!=0 && disabled==0,
"rc=%d error=%ld disabled=%d",rc,GetLastError(),disabled);
"rc=%d error=%ld disabled=%d\n",rc,GetLastError(),disabled);
}
}
}
@ -464,22 +464,22 @@ VOID test_GetThreadTimes()
thread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)threadFunc2,NULL,
CREATE_SUSPENDED,&threadId);
ok(thread!=NULL,"Create Thread failed.");
ok(thread!=NULL,"Create Thread failed\n");
/* check that access control is obeyed */
if (pOpenThread) {
access_thread=pOpenThread(THREAD_ALL_ACCESS &
(~THREAD_QUERY_INFORMATION), 0,threadId);
ok(access_thread!=NULL,
"OpenThread returned an invalid handle");
"OpenThread returned an invalid handle\n");
}
ok(ResumeThread(thread)==1,"Resume thread returned an invalid value");
ok(ResumeThread(thread)==1,"Resume thread returned an invalid value\n");
ok(WaitForSingleObject(thread,5000)==WAIT_OBJECT_0,
"ResumeThread didn't work");
"ResumeThread didn't work\n");
if(access_thread!=NULL) {
error=GetThreadTimes(access_thread,&creationTime,&exitTime,
&kernelTime,&userTime);
ok(error==0, "GetThreadTimes did not obey access restrictions");
ok(CloseHandle(access_thread)!=0,"CloseHandle Failed");
ok(error==0, "GetThreadTimes did not obey access restrictions\n");
ok(CloseHandle(access_thread)!=0,"CloseHandle Failed\n");
}
creationTime.dwLowDateTime=99; creationTime.dwHighDateTime=99;
exitTime.dwLowDateTime=99; exitTime.dwHighDateTime=99;
@ -489,16 +489,16 @@ VOID test_GetThreadTimes()
error=GetThreadTimes(thread,&creationTime,&exitTime,
&kernelTime,&userTime);
if (error!=0 || GetLastError()!=ERROR_CALL_NOT_IMPLEMENTED) {
ok(error!=0,"GetThreadTimes failed");
ok(error!=0,"GetThreadTimes failed\n");
ok(creationTime.dwLowDateTime!=99 || creationTime.dwHighDateTime!=99,
"creationTime was invalid");
"creationTime was invalid\n");
ok(exitTime.dwLowDateTime!=99 || exitTime.dwHighDateTime!=99,
"exitTime was invalid");
"exitTime was invalid\n");
ok(kernelTime.dwLowDateTime!=99 || kernelTime.dwHighDateTime!=99,
"kernelTimewas invalid");
"kernelTimewas invalid\n");
ok(userTime.dwLowDateTime!=99 || userTime.dwHighDateTime!=99,
"userTime was invalid");
ok(CloseHandle(thread)!=0,"CloseHandle failed");
"userTime was invalid\n");
ok(CloseHandle(thread)!=0,"CloseHandle failed\n");
}
}
@ -515,35 +515,35 @@ VOID test_thread_processor()
sysInfo.dwNumberOfProcessors=0;
GetSystemInfo(&sysInfo);
ok(sysInfo.dwNumberOfProcessors>0,
"GetSystemInfo failed to return a valid # of processors");
"GetSystemInfo failed to return a valid # of processors\n");
/* Use the current Thread/process for all tests */
curthread=GetCurrentThread();
ok(curthread!=NULL,"GetCurrentThread failed");
ok(curthread!=NULL,"GetCurrentThread failed\n");
curproc=GetCurrentProcess();
ok(curproc!=NULL,"GetCurrentProcess failed");
ok(curproc!=NULL,"GetCurrentProcess failed\n");
/* Check the Affinity Mask functions */
ok(GetProcessAffinityMask(curproc,&processMask,&systemMask)!=0,
"GetProcessAffinityMask failed");
"GetProcessAffinityMask failed\n");
ok(SetThreadAffinityMask(curthread,processMask)==1,
"SetThreadAffinityMask failed");
"SetThreadAffinityMask failed\n");
ok(SetThreadAffinityMask(curthread,processMask+1)==0,
"SetThreadAffinityMask passed for an illegal processor");
"SetThreadAffinityMask passed for an illegal processor\n");
/* NOTE: This only works on WinNT/2000/XP) */
if (pSetThreadIdealProcessor) {
todo_wine {
SetLastError(0);
error=pSetThreadIdealProcessor(curthread,0);
if (GetLastError()!=ERROR_CALL_NOT_IMPLEMENTED) {
ok(error!=-1, "SetThreadIdealProcessor failed");
ok(error!=-1, "SetThreadIdealProcessor failed\n");
}
}
if (GetLastError()!=ERROR_CALL_NOT_IMPLEMENTED) {
error=pSetThreadIdealProcessor(curthread,MAXIMUM_PROCESSORS+1);
ok(error==-1,
"SetThreadIdealProcessor succeeded with an illegal processor #");
"SetThreadIdealProcessor succeeded with an illegal processor #\n");
todo_wine {
error=pSetThreadIdealProcessor(curthread,MAXIMUM_PROCESSORS);
ok(error==0, "SetThreadIdealProcessor returned an incorrect value");
ok(error==0, "SetThreadIdealProcessor returned an incorrect value\n");
}
}
}
@ -556,7 +556,7 @@ START_TEST(thread)
so that the compile passes
*/
lib=LoadLibraryA("kernel32");
ok(lib!=NULL,"Couldn't load kernel32.dll");
ok(lib!=NULL,"Couldn't load kernel32.dll\n");
pGetThreadPriorityBoost=(GetThreadPriorityBoost_t)GetProcAddress(lib,"GetThreadPriorityBoost");
pOpenThread=(OpenThread_t)GetProcAddress(lib,"OpenThread");
pSetThreadIdealProcessor=(SetThreadIdealProcessor_t)GetProcAddress(lib,"SetThreadIdealProcessor");