setupapi/tests: Win64 printf format warning fixes.

This commit is contained in:
Michael Ploujnikov 2006-10-09 18:35:04 -04:00 committed by Alexandre Julliard
parent 5512168869
commit 8e302e15d2
5 changed files with 35 additions and 36 deletions

View File

@ -4,7 +4,6 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
TESTDLL = setupapi.dll
IMPORTS = setupapi advapi32 kernel32
EXTRADEFS = -DWINE_NO_LONG_AS_INT
CTESTS = \
devinst.c \

View File

@ -62,24 +62,24 @@ static void test_SetupDiCreateDeviceInfoListEx(void)
devlist = pSetupDiCreateDeviceInfoListExW(NULL, NULL, NULL, notnull);
error = GetLastError();
ok(devlist == INVALID_HANDLE_VALUE, "SetupDiCreateDeviceInfoListExW failed : %p %ld (expected %p)\n", devlist, error, INVALID_HANDLE_VALUE);
ok(error == ERROR_INVALID_PARAMETER, "GetLastError returned wrong value : %ld, (expected %d)\n", error, ERROR_INVALID_PARAMETER);
ok(devlist == INVALID_HANDLE_VALUE, "SetupDiCreateDeviceInfoListExW failed : %p %d (expected %p)\n", devlist, error, INVALID_HANDLE_VALUE);
ok(error == ERROR_INVALID_PARAMETER, "GetLastError returned wrong value : %d, (expected %d)\n", error, ERROR_INVALID_PARAMETER);
SetLastError(0xdeadbeef);
/* create empty DeviceInfoList, but set MachineName to something */
devlist = pSetupDiCreateDeviceInfoListExW(NULL, NULL, machine, NULL);
error = GetLastError();
ok(devlist == INVALID_HANDLE_VALUE, "SetupDiCreateDeviceInfoListExW failed : %p %ld (expected %p)\n", devlist, error, INVALID_HANDLE_VALUE);
ok(error == ERROR_INVALID_MACHINENAME, "GetLastError returned wrong value : %ld, (expected %d)\n", error, ERROR_INVALID_MACHINENAME);
ok(devlist == INVALID_HANDLE_VALUE, "SetupDiCreateDeviceInfoListExW failed : %p %d (expected %p)\n", devlist, error, INVALID_HANDLE_VALUE);
ok(error == ERROR_INVALID_MACHINENAME, "GetLastError returned wrong value : %d, (expected %d)\n", error, ERROR_INVALID_MACHINENAME);
/* create empty DeviceInfoList */
devlist = pSetupDiCreateDeviceInfoListExW(NULL, NULL, NULL, NULL);
ok(devlist && devlist != INVALID_HANDLE_VALUE, "SetupDiCreateDeviceInfoListExW failed : %p %ld (expected != %p)\n", devlist, error, INVALID_HANDLE_VALUE);
ok(devlist && devlist != INVALID_HANDLE_VALUE, "SetupDiCreateDeviceInfoListExW failed : %p %d (expected != %p)\n", devlist, error, INVALID_HANDLE_VALUE);
/* destroy DeviceInfoList */
ret = pSetupDiDestroyDeviceInfoList(devlist);
ok(ret, "SetupDiDestroyDeviceInfoList failed : %ld\n", error);
ok(ret, "SetupDiDestroyDeviceInfoList failed : %d\n", error);
}
static void test_SetupDiOpenClassRegKeyExA(void)
@ -108,7 +108,7 @@ static void test_SetupDiOpenClassRegKeyExA(void)
classKey = pSetupDiOpenClassRegKeyExA(&guid, KEY_ALL_ACCESS,
DIOCR_INSTALLER, NULL, NULL);
ok(classKey != INVALID_HANDLE_VALUE,
"opening class registry key failed with error %ld\n",
"opening class registry key failed with error %d\n",
GetLastError());
if (classKey != INVALID_HANDLE_VALUE)
RegCloseKey(classKey);

View File

@ -143,20 +143,20 @@ static void test_invalid_files(void)
err_line = 0xdeadbeef;
hinf = test_file_contents( invalid_files[i].data, &err_line );
err = GetLastError();
trace( "hinf=%p err=%lx line=%d\n", hinf, err, err_line );
trace( "hinf=%p err=%x line=%d\n", hinf, err, err_line );
if (invalid_files[i].error) /* should fail */
{
ok( hinf == INVALID_HANDLE_VALUE, "file %u: Open succeeded\n", i );
if (invalid_files[i].todo) todo_wine
{
ok( err == invalid_files[i].error, "file %u: Bad error %lx/%lx\n",
ok( err == invalid_files[i].error, "file %u: Bad error %x/%x\n",
i, err, invalid_files[i].error );
ok( err_line == invalid_files[i].err_line, "file %u: Bad error line %d/%d\n",
i, err_line, invalid_files[i].err_line );
}
else
{
ok( err == invalid_files[i].error, "file %u: Bad error %lx/%lx\n",
ok( err == invalid_files[i].error, "file %u: Bad error %x/%x\n",
i, err, invalid_files[i].error );
ok( err_line == invalid_files[i].err_line, "file %u: Bad error line %d/%d\n",
i, err_line, invalid_files[i].err_line );
@ -165,7 +165,7 @@ static void test_invalid_files(void)
else /* should succeed */
{
ok( hinf != INVALID_HANDLE_VALUE, "file %u: Open failed\n", i );
ok( err == 0, "file %u: Error code set to %lx\n", i, err );
ok( err == 0, "file %u: Error code set to %x\n", i, err );
}
if (hinf != INVALID_HANDLE_VALUE) SetupCloseInfFile( hinf );
}
@ -223,23 +223,23 @@ static void test_section_names(void)
{
SetLastError( 0xdeadbeef );
hinf = test_file_contents( section_names[i].data, &err_line );
ok( hinf != INVALID_HANDLE_VALUE, "line %u: open failed err %lx\n", i, GetLastError() );
ok( hinf != INVALID_HANDLE_VALUE, "line %u: open failed err %x\n", i, GetLastError() );
if (hinf == INVALID_HANDLE_VALUE) continue;
ret = SetupGetLineCountA( hinf, section_names[i].section );
err = GetLastError();
trace( "hinf=%p ret=%ld err=%lx\n", hinf, ret, err );
trace( "hinf=%p ret=%d err=%x\n", hinf, ret, err );
if (ret != -1)
{
ok( !section_names[i].error, "line %u: section name %s found\n",
i, section_names[i].section );
ok( !err, "line %u: bad error code %lx\n", i, err );
ok( !err, "line %u: bad error code %x\n", i, err );
}
else
{
ok( section_names[i].error, "line %u: section name %s not found\n",
i, section_names[i].section );
ok( err == section_names[i].error, "line %u: bad error %lx/%lx\n",
ok( err == section_names[i].error, "line %u: bad error %x/%x\n",
i, err, section_names[i].error );
}
SetupCloseInfFile( hinf );
@ -328,12 +328,12 @@ static const char *check_key( INFCONTEXT *context, const char *wanted )
if (!key)
{
ok( !wanted, "missing key %s\n", wanted );
ok( err == 0 || err == ERROR_INVALID_PARAMETER, "last error set to %lx\n", err );
ok( err == 0 || err == ERROR_INVALID_PARAMETER, "last error set to %x\n", err );
}
else
{
ok( !strcmp( key, wanted ), "bad key %s/%s\n", key, wanted );
ok( err == 0, "last error set to %lx\n", err );
ok( err == 0, "last error set to %x\n", err );
}
return key;
}
@ -355,7 +355,7 @@ static void test_key_names(void)
strcat( buffer, key_names[i].data );
SetLastError( 0xdeadbeef );
hinf = test_file_contents( buffer, &err_line );
ok( hinf != INVALID_HANDLE_VALUE, "line %u: open failed err %lx\n", i, GetLastError() );
ok( hinf != INVALID_HANDLE_VALUE, "line %u: open failed err %x\n", i, GetLastError() );
if (hinf == INVALID_HANDLE_VALUE) continue;
ret = SetupFindFirstLineA( hinf, "Test", 0, &context );
@ -370,7 +370,7 @@ static void test_key_names(void)
err = GetLastError();
if (field)
{
ok( err == 0, "line %u: bad error %lx\n", i, GetLastError() );
ok( err == 0, "line %u: bad error %x\n", i, GetLastError() );
if (key_names[i].fields[index])
ok( !strcmp( field, key_names[i].fields[index] ), "line %u: bad field %s/%s\n",
i, field, key_names[i].fields[index] );
@ -382,7 +382,7 @@ static void test_key_names(void)
else
{
ok( err == 0 || err == ERROR_INVALID_PARAMETER,
"line %u: bad error %lx\n", i, GetLastError() );
"line %u: bad error %x\n", i, GetLastError() );
if (key_names[i].fields[index])
ok( 0, "line %u: missing field %s\n", i, key_names[i].fields[index] );
}
@ -404,7 +404,7 @@ static void test_close_inf_file(void)
{
SetLastError(0xdeadbeef);
SetupCloseInfFile(NULL);
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
}
static const char *contents = "[Version]\n"
@ -448,7 +448,7 @@ static void test_pSetupGetField(void)
ret = HeapFree( GetProcessHeap(), 0, (LPVOID)field );
ok( !ret, "Expected HeapFree to fail\n" );
ok( GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError() );
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError() );
}
field = pSetupGetField( &context, 3 );
@ -458,7 +458,7 @@ static void test_pSetupGetField(void)
field = pSetupGetField( &context, 4 );
ok( field == NULL, "Expected NULL, got %p\n", field );
ok( GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError() );
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError() );
SetupCloseInfFile( hinf );
}

View File

@ -139,7 +139,7 @@ static void test_SetupGetInfInformation(void)
ret = pSetupGetInfInformationA(NULL, INFINFO_INF_SPEC_IS_HINF, NULL, 0, &size);
ok(ret == FALSE, "Expected SetupGetInfInformation to fail\n");
ok(GetLastError() == ERROR_INVALID_HANDLE,
"Expected ERROR_INVALID_HANDLE, got %ld\n", GetLastError());
"Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
ok(size == 0xdeadbeef, "Expected size to remain unchanged\n");
/* try an invalid inf filename */
@ -148,7 +148,7 @@ static void test_SetupGetInfInformation(void)
ret = pSetupGetInfInformationA(NULL, INFINFO_INF_NAME_IS_ABSOLUTE, NULL, 0, &size);
ok(ret == FALSE, "Expected SetupGetInfInformation to fail\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
ok(size == 0xdeadbeef, "Expected size to remain unchanged\n");
create_inf_file(inf_filename);
@ -159,7 +159,7 @@ static void test_SetupGetInfInformation(void)
ret = pSetupGetInfInformationA(inf_filename, -1, NULL, 0, &size);
ok(ret == FALSE, "Expected SetupGetInfInformation to fail\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
ok(size == 0xdeadbeef, "Expected size to remain unchanged\n");
/* try a nonexistent inf file */
@ -168,7 +168,7 @@ static void test_SetupGetInfInformation(void)
ret = pSetupGetInfInformationA("idontexist", INFINFO_INF_NAME_IS_ABSOLUTE, NULL, 0, &size);
ok(ret == FALSE, "Expected SetupGetInfInformation to fail\n");
ok(GetLastError() == ERROR_FILE_NOT_FOUND,
"Expected ERROR_FILE_NOT_FOUND, got %ld\n", GetLastError());
"Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
ok(size == 0xdeadbeef, "Expected size to remain unchanged\n");
/* successfully open the inf file */
@ -182,7 +182,7 @@ static void test_SetupGetInfInformation(void)
ret = pSetupGetInfInformationA(inf_filename, INFINFO_INF_NAME_IS_ABSOLUTE, NULL, size, &size);
ok(ret == FALSE, "Expected SetupGetInfInformation to fail\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
/* set ReturnBuffer to NULL and ReturnBufferSize to non-zero value 'size-1' */
ret = pSetupGetInfInformationA(inf_filename, INFINFO_INF_NAME_IS_ABSOLUTE, NULL, size-1, &size);
@ -203,7 +203,7 @@ static void test_SetupGetInfInformation(void)
ret = pSetupGetInfInformationA(inf_filename, INFINFO_INF_NAME_IS_ABSOLUTE, info, size - 1, &size);
ok(ret == FALSE, "Expected SetupGetInfInformation to fail\n");
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"Expected ERROR_INSUFFICIENT_BUFFER, got %ld\n", GetLastError());
"Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
/* successfully get the inf information */
ret = pSetupGetInfInformationA(inf_filename, INFINFO_INF_NAME_IS_ABSOLUTE, info, size, &size);

View File

@ -99,15 +99,15 @@ static void test_StringTableAddString(void)
retval=pStringTableAddString(table,String,0);
ok(retval!=-1,"Failed to add String to String Table\n");
ok(hstring==retval,"string handle %lx != String handle %lx in String Table\n", hstring, retval);
ok(hstring==retval,"string handle %x != String handle %x in String Table\n", hstring, retval);
hfoo=pStringTableAddString(table,foo,0);
ok(hfoo!=-1,"Failed to add foo to String Table\n");
ok(hfoo!=hstring,"foo and string share the same ID %lx in String Table\n", hfoo);
ok(hfoo!=hstring,"foo and string share the same ID %x in String Table\n", hfoo);
/* case sensitive */
hString=pStringTableAddString(table,String,ST_CASE_SENSITIVE_COMPARE);
ok(hstring!=hString,"String handle and string share same ID %lx in Table\n", hstring);
ok(hstring!=hString,"String handle and string share same ID %x in Table\n", hstring);
}
static void test_StringTableDuplicate(void)
@ -124,7 +124,7 @@ static void test_StringTableLookUpString(void)
retval=pStringTableLookUpString(table,string,0);
ok(retval!=-1,"Failed find string in String Table 1\n");
ok(retval==hstring,
"Lookup for string (%lx) does not match previous handle (%lx) in String Table 1\n",
"Lookup for string (%x) does not match previous handle (%x) in String Table 1\n",
retval, hstring);
retval=pStringTableLookUpString(table2,string,0);
@ -139,7 +139,7 @@ static void test_StringTableLookUpString(void)
retval=pStringTableLookUpString(table,foo,0);
ok(retval!=-1,"Failed find foo in String Table 1\n");
ok(retval==hfoo,
"Lookup for foo (%lx) does not match previous handle (%lx) in String Table 1\n",
"Lookup for foo (%x) does not match previous handle (%x) in String Table 1\n",
retval, hfoo);
retval=pStringTableLookUpString(table2,foo,0);
@ -150,7 +150,7 @@ static void test_StringTableLookUpString(void)
retval2=pStringTableLookUpString(table,String,ST_CASE_SENSITIVE_COMPARE);
ok(retval!=retval2,"Lookup of string equals String in Table 1\n");
ok(retval2==hString,
"Lookup for String (%lx) does not match previous handle (%lx) in String Table 1\n",
"Lookup for String (%x) does not match previous handle (%x) in String Table 1\n",
retval, hString);
}