Commit e18aa3f6 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

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

parent 4e47ccb4
...@@ -68,7 +68,7 @@ static void test_enum_value(void) ...@@ -68,7 +68,7 @@ static void test_enum_value(void)
static const WCHAR xxxW[] = {'x','x','x','x','x','x','x','x',0}; static const WCHAR xxxW[] = {'x','x','x','x','x','x','x','x',0};
res = RegSetValueExA( hkey_main, "Test", 0, REG_SZ, (BYTE *)"foobar", 7 ); res = RegSetValueExA( hkey_main, "Test", 0, REG_SZ, (BYTE *)"foobar", 7 );
ok( res == 0, "RegSetValueExA failed error %ld", res ); ok( res == 0, "RegSetValueExA failed error %ld\n", res );
/* overflow both name and data */ /* overflow both name and data */
val_count = 2; val_count = 2;
...@@ -77,12 +77,12 @@ static void test_enum_value(void) ...@@ -77,12 +77,12 @@ static void test_enum_value(void)
strcpy( value, "xxxxxxxxxx" ); strcpy( value, "xxxxxxxxxx" );
strcpy( data, "xxxxxxxxxx" ); strcpy( data, "xxxxxxxxxx" );
res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count ); res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld", res ); ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res );
ok( val_count == 2, "val_count set to %ld", val_count ); ok( val_count == 2, "val_count set to %ld\n", val_count );
ok( data_count == 7, "data_count set to %ld instead of 7", data_count ); ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ", type ); ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
ok( !strcmp( value, "xxxxxxxxxx" ), "value set to '%s'", value ); ok( !strcmp( value, "xxxxxxxxxx" ), "value set to '%s'\n", value );
ok( !strcmp( data, "xxxxxxxxxx" ), "data set to '%s'", data ); ok( !strcmp( data, "xxxxxxxxxx" ), "data set to '%s'\n", data );
/* overflow name */ /* overflow name */
val_count = 3; val_count = 3;
...@@ -91,15 +91,15 @@ static void test_enum_value(void) ...@@ -91,15 +91,15 @@ static void test_enum_value(void)
strcpy( value, "xxxxxxxxxx" ); strcpy( value, "xxxxxxxxxx" );
strcpy( data, "xxxxxxxxxx" ); strcpy( data, "xxxxxxxxxx" );
res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count ); res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld", res ); ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res );
/* Win9x returns 2 as specified by MSDN but NT returns 3... */ /* Win9x returns 2 as specified by MSDN but NT returns 3... */
ok( val_count == 2 || val_count == 3, "val_count set to %ld", val_count ); ok( val_count == 2 || val_count == 3, "val_count set to %ld\n", val_count );
ok( data_count == 7, "data_count set to %ld instead of 7", data_count ); ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ", type ); ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
#if 0 #if 0
/* v5.1.2600.0 (XP Home) does not touch value or data in this case */ /* v5.1.2600.0 (XP Home) does not touch value or data in this case */
ok( !strcmp( value, "Te" ), "value set to '%s' instead of 'Te'", value ); ok( !strcmp( value, "Te" ), "value set to '%s' instead of 'Te'\n", value );
ok( !strcmp( data, "foobar" ), "data set to '%s' instead of 'foobar'", data ); ok( !strcmp( data, "foobar" ), "data set to '%s' instead of 'foobar'\n", data );
#endif #endif
/* overflow empty name */ /* overflow empty name */
...@@ -109,14 +109,14 @@ static void test_enum_value(void) ...@@ -109,14 +109,14 @@ static void test_enum_value(void)
strcpy( value, "xxxxxxxxxx" ); strcpy( value, "xxxxxxxxxx" );
strcpy( data, "xxxxxxxxxx" ); strcpy( data, "xxxxxxxxxx" );
res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count ); res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld", res ); ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res );
ok( val_count == 0, "val_count set to %ld", val_count ); ok( val_count == 0, "val_count set to %ld\n", val_count );
ok( data_count == 7, "data_count set to %ld instead of 7", data_count ); ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ", type ); ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
ok( !strcmp( value, "xxxxxxxxxx" ), "value set to '%s'", value ); ok( !strcmp( value, "xxxxxxxxxx" ), "value set to '%s'\n", value );
#if 0 #if 0
/* v5.1.2600.0 (XP Home) does not touch data in this case */ /* v5.1.2600.0 (XP Home) does not touch data in this case */
ok( !strcmp( data, "foobar" ), "data set to '%s' instead of 'foobar'", data ); ok( !strcmp( data, "foobar" ), "data set to '%s' instead of 'foobar'\n", data );
#endif #endif
/* overflow data */ /* overflow data */
...@@ -126,12 +126,12 @@ static void test_enum_value(void) ...@@ -126,12 +126,12 @@ static void test_enum_value(void)
strcpy( value, "xxxxxxxxxx" ); strcpy( value, "xxxxxxxxxx" );
strcpy( data, "xxxxxxxxxx" ); strcpy( data, "xxxxxxxxxx" );
res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count ); res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld", res ); ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res );
ok( val_count == 20, "val_count set to %ld", val_count ); ok( val_count == 20, "val_count set to %ld\n", val_count );
ok( data_count == 7, "data_count set to %ld instead of 7", data_count ); ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ", type ); ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
ok( !strcmp( value, "xxxxxxxxxx" ), "value set to '%s'", value ); ok( !strcmp( value, "xxxxxxxxxx" ), "value set to '%s'\n", value );
ok( !strcmp( data, "xxxxxxxxxx" ), "data set to '%s'", data ); ok( !strcmp( data, "xxxxxxxxxx" ), "data set to '%s'\n", data );
/* no overflow */ /* no overflow */
val_count = 20; val_count = 20;
...@@ -140,12 +140,12 @@ static void test_enum_value(void) ...@@ -140,12 +140,12 @@ static void test_enum_value(void)
strcpy( value, "xxxxxxxxxx" ); strcpy( value, "xxxxxxxxxx" );
strcpy( data, "xxxxxxxxxx" ); strcpy( data, "xxxxxxxxxx" );
res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count ); res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count );
ok( res == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld", res ); ok( res == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", res );
ok( val_count == 4, "val_count set to %ld instead of 4", val_count ); ok( val_count == 4, "val_count set to %ld instead of 4\n", val_count );
ok( data_count == 7, "data_count set to %ld instead of 7", data_count ); ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ", type ); ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
ok( !strcmp( value, "Test" ), "value is '%s' instead of Test", value ); ok( !strcmp( value, "Test" ), "value is '%s' instead of Test\n", value );
ok( !strcmp( data, "foobar" ), "data is '%s' instead of foobar", data ); ok( !strcmp( data, "foobar" ), "data is '%s' instead of foobar\n", data );
/* Unicode tests */ /* Unicode tests */
...@@ -153,7 +153,7 @@ static void test_enum_value(void) ...@@ -153,7 +153,7 @@ static void test_enum_value(void)
res = RegSetValueExW( hkey_main, testW, 0, REG_SZ, (BYTE *)foobarW, 7*sizeof(WCHAR) ); res = RegSetValueExW( hkey_main, testW, 0, REG_SZ, (BYTE *)foobarW, 7*sizeof(WCHAR) );
if (res==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED) if (res==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
goto CLEANUP; goto CLEANUP;
ok( res == 0, "RegSetValueExW failed error %ld", res ); ok( res == 0, "RegSetValueExW failed error %ld\n", res );
/* overflow both name and data */ /* overflow both name and data */
val_count = 2; val_count = 2;
...@@ -162,12 +162,12 @@ static void test_enum_value(void) ...@@ -162,12 +162,12 @@ static void test_enum_value(void)
memcpy( valueW, xxxW, sizeof(xxxW) ); memcpy( valueW, xxxW, sizeof(xxxW) );
memcpy( dataW, xxxW, sizeof(xxxW) ); memcpy( dataW, xxxW, sizeof(xxxW) );
res = RegEnumValueW( hkey_main, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count ); res = RegEnumValueW( hkey_main, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld", res ); ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res );
ok( val_count == 2, "val_count set to %ld", val_count ); ok( val_count == 2, "val_count set to %ld\n", val_count );
ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)", data_count ); ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)\n", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ", type ); ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
ok( !memcmp( valueW, xxxW, sizeof(xxxW) ), "value modified" ); ok( !memcmp( valueW, xxxW, sizeof(xxxW) ), "value modified\n" );
ok( !memcmp( dataW, xxxW, sizeof(xxxW) ), "data modified" ); ok( !memcmp( dataW, xxxW, sizeof(xxxW) ), "data modified\n" );
/* overflow name */ /* overflow name */
val_count = 3; val_count = 3;
...@@ -176,12 +176,12 @@ static void test_enum_value(void) ...@@ -176,12 +176,12 @@ static void test_enum_value(void)
memcpy( valueW, xxxW, sizeof(xxxW) ); memcpy( valueW, xxxW, sizeof(xxxW) );
memcpy( dataW, xxxW, sizeof(xxxW) ); memcpy( dataW, xxxW, sizeof(xxxW) );
res = RegEnumValueW( hkey_main, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count ); res = RegEnumValueW( hkey_main, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld", res ); ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res );
ok( val_count == 3, "val_count set to %ld", val_count ); ok( val_count == 3, "val_count set to %ld\n", val_count );
ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)", data_count ); ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)\n", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ", type ); ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
ok( !memcmp( valueW, xxxW, sizeof(xxxW) ), "value modified" ); ok( !memcmp( valueW, xxxW, sizeof(xxxW) ), "value modified\n" );
ok( !memcmp( dataW, xxxW, sizeof(xxxW) ), "data modified" ); ok( !memcmp( dataW, xxxW, sizeof(xxxW) ), "data modified\n" );
/* overflow data */ /* overflow data */
val_count = 20; val_count = 20;
...@@ -190,12 +190,12 @@ static void test_enum_value(void) ...@@ -190,12 +190,12 @@ static void test_enum_value(void)
memcpy( valueW, xxxW, sizeof(xxxW) ); memcpy( valueW, xxxW, sizeof(xxxW) );
memcpy( dataW, xxxW, sizeof(xxxW) ); memcpy( dataW, xxxW, sizeof(xxxW) );
res = RegEnumValueW( hkey_main, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count ); res = RegEnumValueW( hkey_main, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld", res ); ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res );
ok( val_count == 4, "val_count set to %ld instead of 4", val_count ); ok( val_count == 4, "val_count set to %ld instead of 4\n", val_count );
ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)", data_count ); ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)\n", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ", type ); ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
ok( !memcmp( valueW, testW, sizeof(testW) ), "value is not 'Test'" ); ok( !memcmp( valueW, testW, sizeof(testW) ), "value is not 'Test'\n" );
ok( !memcmp( dataW, xxxW, sizeof(xxxW) ), "data modified" ); ok( !memcmp( dataW, xxxW, sizeof(xxxW) ), "data modified\n" );
/* no overflow */ /* no overflow */
val_count = 20; val_count = 20;
...@@ -204,12 +204,12 @@ static void test_enum_value(void) ...@@ -204,12 +204,12 @@ static void test_enum_value(void)
memcpy( valueW, xxxW, sizeof(xxxW) ); memcpy( valueW, xxxW, sizeof(xxxW) );
memcpy( dataW, xxxW, sizeof(xxxW) ); memcpy( dataW, xxxW, sizeof(xxxW) );
res = RegEnumValueW( hkey_main, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count ); res = RegEnumValueW( hkey_main, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count );
ok( res == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld", res ); ok( res == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", res );
ok( val_count == 4, "val_count set to %ld instead of 4", val_count ); ok( val_count == 4, "val_count set to %ld instead of 4\n", val_count );
ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)", data_count ); ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)\n", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ", type ); ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
ok( !memcmp( valueW, testW, sizeof(testW) ), "value is not 'Test'" ); ok( !memcmp( valueW, testW, sizeof(testW) ), "value is not 'Test'\n" );
ok( !memcmp( dataW, foobarW, sizeof(foobarW) ), "data is not 'foobar'" ); ok( !memcmp( dataW, foobarW, sizeof(foobarW) ), "data is not 'foobar'\n" );
CLEANUP: CLEANUP:
/* cleanup */ /* cleanup */
......
...@@ -57,7 +57,7 @@ static void test_Heap(void) ...@@ -57,7 +57,7 @@ static void test_Heap(void)
/* Retrieve the page size for this system */ /* Retrieve the page size for this system */
sysInfo.dwPageSize=0; sysInfo.dwPageSize=0;
GetSystemInfo(&sysInfo); 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");
/* Create a Heap with a minimum and maximum size */ /* Create a Heap with a minimum and maximum size */
/* Note that Windows and Wine seem to behave a bit differently with respect /* Note that Windows and Wine seem to behave a bit differently with respect
...@@ -76,7 +76,7 @@ static void test_Heap(void) ...@@ -76,7 +76,7 @@ static void test_Heap(void)
nearest page boundary nearest page boundary
*/ */
mem1=HeapAlloc(heap,0,5*memchunk+1); mem1=HeapAlloc(heap,0,5*memchunk+1);
ok(mem1==NULL,"HeapCreate allocated more Ram than it should have"); ok(mem1==NULL,"HeapCreate allocated more Ram than it should have\n");
if(mem1) { if(mem1) {
HeapFree(heap,0,mem1); HeapFree(heap,0,mem1);
} }
...@@ -84,44 +84,44 @@ static void test_Heap(void) ...@@ -84,44 +84,44 @@ static void test_Heap(void)
/* Check that a normal alloc works */ /* Check that a normal alloc works */
mem1=HeapAlloc(heap,0,memchunk); mem1=HeapAlloc(heap,0,memchunk);
ok(mem1!=NULL,"HeapAlloc failed"); ok(mem1!=NULL,"HeapAlloc failed\n");
if(mem1) { if(mem1) {
ok(HeapSize(heap,0,mem1)>=memchunk, "HeapAlloc should return a big enough memory block"); ok(HeapSize(heap,0,mem1)>=memchunk, "HeapAlloc should return a big enough memory block\n");
} }
/* Check that a 'zeroing' alloc works */ /* Check that a 'zeroing' alloc works */
mem2=HeapAlloc(heap,HEAP_ZERO_MEMORY,memchunk); mem2=HeapAlloc(heap,HEAP_ZERO_MEMORY,memchunk);
ok(mem2!=NULL,"HeapAlloc failed"); ok(mem2!=NULL,"HeapAlloc failed\n");
if(mem2) { if(mem2) {
ok(HeapSize(heap,0,mem2)>=memchunk,"HeapAlloc should return a big enough memory block"); ok(HeapSize(heap,0,mem2)>=memchunk,"HeapAlloc should return a big enough memory block\n");
error=0; error=0;
for(i=0;i<memchunk;i++) { for(i=0;i<memchunk;i++) {
if(mem2[i]!=0) { if(mem2[i]!=0) {
error=1; error=1;
} }
} }
ok(!error,"HeapAlloc should have zeroed out it's allocated memory"); ok(!error,"HeapAlloc should have zeroed out it's allocated memory\n");
} }
/* Check that HeapAlloc returns NULL when requested way too much memory */ /* Check that HeapAlloc returns NULL when requested way too much memory */
mem3=HeapAlloc(heap,0,5*memchunk); mem3=HeapAlloc(heap,0,5*memchunk);
ok(mem3==NULL,"HeapAlloc should return NULL"); ok(mem3==NULL,"HeapAlloc should return NULL\n");
if(mem3) { if(mem3) {
ok(HeapFree(heap,0,mem3),"HeapFree didn't pass successfully"); ok(HeapFree(heap,0,mem3),"HeapFree didn't pass successfully\n");
} }
/* Check that HeapRealloc works */ /* Check that HeapRealloc works */
mem2a=HeapReAlloc(heap,HEAP_ZERO_MEMORY,mem2,memchunk+5*sysInfo.dwPageSize); mem2a=HeapReAlloc(heap,HEAP_ZERO_MEMORY,mem2,memchunk+5*sysInfo.dwPageSize);
ok(mem2a!=NULL,"HeapReAlloc failed"); ok(mem2a!=NULL,"HeapReAlloc failed\n");
if(mem2a) { if(mem2a) {
ok(HeapSize(heap,0,mem2a)>=memchunk+5*sysInfo.dwPageSize,"HeapReAlloc failed"); ok(HeapSize(heap,0,mem2a)>=memchunk+5*sysInfo.dwPageSize,"HeapReAlloc failed\n");
error=0; error=0;
for(i=0;i<5*sysInfo.dwPageSize;i++) { for(i=0;i<5*sysInfo.dwPageSize;i++) {
if(mem2a[memchunk+i]!=0) { if(mem2a[memchunk+i]!=0) {
error=1; error=1;
} }
} }
ok(!error,"HeapReAlloc should have zeroed out it's allocated memory"); ok(!error,"HeapReAlloc should have zeroed out it's allocated memory\n");
} }
/* Check that HeapRealloc honours HEAP_REALLOC_IN_PLACE_ONLY */ /* Check that HeapRealloc honours HEAP_REALLOC_IN_PLACE_ONLY */
...@@ -132,32 +132,32 @@ static void test_Heap(void) ...@@ -132,32 +132,32 @@ static void test_Heap(void)
error=1; error=1;
} }
} }
ok(mem1a==NULL || error==0,"HeapReAlloc didn't honour HEAP_REALLOC_IN_PLACE_ONLY"); ok(mem1a==NULL || error==0,"HeapReAlloc didn't honour HEAP_REALLOC_IN_PLACE_ONLY\n");
/* Check that HeapFree works correctly */ /* Check that HeapFree works correctly */
if(mem1a) { if(mem1a) {
ok(HeapFree(heap,0,mem1a),"HeapFree failed"); ok(HeapFree(heap,0,mem1a),"HeapFree failed\n");
} else { } else {
ok(HeapFree(heap,0,mem1),"HeapFree failed"); ok(HeapFree(heap,0,mem1),"HeapFree failed\n");
} }
if(mem2a) { if(mem2a) {
ok(HeapFree(heap,0,mem2a),"HeapFree failed"); ok(HeapFree(heap,0,mem2a),"HeapFree failed\n");
} else { } else {
ok(HeapFree(heap,0,mem2),"HeapFree failed"); ok(HeapFree(heap,0,mem2),"HeapFree failed\n");
} }
/* 0-length buffer */ /* 0-length buffer */
mem1 = HeapAlloc(heap, 0, 0); mem1 = HeapAlloc(heap, 0, 0);
ok(mem1 != NULL, "Reserved memory"); ok(mem1 != NULL, "Reserved memory\n");
dwSize = HeapSize(heap, 0, mem1); dwSize = HeapSize(heap, 0, mem1);
/* should work with 0-length buffer */ /* should work with 0-length buffer */
ok((dwSize >= 0) && (dwSize < 0xFFFFFFFF), ok((dwSize >= 0) && (dwSize < 0xFFFFFFFF),
"The size of the 0-length buffer"); "The size of the 0-length buffer\n");
ok(HeapFree(heap, 0, mem1), "Freed the 0-length buffer"); ok(HeapFree(heap, 0, mem1), "Freed the 0-length buffer\n");
/* Check that HeapDestry works */ /* Check that HeapDestry works */
ok(HeapDestroy(heap),"HeapDestroy failed"); ok(HeapDestroy(heap),"HeapDestroy failed\n");
} }
/* The following functions don't have tests, because either I don't know how /* The following functions don't have tests, because either I don't know how
...@@ -183,18 +183,18 @@ static void test_Global(void) ...@@ -183,18 +183,18 @@ static void test_Global(void)
SetLastError(NO_ERROR); SetLastError(NO_ERROR);
/* Check that a normal alloc works */ /* Check that a normal alloc works */
mem1=GlobalAlloc(0,memchunk); mem1=GlobalAlloc(0,memchunk);
ok(mem1!=NULL,"GlobalAlloc failed"); ok(mem1!=NULL,"GlobalAlloc failed\n");
if(mem1) { if(mem1) {
ok(GlobalSize(mem1)>=memchunk, "GlobalAlloc should return a big enough memory block"); ok(GlobalSize(mem1)>=memchunk, "GlobalAlloc should return a big enough memory block\n");
} }
/* Check that a 'zeroing' alloc works */ /* Check that a 'zeroing' alloc works */
mem2=GlobalAlloc(GMEM_ZEROINIT,memchunk); mem2=GlobalAlloc(GMEM_ZEROINIT,memchunk);
ok(mem2!=NULL,"GlobalAlloc failed: error=%ld",GetLastError()); ok(mem2!=NULL,"GlobalAlloc failed: error=%ld\n",GetLastError());
if(mem2) { if(mem2) {
ok(GlobalSize(mem2)>=memchunk,"GlobalAlloc should return a big enough memory block"); ok(GlobalSize(mem2)>=memchunk,"GlobalAlloc should return a big enough memory block\n");
mem2ptr=GlobalLock(mem2); mem2ptr=GlobalLock(mem2);
ok(mem2ptr==mem2,"GlobalLock should have returned the same memory as was allocated"); ok(mem2ptr==mem2,"GlobalLock should have returned the same memory as was allocated\n");
if(mem2ptr) { if(mem2ptr) {
error=0; error=0;
for(i=0;i<memchunk;i++) { for(i=0;i<memchunk;i++) {
...@@ -202,27 +202,27 @@ static void test_Global(void) ...@@ -202,27 +202,27 @@ static void test_Global(void)
error=1; error=1;
} }
} }
ok(!error,"GlobalAlloc should have zeroed out it's allocated memory"); ok(!error,"GlobalAlloc should have zeroed out it's allocated memory\n");
} }
} }
/* Check that GlobalReAlloc works */ /* Check that GlobalReAlloc works */
/* Check that we can change GMEM_FIXED to GMEM_MOVEABLE */ /* Check that we can change GMEM_FIXED to GMEM_MOVEABLE */
mem2a=GlobalReAlloc(mem2,0,GMEM_MODIFY | GMEM_MOVEABLE); mem2a=GlobalReAlloc(mem2,0,GMEM_MODIFY | GMEM_MOVEABLE);
ok(mem2a!=NULL,"GlobalReAlloc failed to convert FIXED to MOVEABLE: error=%ld",GetLastError()); ok(mem2a!=NULL,"GlobalReAlloc failed to convert FIXED to MOVEABLE: error=%ld\n",GetLastError());
if(mem2a!=NULL) { if(mem2a!=NULL) {
mem2=mem2a; mem2=mem2a;
} }
mem2ptr=GlobalLock(mem2a); mem2ptr=GlobalLock(mem2a);
ok(mem2ptr!=NULL && !GlobalUnlock(mem2a)&&GetLastError()==NO_ERROR, ok(mem2ptr!=NULL && !GlobalUnlock(mem2a)&&GetLastError()==NO_ERROR,
"Converting from FIXED to MOVEABLE didn't REALLY work"); "Converting from FIXED to MOVEABLE didn't REALLY work\n");
/* Check that ReAllocing memory works as expected */ /* Check that ReAllocing memory works as expected */
mem2a=GlobalReAlloc(mem2,2*memchunk,GMEM_MOVEABLE | GMEM_ZEROINIT); mem2a=GlobalReAlloc(mem2,2*memchunk,GMEM_MOVEABLE | GMEM_ZEROINIT);
ok(mem2a!=NULL,"GlobalReAlloc failed"); ok(mem2a!=NULL,"GlobalReAlloc failed\n");
if(mem2a) { if(mem2a) {
ok(GlobalSize(mem2a)>=2*memchunk,"GlobalReAlloc failed"); ok(GlobalSize(mem2a)>=2*memchunk,"GlobalReAlloc failed\n");
mem2ptr=GlobalLock(mem2a); mem2ptr=GlobalLock(mem2a);
ok(mem2ptr!=NULL,"GlobalLock Failed."); ok(mem2ptr!=NULL,"GlobalLock Failed\n");
if(mem2ptr) { if(mem2ptr) {
error=0; error=0;
for(i=0;i<memchunk;i++) { for(i=0;i<memchunk;i++) {
...@@ -230,25 +230,25 @@ static void test_Global(void) ...@@ -230,25 +230,25 @@ static void test_Global(void)
error=1; error=1;
} }
} }
ok(!error,"GlobalReAlloc should have zeroed out it's allocated memory"); ok(!error,"GlobalReAlloc should have zeroed out it's allocated memory\n");
/* Check that GlobalHandle works */ /* Check that GlobalHandle works */
mem2b=GlobalHandle(mem2ptr); mem2b=GlobalHandle(mem2ptr);
ok(mem2b==mem2a,"GlobalHandle didn't return the correct memory handle"); ok(mem2b==mem2a,"GlobalHandle didn't return the correct memory handle\n");
/* Check that we can't discard locked memory */ /* Check that we can't discard locked memory */
mem2b=GlobalDiscard(mem2a); mem2b=GlobalDiscard(mem2a);
ok(mem2b==NULL,"Discarded memory we shouldn't have"); ok(mem2b==NULL,"Discarded memory we shouldn't have\n");
ok(!GlobalUnlock(mem2a) && GetLastError()==NO_ERROR,"GlobalUnlock Failed."); ok(!GlobalUnlock(mem2a) && GetLastError()==NO_ERROR,"GlobalUnlock Failed\n");
} }
} }
if(mem1) { if(mem1) {
ok(GlobalFree(mem1)==NULL,"GlobalFree failed"); ok(GlobalFree(mem1)==NULL,"GlobalFree failed\n");
} }
if(mem2a) { if(mem2a) {
ok(GlobalFree(mem2a)==NULL,"GlobalFree failed"); ok(GlobalFree(mem2a)==NULL,"GlobalFree failed\n");
} else { } else {
ok(GlobalFree(mem2)==NULL,"GlobalFree failed"); ok(GlobalFree(mem2)==NULL,"GlobalFree failed\n");
} }
} }
...@@ -274,18 +274,18 @@ static void test_Local(void) ...@@ -274,18 +274,18 @@ static void test_Local(void)
/* Check that a normal alloc works */ /* Check that a normal alloc works */
mem1=LocalAlloc(0,memchunk); mem1=LocalAlloc(0,memchunk);
ok(mem1!=NULL,"LocalAlloc failed: error=%ld",GetLastError()); ok(mem1!=NULL,"LocalAlloc failed: error=%ld\n",GetLastError());
if(mem1) { if(mem1) {
ok(LocalSize(mem1)>=memchunk, "LocalAlloc should return a big enough memory block"); ok(LocalSize(mem1)>=memchunk, "LocalAlloc should return a big enough memory block\n");
} }
/* Check that a 'zeroing' and lock alloc works */ /* Check that a 'zeroing' and lock alloc works */
mem2=LocalAlloc(LMEM_ZEROINIT|LMEM_MOVEABLE,memchunk); mem2=LocalAlloc(LMEM_ZEROINIT|LMEM_MOVEABLE,memchunk);
ok(mem2!=NULL,"LocalAlloc failed: error=%ld",GetLastError()); ok(mem2!=NULL,"LocalAlloc failed: error=%ld\n",GetLastError());
if(mem2) { if(mem2) {
ok(LocalSize(mem2)>=memchunk,"LocalAlloc should return a big enough memory block"); ok(LocalSize(mem2)>=memchunk,"LocalAlloc should return a big enough memory block\n");
mem2ptr=LocalLock(mem2); mem2ptr=LocalLock(mem2);
ok(mem2ptr!=NULL,"LocalLock: error=%ld",GetLastError()); ok(mem2ptr!=NULL,"LocalLock: error=%ld\n",GetLastError());
if(mem2ptr) { if(mem2ptr) {
error=0; error=0;
for(i=0;i<memchunk;i++) { for(i=0;i<memchunk;i++) {
...@@ -293,27 +293,27 @@ static void test_Local(void) ...@@ -293,27 +293,27 @@ static void test_Local(void)
error=1; error=1;
} }
} }
ok(!error,"LocalAlloc should have zeroed out it's allocated memory"); ok(!error,"LocalAlloc should have zeroed out it's allocated memory\n");
SetLastError(0); SetLastError(0);
error=LocalUnlock(mem2); error=LocalUnlock(mem2);
ok(error==0 && GetLastError()==NO_ERROR, ok(error==0 && GetLastError()==NO_ERROR,
"LocalUnlock Failed: rc=%d err=%ld",error,GetLastError()); "LocalUnlock Failed: rc=%d err=%ld\n",error,GetLastError());
} }
} }
mem2a=LocalFree(mem2); mem2a=LocalFree(mem2);
ok(mem2a==NULL, "LocalFree failed: %p",mem2a); ok(mem2a==NULL, "LocalFree failed: %p\n",mem2a);
/* Reallocate mem2 as moveable memory */ /* Reallocate mem2 as moveable memory */
mem2=LocalAlloc(LMEM_MOVEABLE | LMEM_ZEROINIT,memchunk); mem2=LocalAlloc(LMEM_MOVEABLE | LMEM_ZEROINIT,memchunk);
ok(mem2!=NULL, "LocalAlloc failed to create moveable memory, error=%ld",GetLastError()); ok(mem2!=NULL, "LocalAlloc failed to create moveable memory, error=%ld\n",GetLastError());
/* Check that ReAllocing memory works as expected */ /* Check that ReAllocing memory works as expected */
mem2a=LocalReAlloc(mem2,2*memchunk,LMEM_MOVEABLE | LMEM_ZEROINIT); mem2a=LocalReAlloc(mem2,2*memchunk,LMEM_MOVEABLE | LMEM_ZEROINIT);
ok(mem2a!=NULL,"LocalReAlloc failed, error=%ld",GetLastError()); ok(mem2a!=NULL,"LocalReAlloc failed, error=%ld\n",GetLastError());
if(mem2a) { if(mem2a) {
ok(LocalSize(mem2a)>=2*memchunk,"LocalReAlloc failed"); ok(LocalSize(mem2a)>=2*memchunk,"LocalReAlloc failed\n");
mem2ptr=LocalLock(mem2a); mem2ptr=LocalLock(mem2a);
ok(mem2ptr!=NULL,"LocalLock Failed."); ok(mem2ptr!=NULL,"LocalLock Failed\n");
if(mem2ptr) { if(mem2ptr) {
error=0; error=0;
for(i=0;i<memchunk;i++) { for(i=0;i<memchunk;i++) {
...@@ -321,24 +321,24 @@ static void test_Local(void) ...@@ -321,24 +321,24 @@ static void test_Local(void)
error=1; error=1;
} }
} }
ok(!error,"LocalReAlloc should have zeroed out it's allocated memory"); ok(!error,"LocalReAlloc should have zeroed out it's allocated memory\n");
/* Check that LocalHandle works */ /* Check that LocalHandle works */
mem2b=LocalHandle(mem2ptr); mem2b=LocalHandle(mem2ptr);
ok(mem2b==mem2a,"LocalHandle didn't return the correct memory handle"); ok(mem2b==mem2a,"LocalHandle didn't return the correct memory handle\n");
/* Check that we can't discard locked memory */ /* Check that we can't discard locked memory */
mem2b=LocalDiscard(mem2a); mem2b=LocalDiscard(mem2a);
ok(mem2b==NULL,"Discarded memory we shouldn't have"); ok(mem2b==NULL,"Discarded memory we shouldn't have\n");
SetLastError(NO_ERROR); SetLastError(NO_ERROR);
ok(!LocalUnlock(mem2a) && GetLastError()==NO_ERROR, "LocalUnlock Failed."); ok(!LocalUnlock(mem2a) && GetLastError()==NO_ERROR, "LocalUnlock Failed\n");
} }
} }
if(mem1) { if(mem1) {
ok(LocalFree(mem1)==NULL,"LocalFree failed"); ok(LocalFree(mem1)==NULL,"LocalFree failed\n");
} }
if(mem2a) { if(mem2a) {
ok(LocalFree(mem2a)==NULL,"LocalFree failed"); ok(LocalFree(mem2a)==NULL,"LocalFree failed\n");
} else { } else {
ok(LocalFree(mem2)==NULL,"LocalFree failed"); ok(LocalFree(mem2)==NULL,"LocalFree failed\n");
} }
} }
...@@ -370,14 +370,14 @@ static void test_Virtual(void) ...@@ -370,14 +370,14 @@ static void test_Virtual(void)
/* Retrieve the page size for this system */ /* Retrieve the page size for this system */
sysInfo.dwPageSize=0; sysInfo.dwPageSize=0;
GetSystemInfo(&sysInfo); 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");
/* Choose a reasonable allocation size */ /* Choose a reasonable allocation size */
memchunk=10*sysInfo.dwPageSize; memchunk=10*sysInfo.dwPageSize;
/* Check that a normal alloc works */ /* Check that a normal alloc works */
mem1=VirtualAlloc(NULL,memchunk,MEM_COMMIT,PAGE_READWRITE); mem1=VirtualAlloc(NULL,memchunk,MEM_COMMIT,PAGE_READWRITE);
ok(mem1!=NULL,"VirtualAlloc failed"); ok(mem1!=NULL,"VirtualAlloc failed\n");
if(mem1) { if(mem1) {
/* check that memory is initialized to 0 */ /* check that memory is initialized to 0 */
error=0; error=0;
...@@ -386,7 +386,7 @@ static void test_Virtual(void) ...@@ -386,7 +386,7 @@ static void test_Virtual(void)
error=1; error=1;
} }
} }
ok(!error,"VirtualAlloc did not initialize memory to '0's"); ok(!error,"VirtualAlloc did not initialize memory to '0's\n");
/* Check that we can read/write to memory */ /* Check that we can read/write to memory */
error=0; error=0;
for(i=0;i<memchunk;i+=100) { for(i=0;i<memchunk;i+=100) {
...@@ -395,9 +395,9 @@ static void test_Virtual(void) ...@@ -395,9 +395,9 @@ static void test_Virtual(void)
error=1; error=1;
} }
} }
ok(!error,"Virtual memory was not writable"); ok(!error,"Virtual memory was not writable\n");
} }
ok(VirtualFree(mem1,0,MEM_RELEASE),"VirtualFree failed"); ok(VirtualFree(mem1,0,MEM_RELEASE),"VirtualFree failed\n");
} }
START_TEST(alloc) START_TEST(alloc)
{ {
......
...@@ -37,16 +37,16 @@ ...@@ -37,16 +37,16 @@
CONSOLE_SCREEN_BUFFER_INFO __sbi; \ CONSOLE_SCREEN_BUFFER_INFO __sbi; \
BOOL expect = GetConsoleScreenBufferInfo((hCon), &__sbi) && \ BOOL expect = GetConsoleScreenBufferInfo((hCon), &__sbi) && \
__sbi.dwCursorPosition.X == (c).X && __sbi.dwCursorPosition.Y == (c).Y; \ __sbi.dwCursorPosition.X == (c).X && __sbi.dwCursorPosition.Y == (c).Y; \
ok(expect, "Expected cursor at (%d,%d), got (%d,%d)", \ ok(expect, "Expected cursor at (%d,%d), got (%d,%d)\n", \
(c).X, (c).Y, __sbi.dwCursorPosition.X, __sbi.dwCursorPosition.Y); \ (c).X, (c).Y, __sbi.dwCursorPosition.X, __sbi.dwCursorPosition.Y); \
} while (0) } while (0)
#define okCHAR(hCon, c, ch, attr) do { \ #define okCHAR(hCon, c, ch, attr) do { \
char __ch; WORD __attr; DWORD __len; BOOL expect; \ char __ch; WORD __attr; DWORD __len; BOOL expect; \
expect = ReadConsoleOutputCharacter((hCon), &__ch, 1, (c), &__len) == 1 && __len == 1 && __ch == (ch); \ expect = ReadConsoleOutputCharacter((hCon), &__ch, 1, (c), &__len) == 1 && __len == 1 && __ch == (ch); \
ok(expect, "At (%d,%d): expecting char '%c'/%02x got '%c'/%02x", (c).X, (c).Y, (ch), (ch), __ch, __ch); \ ok(expect, "At (%d,%d): expecting char '%c'/%02x got '%c'/%02x\n", (c).X, (c).Y, (ch), (ch), __ch, __ch); \
expect = ReadConsoleOutputAttribute((hCon), &__attr, 1, (c), &__len) == 1 && __len == 1 && __attr == (attr); \ expect = ReadConsoleOutputAttribute((hCon), &__attr, 1, (c), &__len) == 1 && __len == 1 && __attr == (attr); \
ok(expect, "At (%d,%d): expecting attr %04x got %04x", (c).X, (c).Y, (attr), __attr); \ ok(expect, "At (%d,%d): expecting attr %04x got %04x\n", (c).X, (c).Y, (attr), __attr); \
} while (0) } while (0)
/* FIXME: this could be optimized on a speed point of view */ /* FIXME: this could be optimized on a speed point of view */
...@@ -73,41 +73,41 @@ static void testCursor(HANDLE hCon, COORD sbSize) ...@@ -73,41 +73,41 @@ static void testCursor(HANDLE hCon, COORD sbSize)
COORD c; COORD c;
c.X = c.Y = 0; c.X = c.Y = 0;
ok(SetConsoleCursorPosition(0, c) == 0, "No handle"); ok(SetConsoleCursorPosition(0, c) == 0, "No handle\n");
ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError: expecting %u got %lu", ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError: expecting %u got %lu\n",
ERROR_INVALID_HANDLE, GetLastError()); ERROR_INVALID_HANDLE, GetLastError());
c.X = c.Y = 0; c.X = c.Y = 0;
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left"); ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left\n");
okCURSOR(hCon, c); okCURSOR(hCon, c);
c.X = sbSize.X - 1; c.X = sbSize.X - 1;
c.Y = sbSize.Y - 1; c.Y = sbSize.Y - 1;
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in lower-right"); ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in lower-right\n");
okCURSOR(hCon, c); okCURSOR(hCon, c);
c.X = sbSize.X; c.X = sbSize.X;
c.Y = sbSize.Y - 1; c.Y = sbSize.Y - 1;
ok(SetConsoleCursorPosition(hCon, c) == 0, "Cursor is outside"); ok(SetConsoleCursorPosition(hCon, c) == 0, "Cursor is outside\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError: expecting %u got %lu", ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError: expecting %u got %lu\n",
ERROR_INVALID_PARAMETER, GetLastError()); ERROR_INVALID_PARAMETER, GetLastError());
c.X = sbSize.X - 1; c.X = sbSize.X - 1;
c.Y = sbSize.Y; c.Y = sbSize.Y;
ok(SetConsoleCursorPosition(hCon, c) == 0, "Cursor is outside"); ok(SetConsoleCursorPosition(hCon, c) == 0, "Cursor is outside\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError: expecting %u got %lu", ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError: expecting %u got %lu\n",
ERROR_INVALID_PARAMETER, GetLastError()); ERROR_INVALID_PARAMETER, GetLastError());
c.X = -1; c.X = -1;
c.Y = 0; c.Y = 0;
ok(SetConsoleCursorPosition(hCon, c) == 0, "Cursor is outside"); ok(SetConsoleCursorPosition(hCon, c) == 0, "Cursor is outside\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError: expecting %u got %lu", ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError: expecting %u got %lu\n",
ERROR_INVALID_PARAMETER, GetLastError()); ERROR_INVALID_PARAMETER, GetLastError());
c.X = 0; c.X = 0;
c.Y = -1; c.Y = -1;
ok(SetConsoleCursorPosition(hCon, c) == 0, "Cursor is outside"); ok(SetConsoleCursorPosition(hCon, c) == 0, "Cursor is outside\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError: expecting %u got %lu", ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError: expecting %u got %lu\n",
ERROR_INVALID_PARAMETER, GetLastError()); ERROR_INVALID_PARAMETER, GetLastError());
} }
...@@ -120,9 +120,9 @@ static void testWriteSimple(HANDLE hCon, COORD sbSize) ...@@ -120,9 +120,9 @@ static void testWriteSimple(HANDLE hCon, COORD sbSize)
/* single line write */ /* single line write */
c.X = c.Y = 0; c.X = c.Y = 0;
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left"); ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left\n");
ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole"); ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole\n");
c.Y = 0; c.Y = 0;
for (c.X = 0; c.X < mylen; c.X++) for (c.X = 0; c.X < mylen; c.X++)
{ {
...@@ -142,13 +142,13 @@ static void testWriteNotWrappedNotProcessed(HANDLE hCon, COORD sbSize) ...@@ -142,13 +142,13 @@ static void testWriteNotWrappedNotProcessed(HANDLE hCon, COORD sbSize)
int p; int p;
ok(GetConsoleMode(hCon, &mode) && SetConsoleMode(hCon, mode & ~(ENABLE_PROCESSED_OUTPUT|ENABLE_WRAP_AT_EOL_OUTPUT)), ok(GetConsoleMode(hCon, &mode) && SetConsoleMode(hCon, mode & ~(ENABLE_PROCESSED_OUTPUT|ENABLE_WRAP_AT_EOL_OUTPUT)),
"clearing wrap at EOL & processed output"); "clearing wrap at EOL & processed output\n");
/* write line, wrapping disabled, buffer exceeds sb width */ /* write line, wrapping disabled, buffer exceeds sb width */
c.X = sbSize.X - 3; c.Y = 0; c.X = sbSize.X - 3; c.Y = 0;
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-3"); ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-3\n");
ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole"); ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole\n");
c.Y = 0; c.Y = 0;
for (p = mylen - 3; p < mylen; p++) for (p = mylen - 3; p < mylen; p++)
{ {
...@@ -165,9 +165,9 @@ static void testWriteNotWrappedNotProcessed(HANDLE hCon, COORD sbSize) ...@@ -165,9 +165,9 @@ static void testWriteNotWrappedNotProcessed(HANDLE hCon, COORD sbSize)
/* write line, wrapping disabled, strings end on end of line */ /* write line, wrapping disabled, strings end on end of line */
c.X = sbSize.X - mylen; c.Y = 0; c.X = sbSize.X - mylen; c.Y = 0;
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-3"); ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-3\n");
ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole"); ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole\n");
c.Y = 0; c.Y = 0;
for (p = 0; p < mylen; p++) for (p = 0; p < mylen; p++)
{ {
...@@ -193,13 +193,13 @@ static void testWriteNotWrappedProcessed(HANDLE hCon, COORD sbSize) ...@@ -193,13 +193,13 @@ static void testWriteNotWrappedProcessed(HANDLE hCon, COORD sbSize)
int p; int p;
ok(GetConsoleMode(hCon, &mode) && SetConsoleMode(hCon, (mode | ENABLE_PROCESSED_OUTPUT) & ~ENABLE_WRAP_AT_EOL_OUTPUT), ok(GetConsoleMode(hCon, &mode) && SetConsoleMode(hCon, (mode | ENABLE_PROCESSED_OUTPUT) & ~ENABLE_WRAP_AT_EOL_OUTPUT),
"clearing wrap at EOL & setting processed output"); "clearing wrap at EOL & setting processed output\n");
/* write line, wrapping disabled, buffer exceeds sb width */ /* write line, wrapping disabled, buffer exceeds sb width */
c.X = sbSize.X - 5; c.Y = 0; c.X = sbSize.X - 5; c.Y = 0;
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-5"); ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-5\n");
ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole"); ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole\n");
c.Y = 0; c.Y = 0;
for (c.X = sbSize.X - 5; c.X < sbSize.X - 1; c.X++) for (c.X = sbSize.X - 5; c.X < sbSize.X - 1; c.X++)
{ {
...@@ -219,9 +219,9 @@ static void testWriteNotWrappedProcessed(HANDLE hCon, COORD sbSize) ...@@ -219,9 +219,9 @@ static void testWriteNotWrappedProcessed(HANDLE hCon, COORD sbSize)
/* write line, wrapping disabled, strings end on end of line */ /* write line, wrapping disabled, strings end on end of line */
c.X = sbSize.X - 4; c.Y = 0; c.X = sbSize.X - 4; c.Y = 0;
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-4"); ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-4\n");
ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole"); ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole\n");
c.Y = 0; c.Y = 0;
for (c.X = sbSize.X - 4; c.X < sbSize.X; c.X++) for (c.X = sbSize.X - 4; c.X < sbSize.X; c.X++)
{ {
...@@ -239,9 +239,9 @@ static void testWriteNotWrappedProcessed(HANDLE hCon, COORD sbSize) ...@@ -239,9 +239,9 @@ static void testWriteNotWrappedProcessed(HANDLE hCon, COORD sbSize)
/* write line, wrapping disabled, strings end after end of line */ /* write line, wrapping disabled, strings end after end of line */
c.X = sbSize.X - 3; c.Y = 0; c.X = sbSize.X - 3; c.Y = 0;
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-4"); ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-4\n");
ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole"); ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole\n");
c.Y = 0; c.Y = 0;
for (p = mylen2 - 3; p < mylen2; p++) for (p = mylen2 - 3; p < mylen2; p++)
{ {
...@@ -268,13 +268,13 @@ static void testWriteWrappedNotProcessed(HANDLE hCon, COORD sbSize) ...@@ -268,13 +268,13 @@ static void testWriteWrappedNotProcessed(HANDLE hCon, COORD sbSize)
int p; int p;
ok(GetConsoleMode(hCon, &mode) && SetConsoleMode(hCon,(mode | ENABLE_WRAP_AT_EOL_OUTPUT) & ~(ENABLE_PROCESSED_OUTPUT)), ok(GetConsoleMode(hCon, &mode) && SetConsoleMode(hCon,(mode | ENABLE_WRAP_AT_EOL_OUTPUT) & ~(ENABLE_PROCESSED_OUTPUT)),
"setting wrap at EOL & clearing processed output"); "setting wrap at EOL & clearing processed output\n");
/* write line, wrapping enabled, buffer doesn't exceed sb width */ /* write line, wrapping enabled, buffer doesn't exceed sb width */
c.X = sbSize.X - 9; c.Y = 0; c.X = sbSize.X - 9; c.Y = 0;
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-9"); ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-9\n");
ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole"); ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole\n");
c.Y = 0; c.Y = 0;
for (p = 0; p < mylen; p++) for (p = 0; p < mylen; p++)
{ {
...@@ -288,9 +288,9 @@ static void testWriteWrappedNotProcessed(HANDLE hCon, COORD sbSize) ...@@ -288,9 +288,9 @@ static void testWriteWrappedNotProcessed(HANDLE hCon, COORD sbSize)
/* write line, wrapping enabled, buffer does exceed sb width */ /* write line, wrapping enabled, buffer does exceed sb width */
c.X = sbSize.X - 3; c.Y = 0; c.X = sbSize.X - 3; c.Y = 0;
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-3"); ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-3\n");
ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole"); ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole\n");
c.Y = 0; c.Y = 0;
for (p = 0; p < 3; p++) for (p = 0; p < 3; p++)
{ {
...@@ -319,13 +319,13 @@ static void testWriteWrappedProcessed(HANDLE hCon, COORD sbSize) ...@@ -319,13 +319,13 @@ static void testWriteWrappedProcessed(HANDLE hCon, COORD sbSize)
int p; int p;
ok(GetConsoleMode(hCon, &mode) && SetConsoleMode(hCon, mode | (ENABLE_WRAP_AT_EOL_OUTPUT|ENABLE_PROCESSED_OUTPUT)), ok(GetConsoleMode(hCon, &mode) && SetConsoleMode(hCon, mode | (ENABLE_WRAP_AT_EOL_OUTPUT|ENABLE_PROCESSED_OUTPUT)),
"setting wrap at EOL & processed output"); "setting wrap at EOL & processed output\n");
/* write line, wrapping enabled, buffer doesn't exceed sb width */ /* write line, wrapping enabled, buffer doesn't exceed sb width */
c.X = sbSize.X - 9; c.Y = 0; c.X = sbSize.X - 9; c.Y = 0;
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-9"); ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-9\n");
ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole"); ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole\n");
for (p = 0; p < 4; p++) for (p = 0; p < 4; p++)
{ {
c.X = sbSize.X - 9 + p; c.X = sbSize.X - 9 + p;
...@@ -344,9 +344,9 @@ static void testWriteWrappedProcessed(HANDLE hCon, COORD sbSize) ...@@ -344,9 +344,9 @@ static void testWriteWrappedProcessed(HANDLE hCon, COORD sbSize)
/* write line, wrapping enabled, buffer does exceed sb width */ /* write line, wrapping enabled, buffer does exceed sb width */
c.X = sbSize.X - 3; c.Y = 2; c.X = sbSize.X - 3; c.Y = 2;
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-3"); ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-3\n");
ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole"); ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole\n");
for (p = 0; p < 3; p++) for (p = 0; p < 3; p++)
{ {
c.X = sbSize.X - 3 + p; c.X = sbSize.X - 3 + p;
...@@ -370,7 +370,7 @@ static void testWriteWrappedProcessed(HANDLE hCon, COORD sbSize) ...@@ -370,7 +370,7 @@ static void testWriteWrappedProcessed(HANDLE hCon, COORD sbSize)
static void testWrite(HANDLE hCon, COORD sbSize) static void testWrite(HANDLE hCon, COORD sbSize)
{ {
/* FIXME: should in fact insure that the sb is at least 10 character wide */ /* FIXME: should in fact insure that the sb is at least 10 character wide */
ok(SetConsoleTextAttribute(hCon, TEST_ATTRIB), "Setting default text color"); ok(SetConsoleTextAttribute(hCon, TEST_ATTRIB), "Setting default text color\n");
resetContent(hCon, sbSize, FALSE); resetContent(hCon, sbSize, FALSE);
testWriteSimple(hCon, sbSize); testWriteSimple(hCon, sbSize);
resetContent(hCon, sbSize, FALSE); resetContent(hCon, sbSize, FALSE);
...@@ -413,7 +413,7 @@ static void testScroll(HANDLE hCon, COORD sbSize) ...@@ -413,7 +413,7 @@ static void testScroll(HANDLE hCon, COORD sbSize)
clip.Top = 0; clip.Top = 0;
clip.Bottom = sbSize.Y - 1; clip.Bottom = sbSize.Y - 1;
ok(ScrollConsoleScreenBuffer(hCon, &scroll, NULL, dst, &ci), "Scrolling SB"); ok(ScrollConsoleScreenBuffer(hCon, &scroll, NULL, dst, &ci), "Scrolling SB\n");
for (c.Y = 0; c.Y < sbSize.Y; c.Y++) for (c.Y = 0; c.Y < sbSize.Y; c.Y++)
{ {
...@@ -448,7 +448,7 @@ static void testScroll(HANDLE hCon, COORD sbSize) ...@@ -448,7 +448,7 @@ static void testScroll(HANDLE hCon, COORD sbSize)
clip.Top = 0; clip.Top = 0;
clip.Bottom = sbSize.Y - 1; clip.Bottom = sbSize.Y - 1;
ok(ScrollConsoleScreenBuffer(hCon, &scroll, NULL, dst, &ci), "Scrolling SB"); ok(ScrollConsoleScreenBuffer(hCon, &scroll, NULL, dst, &ci), "Scrolling SB\n");
for (c.Y = 0; c.Y < sbSize.Y; c.Y++) for (c.Y = 0; c.Y < sbSize.Y; c.Y++)
{ {
...@@ -482,7 +482,7 @@ static void testScroll(HANDLE hCon, COORD sbSize) ...@@ -482,7 +482,7 @@ static void testScroll(HANDLE hCon, COORD sbSize)
clip.Top = H / 2; clip.Top = H / 2;
clip.Bottom = min(H + H / 2, sbSize.Y - 1); clip.Bottom = min(H + H / 2, sbSize.Y - 1);
ok(ScrollConsoleScreenBuffer(hCon, &scroll, &clip, dst, &ci), "Scrolling SB"); ok(ScrollConsoleScreenBuffer(hCon, &scroll, &clip, dst, &ci), "Scrolling SB\n");
for (c.Y = 0; c.Y < sbSize.Y; c.Y++) for (c.Y = 0; c.Y < sbSize.Y; c.Y++)
{ {
...@@ -517,7 +517,7 @@ static void testScroll(HANDLE hCon, COORD sbSize) ...@@ -517,7 +517,7 @@ static void testScroll(HANDLE hCon, COORD sbSize)
clip.Top = H / 2; clip.Top = H / 2;
clip.Bottom = min(H + H / 2, sbSize.Y - 1); clip.Bottom = min(H + H / 2, sbSize.Y - 1);
ok(ScrollConsoleScreenBuffer(hCon, &scroll, &clip, dst, &ci), "Scrolling SB"); ok(ScrollConsoleScreenBuffer(hCon, &scroll, &clip, dst, &ci), "Scrolling SB\n");
for (c.Y = 0; c.Y < sbSize.Y; c.Y++) for (c.Y = 0; c.Y < sbSize.Y; c.Y++)
{ {
...@@ -562,10 +562,10 @@ START_TEST(console) ...@@ -562,10 +562,10 @@ START_TEST(console)
hConOut = CreateFileA("CONOUT$", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0); hConOut = CreateFileA("CONOUT$", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0);
} }
/* now verify everything's ok */ /* now verify everything's ok */
ok(hConIn != INVALID_HANDLE_VALUE, "Opening ConIn"); ok(hConIn != INVALID_HANDLE_VALUE, "Opening ConIn\n");
ok(hConOut != INVALID_HANDLE_VALUE, "Opening ConOut"); ok(hConOut != INVALID_HANDLE_VALUE, "Opening ConOut\n");
ok(ret = GetConsoleScreenBufferInfo(hConOut, &sbi), "Getting sb info"); ok(ret = GetConsoleScreenBufferInfo(hConOut, &sbi), "Getting sb info\n");
if (!ret) return; if (!ret) return;
/* Non interactive tests */ /* Non interactive tests */
......
...@@ -34,23 +34,23 @@ static void test_GetWindowsDirectoryA(void) ...@@ -34,23 +34,23 @@ static void test_GetWindowsDirectoryA(void)
char buf[MAX_PATH]; char buf[MAX_PATH];
len_with_null = GetWindowsDirectoryA(NULL, 0); len_with_null = GetWindowsDirectoryA(NULL, 0);
ok(len_with_null <= MAX_PATH, "should fit into MAX_PATH"); ok(len_with_null <= MAX_PATH, "should fit into MAX_PATH\n");
lstrcpyA(buf, "foo"); lstrcpyA(buf, "foo");
len_with_null = GetWindowsDirectoryA(buf, 1); len_with_null = GetWindowsDirectoryA(buf, 1);
ok(lstrcmpA(buf, "foo") == 0, "should not touch the buffer"); ok(lstrcmpA(buf, "foo") == 0, "should not touch the buffer\n");
lstrcpyA(buf, "foo"); lstrcpyA(buf, "foo");
len = GetWindowsDirectoryA(buf, len_with_null - 1); len = GetWindowsDirectoryA(buf, len_with_null - 1);
ok(lstrcmpA(buf, "foo") == 0, "should not touch the buffer"); ok(lstrcmpA(buf, "foo") == 0, "should not touch the buffer\n");
ok(len == len_with_null, "GetWindowsDirectoryW returned %d, expected %d", ok(len == len_with_null, "GetWindowsDirectoryW returned %d, expected %d\n",
len, len_with_null); len, len_with_null);
lstrcpyA(buf, "foo"); lstrcpyA(buf, "foo");
len = GetWindowsDirectoryA(buf, len_with_null); len = GetWindowsDirectoryA(buf, len_with_null);
ok(lstrcmpA(buf, "foo") != 0, "should touch the buffer"); ok(lstrcmpA(buf, "foo") != 0, "should touch the buffer\n");
ok(len == strlen(buf), "returned length should be equal to the length of string"); ok(len == strlen(buf), "returned length should be equal to the length of string\n");
ok(len == len_with_null-1, "GetWindowsDirectoryA returned %d, expected %d", ok(len == len_with_null-1, "GetWindowsDirectoryA returned %d, expected %d\n",
len, len_with_null-1); len, len_with_null-1);
} }
...@@ -63,25 +63,25 @@ static void test_GetWindowsDirectoryW(void) ...@@ -63,25 +63,25 @@ static void test_GetWindowsDirectoryW(void)
len_with_null = GetWindowsDirectoryW(NULL, 0); len_with_null = GetWindowsDirectoryW(NULL, 0);
if (len_with_null==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED) if (len_with_null==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
return; return;
ok(len_with_null <= MAX_PATH, "should fit into MAX_PATH"); ok(len_with_null <= MAX_PATH, "should fit into MAX_PATH\n");
lstrcpyW(buf, fooW); lstrcpyW(buf, fooW);
len = GetWindowsDirectoryW(buf, 1); len = GetWindowsDirectoryW(buf, 1);
ok(lstrcmpW(buf, fooW) == 0, "should not touch the buffer"); ok(lstrcmpW(buf, fooW) == 0, "should not touch the buffer\n");
ok(len == len_with_null, "GetWindowsDirectoryW returned %d, expected %d", ok(len == len_with_null, "GetWindowsDirectoryW returned %d, expected %d\n",
len, len_with_null); len, len_with_null);
lstrcpyW(buf, fooW); lstrcpyW(buf, fooW);
len = GetWindowsDirectoryW(buf, len_with_null - 1); len = GetWindowsDirectoryW(buf, len_with_null - 1);
ok(lstrcmpW(buf, fooW) == 0, "should not touch the buffer"); ok(lstrcmpW(buf, fooW) == 0, "should not touch the buffer\n");
ok(len == len_with_null, "GetWindowsDirectoryW returned %d, expected %d", ok(len == len_with_null, "GetWindowsDirectoryW returned %d, expected %d\n",
len, len_with_null); len, len_with_null);
lstrcpyW(buf, fooW); lstrcpyW(buf, fooW);
len = GetWindowsDirectoryW(buf, len_with_null); len = GetWindowsDirectoryW(buf, len_with_null);
ok(lstrcmpW(buf, fooW) != 0, "should touch the buffer"); ok(lstrcmpW(buf, fooW) != 0, "should touch the buffer\n");
ok(len == lstrlenW(buf), "returned length should be equal to the length of string"); ok(len == lstrlenW(buf), "returned length should be equal to the length of string\n");
ok(len == len_with_null-1, "GetWindowsDirectoryW returned %d, expected %d", ok(len == len_with_null-1, "GetWindowsDirectoryW returned %d, expected %d\n",
len, len_with_null-1); len, len_with_null-1);
} }
...@@ -95,25 +95,25 @@ static void test_GetSystemDirectoryA(void) ...@@ -95,25 +95,25 @@ static void test_GetSystemDirectoryA(void)
char buf[MAX_PATH]; char buf[MAX_PATH];
len_with_null = GetSystemDirectoryA(NULL, 0); len_with_null = GetSystemDirectoryA(NULL, 0);
ok(len_with_null <= MAX_PATH, "should fit into MAX_PATH"); ok(len_with_null <= MAX_PATH, "should fit into MAX_PATH\n");
lstrcpyA(buf, "foo"); lstrcpyA(buf, "foo");
len = GetSystemDirectoryA(buf, 1); len = GetSystemDirectoryA(buf, 1);
ok(lstrcmpA(buf, "foo") == 0, "should not touch the buffer"); ok(lstrcmpA(buf, "foo") == 0, "should not touch the buffer\n");
ok(len == len_with_null, "GetSystemDirectoryA returned %d, expected %d", ok(len == len_with_null, "GetSystemDirectoryA returned %d, expected %d\n",
len, len_with_null); len, len_with_null);
lstrcpyA(buf, "foo"); lstrcpyA(buf, "foo");
len = GetSystemDirectoryA(buf, len_with_null - 1); len = GetSystemDirectoryA(buf, len_with_null - 1);
ok(lstrcmpA(buf, "foo") == 0, "should not touch the buffer"); ok(lstrcmpA(buf, "foo") == 0, "should not touch the buffer\n");
ok(len == len_with_null, "GetSystemDirectoryA returned %d, expected %d", ok(len == len_with_null, "GetSystemDirectoryA returned %d, expected %d\n",
len, len_with_null); len, len_with_null);
lstrcpyA(buf, "foo"); lstrcpyA(buf, "foo");
len = GetSystemDirectoryA(buf, len_with_null); len = GetSystemDirectoryA(buf, len_with_null);
ok(lstrcmpA(buf, "foo") != 0, "should touch the buffer"); ok(lstrcmpA(buf, "foo") != 0, "should touch the buffer\n");
ok(len == strlen(buf), "returned length should be equal to the length of string"); ok(len == strlen(buf), "returned length should be equal to the length of string\n");
ok(len == len_with_null-1, "GetSystemDirectoryW returned %d, expected %d", ok(len == len_with_null-1, "GetSystemDirectoryW returned %d, expected %d\n",
len, len_with_null-1); len, len_with_null-1);
} }
...@@ -126,25 +126,25 @@ static void test_GetSystemDirectoryW(void) ...@@ -126,25 +126,25 @@ static void test_GetSystemDirectoryW(void)
len_with_null = GetSystemDirectoryW(NULL, 0); len_with_null = GetSystemDirectoryW(NULL, 0);
if (len_with_null==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED) if (len_with_null==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
return; return;
ok(len_with_null <= MAX_PATH, "should fit into MAX_PATH"); ok(len_with_null <= MAX_PATH, "should fit into MAX_PATH\n");
lstrcpyW(buf, fooW); lstrcpyW(buf, fooW);
len = GetSystemDirectoryW(buf, 1); len = GetSystemDirectoryW(buf, 1);
ok(lstrcmpW(buf, fooW) == 0, "should not touch the buffer"); ok(lstrcmpW(buf, fooW) == 0, "should not touch the buffer\n");
ok(len == len_with_null, "GetSystemDirectoryW returned %d, expected %d", ok(len == len_with_null, "GetSystemDirectoryW returned %d, expected %d\n",
len, len_with_null); len, len_with_null);
lstrcpyW(buf, fooW); lstrcpyW(buf, fooW);
len = GetSystemDirectoryW(buf, len_with_null - 1); len = GetSystemDirectoryW(buf, len_with_null - 1);
ok(lstrcmpW(buf, fooW) == 0, "should not touch the buffer"); ok(lstrcmpW(buf, fooW) == 0, "should not touch the buffer\n");
ok(len == len_with_null, "GetSystemDirectoryW returned %d, expected %d", ok(len == len_with_null, "GetSystemDirectoryW returned %d, expected %d\n",
len, len_with_null); len, len_with_null);
lstrcpyW(buf, fooW); lstrcpyW(buf, fooW);
len = GetSystemDirectoryW(buf, len_with_null); len = GetSystemDirectoryW(buf, len_with_null);
ok(lstrcmpW(buf, fooW) != 0, "should touch the buffer"); ok(lstrcmpW(buf, fooW) != 0, "should touch the buffer\n");
ok(len == lstrlenW(buf), "returned length should be equal to the length of string"); ok(len == lstrlenW(buf), "returned length should be equal to the length of string\n");
ok(len == len_with_null-1, "GetSystemDirectoryW returned %d, expected %d", ok(len == len_with_null-1, "GetSystemDirectoryW returned %d, expected %d\n",
len, len_with_null-1); len, len_with_null-1);
} }
...@@ -156,55 +156,55 @@ static void test_CreateDirectoryA(void) ...@@ -156,55 +156,55 @@ static void test_CreateDirectoryA(void)
ret = CreateDirectoryA(NULL, NULL); ret = CreateDirectoryA(NULL, NULL);
ok(ret == FALSE && (GetLastError() == ERROR_PATH_NOT_FOUND || ok(ret == FALSE && (GetLastError() == ERROR_PATH_NOT_FOUND ||
GetLastError() == ERROR_INVALID_PARAMETER), GetLastError() == ERROR_INVALID_PARAMETER),
"CreateDirectoryA(NULL,NULL): ret=%d error=%ld",ret,GetLastError()); "CreateDirectoryA(NULL,NULL): ret=%d error=%ld\n",ret,GetLastError());
ret = CreateDirectoryA("", NULL); ret = CreateDirectoryA("", NULL);
ok(ret == FALSE && (GetLastError() == ERROR_BAD_PATHNAME || ok(ret == FALSE && (GetLastError() == ERROR_BAD_PATHNAME ||
GetLastError() == ERROR_PATH_NOT_FOUND), GetLastError() == ERROR_PATH_NOT_FOUND),
"CreateDirectoryA(\"\",NULL): ret=%d error=%ld",ret,GetLastError()); "CreateDirectoryA(\"\",NULL): ret=%d error=%ld\n",ret,GetLastError());
ret = GetSystemDirectoryA(tmpdir, MAX_PATH); ret = GetSystemDirectoryA(tmpdir, MAX_PATH);
ok(ret < MAX_PATH, "System directory should fit into MAX_PATH"); ok(ret < MAX_PATH, "System directory should fit into MAX_PATH\n");
ret = SetCurrentDirectoryA(tmpdir); ret = SetCurrentDirectoryA(tmpdir);
ok(ret == TRUE, "could not chdir to the System directory"); ok(ret == TRUE, "could not chdir to the System directory\n");
ret = CreateDirectoryA(".", NULL); ret = CreateDirectoryA(".", NULL);
ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS, "should not create existing path"); ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS, "should not create existing path\n");
ret = CreateDirectoryA("..", NULL); ret = CreateDirectoryA("..", NULL);
ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS, "should not create existing path"); ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS, "should not create existing path\n");
GetTempPathA(MAX_PATH, tmpdir); GetTempPathA(MAX_PATH, tmpdir);
tmpdir[3] = 0; /* truncate the path */ tmpdir[3] = 0; /* truncate the path */
ret = CreateDirectoryA(tmpdir, NULL); ret = CreateDirectoryA(tmpdir, NULL);
ok(ret == FALSE && (GetLastError() == ERROR_ALREADY_EXISTS || ok(ret == FALSE && (GetLastError() == ERROR_ALREADY_EXISTS ||
GetLastError() == ERROR_ACCESS_DENIED), GetLastError() == ERROR_ACCESS_DENIED),
"CreateDirectoryA(drive_root): ret=%d error=%ld",ret,GetLastError()); "CreateDirectoryA(drive_root): ret=%d error=%ld\n",ret,GetLastError());
GetTempPathA(MAX_PATH, tmpdir); GetTempPathA(MAX_PATH, tmpdir);
lstrcatA(tmpdir, "Please Remove Me"); lstrcatA(tmpdir, "Please Remove Me");
ret = CreateDirectoryA(tmpdir, NULL); ret = CreateDirectoryA(tmpdir, NULL);
ok(ret == TRUE, "CreateDirectoryA should always succeed"); ok(ret == TRUE, "CreateDirectoryA should always succeed\n");
ret = CreateDirectoryA(tmpdir, NULL); ret = CreateDirectoryA(tmpdir, NULL);
ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS, "should not create existing path"); ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS, "should not create existing path\n");
ret = RemoveDirectoryA(tmpdir); ret = RemoveDirectoryA(tmpdir);
ok(ret == TRUE, "RemoveDirectoryA should always succeed"); ok(ret == TRUE, "RemoveDirectoryA should always succeed\n");
todo_wine { todo_wine {
lstrcatA(tmpdir, "?"); lstrcatA(tmpdir, "?");
ret = CreateDirectoryA(tmpdir, NULL); ret = CreateDirectoryA(tmpdir, NULL);
ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME, ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME,
"CreateDirectoryA with ? wildcard name should fail, ret=%s error=%ld", "CreateDirectoryA with ? wildcard name should fail, ret=%s error=%ld\n",
ret ? " True" : "False", GetLastError()); ret ? " True" : "False", GetLastError());
ret = RemoveDirectoryA(tmpdir); ret = RemoveDirectoryA(tmpdir);
tmpdir[lstrlenA(tmpdir) - 1] = '*'; tmpdir[lstrlenA(tmpdir) - 1] = '*';
ret = CreateDirectoryA(tmpdir, NULL); ret = CreateDirectoryA(tmpdir, NULL);
ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME, ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME,
"CreateDirectoryA with * wildcard name should fail, ret=%s error=%ld", "CreateDirectoryA with * wildcard name should fail, ret=%s error=%ld\n",
ret ? " True" : "False", GetLastError()); ret ? " True" : "False", GetLastError());
ret = RemoveDirectoryA(tmpdir); ret = RemoveDirectoryA(tmpdir);
} }
...@@ -223,51 +223,51 @@ static void test_CreateDirectoryW(void) ...@@ -223,51 +223,51 @@ static void test_CreateDirectoryW(void)
ret = CreateDirectoryW(NULL, NULL); ret = CreateDirectoryW(NULL, NULL);
if (!ret && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED) if (!ret && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
return; return;
ok(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND, "should not create NULL path"); ok(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND, "should not create NULL path\n");
ret = CreateDirectoryW(empty_strW, NULL); ret = CreateDirectoryW(empty_strW, NULL);
ok(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND, "should not create empty path"); ok(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND, "should not create empty path\n");
ret = GetSystemDirectoryW(tmpdir, MAX_PATH); ret = GetSystemDirectoryW(tmpdir, MAX_PATH);
ok(ret < MAX_PATH, "System directory should fit into MAX_PATH"); ok(ret < MAX_PATH, "System directory should fit into MAX_PATH\n");
ret = SetCurrentDirectoryW(tmpdir); ret = SetCurrentDirectoryW(tmpdir);
ok(ret == TRUE, "could not chdir to the System directory"); ok(ret == TRUE, "could not chdir to the System directory\n");
ret = CreateDirectoryW(dotW, NULL); ret = CreateDirectoryW(dotW, NULL);
ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS, "should not create existing path"); ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS, "should not create existing path\n");
ret = CreateDirectoryW(dotdotW, NULL); ret = CreateDirectoryW(dotdotW, NULL);
ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS, "should not create existing path"); ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS, "should not create existing path\n");
GetTempPathW(MAX_PATH, tmpdir); GetTempPathW(MAX_PATH, tmpdir);
tmpdir[3] = 0; /* truncate the path */ tmpdir[3] = 0; /* truncate the path */
ret = CreateDirectoryW(tmpdir, NULL); ret = CreateDirectoryW(tmpdir, NULL);
ok(ret == FALSE && GetLastError() == ERROR_ACCESS_DENIED, "should deny access to the drive root"); ok(ret == FALSE && GetLastError() == ERROR_ACCESS_DENIED, "should deny access to the drive root\n");
GetTempPathW(MAX_PATH, tmpdir); GetTempPathW(MAX_PATH, tmpdir);
lstrcatW(tmpdir, tmp_dir_name); lstrcatW(tmpdir, tmp_dir_name);
ret = CreateDirectoryW(tmpdir, NULL); ret = CreateDirectoryW(tmpdir, NULL);
ok(ret == TRUE, "CreateDirectoryW should always succeed"); ok(ret == TRUE, "CreateDirectoryW should always succeed\n");
ret = CreateDirectoryW(tmpdir, NULL); ret = CreateDirectoryW(tmpdir, NULL);
ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS, "should not create existing path"); ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS, "should not create existing path\n");
ret = RemoveDirectoryW(tmpdir); ret = RemoveDirectoryW(tmpdir);
ok(ret == TRUE, "RemoveDirectoryW should always succeed"); ok(ret == TRUE, "RemoveDirectoryW should always succeed\n");
todo_wine { todo_wine {
lstrcatW(tmpdir, questionW); lstrcatW(tmpdir, questionW);
ret = CreateDirectoryW(tmpdir, NULL); ret = CreateDirectoryW(tmpdir, NULL);
ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME, ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME,
"CreateDirectoryW with ? wildcard name should fail with error 183, ret=%s error=%ld", "CreateDirectoryW with ? wildcard name should fail with error 183, ret=%s error=%ld\n",
ret ? " True" : "False", GetLastError()); ret ? " True" : "False", GetLastError());
ret = RemoveDirectoryW(tmpdir); ret = RemoveDirectoryW(tmpdir);
tmpdir[lstrlenW(tmpdir) - 1] = '*'; tmpdir[lstrlenW(tmpdir) - 1] = '*';
ret = CreateDirectoryW(tmpdir, NULL); ret = CreateDirectoryW(tmpdir, NULL);
ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME, ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME,
"CreateDirectoryW with * wildcard name should fail with error 183, ret=%s error=%ld", "CreateDirectoryW with * wildcard name should fail with error 183, ret=%s error=%ld\n",
ret ? " True" : "False", GetLastError()); ret ? " True" : "False", GetLastError());
ret = RemoveDirectoryW(tmpdir); ret = RemoveDirectoryW(tmpdir);
} }
...@@ -281,22 +281,22 @@ static void test_RemoveDirectoryA(void) ...@@ -281,22 +281,22 @@ static void test_RemoveDirectoryA(void)
GetTempPathA(MAX_PATH, tmpdir); GetTempPathA(MAX_PATH, tmpdir);
lstrcatA(tmpdir, "Please Remove Me"); lstrcatA(tmpdir, "Please Remove Me");
ret = CreateDirectoryA(tmpdir, NULL); ret = CreateDirectoryA(tmpdir, NULL);
ok(ret == TRUE, "CreateDirectoryA should always succeed"); ok(ret == TRUE, "CreateDirectoryA should always succeed\n");
ret = RemoveDirectoryA(tmpdir); ret = RemoveDirectoryA(tmpdir);
ok(ret == TRUE, "RemoveDirectoryA should always succeed"); ok(ret == TRUE, "RemoveDirectoryA should always succeed\n");
todo_wine { todo_wine {
lstrcatA(tmpdir, "?"); lstrcatA(tmpdir, "?");
ret = RemoveDirectoryA(tmpdir); ret = RemoveDirectoryA(tmpdir);
ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME, ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME,
"RemoveDirectoryA with ? wildcard name should fail with error 183, ret=%s error=%ld", "RemoveDirectoryA with ? wildcard name should fail with error 183, ret=%s error=%ld\n",
ret ? " True" : "False", GetLastError()); ret ? " True" : "False", GetLastError());
tmpdir[lstrlenA(tmpdir) - 1] = '*'; tmpdir[lstrlenA(tmpdir) - 1] = '*';
ret = RemoveDirectoryA(tmpdir); ret = RemoveDirectoryA(tmpdir);
ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME, ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME,
"RemoveDirectoryA with * wildcard name should fail with error 183, ret=%s error=%ld", "RemoveDirectoryA with * wildcard name should fail with error 183, ret=%s error=%ld\n",
ret ? " True" : "False", GetLastError()); ret ? " True" : "False", GetLastError());
} }
} }
...@@ -314,22 +314,22 @@ static void test_RemoveDirectoryW(void) ...@@ -314,22 +314,22 @@ static void test_RemoveDirectoryW(void)
if (!ret && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED) if (!ret && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
return; return;
ok(ret == TRUE, "CreateDirectoryW should always succeed"); ok(ret == TRUE, "CreateDirectoryW should always succeed\n");
ret = RemoveDirectoryW(tmpdir); ret = RemoveDirectoryW(tmpdir);
ok(ret == TRUE, "RemoveDirectoryW should always succeed"); ok(ret == TRUE, "RemoveDirectoryW should always succeed\n");
todo_wine { todo_wine {
lstrcatW(tmpdir, questionW); lstrcatW(tmpdir, questionW);
ret = RemoveDirectoryW(tmpdir); ret = RemoveDirectoryW(tmpdir);
ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME, ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME,
"RemoveDirectoryW with wildcard should fail with error 183, ret=%s error=%ld", "RemoveDirectoryW with wildcard should fail with error 183, ret=%s error=%ld\n",
ret ? " True" : "False", GetLastError()); ret ? " True" : "False", GetLastError());
tmpdir[lstrlenW(tmpdir) - 1] = '*'; tmpdir[lstrlenW(tmpdir) - 1] = '*';
ret = RemoveDirectoryW(tmpdir); ret = RemoveDirectoryW(tmpdir);
ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME, ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME,
"RemoveDirectoryW with * wildcard name should fail with error 183, ret=%s error=%ld", "RemoveDirectoryW with * wildcard name should fail with error 183, ret=%s error=%ld\n",
ret ? " True" : "False", GetLastError()); ret ? " True" : "False", GetLastError());
} }
......
...@@ -83,20 +83,20 @@ void UuidConversionAndComparison(void) { ...@@ -83,20 +83,20 @@ void UuidConversionAndComparison(void) {
} else { } else {
PUuid2 = NULL; PUuid2 = NULL;
} }
ok( (UuidEqual(PUuid1, PUuid2, &rslt) == Uuid_Comparison_Grid[i1][i2]), "UUID Equality" ); ok( (UuidEqual(PUuid1, PUuid2, &rslt) == Uuid_Comparison_Grid[i1][i2]), "UUID Equality\n" );
} }
/* Uuid to String to Uuid (char) */ /* Uuid to String to Uuid (char) */
for (i1 = 0; i1 < 10; i1++) { for (i1 = 0; i1 < 10; i1++) {
Uuid1 = Uuid_Table[i1]; Uuid1 = Uuid_Table[i1];
ok( (UuidToStringA(&Uuid1, (unsigned char**)&str) == RPC_S_OK), "Simple UUID->String copy" ); ok( (UuidToStringA(&Uuid1, (unsigned char**)&str) == RPC_S_OK), "Simple UUID->String copy\n" );
ok( (UuidFromStringA(str, &Uuid2) == RPC_S_OK), "Simple String->UUID copy from generated UUID String" ); ok( (UuidFromStringA(str, &Uuid2) == RPC_S_OK), "Simple String->UUID copy from generated UUID String\n" );
ok( UuidEqual(&Uuid1, &Uuid2, &rslt), "Uuid -> String -> Uuid transform" ); ok( UuidEqual(&Uuid1, &Uuid2, &rslt), "Uuid -> String -> Uuid transform\n" );
/* invalid uuid tests -- size of valid UUID string=36 */ /* invalid uuid tests -- size of valid UUID string=36 */
for (i2 = 0; i2 < 36; i2++) { for (i2 = 0; i2 < 36; i2++) {
x = str[i2]; x = str[i2];
str[i2] = 'g'; /* whatever, but "g" is a good boundary condition */ str[i2] = 'g'; /* whatever, but "g" is a good boundary condition */
ok( (UuidFromStringA(str, &Uuid1) == RPC_S_INVALID_STRING_UUID), "Invalid UUID String" ); ok( (UuidFromStringA(str, &Uuid1) == RPC_S_INVALID_STRING_UUID), "Invalid UUID String\n" );
str[i2] = x; /* change it back so remaining tests are interesting. */ str[i2] = x; /* change it back so remaining tests are interesting. */
} }
} }
...@@ -109,14 +109,14 @@ void UuidConversionAndComparison(void) { ...@@ -109,14 +109,14 @@ void UuidConversionAndComparison(void) {
/* Must be Win9x (no Unicode support), skip the tests */ /* Must be Win9x (no Unicode support), skip the tests */
break; break;
} }
ok( (rslt == RPC_S_OK), "Simple UUID->WString copy" ); ok( (rslt == RPC_S_OK), "Simple UUID->WString copy\n" );
ok( (UuidFromStringW(wstr, &Uuid2) == RPC_S_OK), "Simple WString->UUID copy from generated UUID String" ); ok( (UuidFromStringW(wstr, &Uuid2) == RPC_S_OK), "Simple WString->UUID copy from generated UUID String\n" );
ok( UuidEqual(&Uuid1, &Uuid2, &rslt), "Uuid -> WString -> Uuid transform" ); ok( UuidEqual(&Uuid1, &Uuid2, &rslt), "Uuid -> WString -> Uuid transform\n" );
/* invalid uuid tests -- size of valid UUID string=36 */ /* invalid uuid tests -- size of valid UUID string=36 */
for (i2 = 0; i2 < 36; i2++) { for (i2 = 0; i2 < 36; i2++) {
wx = wstr[i2]; wx = wstr[i2];
wstr[i2] = 'g'; /* whatever, but "g" is a good boundary condition */ wstr[i2] = 'g'; /* whatever, but "g" is a good boundary condition */
ok( (UuidFromStringW(wstr, &Uuid1) == RPC_S_INVALID_STRING_UUID), "Invalid UUID WString" ); ok( (UuidFromStringW(wstr, &Uuid1) == RPC_S_INVALID_STRING_UUID), "Invalid UUID WString\n" );
wstr[i2] = wx; /* change it back so remaining tests are interesting. */ wstr[i2] = wx; /* change it back so remaining tests are interesting. */
} }
} }
......
...@@ -36,11 +36,9 @@ void createTestFile(CHAR *name) ...@@ -36,11 +36,9 @@ void createTestFile(CHAR *name)
{ {
HANDLE file; HANDLE file;
DWORD written; DWORD written;
CHAR msg[MAX_PATH];
file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL); file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
sprintf(msg, "Failure to open file %s", name); ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
ok(file != INVALID_HANDLE_VALUE, msg);
WriteFile(file, name, strlen(name), &written, NULL); WriteFile(file, name, strlen(name), &written, NULL);
WriteFile(file, "\n", strlen("\n"), &written, NULL); WriteFile(file, "\n", strlen("\n"), &written, NULL);
CloseHandle(file); CloseHandle(file);
...@@ -119,33 +117,33 @@ void test_delete(void) ...@@ -119,33 +117,33 @@ void test_delete(void)
shfo.hNameMappings = NULL; shfo.hNameMappings = NULL;
shfo.lpszProgressTitle = NULL; shfo.lpszProgressTitle = NULL;
ok(!SHFileOperationA(&shfo), "Deletion was successful"); ok(!SHFileOperationA(&shfo), "Deletion was successful\n");
ok(file_exists(".\\test4.txt"), "Directory should not be removed"); ok(file_exists(".\\test4.txt"), "Directory should not be removed\n");
ok(!file_exists(".\\test1.txt"), "File should be removed"); ok(!file_exists(".\\test1.txt"), "File should be removed\n");
ok(!SHFileOperationA(&shfo), "Directory exists, but is not removed"); ok(!SHFileOperationA(&shfo), "Directory exists, but is not removed\n");
ok(file_exists(".\\test4.txt"), "Directory should not be removed"); ok(file_exists(".\\test4.txt"), "Directory should not be removed\n");
shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI; shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI;
ok(!SHFileOperationA(&shfo), "Directory removed"); ok(!SHFileOperationA(&shfo), "Directory removed\n");
ok(!file_exists(".\\test4.txt"), "Directory should be removed"); ok(!file_exists(".\\test4.txt"), "Directory should be removed\n");
ok(!SHFileOperationA(&shfo), "The requested file does not exist"); ok(!SHFileOperationA(&shfo), "The requested file does not exist\n");
init_shfo_tests(); init_shfo_tests();
sprintf(buf, "%s\\%s", CURR_DIR, "test4.txt"); sprintf(buf, "%s\\%s", CURR_DIR, "test4.txt");
buf[strlen(buf) + 1] = '\0'; buf[strlen(buf) + 1] = '\0';
ok(MoveFileA(".\\test1.txt", ".\\test4.txt\\test1.txt"), "Fill the subdirectory"); ok(MoveFileA(".\\test1.txt", ".\\test4.txt\\test1.txt"), "Fill the subdirectory\n");
ok(!SHFileOperationA(&shfo), "Directory removed"); ok(!SHFileOperationA(&shfo), "Directory removed\n");
ok(!file_exists(".\\test4.txt"), "Directory is removed"); ok(!file_exists(".\\test4.txt"), "Directory is removed\n");
init_shfo_tests(); init_shfo_tests();
shfo.pFrom = ".\\test1.txt\0.\\test4.txt\0"; shfo.pFrom = ".\\test1.txt\0.\\test4.txt\0";
ok(!SHFileOperationA(&shfo), "Directory and a file removed"); ok(!SHFileOperationA(&shfo), "Directory and a file removed\n");
ok(!file_exists(".\\test1.txt"), "The file should be removed"); ok(!file_exists(".\\test1.txt"), "The file should be removed\n");
ok(!file_exists(".\\test4.txt"), "Directory should be removed"); ok(!file_exists(".\\test4.txt"), "Directory should be removed\n");
ok(file_exists(".\\test2.txt"), "This file should not be removed"); ok(file_exists(".\\test2.txt"), "This file should not be removed\n");
} }
/* tests the FO_RENAME action */ /* tests the FO_RENAME action */
...@@ -167,19 +165,19 @@ void test_rename() ...@@ -167,19 +165,19 @@ void test_rename()
set_curr_dir_path(from, "test1.txt\0"); set_curr_dir_path(from, "test1.txt\0");
set_curr_dir_path(to, "test4.txt\0"); set_curr_dir_path(to, "test4.txt\0");
ok(SHFileOperationA(&shfo), "File is not renamed moving to other directory " ok(SHFileOperationA(&shfo), "File is not renamed moving to other directory "
"when specifying directory name only"); "when specifying directory name only\n");
ok(file_exists(".\\test1.txt"), "The file is not removed"); ok(file_exists(".\\test1.txt"), "The file is not removed\n");
set_curr_dir_path(from, "test3.txt\0"); set_curr_dir_path(from, "test3.txt\0");
set_curr_dir_path(to, "test4.txt\\test1.txt\0"); set_curr_dir_path(to, "test4.txt\\test1.txt\0");
ok(!SHFileOperationA(&shfo), "File is renamed moving to other directory"); ok(!SHFileOperationA(&shfo), "File is renamed moving to other directory\n");
ok(file_exists(".\\test4.txt\\test1.txt"), "The file is renamed"); ok(file_exists(".\\test4.txt\\test1.txt"), "The file is renamed\n");
set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0"); set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0"); set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0");
retval = SHFileOperationA(&shfo); /* W98 returns 0, W2K and newer returns ERROR_GEN_FAILURE, both do nothing */ retval = SHFileOperationA(&shfo); /* W98 returns 0, W2K and newer returns ERROR_GEN_FAILURE, both do nothing */
ok(!retval || retval == ERROR_GEN_FAILURE, "Can't rename many files, retval = %lx", retval); ok(!retval || retval == ERROR_GEN_FAILURE, "Can't rename many files, retval = %lx\n", retval);
ok(file_exists(".\\test1.txt"), "The file is not renamed - many files are specified "); ok(file_exists(".\\test1.txt"), "The file is not renamed - many files are specified\n");
memcpy(&shfo2, &shfo, sizeof(SHFILEOPSTRUCTA)); memcpy(&shfo2, &shfo, sizeof(SHFILEOPSTRUCTA));
shfo2.fFlags |= FOF_MULTIDESTFILES; shfo2.fFlags |= FOF_MULTIDESTFILES;
...@@ -187,26 +185,26 @@ void test_rename() ...@@ -187,26 +185,26 @@ void test_rename()
set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0"); set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0"); set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0");
retval = SHFileOperationA(&shfo2); /* W98 returns 0, W2K and newer returns ERROR_GEN_FAILURE, both do nothing */ retval = SHFileOperationA(&shfo2); /* W98 returns 0, W2K and newer returns ERROR_GEN_FAILURE, both do nothing */
ok(!retval || retval == ERROR_GEN_FAILURE, "Can't rename many files, retval = %lx", retval); ok(!retval || retval == ERROR_GEN_FAILURE, "Can't rename many files, retval = %lx\n", retval);
ok(file_exists(".\\test1.txt"), "The file is not renamed - many files are specified "); ok(file_exists(".\\test1.txt"), "The file is not renamed - many files are specified\n");
set_curr_dir_path(from, "test1.txt\0"); set_curr_dir_path(from, "test1.txt\0");
set_curr_dir_path(to, "test6.txt\0"); set_curr_dir_path(to, "test6.txt\0");
ok(!SHFileOperationA(&shfo), "Rename file"); ok(!SHFileOperationA(&shfo), "Rename file\n");
ok(!file_exists(".\\test1.txt"), "The file is renamed"); ok(!file_exists(".\\test1.txt"), "The file is renamed\n");
ok(file_exists(".\\test6.txt"), "The file is renamed"); ok(file_exists(".\\test6.txt"), "The file is renamed\n");
set_curr_dir_path(from, "test6.txt\0"); set_curr_dir_path(from, "test6.txt\0");
set_curr_dir_path(to, "test1.txt\0"); set_curr_dir_path(to, "test1.txt\0");
ok(!SHFileOperationA(&shfo), "Rename file back"); ok(!SHFileOperationA(&shfo), "Rename file back\n");
set_curr_dir_path(from, "test4.txt\0"); set_curr_dir_path(from, "test4.txt\0");
set_curr_dir_path(to, "test6.txt\0"); set_curr_dir_path(to, "test6.txt\0");
ok(!SHFileOperationA(&shfo), "Rename dir"); ok(!SHFileOperationA(&shfo), "Rename dir\n");
ok(!file_exists(".\\test4.txt"), "The dir is renamed"); ok(!file_exists(".\\test4.txt"), "The dir is renamed\n");
ok(file_exists(".\\test6.txt"), "The dir is renamed "); ok(file_exists(".\\test6.txt"), "The dir is renamed\n");
set_curr_dir_path(from, "test6.txt\0"); set_curr_dir_path(from, "test6.txt\0");
set_curr_dir_path(to, "test4.txt\0"); set_curr_dir_path(to, "test4.txt\0");
ok(!SHFileOperationA(&shfo), "Rename dir back"); ok(!SHFileOperationA(&shfo), "Rename dir back\n");
} }
/* tests the FO_COPY action */ /* tests the FO_COPY action */
...@@ -228,18 +226,18 @@ void test_copy(void) ...@@ -228,18 +226,18 @@ void test_copy(void)
set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0"); set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0"); set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0");
ok(SHFileOperationA(&shfo), "Can't copy many files"); ok(SHFileOperationA(&shfo), "Can't copy many files\n");
ok(!file_exists(".\\test6.txt"), "The file is not copied - many files are " ok(!file_exists(".\\test6.txt"), "The file is not copied - many files are "
"specified as a target"); "specified as a target\n");
memcpy(&shfo2, &shfo, sizeof(SHFILEOPSTRUCTA)); memcpy(&shfo2, &shfo, sizeof(SHFILEOPSTRUCTA));
shfo2.fFlags |= FOF_MULTIDESTFILES; shfo2.fFlags |= FOF_MULTIDESTFILES;
set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0"); set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0"); set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0");
ok(!SHFileOperationA(&shfo2), "Can't copy many files"); ok(!SHFileOperationA(&shfo2), "Can't copy many files\n");
ok(file_exists(".\\test6.txt"), "The file is copied - many files are " ok(file_exists(".\\test6.txt"), "The file is copied - many files are "
"specified as a target"); "specified as a target\n");
DeleteFileA(".\\test6.txt"); DeleteFileA(".\\test6.txt");
DeleteFileA(".\\test7.txt"); DeleteFileA(".\\test7.txt");
RemoveDirectoryA(".\\test8.txt"); RemoveDirectoryA(".\\test8.txt");
...@@ -247,41 +245,41 @@ void test_copy(void) ...@@ -247,41 +245,41 @@ void test_copy(void)
/* number of sources do not correspond to number of targets */ /* number of sources do not correspond to number of targets */
set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0"); set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
set_curr_dir_path(to, "test6.txt\0test7.txt\0"); set_curr_dir_path(to, "test6.txt\0test7.txt\0");
ok(SHFileOperationA(&shfo2), "Can't copy many files"); ok(SHFileOperationA(&shfo2), "Can't copy many files\n");
ok(!file_exists(".\\test6.txt"), "The file is not copied - many files are " ok(!file_exists(".\\test6.txt"), "The file is not copied - many files are "
"specified as a target"); "specified as a target\n");
set_curr_dir_path(from, "test1.txt\0"); set_curr_dir_path(from, "test1.txt\0");
set_curr_dir_path(to, "test4.txt\0"); set_curr_dir_path(to, "test4.txt\0");
ok(!SHFileOperationA(&shfo), "Prepare test to check how directories are copied recursively"); ok(!SHFileOperationA(&shfo), "Prepare test to check how directories are copied recursively\n");
ok(file_exists(".\\test4.txt\\test1.txt"), "The file is copied"); ok(file_exists(".\\test4.txt\\test1.txt"), "The file is copied\n");
set_curr_dir_path(from, "test?.txt\0"); set_curr_dir_path(from, "test?.txt\0");
set_curr_dir_path(to, "testdir2\0"); set_curr_dir_path(to, "testdir2\0");
ok(!file_exists(".\\testdir2\\test1.txt"), "The file is not copied yet"); ok(!file_exists(".\\testdir2\\test1.txt"), "The file is not copied yet\n");
ok(!file_exists(".\\testdir2\\test4.txt"), "The directory is not copied yet"); ok(!file_exists(".\\testdir2\\test4.txt"), "The directory is not copied yet\n");
ok(!SHFileOperationA(&shfo), "Files and directories are copied to directory "); ok(!SHFileOperationA(&shfo), "Files and directories are copied to directory\n");
ok(file_exists(".\\testdir2\\test1.txt"), "The file is copied"); ok(file_exists(".\\testdir2\\test1.txt"), "The file is copied\n");
ok(file_exists(".\\testdir2\\test4.txt"), "The directory is copied"); ok(file_exists(".\\testdir2\\test4.txt"), "The directory is copied\n");
ok(file_exists(".\\testdir2\\test4.txt\\test1.txt"), "The file in subdirectory is copied"); ok(file_exists(".\\testdir2\\test4.txt\\test1.txt"), "The file in subdirectory is copied\n");
clean_after_shfo_tests(); clean_after_shfo_tests();
init_shfo_tests(); init_shfo_tests();
shfo.fFlags |= FOF_FILESONLY; shfo.fFlags |= FOF_FILESONLY;
ok(!file_exists(".\\testdir2\\test1.txt"), "The file is not copied yet"); ok(!file_exists(".\\testdir2\\test1.txt"), "The file is not copied yet\n");
ok(!file_exists(".\\testdir2\\test4.txt"), "The directory is not copied yet"); ok(!file_exists(".\\testdir2\\test4.txt"), "The directory is not copied yet\n");
ok(!SHFileOperationA(&shfo), "Files are copied to other directory "); ok(!SHFileOperationA(&shfo), "Files are copied to other directory\n");
ok(file_exists(".\\testdir2\\test1.txt"), "The file is copied"); ok(file_exists(".\\testdir2\\test1.txt"), "The file is copied\n");
ok(!file_exists(".\\testdir2\\test4.txt"), "The directory is copied"); ok(!file_exists(".\\testdir2\\test4.txt"), "The directory is copied\n");
clean_after_shfo_tests(); clean_after_shfo_tests();
init_shfo_tests(); init_shfo_tests();
set_curr_dir_path(from, "test1.txt\0test2.txt\0"); set_curr_dir_path(from, "test1.txt\0test2.txt\0");
ok(!file_exists(".\\testdir2\\test1.txt"), "The file is not copied yet"); ok(!file_exists(".\\testdir2\\test1.txt"), "The file is not copied yet\n");
ok(!file_exists(".\\testdir2\\test2.txt"), "The file is not copied yet"); ok(!file_exists(".\\testdir2\\test2.txt"), "The file is not copied yet\n");
ok(!SHFileOperationA(&shfo), "Files are copied to other directory "); ok(!SHFileOperationA(&shfo), "Files are copied to other directory \n");
ok(file_exists(".\\testdir2\\test1.txt"), "The file is copied"); ok(file_exists(".\\testdir2\\test1.txt"), "The file is copied\n");
ok(file_exists(".\\testdir2\\test2.txt"), "The file is copied"); ok(file_exists(".\\testdir2\\test2.txt"), "The file is copied\n");
clean_after_shfo_tests(); clean_after_shfo_tests();
/* Copying multiple files with one not existing as source, fails the /* Copying multiple files with one not existing as source, fails the
...@@ -289,19 +287,19 @@ void test_copy(void) ...@@ -289,19 +287,19 @@ void test_copy(void)
init_shfo_tests(); init_shfo_tests();
tmp_flags = shfo.fFlags; tmp_flags = shfo.fFlags;
set_curr_dir_path(from, "test1.txt\0test10.txt\0test2.txt\0"); set_curr_dir_path(from, "test1.txt\0test10.txt\0test2.txt\0");
ok(!file_exists(".\\testdir2\\test1.txt"), "The file is not copied yet"); ok(!file_exists(".\\testdir2\\test1.txt"), "The file is not copied yet\n");
ok(!file_exists(".\\testdir2\\test2.txt"), "The file is not copied yet"); ok(!file_exists(".\\testdir2\\test2.txt"), "The file is not copied yet\n");
retval = SHFileOperationA(&shfo); retval = SHFileOperationA(&shfo);
if (!retval) if (!retval)
/* Win 95/NT returns success but copies only the files up to the non-existent source */ /* Win 95/NT returns success but copies only the files up to the non-existent source */
ok(file_exists(".\\testdir2\\test1.txt"), "The file is not copied"); ok(file_exists(".\\testdir2\\test1.txt"), "The file is not copied\n");
else else
{ {
/* Win 98/ME/2K/XP fail the entire operation with return code 1026 if one source file does not exist */ /* Win 98/ME/2K/XP fail the entire operation with return code 1026 if one source file does not exist */
ok(retval == 1026, "Files are copied to other directory "); ok(retval == 1026, "Files are copied to other directory\n");
ok(!file_exists(".\\testdir2\\test1.txt"), "The file is copied"); ok(!file_exists(".\\testdir2\\test1.txt"), "The file is copied\n");
} }
ok(!file_exists(".\\testdir2\\test2.txt"), "The file is copied"); ok(!file_exists(".\\testdir2\\test2.txt"), "The file is copied\n");
shfo.fFlags = tmp_flags; shfo.fFlags = tmp_flags;
} }
...@@ -322,17 +320,17 @@ void test_move(void) ...@@ -322,17 +320,17 @@ void test_move(void)
set_curr_dir_path(from, "test1.txt\0"); set_curr_dir_path(from, "test1.txt\0");
set_curr_dir_path(to, "test4.txt\0"); set_curr_dir_path(to, "test4.txt\0");
ok(!SHFileOperationA(&shfo), "Prepare test to check how directories are moved recursively"); ok(!SHFileOperationA(&shfo), "Prepare test to check how directories are moved recursively\n");
ok(file_exists(".\\test4.txt\\test1.txt"), "The file is moved"); ok(file_exists(".\\test4.txt\\test1.txt"), "The file is moved\n");
set_curr_dir_path(from, "test?.txt\0"); set_curr_dir_path(from, "test?.txt\0");
set_curr_dir_path(to, "testdir2\0"); set_curr_dir_path(to, "testdir2\0");
ok(!file_exists(".\\testdir2\\test2.txt"), "The file is not moved yet"); ok(!file_exists(".\\testdir2\\test2.txt"), "The file is not moved yet\n");
ok(!file_exists(".\\testdir2\\test4.txt"), "The directory is not moved yet"); ok(!file_exists(".\\testdir2\\test4.txt"), "The directory is not moved yet\n");
ok(!SHFileOperationA(&shfo), "Files and directories are moved to directory "); ok(!SHFileOperationA(&shfo), "Files and directories are moved to directory\n");
ok(file_exists(".\\testdir2\\test2.txt"), "The file is moved"); ok(file_exists(".\\testdir2\\test2.txt"), "The file is moved\n");
ok(file_exists(".\\testdir2\\test4.txt"), "The directory is moved"); ok(file_exists(".\\testdir2\\test4.txt"), "The directory is moved\n");
ok(file_exists(".\\testdir2\\test4.txt\\test1.txt"), "The file in subdirectory is moved"); ok(file_exists(".\\testdir2\\test4.txt\\test1.txt"), "The file in subdirectory is moved\n");
clean_after_shfo_tests(); clean_after_shfo_tests();
init_shfo_tests(); init_shfo_tests();
...@@ -342,9 +340,9 @@ void test_move(void) ...@@ -342,9 +340,9 @@ void test_move(void)
set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0"); set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0"); set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0");
ok(!SHFileOperationA(&shfo2), "Move many files"); ok(!SHFileOperationA(&shfo2), "Move many files\n");
ok(file_exists(".\\test6.txt"), "The file is moved - many files are " ok(file_exists(".\\test6.txt"), "The file is moved - many files are "
"specified as a target"); "specified as a target\n");
DeleteFileA(".\\test6.txt"); DeleteFileA(".\\test6.txt");
DeleteFileA(".\\test7.txt"); DeleteFileA(".\\test7.txt");
RemoveDirectoryA(".\\test8.txt"); RemoveDirectoryA(".\\test8.txt");
...@@ -354,40 +352,40 @@ void test_move(void) ...@@ -354,40 +352,40 @@ void test_move(void)
/* number of sources do not correspond to number of targets */ /* number of sources do not correspond to number of targets */
set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0"); set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
set_curr_dir_path(to, "test6.txt\0test7.txt\0"); set_curr_dir_path(to, "test6.txt\0test7.txt\0");
ok(SHFileOperationA(&shfo2), "Can't move many files"); ok(SHFileOperationA(&shfo2), "Can't move many files\n");
ok(!file_exists(".\\test6.txt"), "The file is not moved - many files are " ok(!file_exists(".\\test6.txt"), "The file is not moved - many files are "
"specified as a target"); "specified as a target\n");
init_shfo_tests(); init_shfo_tests();
set_curr_dir_path(from, "test3.txt\0"); set_curr_dir_path(from, "test3.txt\0");
set_curr_dir_path(to, "test4.txt\\test1.txt\0"); set_curr_dir_path(to, "test4.txt\\test1.txt\0");
ok(!SHFileOperationA(&shfo), "File is moved moving to other directory"); ok(!SHFileOperationA(&shfo), "File is moved moving to other directory\n");
ok(file_exists(".\\test4.txt\\test1.txt"), "The file is moved"); ok(file_exists(".\\test4.txt\\test1.txt"), "The file is moved\n");
set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0"); set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0"); set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0");
ok(SHFileOperationA(&shfo), "Can not move many files"); ok(SHFileOperationA(&shfo), "Can not move many files\n");
ok(file_exists(".\\test1.txt"), "The file is not moved. Many files are specified "); ok(file_exists(".\\test1.txt"), "The file is not moved. Many files are specified\n");
ok(file_exists(".\\test4.txt"), "The directory not is moved. Many files are specified "); ok(file_exists(".\\test4.txt"), "The directory not is moved. Many files are specified\n");
set_curr_dir_path(from, "test1.txt\0"); set_curr_dir_path(from, "test1.txt\0");
set_curr_dir_path(to, "test6.txt\0"); set_curr_dir_path(to, "test6.txt\0");
ok(!SHFileOperationA(&shfo), "Move file"); ok(!SHFileOperationA(&shfo), "Move file\n");
ok(!file_exists(".\\test1.txt"), "The file is moved"); ok(!file_exists(".\\test1.txt"), "The file is moved\n");
ok(file_exists(".\\test6.txt"), "The file is moved "); ok(file_exists(".\\test6.txt"), "The file is moved\n");
set_curr_dir_path(from, "test6.txt\0"); set_curr_dir_path(from, "test6.txt\0");
set_curr_dir_path(to, "test1.txt\0"); set_curr_dir_path(to, "test1.txt\0");
ok(!SHFileOperationA(&shfo), "Move file back"); ok(!SHFileOperationA(&shfo), "Move file back\n");
set_curr_dir_path(from, "test4.txt\0"); set_curr_dir_path(from, "test4.txt\0");
set_curr_dir_path(to, "test6.txt\0"); set_curr_dir_path(to, "test6.txt\0");
ok(!SHFileOperationA(&shfo), "Move dir"); ok(!SHFileOperationA(&shfo), "Move dir\n");
ok(!file_exists(".\\test4.txt"), "The dir is moved"); ok(!file_exists(".\\test4.txt"), "The dir is moved\n");
ok(file_exists(".\\test6.txt"), "The dir is moved "); ok(file_exists(".\\test6.txt"), "The dir is moved\n");
set_curr_dir_path(from, "test6.txt\0"); set_curr_dir_path(from, "test6.txt\0");
set_curr_dir_path(to, "test4.txt\0"); set_curr_dir_path(to, "test4.txt\0");
ok(!SHFileOperationA(&shfo), "Move dir back"); ok(!SHFileOperationA(&shfo), "Move dir back\n");
} }
START_TEST(shlfileop) START_TEST(shlfileop)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment