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

This commit is contained in:
Francois Gouget 2004-01-27 20:13:03 +00:00 committed by Alexandre Julliard
parent 333ecf3b75
commit ce7c3b50ac
10 changed files with 526 additions and 526 deletions

View File

@ -55,35 +55,35 @@ static void test__hread( void )
filehandle = _lcreat( filename, 0 );
if (filehandle == HFILE_ERROR)
{
ok(0,"couldn't create file \"%s\" (err=%ld)",filename,GetLastError());
ok(0,"couldn't create file \"%s\" (err=%ld)\n",filename,GetLastError());
return;
}
ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite complains" );
ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite complains\n" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" );
filehandle = _lopen( filename, OF_READ );
ok( HFILE_ERROR != filehandle, "couldn't open file \"%s\" again (err=%ld)", filename, GetLastError( ) );
ok( HFILE_ERROR != filehandle, "couldn't open file \"%s\" again (err=%ld)\n", filename, GetLastError( ) );
bytes_read = _hread( filehandle, buffer, 2 * strlen( sillytext ) );
ok( lstrlenA( sillytext ) == bytes_read, "file read size error" );
ok( lstrlenA( sillytext ) == bytes_read, "file read size error\n" );
for (bytes_wanted = 0; bytes_wanted < lstrlenA( sillytext ); bytes_wanted++)
{
ok( 0 == _llseek( filehandle, 0, FILE_BEGIN ), "_llseek complains" );
ok( _hread( filehandle, buffer, bytes_wanted ) == bytes_wanted, "erratic _hread return value" );
ok( 0 == _llseek( filehandle, 0, FILE_BEGIN ), "_llseek complains\n" );
ok( _hread( filehandle, buffer, bytes_wanted ) == bytes_wanted, "erratic _hread return value\n" );
for (i = 0; i < bytes_wanted; i++)
{
ok( buffer[i] == sillytext[i], "that's not what's written" );
ok( buffer[i] == sillytext[i], "that's not what's written\n" );
}
}
ok( HFILE_ERROR != _lclose( filehandle ), "_lclose complains" );
ok( HFILE_ERROR != _lclose( filehandle ), "_lclose complains\n" );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)", GetLastError( ) );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)\n", GetLastError( ) );
}
@ -102,21 +102,21 @@ static void test__hwrite( void )
filehandle = _lcreat( filename, 0 );
if (filehandle == HFILE_ERROR)
{
ok(0,"couldn't create file \"%s\" (err=%ld)",filename,GetLastError());
ok(0,"couldn't create file \"%s\" (err=%ld)\n",filename,GetLastError());
return;
}
ok( HFILE_ERROR != _hwrite( filehandle, "", 0 ), "_hwrite complains" );
ok( HFILE_ERROR != _hwrite( filehandle, "", 0 ), "_hwrite complains\n" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" );
filehandle = _lopen( filename, OF_READ );
bytes_read = _hread( filehandle, buffer, 1);
ok( 0 == bytes_read, "file read size error" );
ok( 0 == bytes_read, "file read size error\n" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" );
filehandle = _lopen( filename, OF_READWRITE );
@ -130,18 +130,18 @@ static void test__hwrite( void )
buffer[i] = rand( );
checksum[0] = checksum[0] + buffer[i];
}
ok( HFILE_ERROR != _hwrite( filehandle, buffer, sizeof( buffer ) ), "_hwrite complains" );
ok( HFILE_ERROR != _hwrite( filehandle, buffer, sizeof( buffer ) ), "_hwrite complains\n" );
bytes_written = bytes_written + sizeof( buffer );
}
ok( HFILE_ERROR != _hwrite( filehandle, checksum, 1 ), "_hwrite complains" );
ok( HFILE_ERROR != _hwrite( filehandle, checksum, 1 ), "_hwrite complains\n" );
bytes_written++;
ok( HFILE_ERROR != _lclose( filehandle ), "_lclose complains" );
ok( HFILE_ERROR != _lclose( filehandle ), "_lclose complains\n" );
memory_object = LocalAlloc( LPTR, bytes_written );
ok( 0 != memory_object, "LocalAlloc fails. (Could be out of memory.)" );
ok( 0 != memory_object, "LocalAlloc fails. (Could be out of memory.)\n" );
contents = LocalLock( memory_object );
@ -149,9 +149,9 @@ static void test__hwrite( void )
contents = LocalLock( memory_object );
ok( NULL != contents, "LocalLock whines" );
ok( NULL != contents, "LocalLock whines\n" );
ok( bytes_written == _hread( filehandle, contents, bytes_written), "read length differ from write length" );
ok( bytes_written == _hread( filehandle, contents, bytes_written), "read length differ from write length\n" );
checksum[0] = '\0';
i = 0;
@ -162,11 +162,11 @@ static void test__hwrite( void )
}
while (i < bytes_written - 1);
ok( checksum[0] == contents[i], "stored checksum differ from computed checksum" );
ok( checksum[0] == contents[i], "stored checksum differ from computed checksum\n" );
ok( HFILE_ERROR != _lclose( filehandle ), "_lclose complains" );
ok( HFILE_ERROR != _lclose( filehandle ), "_lclose complains\n" );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)", GetLastError( ) );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)\n", GetLastError( ) );
}
@ -177,15 +177,15 @@ static void test__lclose( void )
filehandle = _lcreat( filename, 0 );
if (filehandle == HFILE_ERROR)
{
ok(0,"couldn't create file \"%s\" (err=%ld)",filename,GetLastError());
ok(0,"couldn't create file \"%s\" (err=%ld)\n",filename,GetLastError());
return;
}
ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite complains" );
ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite complains\n" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)", GetLastError( ) );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)\n", GetLastError( ) );
}
@ -201,107 +201,107 @@ static void test__lcreat( void )
filehandle = _lcreat( filename, 0 );
if (filehandle == HFILE_ERROR)
{
ok(0,"couldn't create file \"%s\" (err=%ld)",filename,GetLastError());
ok(0,"couldn't create file \"%s\" (err=%ld)\n",filename,GetLastError());
return;
}
ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite complains" );
ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite complains\n" );
ok( 0 == _llseek( filehandle, 0, FILE_BEGIN ), "_llseek complains" );
ok( 0 == _llseek( filehandle, 0, FILE_BEGIN ), "_llseek complains\n" );
ok( _hread( filehandle, buffer, strlen( sillytext ) ) == lstrlenA( sillytext ), "erratic _hread return value" );
ok( _hread( filehandle, buffer, strlen( sillytext ) ) == lstrlenA( sillytext ), "erratic _hread return value\n" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" );
ok( INVALID_HANDLE_VALUE != FindFirstFileA( filename, &search_results ), "should be able to find file" );
ok( INVALID_HANDLE_VALUE != FindFirstFileA( filename, &search_results ), "should be able to find file\n" );
ok( DeleteFileA(filename) != 0, "DeleteFile failed (%ld)", GetLastError());
ok( DeleteFileA(filename) != 0, "DeleteFile failed (%ld)\n", GetLastError());
filehandle = _lcreat( filename, 1 ); /* readonly */
ok( HFILE_ERROR != filehandle, "couldn't create file \"%s\" (err=%ld)", filename, GetLastError( ) );
ok( HFILE_ERROR != filehandle, "couldn't create file \"%s\" (err=%ld)\n", filename, GetLastError( ) );
ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite shouldn't be able to write never the less" );
ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite shouldn't be able to write never the less\n" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" );
ok( INVALID_HANDLE_VALUE != FindFirstFileA( filename, &search_results ), "should be able to find file" );
ok( INVALID_HANDLE_VALUE != FindFirstFileA( filename, &search_results ), "should be able to find file\n" );
ok( 0 == DeleteFileA( filename ), "shouldn't be able to delete a readonly file" );
ok( 0 == DeleteFileA( filename ), "shouldn't be able to delete a readonly file\n" );
ok( SetFileAttributesA(filename, FILE_ATTRIBUTE_NORMAL ) != 0, "couldn't change attributes on file" );
ok( SetFileAttributesA(filename, FILE_ATTRIBUTE_NORMAL ) != 0, "couldn't change attributes on file\n" );
ok( DeleteFileA( filename ) != 0, "now it should be possible to delete the file!" );
ok( DeleteFileA( filename ) != 0, "now it should be possible to delete the file!\n" );
filehandle = _lcreat( filename, 2 );
ok( HFILE_ERROR != filehandle, "couldn't create file \"%s\" (err=%ld)", filename, GetLastError( ) );
ok( HFILE_ERROR != filehandle, "couldn't create file \"%s\" (err=%ld)\n", filename, GetLastError( ) );
ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite complains" );
ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite complains\n" );
ok( 0 == _llseek( filehandle, 0, FILE_BEGIN ), "_llseek complains" );
ok( 0 == _llseek( filehandle, 0, FILE_BEGIN ), "_llseek complains\n" );
ok( _hread( filehandle, buffer, strlen( sillytext ) ) == lstrlenA( sillytext ), "erratic _hread return value" );
ok( _hread( filehandle, buffer, strlen( sillytext ) ) == lstrlenA( sillytext ), "erratic _hread return value\n" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" );
ok( INVALID_HANDLE_VALUE != FindFirstFileA( filename, &search_results ), "should STILL be able to find file" );
ok( INVALID_HANDLE_VALUE != FindFirstFileA( filename, &search_results ), "should STILL be able to find file\n" );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)", GetLastError( ) );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)\n", GetLastError( ) );
filehandle = _lcreat( filename, 4 ); /* SYSTEM file */
ok( HFILE_ERROR != filehandle, "couldn't create file \"%s\" (err=%ld)", filename, GetLastError( ) );
ok( HFILE_ERROR != filehandle, "couldn't create file \"%s\" (err=%ld)\n", filename, GetLastError( ) );
ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite complains" );
ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite complains\n" );
ok( 0 == _llseek( filehandle, 0, FILE_BEGIN ), "_llseek complains" );
ok( 0 == _llseek( filehandle, 0, FILE_BEGIN ), "_llseek complains\n" );
ok( _hread( filehandle, buffer, strlen( sillytext ) ) == lstrlenA( sillytext ), "erratic _hread return value" );
ok( _hread( filehandle, buffer, strlen( sillytext ) ) == lstrlenA( sillytext ), "erratic _hread return value\n" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" );
ok( INVALID_HANDLE_VALUE != FindFirstFileA( filename, &search_results ), "should STILL be able to find file" );
ok( INVALID_HANDLE_VALUE != FindFirstFileA( filename, &search_results ), "should STILL be able to find file\n" );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)", GetLastError( ) );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)\n", GetLastError( ) );
filehandle=_lcreat (slashname, 0); /* illegal name */
if (HFILE_ERROR==filehandle) {
err=GetLastError ();
ok (err==ERROR_INVALID_NAME || err==ERROR_PATH_NOT_FOUND,
"creating file \"%s\" failed with error %d", slashname, err);
"creating file \"%s\" failed with error %d\n", slashname, err);
} else { /* only NT succeeds */
_lclose(filehandle);
find=FindFirstFileA (slashname, &search_results);
if (INVALID_HANDLE_VALUE==find)
ok (0, "file \"%s\" not found", slashname);
ok (0, "file \"%s\" not found\n", slashname);
else {
ok (0!=FindClose (find), "FindClose complains (%ld)", GetLastError ());
ok (0!=FindClose (find), "FindClose complains (%ld)\n", GetLastError ());
slashname[strlen(slashname)-1]=0;
ok (!strcmp (slashname, search_results.cFileName),
"found unexpected name \"%s\"", search_results.cFileName);
"found unexpected name \"%s\"\n", search_results.cFileName);
ok (FILE_ATTRIBUTE_ARCHIVE==search_results.dwFileAttributes,
"attributes of file \"%s\" are 0x%04lx", search_results.cFileName,
"attributes of file \"%s\" are 0x%04lx\n", search_results.cFileName,
search_results.dwFileAttributes);
}
ok (0!=DeleteFileA (slashname), "Can't delete \"%s\" (%ld)", slashname,
ok (0!=DeleteFileA (slashname), "Can't delete \"%s\" (%ld)\n", slashname,
GetLastError ());
}
filehandle=_lcreat (filename, 8); /* illegal attribute */
if (HFILE_ERROR==filehandle)
ok (0, "couldn't create volume label \"%s\"", filename);
ok (0, "couldn't create volume label \"%s\"\n", filename);
else {
_lclose(filehandle);
find=FindFirstFileA (filename, &search_results);
if (INVALID_HANDLE_VALUE==find)
ok (0, "file \"%s\" not found", filename);
ok (0, "file \"%s\" not found\n", filename);
else {
ok (0!=FindClose (find), "FindClose complains (%ld)", GetLastError ());
ok (0!=FindClose (find), "FindClose complains (%ld)\n", GetLastError ());
ok (!strcmp (filename, search_results.cFileName),
"found unexpected name \"%s\"", search_results.cFileName);
"found unexpected name \"%s\"\n", search_results.cFileName);
ok (FILE_ATTRIBUTE_ARCHIVE==search_results.dwFileAttributes,
"attributes of file \"%s\" are 0x%04lx", search_results.cFileName,
"attributes of file \"%s\" are 0x%04lx\n", search_results.cFileName,
search_results.dwFileAttributes);
}
ok (0!=DeleteFileA (filename), "Can't delete \"%s\" (%ld)", slashname,
ok (0!=DeleteFileA (filename), "Can't delete \"%s\" (%ld)\n", slashname,
GetLastError ());
}
}
@ -317,29 +317,29 @@ static void test__llseek( void )
filehandle = _lcreat( filename, 0 );
if (filehandle == HFILE_ERROR)
{
ok(0,"couldn't create file \"%s\" (err=%ld)",filename,GetLastError());
ok(0,"couldn't create file \"%s\" (err=%ld)\n",filename,GetLastError());
return;
}
for (i = 0; i < 400; i++)
{
ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite complains" );
ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite complains\n" );
}
ok( HFILE_ERROR != _llseek( filehandle, 400 * strlen( sillytext ), FILE_CURRENT ), "should be able to seek" );
ok( HFILE_ERROR != _llseek( filehandle, 27 + 35 * strlen( sillytext ), FILE_BEGIN ), "should be able to seek" );
ok( HFILE_ERROR != _llseek( filehandle, 400 * strlen( sillytext ), FILE_CURRENT ), "should be able to seek\n" );
ok( HFILE_ERROR != _llseek( filehandle, 27 + 35 * strlen( sillytext ), FILE_BEGIN ), "should be able to seek\n" );
bytes_read = _hread( filehandle, buffer, 1);
ok( 1 == bytes_read, "file read size error" );
ok( buffer[0] == sillytext[27], "_llseek error, it got lost seeking" );
ok( HFILE_ERROR != _llseek( filehandle, -400 * strlen( sillytext ), FILE_END ), "should be able to seek" );
ok( 1 == bytes_read, "file read size error\n" );
ok( buffer[0] == sillytext[27], "_llseek error, it got lost seeking\n" );
ok( HFILE_ERROR != _llseek( filehandle, -400 * strlen( sillytext ), FILE_END ), "should be able to seek\n" );
bytes_read = _hread( filehandle, buffer, 1);
ok( 1 == bytes_read, "file read size error" );
ok( buffer[0] == sillytext[0], "_llseek error, it got lost seeking" );
ok( HFILE_ERROR != _llseek( filehandle, 1000000, FILE_END ), "should be able to seek past file; poor, poor Windows programmers" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains" );
ok( 1 == bytes_read, "file read size error\n" );
ok( buffer[0] == sillytext[0], "_llseek error, it got lost seeking\n" );
ok( HFILE_ERROR != _llseek( filehandle, 1000000, FILE_END ), "should be able to seek past file; poor, poor Windows programmers\n" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)", GetLastError( ) );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)\n", GetLastError( ) );
}
@ -352,31 +352,31 @@ static void test__llopen( void )
filehandle = _lcreat( filename, 0 );
if (filehandle == HFILE_ERROR)
{
ok(0,"couldn't create file \"%s\" (err=%ld)",filename,GetLastError());
ok(0,"couldn't create file \"%s\" (err=%ld)\n",filename,GetLastError());
return;
}
ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite complains" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains" );
ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite complains\n" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" );
filehandle = _lopen( filename, OF_READ );
ok( HFILE_ERROR == _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite shouldn't be able to write!" );
ok( HFILE_ERROR == _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite shouldn't be able to write!\n" );
bytes_read = _hread( filehandle, buffer, strlen( sillytext ) );
ok( strlen( sillytext ) == bytes_read, "file read size error" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains" );
ok( strlen( sillytext ) == bytes_read, "file read size error\n" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" );
filehandle = _lopen( filename, OF_READWRITE );
bytes_read = _hread( filehandle, buffer, 2 * strlen( sillytext ) );
ok( strlen( sillytext ) == bytes_read, "file read size error" );
ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite should write just fine" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains" );
ok( strlen( sillytext ) == bytes_read, "file read size error\n" );
ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite should write just fine\n" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" );
filehandle = _lopen( filename, OF_WRITE );
ok( HFILE_ERROR == _hread( filehandle, buffer, 1 ), "you should only be able to write this file" );
ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite should write just fine" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains" );
ok( HFILE_ERROR == _hread( filehandle, buffer, 1 ), "you should only be able to write this file\n" );
ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite should write just fine\n" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)", GetLastError( ) );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)\n", GetLastError( ) );
/* TODO - add tests for the SHARE modes - use two processes to pull this one off */
}
@ -392,35 +392,35 @@ static void test__lread( void )
filehandle = _lcreat( filename, 0 );
if (filehandle == HFILE_ERROR)
{
ok(0,"couldn't create file \"%s\" (err=%ld)",filename,GetLastError());
ok(0,"couldn't create file \"%s\" (err=%ld)\n",filename,GetLastError());
return;
}
ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite complains" );
ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite complains\n" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" );
filehandle = _lopen( filename, OF_READ );
ok( HFILE_ERROR != filehandle, "couldn't open file \"%s\" again (err=%ld)", filename, GetLastError());
ok( HFILE_ERROR != filehandle, "couldn't open file \"%s\" again (err=%ld)\n", filename, GetLastError());
bytes_read = _lread( filehandle, buffer, 2 * strlen( sillytext ) );
ok( lstrlenA( sillytext ) == bytes_read, "file read size error" );
ok( lstrlenA( sillytext ) == bytes_read, "file read size error\n" );
for (bytes_wanted = 0; bytes_wanted < strlen( sillytext ); bytes_wanted++)
{
ok( 0 == _llseek( filehandle, 0, FILE_BEGIN ), "_llseek complains" );
ok( _lread( filehandle, buffer, bytes_wanted ) == bytes_wanted, "erratic _hread return value" );
ok( 0 == _llseek( filehandle, 0, FILE_BEGIN ), "_llseek complains\n" );
ok( _lread( filehandle, buffer, bytes_wanted ) == bytes_wanted, "erratic _hread return value\n" );
for (i = 0; i < bytes_wanted; i++)
{
ok( buffer[i] == sillytext[i], "that's not what's written" );
ok( buffer[i] == sillytext[i], "that's not what's written\n" );
}
}
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)", GetLastError( ) );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)\n", GetLastError( ) );
}
@ -439,21 +439,21 @@ static void test__lwrite( void )
filehandle = _lcreat( filename, 0 );
if (filehandle == HFILE_ERROR)
{
ok(0,"couldn't create file \"%s\" (err=%ld)",filename,GetLastError());
ok(0,"couldn't create file \"%s\" (err=%ld)\n",filename,GetLastError());
return;
}
ok( HFILE_ERROR != _lwrite( filehandle, "", 0 ), "_hwrite complains" );
ok( HFILE_ERROR != _lwrite( filehandle, "", 0 ), "_hwrite complains\n" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" );
filehandle = _lopen( filename, OF_READ );
bytes_read = _hread( filehandle, buffer, 1);
ok( 0 == bytes_read, "file read size error" );
ok( 0 == bytes_read, "file read size error\n" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" );
filehandle = _lopen( filename, OF_READWRITE );
@ -467,18 +467,18 @@ static void test__lwrite( void )
buffer[i] = rand( );
checksum[0] = checksum[0] + buffer[i];
}
ok( HFILE_ERROR != _lwrite( filehandle, buffer, sizeof( buffer ) ), "_hwrite complains" );
ok( HFILE_ERROR != _lwrite( filehandle, buffer, sizeof( buffer ) ), "_hwrite complains\n" );
bytes_written = bytes_written + sizeof( buffer );
}
ok( HFILE_ERROR != _lwrite( filehandle, checksum, 1 ), "_hwrite complains" );
ok( HFILE_ERROR != _lwrite( filehandle, checksum, 1 ), "_hwrite complains\n" );
bytes_written++;
ok( HFILE_ERROR != _lclose( filehandle ), "_lclose complains" );
ok( HFILE_ERROR != _lclose( filehandle ), "_lclose complains\n" );
memory_object = LocalAlloc( LPTR, bytes_written );
ok( 0 != memory_object, "LocalAlloc fails, could be out of memory" );
ok( 0 != memory_object, "LocalAlloc fails, could be out of memory\n" );
contents = LocalLock( memory_object );
@ -486,9 +486,9 @@ static void test__lwrite( void )
contents = LocalLock( memory_object );
ok( NULL != contents, "LocalLock whines" );
ok( NULL != contents, "LocalLock whines\n" );
ok( bytes_written == _hread( filehandle, contents, bytes_written), "read length differ from write length" );
ok( bytes_written == _hread( filehandle, contents, bytes_written), "read length differ from write length\n" );
checksum[0] = '\0';
i = 0;
@ -499,11 +499,11 @@ static void test__lwrite( void )
}
while (i < bytes_written - 1);
ok( checksum[0] == contents[i], "stored checksum differ from computed checksum" );
ok( checksum[0] == contents[i], "stored checksum differ from computed checksum\n" );
ok( HFILE_ERROR != _lclose( filehandle ), "_lclose complains" );
ok( HFILE_ERROR != _lclose( filehandle ), "_lclose complains\n" );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)", GetLastError( ) );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)\n", GetLastError( ) );
}
static void test_CopyFileA(void)
@ -514,14 +514,14 @@ static void test_CopyFileA(void)
DWORD ret;
ret = GetTempPathA(MAX_PATH, temp_path);
ok(ret != 0, "GetTempPathA error %ld", GetLastError());
ok(ret < MAX_PATH, "temp path should fit into MAX_PATH");
ok(ret != 0, "GetTempPathA error %ld\n", GetLastError());
ok(ret < MAX_PATH, "temp path should fit into MAX_PATH\n");
ret = GetTempFileNameA(temp_path, prefix, 0, source);
ok(ret != 0, "GetTempFileNameA error %ld", GetLastError());
ok(ret != 0, "GetTempFileNameA error %ld\n", GetLastError());
ret = GetTempFileNameA(temp_path, prefix, 0, dest);
ok(ret != 0, "GetTempFileNameA error %ld", GetLastError());
ok(ret != 0, "GetTempFileNameA error %ld\n", GetLastError());
ret = CopyFileA(source, dest, TRUE);
ok(!ret && GetLastError() == ERROR_FILE_EXISTS,
@ -546,14 +546,14 @@ static void test_CopyFileW(void)
ret = GetTempPathW(MAX_PATH, temp_path);
if (ret==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
return;
ok(ret != 0, "GetTempPathW error %ld", GetLastError());
ok(ret < MAX_PATH, "temp path should fit into MAX_PATH");
ok(ret != 0, "GetTempPathW error %ld\n", GetLastError());
ok(ret < MAX_PATH, "temp path should fit into MAX_PATH\n");
ret = GetTempFileNameW(temp_path, prefix, 0, source);
ok(ret != 0, "GetTempFileNameW error %ld", GetLastError());
ok(ret != 0, "GetTempFileNameW error %ld\n", GetLastError());
ret = GetTempFileNameW(temp_path, prefix, 0, dest);
ok(ret != 0, "GetTempFileNameW error %ld", GetLastError());
ok(ret != 0, "GetTempFileNameW error %ld\n", GetLastError());
ret = CopyFileW(source, dest, TRUE);
ok(!ret && GetLastError() == ERROR_FILE_EXISTS,
@ -577,16 +577,16 @@ static void test_CreateFileA(void)
DWORD ret;
ret = GetTempPathA(MAX_PATH, temp_path);
ok(ret != 0, "GetTempPathA error %ld", GetLastError());
ok(ret < MAX_PATH, "temp path should fit into MAX_PATH");
ok(ret != 0, "GetTempPathA error %ld\n", GetLastError());
ok(ret < MAX_PATH, "temp path should fit into MAX_PATH\n");
ret = GetTempFileNameA(temp_path, prefix, 0, filename);
ok(ret != 0, "GetTempFileNameA error %ld", GetLastError());
ok(ret != 0, "GetTempFileNameA error %ld\n", GetLastError());
hFile = CreateFileA(filename, GENERIC_READ, 0, NULL,
CREATE_NEW, FILE_FLAG_RANDOM_ACCESS, 0);
ok(hFile == INVALID_HANDLE_VALUE && GetLastError() == ERROR_FILE_EXISTS,
"CREATE_NEW should fail if file exists and last error value should be ERROR_FILE_EXISTS");
"CREATE_NEW should fail if file exists and last error value should be ERROR_FILE_EXISTS\n");
ret = DeleteFileA(filename);
ok(ret, "DeleteFileA: error %ld\n", GetLastError());
@ -603,16 +603,16 @@ static void test_CreateFileW(void)
ret = GetTempPathW(MAX_PATH, temp_path);
if (ret==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
return;
ok(ret != 0, "GetTempPathW error %ld", GetLastError());
ok(ret < MAX_PATH, "temp path should fit into MAX_PATH");
ok(ret != 0, "GetTempPathW error %ld\n", GetLastError());
ok(ret < MAX_PATH, "temp path should fit into MAX_PATH\n");
ret = GetTempFileNameW(temp_path, prefix, 0, filename);
ok(ret != 0, "GetTempFileNameW error %ld", GetLastError());
ok(ret != 0, "GetTempFileNameW error %ld\n", GetLastError());
hFile = CreateFileW(filename, GENERIC_READ, 0, NULL,
CREATE_NEW, FILE_FLAG_RANDOM_ACCESS, 0);
ok(hFile == INVALID_HANDLE_VALUE && GetLastError() == ERROR_FILE_EXISTS,
"CREATE_NEW should fail if file exists and last error value should be ERROR_FILE_EXISTS");
"CREATE_NEW should fail if file exists and last error value should be ERROR_FILE_EXISTS\n");
ret = DeleteFileW(filename);
ok(ret, "DeleteFileW: error %ld\n", GetLastError());
@ -627,7 +627,7 @@ static void test_GetTempFileNameA() {
/* this test may depend on the config file settings */
result = GetTempFileNameA("C:", "abc", 1, out);
ok( result != 0, "GetTempFileNameA: error %ld\n", GetLastError() );
ok( ((out[0] == 'C') && (out[1] == ':')) && (out[2] == '\\'), "GetTempFileNameA: first three characters should be C:\\, string was actually %s", out );
ok( ((out[0] == 'C') && (out[1] == ':')) && (out[2] == '\\'), "GetTempFileNameA: first three characters should be C:\\, string was actually %s\n", out );
result = GetTempFileNameA("c:\\windows\\", "abc", 2, out);
ok( result != 0, "GetTempFileNameA: error %ld\n", GetLastError() );
@ -642,12 +642,12 @@ static void test_DeleteFileA( void )
ret = DeleteFileA(NULL);
ok(!ret && (GetLastError() == ERROR_INVALID_PARAMETER ||
GetLastError() == ERROR_PATH_NOT_FOUND),
"DeleteFileA(NULL) returned ret=%d error=%ld",ret,GetLastError());
"DeleteFileA(NULL) returned ret=%d error=%ld\n",ret,GetLastError());
ret = DeleteFileA("");
ok(!ret && (GetLastError() == ERROR_PATH_NOT_FOUND ||
GetLastError() == ERROR_BAD_PATHNAME),
"DeleteFileA(\"\") returned ret=%d error=%ld",ret,GetLastError());
"DeleteFileA(\"\") returned ret=%d error=%ld\n",ret,GetLastError());
}
static void test_DeleteFileW( void )
@ -659,11 +659,11 @@ static void test_DeleteFileW( void )
if (ret==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
return;
ok(!ret && GetLastError() == ERROR_PATH_NOT_FOUND,
"DeleteFileW(NULL) returned ret=%d error=%ld",ret,GetLastError());
"DeleteFileW(NULL) returned ret=%d error=%ld\n",ret,GetLastError());
ret = DeleteFileW(emptyW);
ok(!ret && GetLastError() == ERROR_PATH_NOT_FOUND,
"DeleteFileW(\"\") returned ret=%d error=%ld",ret,GetLastError());
"DeleteFileW(\"\") returned ret=%d error=%ld\n",ret,GetLastError());
}
#define IsDotDir(x) ((x[0] == '.') && ((x[1] == 0) || ((x[1] == '.') && (x[2] == 0))))
@ -676,14 +676,14 @@ static void test_MoveFileA(void)
DWORD ret;
ret = GetTempPathA(MAX_PATH, tempdir);
ok(ret != 0, "GetTempPathA error %ld", GetLastError());
ok(ret < MAX_PATH, "temp path should fit into MAX_PATH");
ok(ret != 0, "GetTempPathA error %ld\n", GetLastError());
ok(ret < MAX_PATH, "temp path should fit into MAX_PATH\n");
ret = GetTempFileNameA(tempdir, prefix, 0, source);
ok(ret != 0, "GetTempFileNameA error %ld", GetLastError());
ok(ret != 0, "GetTempFileNameA error %ld\n", GetLastError());
ret = GetTempFileNameA(tempdir, prefix, 0, dest);
ok(ret != 0, "GetTempFileNameA error %ld", GetLastError());
ok(ret != 0, "GetTempFileNameA error %ld\n", GetLastError());
ret = MoveFileA(source, dest);
ok(!ret && GetLastError() == ERROR_ALREADY_EXISTS,
@ -697,14 +697,14 @@ static void test_MoveFileA(void)
lstrcatA(tempdir, "Remove Me");
ret = CreateDirectoryA(tempdir, NULL);
ok(ret == TRUE, "CreateDirectoryA failed");
ok(ret == TRUE, "CreateDirectoryA failed\n");
lstrcpyA(source, dest);
lstrcpyA(dest, tempdir);
lstrcatA(dest, "\\wild?.*");
ret = MoveFileA(source, dest);
todo_wine {
ok(!ret, "MoveFileA: shouldn't move to wildcard file");
ok(!ret, "MoveFileA: shouldn't move to wildcard file\n");
ok(GetLastError() == ERROR_INVALID_NAME,
"MoveFileA: with wildcards, unexpected error %ld\n", GetLastError());
#if 0
@ -725,7 +725,7 @@ static void test_MoveFileA(void)
lpName = fd.cAlternateFileName;
if (!lpName[0])
lpName = fd.cFileName;
ok(IsDotDir(lpName), "MoveFileA: wildcards file created!");
ok(IsDotDir(lpName), "MoveFileA: wildcards file created!\n");
}
while (FindNextFileA(hFind, &fd));
FindClose(hFind);
@ -752,14 +752,14 @@ static void test_MoveFileW(void)
ret = GetTempPathW(MAX_PATH, temp_path);
if (ret==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
return;
ok(ret != 0, "GetTempPathW error %ld", GetLastError());
ok(ret < MAX_PATH, "temp path should fit into MAX_PATH");
ok(ret != 0, "GetTempPathW error %ld\n", GetLastError());
ok(ret < MAX_PATH, "temp path should fit into MAX_PATH\n");
ret = GetTempFileNameW(temp_path, prefix, 0, source);
ok(ret != 0, "GetTempFileNameW error %ld", GetLastError());
ok(ret != 0, "GetTempFileNameW error %ld\n", GetLastError());
ret = GetTempFileNameW(temp_path, prefix, 0, dest);
ok(ret != 0, "GetTempFileNameW error %ld", GetLastError());
ok(ret != 0, "GetTempFileNameW error %ld\n", GetLastError());
ret = MoveFileW(source, dest);
ok(!ret && GetLastError() == ERROR_ALREADY_EXISTS,
@ -783,17 +783,17 @@ static void test_offset_in_overlapped_structure(void)
UINT i;
char temp_path[MAX_PATH], temp_fname[MAX_PATH];
ok(GetTempPathA(MAX_PATH, temp_path) != 0, "GetTempPathA error %ld", GetLastError());
ok(GetTempFileNameA(temp_path, "pfx", 0, temp_fname) != 0, "GetTempFileNameA error %ld", GetLastError());
ok(GetTempPathA(MAX_PATH, temp_path) != 0, "GetTempPathA error %ld\n", GetLastError());
ok(GetTempFileNameA(temp_path, "pfx", 0, temp_fname) != 0, "GetTempFileNameA error %ld\n", GetLastError());
/*** Write File *****************************************************/
hFile = CreateFileA(temp_fname, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
ok(hFile != INVALID_HANDLE_VALUE, "CreateFileA error %ld", GetLastError());
ok(hFile != INVALID_HANDLE_VALUE, "CreateFileA error %ld\n", GetLastError());
for(i = 0; i < sizeof(buf); i++) buf[i] = i;
ok(WriteFile(hFile, buf, sizeof(buf), &done, NULL), "WriteFile error %ld", GetLastError());
ok(done == sizeof(buf), "expected number of bytes written %lu", done);
ok(WriteFile(hFile, buf, sizeof(buf), &done, NULL), "WriteFile error %ld\n", GetLastError());
ok(done == sizeof(buf), "expected number of bytes written %lu\n", done);
memset(&ov, 0, sizeof(ov));
ov.Offset = PATTERN_OFFSET;
@ -801,19 +801,19 @@ static void test_offset_in_overlapped_structure(void)
rc=WriteFile(hFile, pattern, sizeof(pattern), &done, &ov);
/* Win 9x does not support the overlapped I/O on files */
if (rc || GetLastError()!=ERROR_INVALID_PARAMETER) {
ok(rc, "WriteFile error %ld", GetLastError());
ok(done == sizeof(pattern), "expected number of bytes written %lu", done);
ok(rc, "WriteFile error %ld\n", GetLastError());
ok(done == sizeof(pattern), "expected number of bytes written %lu\n", done);
trace("Current offset = %04lx\n", SetFilePointer(hFile, 0, NULL, FILE_CURRENT));
ok(SetFilePointer(hFile, 0, NULL, FILE_CURRENT) == (PATTERN_OFFSET + sizeof(pattern)),
"expected file offset %d", PATTERN_OFFSET + sizeof(pattern));
"expected file offset %d\n", PATTERN_OFFSET + sizeof(pattern));
ov.Offset = sizeof(buf) * 2;
ov.OffsetHigh = 0;
ok(WriteFile(hFile, pattern, sizeof(pattern), &done, &ov), "WriteFile error %ld", GetLastError());
ok(done == sizeof(pattern), "expected number of bytes written %lu", done);
ok(WriteFile(hFile, pattern, sizeof(pattern), &done, &ov), "WriteFile error %ld\n", GetLastError());
ok(done == sizeof(pattern), "expected number of bytes written %lu\n", done);
/*trace("Current offset = %04lx\n", SetFilePointer(hFile, 0, NULL, FILE_CURRENT));*/
ok(SetFilePointer(hFile, 0, NULL, FILE_CURRENT) == (sizeof(buf) * 2 + sizeof(pattern)),
"expected file offset %d", sizeof(buf) * 2 + sizeof(pattern));
"expected file offset %d\n", sizeof(buf) * 2 + sizeof(pattern));
}
CloseHandle(hFile);
@ -821,7 +821,7 @@ static void test_offset_in_overlapped_structure(void)
/*** Read File *****************************************************/
hFile = CreateFileA(temp_fname, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, 0);
ok(hFile != INVALID_HANDLE_VALUE, "CreateFileA error %ld", GetLastError());
ok(hFile != INVALID_HANDLE_VALUE, "CreateFileA error %ld\n", GetLastError());
memset(buf, 0, sizeof(buf));
memset(&ov, 0, sizeof(ov));
@ -830,12 +830,12 @@ static void test_offset_in_overlapped_structure(void)
rc=ReadFile(hFile, buf, sizeof(pattern), &done, &ov);
/* Win 9x does not support the overlapped I/O on files */
if (rc || GetLastError()!=ERROR_INVALID_PARAMETER) {
ok(rc, "ReadFile error %ld", GetLastError());
ok(done == sizeof(pattern), "expected number of bytes read %lu", done);
ok(rc, "ReadFile error %ld\n", GetLastError());
ok(done == sizeof(pattern), "expected number of bytes read %lu\n", done);
trace("Current offset = %04lx\n", SetFilePointer(hFile, 0, NULL, FILE_CURRENT));
ok(SetFilePointer(hFile, 0, NULL, FILE_CURRENT) == (PATTERN_OFFSET + sizeof(pattern)),
"expected file offset %d", PATTERN_OFFSET + sizeof(pattern));
ok(!memcmp(buf, pattern, sizeof(pattern)), "pattern match failed");
"expected file offset %d\n", PATTERN_OFFSET + sizeof(pattern));
ok(!memcmp(buf, pattern, sizeof(pattern)), "pattern match failed\n");
}
CloseHandle(hFile);
@ -854,62 +854,62 @@ static void test_LockFile(void)
CREATE_ALWAYS, 0, 0 );
if (handle == INVALID_HANDLE_VALUE)
{
ok(0,"couldn't create file \"%s\" (err=%ld)",filename,GetLastError());
ok(0,"couldn't create file \"%s\" (err=%ld)\n",filename,GetLastError());
return;
}
ok( WriteFile( handle, sillytext, strlen(sillytext), &written, NULL ), "write failed" );
ok( WriteFile( handle, sillytext, strlen(sillytext), &written, NULL ), "write failed\n" );
ok( LockFile( handle, 0, 0, 0, 0 ), "LockFile failed" );
ok( UnlockFile( handle, 0, 0, 0, 0 ), "UnlockFile failed" );
ok( !UnlockFile( handle, 0, 0, 0, 0 ), "UnlockFile succeeded" );
ok( LockFile( handle, 0, 0, 0, 0 ), "LockFile failed\n" );
ok( UnlockFile( handle, 0, 0, 0, 0 ), "UnlockFile failed\n" );
ok( !UnlockFile( handle, 0, 0, 0, 0 ), "UnlockFile succeeded\n" );
ok( LockFile( handle, 10, 0, 20, 0 ), "LockFile 10,20 failed" );
ok( LockFile( handle, 10, 0, 20, 0 ), "LockFile 10,20 failed\n" );
/* overlapping locks must fail */
ok( !LockFile( handle, 12, 0, 10, 0 ), "LockFile 12,10 succeeded" );
ok( !LockFile( handle, 5, 0, 6, 0 ), "LockFile 5,6 succeeded" );
ok( !LockFile( handle, 12, 0, 10, 0 ), "LockFile 12,10 succeeded\n" );
ok( !LockFile( handle, 5, 0, 6, 0 ), "LockFile 5,6 succeeded\n" );
/* non-overlapping locks must succeed */
ok( LockFile( handle, 5, 0, 5, 0 ), "LockFile 5,5 failed" );
ok( LockFile( handle, 5, 0, 5, 0 ), "LockFile 5,5 failed\n" );
ok( !UnlockFile( handle, 10, 0, 10, 0 ), "UnlockFile 10,10 succeeded" );
ok( UnlockFile( handle, 10, 0, 20, 0 ), "UnlockFile 10,20 failed" );
ok( !UnlockFile( handle, 10, 0, 20, 0 ), "UnlockFile 10,20 again succeeded" );
ok( UnlockFile( handle, 5, 0, 5, 0 ), "UnlockFile 5,5 failed" );
ok( !UnlockFile( handle, 10, 0, 10, 0 ), "UnlockFile 10,10 succeeded\n" );
ok( UnlockFile( handle, 10, 0, 20, 0 ), "UnlockFile 10,20 failed\n" );
ok( !UnlockFile( handle, 10, 0, 20, 0 ), "UnlockFile 10,20 again succeeded\n" );
ok( UnlockFile( handle, 5, 0, 5, 0 ), "UnlockFile 5,5 failed\n" );
overlapped.Offset = 100;
overlapped.OffsetHigh = 0;
overlapped.hEvent = 0;
ok( LockFileEx( handle, 0, 0, 100, 0, &overlapped ), "LockFileEx 100,100 failed" );
ok( LockFileEx( handle, 0, 0, 100, 0, &overlapped ), "LockFileEx 100,100 failed\n" );
/* overlapping shared locks are OK */
overlapped.Offset = 150;
ok( LockFileEx( handle, 0, 0, 100, 0, &overlapped ), "LockFileEx 150,100 failed" );
ok( LockFileEx( handle, 0, 0, 100, 0, &overlapped ), "LockFileEx 150,100 failed\n" );
/* but exclusive is not */
ok( !LockFileEx( handle, LOCKFILE_EXCLUSIVE_LOCK|LOCKFILE_FAIL_IMMEDIATELY, 0, 50, 0, &overlapped ),
"LockFileEx exclusive 150,50 succeeded" );
ok( UnlockFileEx( handle, 0, 100, 0, &overlapped ), "UnlockFileEx 150,100 failed" );
ok( !UnlockFileEx( handle, 0, 100, 0, &overlapped ), "UnlockFileEx 150,100 again succeeded" );
"LockFileEx exclusive 150,50 succeeded\n" );
ok( UnlockFileEx( handle, 0, 100, 0, &overlapped ), "UnlockFileEx 150,100 failed\n" );
ok( !UnlockFileEx( handle, 0, 100, 0, &overlapped ), "UnlockFileEx 150,100 again succeeded\n" );
overlapped.Offset = 100;
ok( UnlockFileEx( handle, 0, 100, 0, &overlapped ), "UnlockFileEx 100,100 failed" );
ok( !UnlockFileEx( handle, 0, 100, 0, &overlapped ), "UnlockFileEx 100,100 again succeeded" );
ok( UnlockFileEx( handle, 0, 100, 0, &overlapped ), "UnlockFileEx 100,100 failed\n" );
ok( !UnlockFileEx( handle, 0, 100, 0, &overlapped ), "UnlockFileEx 100,100 again succeeded\n" );
ok( LockFile( handle, 0, 0x10000000, 0, 0xf0000000 ), "LockFile failed" );
ok( !LockFile( handle, ~0, ~0, 1, 0 ), "LockFile ~0,1 succeeded" );
ok( !LockFile( handle, 0, 0x20000000, 20, 0 ), "LockFile 0x20000000,20 succeeded" );
ok( UnlockFile( handle, 0, 0x10000000, 0, 0xf0000000 ), "UnlockFile failed" );
ok( LockFile( handle, 0, 0x10000000, 0, 0xf0000000 ), "LockFile failed\n" );
ok( !LockFile( handle, ~0, ~0, 1, 0 ), "LockFile ~0,1 succeeded\n" );
ok( !LockFile( handle, 0, 0x20000000, 20, 0 ), "LockFile 0x20000000,20 succeeded\n" );
ok( UnlockFile( handle, 0, 0x10000000, 0, 0xf0000000 ), "UnlockFile failed\n" );
/* wrap-around lock should not do anything */
/* (but still succeeds on NT4 so we don't check result) */
LockFile( handle, 0, 0x10000000, 0, 0xf0000001 );
ok( LockFile( handle, ~0, ~0, 1, 0 ), "LockFile ~0,1 failed" );
ok( UnlockFile( handle, ~0, ~0, 1, 0 ), "Unlockfile ~0,1 failed" );
ok( LockFile( handle, ~0, ~0, 1, 0 ), "LockFile ~0,1 failed\n" );
ok( UnlockFile( handle, ~0, ~0, 1, 0 ), "Unlockfile ~0,1 failed\n" );
/* zero-byte lock */
ok( LockFile( handle, 100, 0, 0, 0 ), "LockFile 100,0 failed" );
ok( !LockFile( handle, 98, 0, 4, 0 ), "LockFile 98,4 succeeded" );
ok( LockFile( handle, 90, 0, 10, 0 ), "LockFile 90,10 failed" );
ok( LockFile( handle, 100, 0, 10, 0 ), "LockFile 100,10 failed" );
ok( UnlockFile( handle, 90, 0, 10, 0 ), "UnlockFile 90,10 failed" );
ok( UnlockFile( handle, 100, 0, 10, 0 ), "UnlockFile 100,10 failed" );
ok( UnlockFile( handle, 100, 0, 0, 0 ), "UnlockFile 100,0 failed" );
ok( LockFile( handle, 100, 0, 0, 0 ), "LockFile 100,0 failed\n" );
ok( !LockFile( handle, 98, 0, 4, 0 ), "LockFile 98,4 succeeded\n" );
ok( LockFile( handle, 90, 0, 10, 0 ), "LockFile 90,10 failed\n" );
ok( LockFile( handle, 100, 0, 10, 0 ), "LockFile 100,10 failed\n" );
ok( UnlockFile( handle, 90, 0, 10, 0 ), "UnlockFile 90,10 failed\n" );
ok( UnlockFile( handle, 100, 0, 10, 0 ), "UnlockFile 100,10 failed\n" );
ok( UnlockFile( handle, 100, 0, 0, 0 ), "UnlockFile 100,0 failed\n" );
CloseHandle( handle );
DeleteFileA( filename );
@ -923,12 +923,12 @@ static void test_FindFirstFileA()
handle = FindFirstFileA("C:\\",&search_results);
err = GetLastError();
ok ( handle == INVALID_HANDLE_VALUE , "FindFirstFile on Root directory should Fail");
ok ( handle == INVALID_HANDLE_VALUE , "FindFirstFile on Root directory should Fail\n");
if (handle == INVALID_HANDLE_VALUE)
ok ( err == ERROR_FILE_NOT_FOUND, "Bad Error number %d\n", err);
handle = FindFirstFileA("C:\\*",&search_results);
ok ( handle != INVALID_HANDLE_VALUE, "FindFirstFile on C:\\* should succeed" );
ok ( FindClose(handle) == TRUE, "Failed to close handle");
ok ( handle != INVALID_HANDLE_VALUE, "FindFirstFile on C:\\* should succeed\n" );
ok ( FindClose(handle) == TRUE, "Failed to close handle\n");
}
static void test_FindNextFileA()
@ -938,14 +938,14 @@ static void test_FindNextFileA()
int err;
handle = FindFirstFileA("C:\\*",&search_results);
ok ( handle != INVALID_HANDLE_VALUE, "FindFirstFile on C:\\* should succeed" );
ok ( handle != INVALID_HANDLE_VALUE, "FindFirstFile on C:\\* should succeed\n" );
while (FindNextFile(handle, &search_results))
{
/* get to the end of the files */
}
ok ( FindClose(handle) == TRUE, "Failed to close handle");
ok ( FindClose(handle) == TRUE, "Failed to close handle\n");
err = GetLastError();
ok ( err == ERROR_NO_MORE_FILES, "GetLastError should return ERROR_NO_MORE_FILES");
ok ( err == ERROR_NO_MORE_FILES, "GetLastError should return ERROR_NO_MORE_FILES\n");
}
static void test_MapFile()
@ -976,7 +976,7 @@ static void test_MapFile()
ok( CloseHandle( hmap ), "can't close mapping handle\n");
ok( CloseHandle( handle ), "can't close file handle\n");
ok( DeleteFileA( filename ), "DeleteFile failed after map" );
ok( DeleteFileA( filename ), "DeleteFile failed after map\n" );
}
START_TEST(file)

View File

@ -47,177 +47,177 @@ void test_message_from_string(void)
/* the basics */
r = FormatMessageA(FORMAT_MESSAGE_FROM_STRING, "test", 0,
0, out, sizeof(out)/sizeof(CHAR),NULL);
ok(!strcmp("test", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r);
ok(!strcmp("test", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
/* using the format feature */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!s!", 0,
0, out, sizeof(out)/sizeof(CHAR), "test");
ok(!strcmp("test", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r);
ok(!strcmp("test", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
/* no format */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1", 0,
0, out, sizeof(out)/sizeof(CHAR), "test");
ok(!strcmp("test", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r);
ok(!strcmp("test", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
/* two pieces */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1%2", 0,
0, out, sizeof(out)/sizeof(CHAR), "te","st");
ok(!strcmp("test", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r);
ok(!strcmp("test", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
/* three pieces */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1%3%2%1", 0,
0, out, sizeof(out)/sizeof(CHAR), "t","s","e");
ok(!strcmp("test", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r);
ok(!strcmp("test", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
/* s doesn't seem to work in format strings */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%!s!", 0,
0, out, sizeof(out)/sizeof(CHAR), "test");
ok(!strcmp("!s!", out),"failed out=[%s]",out);
ok(r==3,"failed: r=%ld",r);
ok(!strcmp("!s!", out),"failed out=[%s]\n",out);
ok(r==3,"failed: r=%ld\n",r);
/* S is unicode */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!S!", 0,
0, out, sizeof(out)/sizeof(CHAR), szwTest);
ok(!strcmp("test", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r);
ok(!strcmp("test", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
/* as characters */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!c!%2!c!%3!c!%1!c!", 0,
0, out, sizeof(out)/sizeof(CHAR), 't','e','s');
ok(!strcmp("test", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r);
ok(!strcmp("test", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
/* some numbers */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!d!%2!d!%3!d!", 0,
0, out, sizeof(out)/sizeof(CHAR), 1,2,3);
ok(!strcmp("123", out),"failed out=[%s]",out);
ok(r==3,"failed: r=%ld",r);
ok(!strcmp("123", out),"failed out=[%s]\n",out);
ok(r==3,"failed: r=%ld\n",r);
/* a single digit with some spacing */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!4d!", 0,
0, out, sizeof(out)/sizeof(CHAR), 1);
ok(!strcmp(" 1", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r);
ok(!strcmp(" 1", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
/* a single digit, left justified */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!-4d!", 0,
0, out, sizeof(out)/sizeof(CHAR), 1);
ok(!strcmp("1 ", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r);
ok(!strcmp("1 ", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
/* two digit decimal number */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!4d!", 0,
0, out, sizeof(out)/sizeof(CHAR), 11);
ok(!strcmp(" 11", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r);
ok(!strcmp(" 11", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
/* a hex number */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!4x!", 0,
0, out, sizeof(out)/sizeof(CHAR), 11);
ok(!strcmp(" b", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r);
ok(!strcmp(" b", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
/* a hex number, upper case */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!4X!", 0,
0, out, sizeof(out)/sizeof(CHAR), 11);
ok(!strcmp(" B", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r);
ok(!strcmp(" B", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
/* a hex number, upper case, left justified */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!-4X!", 0,
0, out, sizeof(out)/sizeof(CHAR), 11);
ok(!strcmp("B ", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r);
ok(!strcmp("B ", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
/* a long hex number, upper case */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!4X!", 0,
0, out, sizeof(out)/sizeof(CHAR), 0x1ab);
ok(!strcmp(" 1AB", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r);
ok(!strcmp(" 1AB", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
/* two percent... */
r = doit(FORMAT_MESSAGE_FROM_STRING, " %%%% ", 0,
0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp(" %% ", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r);
ok(!strcmp(" %% ", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
/* periods are special cases */
r = doit(FORMAT_MESSAGE_FROM_STRING, " %.%. %1!d!", 0,
0, out, sizeof(out)/sizeof(CHAR), 0x1ab);
ok(!strcmp(" .. 427", out),"failed out=[%s]",out);
ok(r==7,"failed: r=%ld",r);
ok(!strcmp(" .. 427", out),"failed out=[%s]\n",out);
ok(r==7,"failed: r=%ld\n",r);
/* %0 ends the line */
r = doit(FORMAT_MESSAGE_FROM_STRING, "test%0test", 0,
0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp("test", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r);
ok(!strcmp("test", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
/* %! prints an exclaimation */
r = doit(FORMAT_MESSAGE_FROM_STRING, "yah%!%0 ", 0,
0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp("yah!", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r);
ok(!strcmp("yah!", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
/* %space */
r = doit(FORMAT_MESSAGE_FROM_STRING, "% % ", 0,
0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp(" ", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r);
ok(!strcmp(" ", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
/* line feed */
r = doit(FORMAT_MESSAGE_FROM_STRING, "hi\n", 0,
0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp("hi\r\n", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r);
ok(!strcmp("hi\r\n", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
/* carriage return line feed */
r = doit(FORMAT_MESSAGE_FROM_STRING, "hi\r\n", 0,
0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp("hi\r\n", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r);
ok(!strcmp("hi\r\n", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
/* carriage return line feed */
r = doit(FORMAT_MESSAGE_FROM_STRING, "\r", 0,
0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp("\r\n", out),"failed out=[%s]",out);
ok(r==2,"failed: r=%ld",r);
ok(!strcmp("\r\n", out),"failed out=[%s]\n",out);
ok(r==2,"failed: r=%ld\n",r);
/* carriage return line feed */
r = doit(FORMAT_MESSAGE_FROM_STRING, "\r\r\n", 0,
0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp("\r\n\r\n", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r);
ok(!strcmp("\r\n\r\n", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
/* change of pace... test the low byte of dwflags */
/* line feed */
r = doit(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_MAX_WIDTH_MASK, "hi\n", 0,
0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp("hi ", out) || !strcmp("hi\r\n", out),"failed out=[%s]",out);
ok(r==3 || r==4,"failed: r=%ld",r);
ok(!strcmp("hi ", out) || !strcmp("hi\r\n", out),"failed out=[%s]\n",out);
ok(r==3 || r==4,"failed: r=%ld\n",r);
/* carriage return line feed */
r = doit(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_MAX_WIDTH_MASK, "hi\r\n", 0,
0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp("hi ", out),"failed out=[%s]",out);
ok(r==3,"failed: r=%ld",r);
ok(!strcmp("hi ", out),"failed out=[%s]\n",out);
ok(r==3,"failed: r=%ld\n",r);
/* carriage return line feed */
r = doit(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_MAX_WIDTH_MASK, "\r", 0,
0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp(" ", out),"failed out=[%s]",out);
ok(r==1,"failed: r=%ld",r);
ok(!strcmp(" ", out),"failed out=[%s]\n",out);
ok(r==1,"failed: r=%ld\n",r);
/* carriage return line feed */
r = doit(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_MAX_WIDTH_MASK, "\r\r\n", 0,
0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp(" ", out),"failed out=[%s]",out);
ok(r==2,"failed: r=%ld",r);
ok(!strcmp(" ", out),"failed out=[%s]\n",out);
ok(r==2,"failed: r=%ld\n",r);
}
START_TEST(format_msg)

View File

@ -56,11 +56,11 @@ static int init_access_tests(void)
rc=GetUserNameW(user_name, &dwSize);
if (rc==FALSE && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
return 0;
ok(rc, "User Name Retrieved");
ok(rc, "User Name Retrieved\n");
computer_name[0] = 0;
dwSize = sizeof(computer_name);
ok(GetComputerNameW(computer_name, &dwSize), "Computer Name Retrieved");
ok(GetComputerNameW(computer_name, &dwSize), "Computer Name Retrieved\n");
return 1;
}
@ -77,45 +77,45 @@ void run_usergetinfo_tests(void)
/* Level 0 */
rc=pNetUserGetInfo(NULL, sAdminUserName, 0, (LPBYTE *)&ui0);
ok(rc == NERR_Success, "NetUserGetInfo: rc=%ld", rc);
ok(!lstrcmpW(sAdminUserName, ui0->usri0_name), "This is really user name");
ok(rc == NERR_Success, "NetUserGetInfo: rc=%ld\n", rc);
ok(!lstrcmpW(sAdminUserName, ui0->usri0_name), "This is really user name\n");
pNetApiBufferSize(ui0, &dwSize);
ok(dwSize >= (sizeof(USER_INFO_0) +
(lstrlenW(ui0->usri0_name) + 1) * sizeof(WCHAR)),
"Is allocated with NetApiBufferAllocate");
"Is allocated with NetApiBufferAllocate\n");
/* Level 10 */
rc=pNetUserGetInfo(NULL, sAdminUserName, 10, (LPBYTE *)&ui10);
ok(rc == NERR_Success, "NetUserGetInfo: rc=%ld", rc);
ok(!lstrcmpW(sAdminUserName, ui10->usri10_name), "This is really user name");
ok(rc == NERR_Success, "NetUserGetInfo: rc=%ld\n", rc);
ok(!lstrcmpW(sAdminUserName, ui10->usri10_name), "This is really user name\n");
pNetApiBufferSize(ui10, &dwSize);
ok(dwSize >= (sizeof(USER_INFO_10) +
(lstrlenW(ui10->usri10_name) + 1 +
lstrlenW(ui10->usri10_comment) + 1 +
lstrlenW(ui10->usri10_usr_comment) + 1 +
lstrlenW(ui10->usri10_full_name) + 1) * sizeof(WCHAR)),
"Is allocated with NetApiBufferAllocate");
"Is allocated with NetApiBufferAllocate\n");
pNetApiBufferFree(ui0);
pNetApiBufferFree(ui10);
/* errors handling */
rc=pNetUserGetInfo(NULL, sAdminUserName, 10000, (LPBYTE *)&ui0);
ok(rc == ERROR_INVALID_LEVEL,"Invalid Level: rc=%ld",rc);
ok(rc == ERROR_INVALID_LEVEL,"Invalid Level: rc=%ld\n",rc);
rc=pNetUserGetInfo(NULL, sNonexistentUser, 0, (LPBYTE *)&ui0);
ok(rc == NERR_UserNotFound,"Invalid User Name: rc=%ld",rc);
ok(rc == NERR_UserNotFound,"Invalid User Name: rc=%ld\n",rc);
todo_wine {
/* FIXME - Currently Wine can't verify whether the network path is good or bad */
rc=pNetUserGetInfo(sBadNetPath, sAdminUserName, 0, (LPBYTE *)&ui0);
ok(rc == ERROR_BAD_NETPATH || rc == ERROR_NETWORK_UNREACHABLE,
"Bad Network Path: rc=%ld",rc);
"Bad Network Path: rc=%ld\n",rc);
}
rc=pNetUserGetInfo(sEmptyStr, sAdminUserName, 0, (LPBYTE *)&ui0);
ok(rc == ERROR_BAD_NETPATH,"Bad Network Path: rc=%ld",rc);
ok(rc == ERROR_BAD_NETPATH,"Bad Network Path: rc=%ld\n",rc);
rc=pNetUserGetInfo(sInvalidName, sAdminUserName, 0, (LPBYTE *)&ui0);
ok(rc == ERROR_INVALID_NAME,"Invalid Server Name: rc=%ld",rc);
ok(rc == ERROR_INVALID_NAME,"Invalid Server Name: rc=%ld\n",rc);
rc=pNetUserGetInfo(sInvalidName2, sAdminUserName, 0, (LPBYTE *)&ui0);
ok(rc == ERROR_INVALID_NAME,"Invalid Server Name: rc=%ld",rc);
ok(rc == ERROR_INVALID_NAME,"Invalid Server Name: rc=%ld\n",rc);
}
/* checks Level 1 of NetQueryDisplayInformation */
@ -137,22 +137,22 @@ void run_querydisplayinformation1_tests(void)
(PVOID *)&Buffer);
ok((Result == ERROR_SUCCESS) || (Result == ERROR_MORE_DATA),
"Information Retrieved");
"Information Retrieved\n");
rec = Buffer;
for(; EntryCount > 0; EntryCount--)
{
if (!lstrcmpW(rec->usri1_name, sAdminUserName))
{
ok(!hasAdmin, "One admin user");
ok(rec->usri1_flags & UF_SCRIPT, "UF_SCRIPT flag is set");
ok(rec->usri1_flags & UF_NORMAL_ACCOUNT, "UF_NORMAL_ACCOUNT flag is set");
ok(!hasAdmin, "One admin user\n");
ok(rec->usri1_flags & UF_SCRIPT, "UF_SCRIPT flag is set\n");
ok(rec->usri1_flags & UF_NORMAL_ACCOUNT, "UF_NORMAL_ACCOUNT flag is set\n");
hasAdmin = TRUE;
}
else if (!lstrcmpW(rec->usri1_name, sGuestUserName))
{
ok(!hasGuest, "One guest record");
ok(rec->usri1_flags & UF_SCRIPT, "UF_SCRIPT flag is set");
ok(rec->usri1_flags & UF_NORMAL_ACCOUNT, "UF_NORMAL_ACCOUNT flag is set");
ok(!hasGuest, "One guest record\n");
ok(rec->usri1_flags & UF_SCRIPT, "UF_SCRIPT flag is set\n");
ok(rec->usri1_flags & UF_NORMAL_ACCOUNT, "UF_NORMAL_ACCOUNT flag is set\n");
hasGuest = TRUE;
}
@ -163,8 +163,8 @@ void run_querydisplayinformation1_tests(void)
pNetApiBufferFree(Buffer);
} while (Result == ERROR_MORE_DATA);
ok(hasAdmin, "Has Administrator account");
ok(hasGuest, "Has Guest account");
ok(hasAdmin, "Has Administrator account\n");
ok(hasGuest, "Has Guest account\n");
}
START_TEST(access)

View File

@ -45,37 +45,37 @@ void run_apibuf_tests(void)
/* test normal logic */
ok(pNetApiBufferAllocate(1024, (LPVOID *)&p) == NERR_Success,
"Reserved memory");
ok(pNetApiBufferSize(p, &dwSize) == NERR_Success, "Got size");
ok(dwSize >= 1024, "The size is correct");
"Reserved memory\n");
ok(pNetApiBufferSize(p, &dwSize) == NERR_Success, "Got size\n");
ok(dwSize >= 1024, "The size is correct\n");
ok(pNetApiBufferReallocate(p, 1500, (LPVOID *) &p) == NERR_Success,
"Reallocated");
ok(pNetApiBufferSize(p, &dwSize) == NERR_Success, "Got size");
ok(dwSize >= 1500, "The size is correct");
"Reallocated\n");
ok(pNetApiBufferSize(p, &dwSize) == NERR_Success, "Got size\n");
ok(dwSize >= 1500, "The size is correct\n");
ok(pNetApiBufferFree(p) == NERR_Success, "Freed");
ok(pNetApiBufferFree(p) == NERR_Success, "Freed\n");
/* test errors handling */
ok(pNetApiBufferFree(p) == NERR_Success, "Freed");
ok(pNetApiBufferFree(p) == NERR_Success, "Freed\n");
ok(pNetApiBufferSize(p, &dwSize) == NERR_Success, "Got size");
ok(dwSize >= 0, "The size");
ok(pNetApiBufferSize(NULL, &dwSize) == ERROR_INVALID_PARAMETER, "Error for NULL pointer");
ok(pNetApiBufferSize(p, &dwSize) == NERR_Success, "Got size\n");
ok(dwSize >= 0, "The size\n");
ok(pNetApiBufferSize(NULL, &dwSize) == ERROR_INVALID_PARAMETER, "Error for NULL pointer\n");
/* border reallocate cases */
ok(pNetApiBufferReallocate(0, 1500, (LPVOID *) &p) != NERR_Success, "(Re)allocated");
ok(p == NULL, "Some memory got allocated");
ok(pNetApiBufferAllocate(1024, (LPVOID *)&p) == NERR_Success, "Memory not reserved");
ok(pNetApiBufferReallocate(p, 0, (LPVOID *) &p) == NERR_Success, "Not freed");
ok(p == NULL, "Pointer not cleared");
ok(pNetApiBufferReallocate(0, 1500, (LPVOID *) &p) != NERR_Success, "(Re)allocated\n");
ok(p == NULL, "Some memory got allocated\n");
ok(pNetApiBufferAllocate(1024, (LPVOID *)&p) == NERR_Success, "Memory not reserved\n");
ok(pNetApiBufferReallocate(p, 0, (LPVOID *) &p) == NERR_Success, "Not freed\n");
ok(p == NULL, "Pointer not cleared\n");
/* 0-length buffer */
ok(pNetApiBufferAllocate(0, (LPVOID *)&p) == NERR_Success,
"Reserved memory");
ok(pNetApiBufferSize(p, &dwSize) == NERR_Success, "Got size");
ok((dwSize >= 0) && (dwSize < 0xFFFFFFFF),"The size of the 0-length buffer");
ok(pNetApiBufferFree(p) == NERR_Success, "Freed");
"Reserved memory\n");
ok(pNetApiBufferSize(p, &dwSize) == NERR_Success, "Got size\n");
ok((dwSize >= 0) && (dwSize < 0xFFFFFFFF),"The size of the 0-length buffer\n");
ok(pNetApiBufferFree(p) == NERR_Success, "Freed\n");
}
START_TEST(apibuf)

View File

@ -52,11 +52,11 @@ static int init_wksta_tests(void)
rc=GetUserNameW(user_name, &dwSize);
if (rc==FALSE && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
return 0;
ok(rc, "User Name Retrieved");
ok(rc, "User Name Retrieved\n");
computer_name[0] = 0;
dwSize = sizeof(computer_name);
ok(GetComputerNameW(computer_name, &dwSize), "Computer Name Retrieved");
ok(GetComputerNameW(computer_name, &dwSize), "Computer Name Retrieved\n");
return 1;
}
@ -67,8 +67,8 @@ static void run_get_comp_name_tests(void)
if (!pNetpGetComputerName)
return;
ok(pNetpGetComputerName(&ws) == NERR_Success, "Computer name is retrieved");
ok(!lstrcmpW(computer_name, ws), "This is really computer name");
ok(pNetpGetComputerName(&ws) == NERR_Success, "Computer name is retrieved\n");
ok(!lstrcmpW(computer_name, ws), "This is really computer name\n");
pNetApiBufferFree(ws);
}
@ -84,35 +84,35 @@ static void run_wkstausergetinfo_tests(void)
/* Level 0 */
ok(pNetWkstaUserGetInfo(NULL, 0, (LPBYTE *)&ui0) == NERR_Success,
"NetWkstaUserGetInfo is successful");
ok(!lstrcmpW(user_name, ui0->wkui0_username), "This is really user name");
"NetWkstaUserGetInfo is successful\n");
ok(!lstrcmpW(user_name, ui0->wkui0_username), "This is really user name\n");
pNetApiBufferSize(ui0, &dwSize);
ok(dwSize >= (sizeof(WKSTA_USER_INFO_0) +
lstrlenW(ui0->wkui0_username) * sizeof(WCHAR)),
"Is allocated with NetApiBufferAllocate");
"Is allocated with NetApiBufferAllocate\n");
/* Level 1 */
ok(pNetWkstaUserGetInfo(NULL, 1, (LPBYTE *)&ui1) == NERR_Success,
"NetWkstaUserGetInfo is successful");
"NetWkstaUserGetInfo is successful\n");
ok(lstrcmpW(ui1->wkui1_username, ui0->wkui0_username) == 0,
"the same name as returned for level 0");
"the same name as returned for level 0\n");
pNetApiBufferSize(ui1, &dwSize);
ok(dwSize >= (sizeof(WKSTA_USER_INFO_1) +
(lstrlenW(ui1->wkui1_username) +
lstrlenW(ui1->wkui1_logon_domain) +
lstrlenW(ui1->wkui1_oth_domains) +
lstrlenW(ui1->wkui1_logon_server)) * sizeof(WCHAR)),
"Is allocated with NetApiBufferAllocate");
"Is allocated with NetApiBufferAllocate\n");
/* Level 1101 */
ok(pNetWkstaUserGetInfo(NULL, 1101, (LPBYTE *)&ui1101) == NERR_Success,
"NetWkstaUserGetInfo is successful");
"NetWkstaUserGetInfo is successful\n");
ok(lstrcmpW(ui1101->wkui1101_oth_domains, ui1->wkui1_oth_domains) == 0,
"the same oth_domains as returned for level 1");
"the same oth_domains as returned for level 1\n");
pNetApiBufferSize(ui1101, &dwSize);
ok(dwSize >= (sizeof(WKSTA_USER_INFO_1101) +
lstrlenW(ui1101->wkui1101_oth_domains) * sizeof(WCHAR)),
"Is allocated with NetApiBufferAllocate");
"Is allocated with NetApiBufferAllocate\n");
pNetApiBufferFree(ui0);
pNetApiBufferFree(ui1);
@ -120,7 +120,7 @@ static void run_wkstausergetinfo_tests(void)
/* errors handling */
ok(pNetWkstaUserGetInfo(NULL, 10000, (LPBYTE *)&ui0) == ERROR_INVALID_LEVEL,
"Invalid level");
"Invalid level\n");
}
static void run_wkstatransportenum_tests(void)
@ -136,7 +136,7 @@ static void run_wkstatransportenum_tests(void)
apiReturn = pNetWkstaTransportEnum(NULL, 1, NULL, MAX_PREFERRED_LENGTH,
NULL, &totalEntries, NULL);
ok(apiReturn == ERROR_INVALID_LEVEL || apiReturn == ERROR_INVALID_PARAMETER,
"NetWkstaTransportEnum returned %ld", apiReturn);
"NetWkstaTransportEnum returned %ld\n", apiReturn);
/* 2nd check: is param 5 passed? (only if level passes?) */
apiReturn = pNetWkstaTransportEnum(NULL, 0, NULL, MAX_PREFERRED_LENGTH,
@ -147,30 +147,30 @@ static void run_wkstatransportenum_tests(void)
return;
ok(apiReturn == STATUS_ACCESS_VIOLATION || apiReturn == ERROR_INVALID_PARAMETER,
"NetWkstaTransportEnum returned %ld", apiReturn);
"NetWkstaTransportEnum returned %ld\n", apiReturn);
/* 3rd check: is param 3 passed? */
apiReturn = pNetWkstaTransportEnum(NULL, 0, NULL, MAX_PREFERRED_LENGTH,
NULL, NULL, NULL);
ok(apiReturn == STATUS_ACCESS_VIOLATION || apiReturn == ERROR_INVALID_PARAMETER,
"NetWkstaTransportEnum returned %ld", apiReturn);
"NetWkstaTransportEnum returned %ld\n", apiReturn);
/* 4th check: is param 6 passed? */
apiReturn = pNetWkstaTransportEnum(NULL, 0, &bufPtr, MAX_PREFERRED_LENGTH,
&entriesRead, NULL, NULL);
ok(apiReturn == RPC_X_NULL_REF_POINTER, "null pointer");
ok(apiReturn == RPC_X_NULL_REF_POINTER, "null pointer\n");
/* final check: valid return, actually get data back */
apiReturn = pNetWkstaTransportEnum(NULL, 0, &bufPtr, MAX_PREFERRED_LENGTH,
&entriesRead, &totalEntries, NULL);
ok(apiReturn == NERR_Success || apiReturn == ERROR_NETWORK_UNREACHABLE,
"NetWkstaTransportEnum returned %ld", apiReturn);
"NetWkstaTransportEnum returned %ld\n", apiReturn);
if (apiReturn == NERR_Success) {
/* WKSTA_TRANSPORT_INFO_0 *transports = (WKSTA_TRANSPORT_INFO_0 *)bufPtr; */
ok(bufPtr != NULL, "got data back");
ok(entriesRead > 0, "read at least one transport");
ok(totalEntries > 0, "at least one transport");
ok(bufPtr != NULL, "got data back\n");
ok(entriesRead > 0, "read at least one transport\n");
ok(totalEntries > 0, "at least one transport\n");
pNetApiBufferFree(bufPtr);
}
}

View File

@ -215,31 +215,31 @@ static HRESULT (WINAPI *pSHLWAPI_214)(_IDummyStream*,ULARGE_INTEGER*);
static void InitFunctionPtrs()
{
SHLWAPI_hshlwapi = LoadLibraryA("shlwapi.dll");
ok(SHLWAPI_hshlwapi != 0, "LoadLibrary failed");
ok(SHLWAPI_hshlwapi != 0, "LoadLibrary failed\n");
if (SHLWAPI_hshlwapi)
{
pSHLWAPI_17 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)17);
ok(pSHLWAPI_17 != 0, "No Ordinal 17");
ok(pSHLWAPI_17 != 0, "No Ordinal 17\n");
pSHLWAPI_18 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)18);
ok(pSHLWAPI_18 != 0, "No Ordinal 18");
ok(pSHLWAPI_18 != 0, "No Ordinal 18\n");
pSHLWAPI_19 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)19);
ok(pSHLWAPI_19 != 0, "No Ordinal 19");
ok(pSHLWAPI_19 != 0, "No Ordinal 19\n");
pSHLWAPI_20 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)20);
ok(pSHLWAPI_20 != 0, "No Ordinal 20");
ok(pSHLWAPI_20 != 0, "No Ordinal 20\n");
pSHLWAPI_21 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)21);
ok(pSHLWAPI_21 != 0, "No Ordinal 21");
ok(pSHLWAPI_21 != 0, "No Ordinal 21\n");
pSHLWAPI_22 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)22);
ok(pSHLWAPI_22 != 0, "No Ordinal 22");
ok(pSHLWAPI_22 != 0, "No Ordinal 22\n");
pSHLWAPI_166 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)166);
ok(pSHLWAPI_166 != 0, "No Ordinal 166");
ok(pSHLWAPI_166 != 0, "No Ordinal 166\n");
pSHLWAPI_184 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)184);
ok(pSHLWAPI_184 != 0, "No Ordinal 184");
ok(pSHLWAPI_184 != 0, "No Ordinal 184\n");
pSHLWAPI_212 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)212);
ok(pSHLWAPI_212 != 0, "No Ordinal 212");
ok(pSHLWAPI_212 != 0, "No Ordinal 212\n");
pSHLWAPI_213 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)213);
ok(pSHLWAPI_213 != 0, "No Ordinal 213");
ok(pSHLWAPI_213 != 0, "No Ordinal 213\n");
pSHLWAPI_214 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)214);
ok(pSHLWAPI_214 != 0, "No Ordinal 214");
ok(pSHLWAPI_214 != 0, "No Ordinal 214\n");
}
}
@ -289,30 +289,30 @@ static void test_CList(void)
/* Add it */
hRet = pSHLWAPI_20(&list, inserted);
ok(hRet > S_OK, "failed list add");
ok(hRet > S_OK, "failed list add\n");
if (hRet > S_OK)
{
ok(list && list->ulSize, "item not added");
ok(list && list->ulSize, "item not added\n");
/* Find it */
inserted = pSHLWAPI_22(list, item->ulId);
ok(inserted != NULL, "lost after adding");
ok(inserted != NULL, "lost after adding\n");
ok(!inserted || inserted->ulId != ~0UL, "find returned a container");
ok(!inserted || inserted->ulId != ~0UL, "find returned a container\n");
/* Check size */
if (inserted && inserted->ulSize & 0x3)
{
/* Contained */
ok(inserted[-1].ulId == ~0UL, "invalid size is not countained");
ok(inserted[-1].ulId == ~0UL, "invalid size is not countained\n");
ok(inserted[-1].ulSize > inserted->ulSize+sizeof(SHLWAPI_CLIST),
"container too small");
"container too small\n");
}
else if (inserted)
{
ok(inserted->ulSize==item->ulSize+sizeof(SHLWAPI_CLIST),
"id %ld size wrong (%ld!=%ld)", inserted->ulId, inserted->ulSize,
"id %ld size wrong (%ld!=%ld)\n", inserted->ulId, inserted->ulSize,
item->ulSize+sizeof(SHLWAPI_CLIST));
}
if (inserted)
@ -324,9 +324,9 @@ static void test_CList(void)
if (bufftest[sizeof(SHLWAPI_CLIST)+i] != i*2)
bDataOK = FALSE;
ok(bDataOK == TRUE, "data corrupted on insert");
ok(bDataOK == TRUE, "data corrupted on insert\n");
}
ok(!inserted || inserted->ulId==item->ulId, "find got wrong item");
ok(!inserted || inserted->ulId==item->ulId, "find got wrong item\n");
}
item++;
}
@ -335,32 +335,32 @@ static void test_CList(void)
InitDummyStream(&streamobj);
hRet = pSHLWAPI_17(&streamobj, list);
ok(hRet == S_OK, "write failed");
ok(hRet == S_OK, "write failed\n");
if (hRet == S_OK)
{
/* 1 call for each element, + 1 for OK (use our null element for this) */
ok(streamobj.writecalls == sizeof(SHLWAPI_CLIST_items)/sizeof(SHLWAPI_CLIST),
"wrong call count");
ok(streamobj.readcalls == 0,"called Read() in write");
ok(streamobj.seekcalls == 0,"called Seek() in write");
"wrong call count\n");
ok(streamobj.readcalls == 0,"called Read() in write\n");
ok(streamobj.seekcalls == 0,"called Seek() in write\n");
}
/* Failure cases for writing */
InitDummyStream(&streamobj);
streamobj.failwritecall = TRUE;
hRet = pSHLWAPI_17(&streamobj, list);
ok(hRet == STG_E_ACCESSDENIED, "changed object failure return");
ok(streamobj.writecalls == 1, "called object after failure");
ok(streamobj.readcalls == 0,"called Read() after failure");
ok(streamobj.seekcalls == 0,"called Seek() after failure");
ok(hRet == STG_E_ACCESSDENIED, "changed object failure return\n");
ok(streamobj.writecalls == 1, "called object after failure\n");
ok(streamobj.readcalls == 0,"called Read() after failure\n");
ok(streamobj.seekcalls == 0,"called Seek() after failure\n");
InitDummyStream(&streamobj);
streamobj.failwritesize = TRUE;
hRet = pSHLWAPI_17(&streamobj, list);
ok(hRet == STG_E_MEDIUMFULL, "changed size failure return");
ok(streamobj.writecalls == 1, "called object after size failure");
ok(streamobj.readcalls == 0,"called Read() after failure");
ok(streamobj.seekcalls == 0,"called Seek() after failure");
ok(hRet == STG_E_MEDIUMFULL, "changed size failure return\n");
ok(streamobj.writecalls == 1, "called object after size failure\n");
ok(streamobj.readcalls == 0,"called Read() after failure\n");
ok(streamobj.seekcalls == 0,"called Seek() after failure\n");
/* Invalid inputs for adding */
inserted = (LPSHLWAPI_CLIST)buff;
@ -368,48 +368,48 @@ static void test_CList(void)
inserted->ulId = 33;
hRet = pSHLWAPI_20(&list, inserted);
/* The call succeeds but the item is not inserted */
ok(hRet == S_OK, "failed bad element size");
ok(hRet == S_OK, "failed bad element size\n");
inserted = pSHLWAPI_22(list, 33);
ok(inserted == NULL, "inserted bad element size");
ok(inserted == NULL, "inserted bad element size\n");
inserted = (LPSHLWAPI_CLIST)buff;
inserted->ulSize = 44;
inserted->ulId = ~0UL;
hRet = pSHLWAPI_20(&list, inserted);
/* The call succeeds but the item is not inserted */
ok(hRet == S_OK, "failed adding a container");
ok(hRet == S_OK, "failed adding a container\n");
item = SHLWAPI_CLIST_items;
/* Look for non-existing item in populated list */
inserted = pSHLWAPI_22(list, 99999999);
ok(inserted == NULL, "found a non-existing item");
ok(inserted == NULL, "found a non-existing item\n");
while (item->ulSize)
{
/* Delete items */
BOOL bRet = pSHLWAPI_21(&list, item->ulId);
ok(bRet == TRUE, "couldn't find item to delete");
ok(bRet == TRUE, "couldn't find item to delete\n");
item++;
}
/* Look for non-existing item in empty list */
inserted = pSHLWAPI_22(list, 99999999);
ok(inserted == NULL, "found an item in empty list");
ok(inserted == NULL, "found an item in empty list\n");
/* Create a list by reading in data */
InitDummyStream(&streamobj);
hRet = pSHLWAPI_18(&streamobj, &list);
ok(hRet == S_OK, "failed create from Read()");
ok(hRet == S_OK, "failed create from Read()\n");
if (hRet == S_OK)
{
ok(streamobj.readbeyondend == FALSE, "read beyond end");
ok(streamobj.readbeyondend == FALSE, "read beyond end\n");
/* 2 calls per item, but only 1 for the terminator */
ok(streamobj.readcalls == sizeof(SHLWAPI_CLIST_items)/sizeof(SHLWAPI_CLIST)*2-1,
"wrong call count");
ok(streamobj.writecalls == 0, "called Write() from create");
ok(streamobj.seekcalls == 0,"called Seek() from create");
"wrong call count\n");
ok(streamobj.writecalls == 0, "called Write() from create\n");
ok(streamobj.seekcalls == 0,"called Seek() from create\n");
item = SHLWAPI_CLIST_items;
@ -417,25 +417,25 @@ static void test_CList(void)
while (item->ulSize)
{
inserted = pSHLWAPI_22(list, item->ulId);
ok(inserted != NULL, "lost after adding");
ok(inserted != NULL, "lost after adding\n");
ok(!inserted || inserted->ulId != ~0UL, "find returned a container");
ok(!inserted || inserted->ulId != ~0UL, "find returned a container\n");
/* Check size */
if (inserted && inserted->ulSize & 0x3)
{
/* Contained */
ok(inserted[-1].ulId == ~0UL, "invalid size is not countained");
ok(inserted[-1].ulId == ~0UL, "invalid size is not countained\n");
ok(inserted[-1].ulSize > inserted->ulSize+sizeof(SHLWAPI_CLIST),
"container too small");
"container too small\n");
}
else if (inserted)
{
ok(inserted->ulSize==item->ulSize+sizeof(SHLWAPI_CLIST),
"id %ld size wrong (%ld!=%ld)", inserted->ulId, inserted->ulSize,
"id %ld size wrong (%ld!=%ld)\n", inserted->ulId, inserted->ulSize,
item->ulSize+sizeof(SHLWAPI_CLIST));
}
ok(!inserted || inserted->ulId==item->ulId, "find got wrong item");
ok(!inserted || inserted->ulId==item->ulId, "find got wrong item\n");
if (inserted)
{
BOOL bDataOK = TRUE;
@ -445,7 +445,7 @@ static void test_CList(void)
if (bufftest[sizeof(SHLWAPI_CLIST)+i] != i*2)
bDataOK = FALSE;
ok(bDataOK == TRUE, "data corrupted on insert");
ok(bDataOK == TRUE, "data corrupted on insert\n");
}
item++;
}
@ -455,21 +455,21 @@ static void test_CList(void)
InitDummyStream(&streamobj);
streamobj.failreadcall = TRUE;
hRet = pSHLWAPI_18(&streamobj, &list);
ok(hRet == STG_E_ACCESSDENIED, "changed object failure return");
ok(streamobj.readbeyondend == FALSE, "read beyond end");
ok(streamobj.readcalls == 1, "called object after read failure");
ok(streamobj.writecalls == 0,"called Write() after read failure");
ok(streamobj.seekcalls == 0,"called Seek() after read failure");
ok(hRet == STG_E_ACCESSDENIED, "changed object failure return\n");
ok(streamobj.readbeyondend == FALSE, "read beyond end\n");
ok(streamobj.readcalls == 1, "called object after read failure\n");
ok(streamobj.writecalls == 0,"called Write() after read failure\n");
ok(streamobj.seekcalls == 0,"called Seek() after read failure\n");
/* Read returns large object */
InitDummyStream(&streamobj);
streamobj.readreturnlarge = TRUE;
hRet = pSHLWAPI_18(&streamobj, &list);
ok(hRet == S_OK, "failed create from Read() with large item");
ok(streamobj.readbeyondend == FALSE, "read beyond end");
ok(streamobj.readcalls == 1,"wrong call count");
ok(streamobj.writecalls == 0,"called Write() after read failure");
ok(streamobj.seekcalls == 2,"wrong Seek() call count (%d)", streamobj.seekcalls);
ok(hRet == S_OK, "failed create from Read() with large item\n");
ok(streamobj.readbeyondend == FALSE, "read beyond end\n");
ok(streamobj.readcalls == 1,"wrong call count\n");
ok(streamobj.writecalls == 0,"called Write() after read failure\n");
ok(streamobj.seekcalls == 2,"wrong Seek() call count (%d)\n", streamobj.seekcalls);
pSHLWAPI_19(list);
}
@ -485,46 +485,46 @@ static void test_SHLWAPI_166(void)
InitDummyStream(&streamobj);
bRet = pSHLWAPI_166(&streamobj);
ok(bRet == TRUE, "failed before seek adjusted");
ok(streamobj.readcalls == 0, "called Read()");
ok(streamobj.writecalls == 0, "called Write()");
ok(streamobj.seekcalls == 0, "called Seek()");
ok(streamobj.statcalls == 1, "wrong call count");
ok(bRet == TRUE, "failed before seek adjusted\n");
ok(streamobj.readcalls == 0, "called Read()\n");
ok(streamobj.writecalls == 0, "called Write()\n");
ok(streamobj.seekcalls == 0, "called Seek()\n");
ok(streamobj.statcalls == 1, "wrong call count\n");
streamobj.statcalls = 0;
streamobj.pos.QuadPart = 50001;
bRet = pSHLWAPI_166(&streamobj);
ok(bRet == FALSE, "failed after seek adjusted");
ok(streamobj.readcalls == 0, "called Read()");
ok(streamobj.writecalls == 0, "called Write()");
ok(streamobj.seekcalls == 0, "called Seek()");
ok(streamobj.statcalls == 1, "wrong call count");
ok(bRet == FALSE, "failed after seek adjusted\n");
ok(streamobj.readcalls == 0, "called Read()\n");
ok(streamobj.writecalls == 0, "called Write()\n");
ok(streamobj.seekcalls == 0, "called Seek()\n");
ok(streamobj.statcalls == 1, "wrong call count\n");
/* Failure cases */
InitDummyStream(&streamobj);
streamobj.pos.QuadPart = 50001;
streamobj.failstatcall = TRUE; /* 1: Stat() Bad, Read() OK */
bRet = pSHLWAPI_166(&streamobj);
ok(bRet == FALSE, "should be FALSE after read is OK");
ok(streamobj.readcalls == 1, "wrong call count");
ok(streamobj.writecalls == 0, "called Write()");
ok(streamobj.seekcalls == 1, "wrong call count");
ok(streamobj.statcalls == 1, "wrong call count");
ok(streamobj.pos.QuadPart == 0, "Didn't seek to start");
ok(bRet == FALSE, "should be FALSE after read is OK\n");
ok(streamobj.readcalls == 1, "wrong call count\n");
ok(streamobj.writecalls == 0, "called Write()\n");
ok(streamobj.seekcalls == 1, "wrong call count\n");
ok(streamobj.statcalls == 1, "wrong call count\n");
ok(streamobj.pos.QuadPart == 0, "Didn't seek to start\n");
InitDummyStream(&streamobj);
streamobj.pos.QuadPart = 50001;
streamobj.failstatcall = TRUE;
streamobj.failreadcall = TRUE; /* 2: Stat() Bad, Read() Bad Also */
bRet = pSHLWAPI_166(&streamobj);
ok(bRet == TRUE, "Should be true after read fails");
ok(streamobj.readcalls == 1, "wrong call count");
ok(streamobj.writecalls == 0, "called Write()");
ok(streamobj.seekcalls == 0, "Called Seek()");
ok(streamobj.statcalls == 1, "wrong call count");
ok(streamobj.pos.QuadPart == 50001, "called Seek() after read failed");
ok(bRet == TRUE, "Should be true after read fails\n");
ok(streamobj.readcalls == 1, "wrong call count\n");
ok(streamobj.writecalls == 0, "called Write()\n");
ok(streamobj.seekcalls == 0, "Called Seek()\n");
ok(streamobj.statcalls == 1, "wrong call count\n");
ok(streamobj.pos.QuadPart == 50001, "called Seek() after read failed\n");
}
static void test_SHLWAPI_184(void)
@ -539,10 +539,10 @@ static void test_SHLWAPI_184(void)
InitDummyStream(&streamobj);
hRet = pSHLWAPI_184(&streamobj, buff, sizeof(buff));
ok(hRet == S_OK, "failed Read()");
ok(streamobj.readcalls == 1, "wrong call count");
ok(streamobj.writecalls == 0, "called Write()");
ok(streamobj.seekcalls == 0, "called Seek()");
ok(hRet == S_OK, "failed Read()\n");
ok(streamobj.readcalls == 1, "wrong call count\n");
ok(streamobj.writecalls == 0, "called Write()\n");
ok(streamobj.seekcalls == 0, "called Seek()\n");
}
static void test_SHLWAPI_212(void)
@ -557,10 +557,10 @@ static void test_SHLWAPI_212(void)
InitDummyStream(&streamobj);
hRet = pSHLWAPI_212(&streamobj, buff, sizeof(buff));
ok(hRet == S_OK, "failed Write()");
ok(streamobj.readcalls == 0, "called Read()");
ok(streamobj.writecalls == 1, "wrong call count");
ok(streamobj.seekcalls == 0, "called Seek()");
ok(hRet == S_OK, "failed Write()\n");
ok(streamobj.readcalls == 0, "called Read()\n");
ok(streamobj.writecalls == 1, "wrong call count\n");
ok(streamobj.seekcalls == 0, "called Seek()\n");
}
static void test_SHLWAPI_213(void)
@ -579,15 +579,15 @@ static void test_SHLWAPI_213(void)
streamobj.seekcalls = 0;
pSHLWAPI_213(&streamobj); /* Should rewind */
ok(streamobj.statcalls == 0, "called Stat()");
ok(streamobj.readcalls == 0, "called Read()");
ok(streamobj.writecalls == 0, "called Write()");
ok(streamobj.seekcalls == 1, "wrong call count");
ok(streamobj.statcalls == 0, "called Stat()\n");
ok(streamobj.readcalls == 0, "called Read()\n");
ok(streamobj.writecalls == 0, "called Write()\n");
ok(streamobj.seekcalls == 1, "wrong call count\n");
ul.QuadPart = 50001;
hRet = pSHLWAPI_214(&streamobj, &ul);
ok(hRet == S_OK, "failed Stat()");
ok(ul.QuadPart == 0, "213 didn't rewind stream");
ok(hRet == S_OK, "failed Stat()\n");
ok(ul.QuadPart == 0, "213 didn't rewind stream\n");
}
static void test_SHLWAPI_214(void)
@ -607,12 +607,12 @@ static void test_SHLWAPI_214(void)
streamobj.seekcalls = 0;
hRet = pSHLWAPI_214(&streamobj, &ul);
ok(hRet == S_OK, "failed Stat()");
ok(streamobj.statcalls == 1, "wrong call count");
ok(streamobj.readcalls == 0, "called Read()");
ok(streamobj.writecalls == 0, "called Write()");
ok(streamobj.seekcalls == 0, "called Seek()");
ok(ul.QuadPart == 5000l, "Stat gave wrong size");
ok(hRet == S_OK, "failed Stat()\n");
ok(streamobj.statcalls == 1, "wrong call count\n");
ok(streamobj.readcalls == 0, "called Read()\n");
ok(streamobj.writecalls == 0, "called Write()\n");
ok(streamobj.seekcalls == 0, "called Seek()\n");
ok(ul.QuadPart == 5000l, "Stat gave wrong size\n");
}
START_TEST(clist)

View File

@ -114,13 +114,13 @@ static void test_ClassIDs(void)
while (*guids)
{
dwLen = pSHLWAPI_23(*guids, szBuff, 256);
ok(dwLen == 39, "wrong size for id %d", i);
ok(dwLen == 39, "wrong size for id %d\n", i);
bRet = pSHLWAPI_269(szBuff, &guid);
ok(bRet != FALSE, "created invalid string '%s'", szBuff);
ok(bRet != FALSE, "created invalid string '%s'\n", szBuff);
if (bRet)
ok(IsEqualGUID(*guids, &guid), "GUID created wrong %d", i);
ok(IsEqualGUID(*guids, &guid), "GUID created wrong %d\n", i);
guids++;
i++;
@ -128,42 +128,42 @@ static void test_ClassIDs(void)
/* Test endianess */
dwLen = pSHLWAPI_23(&IID_Endianess, szBuff, 256);
ok(dwLen == 39, "wrong size for IID_Endianess");
ok(dwLen == 39, "wrong size for IID_Endianess\n");
ok(!strcmp(szBuff, "{01020304-0506-0708-090A-0B0C0D0E0F0A}"),
"Endianess Broken, got '%s'", szBuff);
"Endianess Broken, got '%s'\n", szBuff);
/* test lengths */
szBuff[0] = ':';
dwLen = pSHLWAPI_23(&IID_Endianess, szBuff, 0);
ok(dwLen == 0, "accepted bad length");
ok(szBuff[0] == ':', "wrote to buffer with no length");
ok(dwLen == 0, "accepted bad length\n");
ok(szBuff[0] == ':', "wrote to buffer with no length\n");
szBuff[0] = ':';
dwLen = pSHLWAPI_23(&IID_Endianess, szBuff, 38);
ok(dwLen == 0, "accepted bad length");
ok(szBuff[0] == ':', "wrote to buffer with no length");
ok(dwLen == 0, "accepted bad length\n");
ok(szBuff[0] == ':', "wrote to buffer with no length\n");
szBuff[0] = ':';
dwLen = pSHLWAPI_23(&IID_Endianess, szBuff, 39);
ok(dwLen == 39, "rejected ok length");
ok(szBuff[0] == '{', "Didn't write to buffer with ok length");
ok(dwLen == 39, "rejected ok length\n");
ok(szBuff[0] == '{', "Didn't write to buffer with ok length\n");
/* Test string */
strcpy(szBuff, "{xxx-");
bRet = pSHLWAPI_269(szBuff, &guid);
ok(bRet == FALSE, "accepted invalid string");
ok(bRet == FALSE, "accepted invalid string\n");
dwLen = pSHLWAPI_23(&IID_Endianess, szBuff, 39);
ok(dwLen == 39, "rejected ok length");
ok(szBuff[0] == '{', "Didn't write to buffer with ok length");
ok(dwLen == 39, "rejected ok length\n");
ok(szBuff[0] == '{', "Didn't write to buffer with ok length\n");
}
START_TEST(clsid)
{
hShlwapi = LoadLibraryA("shlwapi.dll");
ok(hShlwapi != 0, "LoadLibraryA failed");
ok(hShlwapi != 0, "LoadLibraryA failed\n");
if (hShlwapi)
{
pSHLWAPI_269 = (void*)GetProcAddress(hShlwapi, (LPSTR)269);

View File

@ -56,12 +56,12 @@ static void hash_url(const char* szUrl)
DWORD cbSize = sizeof(DWORD);
DWORD dwHash1, dwHash2;
ok(UrlHashA(szTestUrl, (LPBYTE)&dwHash1, cbSize) == S_OK, "UrlHashA didn't return S_OK");
ok(UrlHashW(wszTestUrl, (LPBYTE)&dwHash2, cbSize) == S_OK, "UrlHashW didn't return S_OK");
ok(UrlHashA(szTestUrl, (LPBYTE)&dwHash1, cbSize) == S_OK, "UrlHashA didn't return S_OK\n");
ok(UrlHashW(wszTestUrl, (LPBYTE)&dwHash2, cbSize) == S_OK, "UrlHashW didn't return S_OK\n");
FreeWideString(wszTestUrl);
ok(dwHash1 == dwHash2, "Hashes didn't compare");
ok(dwHash1 == dwHash2, "Hashes didn't compare\n");
}
static void test_UrlHash(void)
@ -81,13 +81,13 @@ static void test_url_part(const char* szUrl, DWORD dwPart, DWORD dwFlags, const
DWORD dwSize;
dwSize = INTERNET_MAX_URL_LENGTH;
ok( UrlGetPartA(szUrl, szPart, &dwSize, dwPart, dwFlags) == S_OK, "UrlGetPartA didn't return S_OK" );
ok( UrlGetPartA(szUrl, szPart, &dwSize, dwPart, dwFlags) == S_OK, "UrlGetPartA didn't return S_OK\n" );
dwSize = INTERNET_MAX_URL_LENGTH;
ok( UrlGetPartW(wszUrl, wszPart, &dwSize, dwPart, dwFlags) == S_OK, "UrlGetPartW didn't return S_OK" );
ok( UrlGetPartW(wszUrl, wszPart, &dwSize, dwPart, dwFlags) == S_OK, "UrlGetPartW didn't return S_OK\n" );
wszConvertedPart = GetWideString(szPart);
ok(strcmpW(wszPart,wszConvertedPart)==0, "Strings didn't match between ascii and unicode UrlGetPart!");
ok(strcmpW(wszPart,wszConvertedPart)==0, "Strings didn't match between ascii and unicode UrlGetPart!\n");
FreeWideString(wszUrl);
FreeWideString(wszConvertedPart);
@ -95,7 +95,7 @@ static void test_url_part(const char* szUrl, DWORD dwPart, DWORD dwFlags, const
/* Note that v6.0 and later don't return '?' with the query */
ok(strcmp(szPart,szExpected)==0 ||
(*szExpected=='?' && !strcmp(szPart,szExpected+1)),
"Expected %s, but got %s", szExpected, szPart);
"Expected %s, but got %s\n", szExpected, szPart);
}
static void test_UrlGetPart(void)

View File

@ -78,13 +78,13 @@ static HKEY create_test_entries(void)
SetEnvironmentVariableA("LONGSYSTEMVAR", "bar");
SetEnvironmentVariableA("FOO", "ImARatherLongButIndeedNeededString");
ok(!RegCreateKeyA(HKEY_CURRENT_USER, REG_TEST_KEY, &hKey), "RegCreateKeyA failed");
ok(!RegCreateKeyA(HKEY_CURRENT_USER, REG_TEST_KEY, &hKey), "RegCreateKeyA failed\n");
if (hKey)
{
ok(!RegSetValueExA(hKey,"Test1",0,REG_EXPAND_SZ, sTestpath1, strlen(sTestpath1)+1), "RegSetValueExA failed");
ok(!RegSetValueExA(hKey,"Test2",0,REG_SZ, sTestpath1, strlen(sTestpath1)+1), "RegSetValueExA failed");
ok(!RegSetValueExA(hKey,"Test3",0,REG_EXPAND_SZ, sTestpath2, strlen(sTestpath2)+1), "RegSetValueExA failed");
ok(!RegSetValueExA(hKey,"Test1",0,REG_EXPAND_SZ, sTestpath1, strlen(sTestpath1)+1), "RegSetValueExA failed\n");
ok(!RegSetValueExA(hKey,"Test2",0,REG_SZ, sTestpath1, strlen(sTestpath1)+1), "RegSetValueExA failed\n");
ok(!RegSetValueExA(hKey,"Test3",0,REG_EXPAND_SZ, sTestpath2, strlen(sTestpath2)+1), "RegSetValueExA failed\n");
}
sExpLen1 = ExpandEnvironmentStringsA(sTestpath1, sExpTestpath1, sizeof(sExpTestpath1));
@ -104,16 +104,16 @@ static void test_SHGetValue(void)
strcpy(buf, sEmptyBuffer);
dwSize = MAX_PATH;
dwType = -1;
ok(! SHGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test1", &dwType, buf, &dwSize), "SHGetValueA failed");
ok( 0 == strcmp(sExpTestpath1, buf), "(%s,%s)", buf, sExpTestpath1);
ok( REG_SZ == dwType, "(%lx)", dwType);
ok(! SHGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test1", &dwType, buf, &dwSize), "SHGetValueA failed\n");
ok( 0 == strcmp(sExpTestpath1, buf), "(%s,%s)\n", buf, sExpTestpath1);
ok( REG_SZ == dwType, "(%lx)\n", dwType);
strcpy(buf, sEmptyBuffer);
dwSize = MAX_PATH;
dwType = -1;
ok(! SHGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test2", &dwType, buf, &dwSize), "SHGetValueA failed");
ok( 0 == strcmp(sTestpath1, buf) , "(%s)", buf);
ok( REG_SZ == dwType , "(%lx)", dwType);
ok(! SHGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test2", &dwType, buf, &dwSize), "SHGetValueA failed\n");
ok( 0 == strcmp(sTestpath1, buf) , "(%s)\n", buf);
ok( REG_SZ == dwType , "(%lx)\n", dwType);
}
static void test_SHGetRegPath(void)
@ -124,8 +124,8 @@ static void test_SHGetRegPath(void)
return;
strcpy(buf, sEmptyBuffer);
ok(! (*pSHRegGetPathA)(HKEY_CURRENT_USER, REG_TEST_KEY, "Test1", buf, 0), "SHRegGetPathA failed");
ok( 0 == strcmp(sExpTestpath1, buf) , "(%s)", buf);
ok(! (*pSHRegGetPathA)(HKEY_CURRENT_USER, REG_TEST_KEY, "Test1", buf, 0), "SHRegGetPathA failed\n");
ok( 0 == strcmp(sExpTestpath1, buf) , "(%s)\n", buf);
}
static void test_SHQUeryValueEx(void)
@ -138,7 +138,7 @@ static void test_SHQUeryValueEx(void)
const char * sTestedFunction = "";
DWORD nUsedBuffer1,nUsedBuffer2;
ok(! RegOpenKeyExA(HKEY_CURRENT_USER, REG_TEST_KEY, 0, KEY_QUERY_VALUE, &hKey), "test4 RegOpenKey");
ok(! RegOpenKeyExA(HKEY_CURRENT_USER, REG_TEST_KEY, 0, KEY_QUERY_VALUE, &hKey), "test4 RegOpenKey\n");
/****** SHQueryValueExA ******/
@ -148,29 +148,29 @@ static void test_SHQUeryValueEx(void)
/*
* Case 1.1 All arguments are NULL
*/
ok(! SHQueryValueExA( hKey, "Test1", NULL, NULL, NULL, NULL), "SHQueryValueExA failed");
ok(! SHQueryValueExA( hKey, "Test1", NULL, NULL, NULL, NULL), "SHQueryValueExA failed\n");
/*
* Case 1.2 dwType is set
*/
dwType = -1;
ok(! SHQueryValueExA( hKey, "Test1", NULL, &dwType, NULL, NULL), "SHQueryValueExA failed");
ok( dwType == REG_SZ, "(%lu)", dwType);
ok(! SHQueryValueExA( hKey, "Test1", NULL, &dwType, NULL, NULL), "SHQueryValueExA failed\n");
ok( dwType == REG_SZ, "(%lu)\n", dwType);
/*
* dwSize is set
* dwExpanded < dwUnExpanded
*/
dwSize = 6;
ok(! SHQueryValueExA( hKey, "Test1", NULL, NULL, NULL, &dwSize), "SHQueryValueExA failed");
ok( dwSize == nUsedBuffer1, "(%lu,%lu)", dwSize, nUsedBuffer1);
ok(! SHQueryValueExA( hKey, "Test1", NULL, NULL, NULL, &dwSize), "SHQueryValueExA failed\n");
ok( dwSize == nUsedBuffer1, "(%lu,%lu)\n", dwSize, nUsedBuffer1);
/*
* dwExpanded > dwUnExpanded
*/
dwSize = 6;
ok(! SHQueryValueExA( hKey, "Test3", NULL, NULL, NULL, &dwSize), "SHQueryValueExA failed");
ok( dwSize == nUsedBuffer2, "(%lu,%lu)", dwSize, nUsedBuffer2);
ok(! SHQueryValueExA( hKey, "Test3", NULL, NULL, NULL, &dwSize), "SHQueryValueExA failed\n");
ok( dwSize == nUsedBuffer2, "(%lu,%lu)\n", dwSize, nUsedBuffer2);
/*
@ -180,10 +180,10 @@ static void test_SHQUeryValueEx(void)
dwSize = 6;
dwType = -1;
dwRet = SHQueryValueExA( hKey, "Test1", NULL, &dwType, buf, &dwSize);
ok( dwRet == ERROR_MORE_DATA, "(%lu)", dwRet);
ok( 0 == strcmp(sEmptyBuffer, buf), "(%s)", buf);
ok( dwType == REG_SZ, "(%lu)" , dwType);
ok( dwSize == nUsedBuffer1, "(%lu,%lu)" , dwSize, nUsedBuffer1);
ok( dwRet == ERROR_MORE_DATA, "(%lu)\n", dwRet);
ok( 0 == strcmp(sEmptyBuffer, buf), "(%s)\n", buf);
ok( dwType == REG_SZ, "(%lu)\n" , dwType);
ok( dwSize == nUsedBuffer1, "(%lu,%lu)\n" , dwSize, nUsedBuffer1);
/*
* string grows during expanding
@ -192,10 +192,10 @@ static void test_SHQUeryValueEx(void)
dwSize = 6;
dwType = -1;
dwRet = SHQueryValueExA( hKey, "Test3", NULL, &dwType, buf, &dwSize);
ok( ERROR_MORE_DATA == dwRet, "ERROR_MORE_DATA");
ok( 0 == strcmp(sEmptyBuffer, buf), "(%s)", buf);
ok( dwSize == nUsedBuffer2, "(%lu,%lu)" , dwSize, nUsedBuffer2);
ok( dwType == REG_SZ, "(%lu)" , dwType);
ok( ERROR_MORE_DATA == dwRet, "ERROR_MORE_DATA\n");
ok( 0 == strcmp(sEmptyBuffer, buf), "(%s)\n", buf);
ok( dwSize == nUsedBuffer2, "(%lu,%lu)\n" , dwSize, nUsedBuffer2);
ok( dwType == REG_SZ, "(%lu)\n" , dwType);
/*
* if the unexpanded string fits into the buffer it can get cut when expanded
@ -203,11 +203,11 @@ static void test_SHQUeryValueEx(void)
strcpy(buf, sEmptyBuffer);
dwSize = sExpLen2 - 4;
dwType = -1;
ok( ERROR_MORE_DATA == SHQueryValueExA( hKey, "Test3", NULL, &dwType, buf, &dwSize), "Expected ERROR_MORE_DATA");
ok( 0 == strncmp(sExpTestpath2, buf, sExpLen2 - 4 - 1), "(%s)", buf);
ok( sExpLen2 - 4 - 1 == strlen(buf), "(%s)", buf);
ok( dwSize == nUsedBuffer2, "(%lu,%lu)" , dwSize, nUsedBuffer2);
ok( dwType == REG_SZ, "(%lu)" , dwType);
ok( ERROR_MORE_DATA == SHQueryValueExA( hKey, "Test3", NULL, &dwType, buf, &dwSize), "Expected ERROR_MORE_DATA\n");
ok( 0 == strncmp(sExpTestpath2, buf, sExpLen2 - 4 - 1), "(%s)\n", buf);
ok( sExpLen2 - 4 - 1 == strlen(buf), "(%s)\n", buf);
ok( dwSize == nUsedBuffer2, "(%lu,%lu)\n" , dwSize, nUsedBuffer2);
ok( dwType == REG_SZ, "(%lu)\n" , dwType);
/*
* The buffer is NULL but the size is set
@ -216,9 +216,9 @@ static void test_SHQUeryValueEx(void)
dwSize = 6;
dwType = -1;
dwRet = SHQueryValueExA( hKey, "Test3", NULL, &dwType, NULL, &dwSize);
ok( ERROR_SUCCESS == dwRet, "(%lu)", dwRet);
ok( dwSize == nUsedBuffer2, "(%lu,%lu)" , dwSize, nUsedBuffer2);
ok( dwType == REG_SZ, "(%lu)" , dwType);
ok( ERROR_SUCCESS == dwRet, "(%lu)\n", dwRet);
ok( dwSize == nUsedBuffer2, "(%lu,%lu)\n" , dwSize, nUsedBuffer2);
ok( dwType == REG_SZ, "(%lu)\n" , dwType);
RegCloseKey(hKey);
@ -239,20 +239,20 @@ static void test_SHCopyKey(void)
hKeyDst = NULL;
if (RegCreateKeyA(HKEY_CURRENT_USER, REG_TEST_KEY "\\CopyDestination", &hKeyDst) || !hKeyDst)
{
ok(0, "didn't open dest");
ok(0, "didn't open dest\n");
return;
}
hKeySrc = NULL;
if (RegOpenKeyA(HKEY_LOCAL_MACHINE, REG_CURRENT_VERSION, &hKeySrc) || !hKeySrc)
{
ok(0, "didn't open source");
ok(0, "didn't open source\n");
return;
}
if (pSHCopyKeyA)
ok (!(*pSHCopyKeyA)(hKeyDst, NULL, hKeySrc, 0), "failed copy");
ok (!(*pSHCopyKeyA)(hKeyDst, NULL, hKeySrc, 0), "failed copy\n");
RegCloseKey(hKeySrc);
RegCloseKey(hKeyDst);
@ -261,12 +261,12 @@ static void test_SHCopyKey(void)
hKeyDst = NULL;
if (RegOpenKeyA(HKEY_CURRENT_USER, REG_TEST_KEY "\\CopyDestination\\AeDebug", &hKeyDst) || !hKeyDst)
{
ok(0, "didn't open copy");
ok(0, "didn't open copy\n");
return;
}
/* And the we copied the values too */
ok(!SHQueryValueExA(hKeyDst, "Debugger", NULL, NULL, NULL, NULL), "SHQueryValueExA failed");
ok(!SHQueryValueExA(hKeyDst, "Debugger", NULL, NULL, NULL, NULL), "SHQueryValueExA failed\n");
RegCloseKey(hKeyDst);
}

View File

@ -159,7 +159,7 @@ static void test_StrChrA(void)
WORD count;
/* this test crashes on win2k SP4 */
/*ok(!StrChrA(NULL,'\0'), "found a character in a NULL string!");*/
/*ok(!StrChrA(NULL,'\0'), "found a character in a NULL string!\n");*/
for (count = 32; count < 128; count++)
string[count] = (char)count;
@ -186,7 +186,7 @@ static void test_StrChrW(void)
WORD count;
/* this test crashes on win2k SP4 */
/*ok(!StrChrW(NULL,'\0'), "found a character in a NULL string!");*/
/*ok(!StrChrW(NULL,'\0'), "found a character in a NULL string!\n");*/
for (count = 32; count < 16384; count++)
string[count] = count;
@ -195,13 +195,13 @@ static void test_StrChrW(void)
for (count = 32; count < 16384; count++)
{
LPWSTR result = StrChrW(string+32, count);
ok((result - string) == count, "found char %d in wrong place", count);
ok((result - string) == count, "found char %d in wrong place\n", count);
}
for (count = 32; count < 16384; count++)
{
LPWSTR result = StrChrW(string+count+1, count);
ok(!result, "found char not in the string");
ok(!result, "found char not in the string\n");
}
}
@ -211,7 +211,7 @@ static void test_StrChrIA(void)
WORD count;
/* this test crashes on win2k SP4 */
/*ok(!StrChrIA(NULL,'\0'), "found a character in a NULL string!");*/
/*ok(!StrChrIA(NULL,'\0'), "found a character in a NULL string!\n");*/
for (count = 32; count < 128; count++)
string[count] = (char)count;
@ -221,14 +221,14 @@ static void test_StrChrIA(void)
{
LPSTR result = StrChrIA(string+32, count);
ok(result - string == count, "found char '%c' in wrong place", count);
ok(StrChrIA(result, count)!=NULL, "didn't find lowercase '%c'", count);
ok(result - string == count, "found char '%c' in wrong place\n", count);
ok(StrChrIA(result, count)!=NULL, "didn't find lowercase '%c'\n", count);
}
for (count = 'a'; count < 'z'; count++)
{
LPSTR result = StrChrIA(string+count+1, count);
ok(!result, "found char not in the string");
ok(!result, "found char not in the string\n");
}
}
@ -238,7 +238,7 @@ static void test_StrChrIW(void)
WORD count;
/* this test crashes on win2k SP4 */
/*ok(!StrChrIA(NULL,'\0'), "found a character in a NULL string!");*/
/*ok(!StrChrIA(NULL,'\0'), "found a character in a NULL string!\n");*/
for (count = 32; count < 128; count++)
string[count] = count;
@ -248,14 +248,14 @@ static void test_StrChrIW(void)
{
LPWSTR result = StrChrIW(string+32, count);
ok(result - string == count, "found char '%c' in wrong place", count);
ok(StrChrIW(result, count)!=NULL, "didn't find lowercase '%c'", count);
ok(result - string == count, "found char '%c' in wrong place\n", count);
ok(StrChrIW(result, count)!=NULL, "didn't find lowercase '%c'\n", count);
}
for (count = 'a'; count < 'z'; count++)
{
LPWSTR result = StrChrIW(string+count+1, count);
ok(!result, "found char not in the string");
ok(!result, "found char not in the string\n");
}
}
@ -265,7 +265,7 @@ static void test_StrRChrA(void)
WORD count;
/* this test crashes on win2k SP4 */
/*ok(!StrRChrA(NULL, NULL,'\0'), "found a character in a NULL string!");*/
/*ok(!StrRChrA(NULL, NULL,'\0'), "found a character in a NULL string!\n");*/
for (count = 32; count < 128; count++)
string[count] = (char)count;
@ -274,19 +274,19 @@ static void test_StrRChrA(void)
for (count = 32; count < 128; count++)
{
LPSTR result = StrRChrA(string+32, NULL, count);
ok(result - string == count, "found char %d in wrong place", count);
ok(result - string == count, "found char %d in wrong place\n", count);
}
for (count = 32; count < 128; count++)
{
LPSTR result = StrRChrA(string+count+1, NULL, count);
ok(!result, "found char not in the string");
ok(!result, "found char not in the string\n");
}
for (count = 32; count < 128; count++)
{
LPSTR result = StrRChrA(string+count+1, string + 127, count);
ok(!result, "found char not in the string");
ok(!result, "found char not in the string\n");
}
}
@ -296,7 +296,7 @@ static void test_StrRChrW(void)
WORD count;
/* this test crashes on win2k SP4 */
/*ok(!StrRChrW(NULL, NULL,'\0'), "found a character in a NULL string!");*/
/*ok(!StrRChrW(NULL, NULL,'\0'), "found a character in a NULL string!\n");*/
for (count = 32; count < 128; count++)
string[count] = count;
@ -335,7 +335,7 @@ static void test_StrCpyW(void)
MultiByteToWideChar(0,0,result->byte_size_64,-1,szSrc,sizeof(szSrc)/sizeof(WCHAR));
StrCpyW(szBuff, szSrc);
ok(!StrCmpW(szSrc, szBuff), "Copied string %s wrong", result->byte_size_64);
ok(!StrCmpW(szSrc, szBuff), "Copied string %s wrong\n", result->byte_size_64);
result++;
}
}
@ -349,7 +349,7 @@ static void test_StrToIntA(void)
while (result->string)
{
return_val = StrToIntA(result->string);
ok(return_val == result->str_to_int, "converted '%s' wrong (%d)",
ok(return_val == result->str_to_int, "converted '%s' wrong (%d)\n",
result->string, return_val);
result++;
}
@ -365,7 +365,7 @@ static void test_StrToIntW(void)
{
MultiByteToWideChar(0,0,result->string,-1,szBuff,sizeof(szBuff)/sizeof(WCHAR));
return_val = StrToIntW(szBuff);
ok(return_val == result->str_to_int, "converted '%s' wrong (%d)",
ok(return_val == result->str_to_int, "converted '%s' wrong (%d)\n",
result->string, return_val);
result++;
}
@ -381,10 +381,10 @@ static void test_StrToIntExA(void)
{
return_val = -1;
bRet = StrToIntExA(result->string,0,&return_val);
ok(!bRet || return_val != -1, "No result returned from '%s'",
ok(!bRet || return_val != -1, "No result returned from '%s'\n",
result->string);
if (bRet)
ok(return_val == result->str_to_int_ex, "converted '%s' wrong (%d)",
ok(return_val == result->str_to_int_ex, "converted '%s' wrong (%d)\n",
result->string, return_val);
result++;
}
@ -394,10 +394,10 @@ static void test_StrToIntExA(void)
{
return_val = -1;
bRet = StrToIntExA(result->string,STIF_SUPPORT_HEX,&return_val);
ok(!bRet || return_val != -1, "No result returned from '%s'",
ok(!bRet || return_val != -1, "No result returned from '%s'\n",
result->string);
if (bRet)
ok(return_val == result->str_to_int_hex, "converted '%s' wrong (%d)",
ok(return_val == result->str_to_int_hex, "converted '%s' wrong (%d)\n",
result->string, return_val);
result++;
}
@ -415,10 +415,10 @@ static void test_StrToIntExW(void)
return_val = -1;
MultiByteToWideChar(0,0,result->string,-1,szBuff,sizeof(szBuff)/sizeof(WCHAR));
bRet = StrToIntExW(szBuff, 0, &return_val);
ok(!bRet || return_val != -1, "No result returned from '%s'",
ok(!bRet || return_val != -1, "No result returned from '%s'\n",
result->string);
if (bRet)
ok(return_val == result->str_to_int_ex, "converted '%s' wrong (%d)",
ok(return_val == result->str_to_int_ex, "converted '%s' wrong (%d)\n",
result->string, return_val);
result++;
}
@ -429,10 +429,10 @@ static void test_StrToIntExW(void)
return_val = -1;
MultiByteToWideChar(0,0,result->string,-1,szBuff,sizeof(szBuff)/sizeof(WCHAR));
bRet = StrToIntExW(szBuff, STIF_SUPPORT_HEX, &return_val);
ok(!bRet || return_val != -1, "No result returned from '%s'",
ok(!bRet || return_val != -1, "No result returned from '%s'\n",
result->string);
if (bRet)
ok(return_val == result->str_to_int_hex, "converted '%s' wrong (%d)",
ok(return_val == result->str_to_int_hex, "converted '%s' wrong (%d)\n",
result->string, return_val);
result++;
}
@ -447,10 +447,10 @@ static void test_StrDupA()
{
lpszStr = StrDupA(result->byte_size_64);
ok(lpszStr != NULL, "Dup failed");
ok(lpszStr != NULL, "Dup failed\n");
if (lpszStr)
{
ok(!strcmp(result->byte_size_64, lpszStr), "Copied string wrong");
ok(!strcmp(result->byte_size_64, lpszStr), "Copied string wrong\n");
LocalFree((HLOCAL)lpszStr);
}
result++;
@ -460,7 +460,7 @@ static void test_StrDupA()
* returned an empty string (as Wine does).
*/
lpszStr = StrDupA(NULL);
ok(lpszStr == NULL || *lpszStr == '\0', "NULL string returned %p", lpszStr);
ok(lpszStr == NULL || *lpszStr == '\0', "NULL string returned %p\n", lpszStr);
}
static void test_StrFormatByteSize64A(void)
@ -531,7 +531,7 @@ void test_StrFromTimeIntervalA(void)
{
StrFromTimeIntervalA(szBuff, 256, result->ms, result->digits);
ok(!strcmp(result->time_interval, szBuff), "Formatted %ld %d wrong",
ok(!strcmp(result->time_interval, szBuff), "Formatted %ld %d wrong\n",
result->ms, result->digits);
result++;
}