Commit 9d03aa32 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

setupapi/tests: Enable compilation with -D__WINESRC__.

parent 60f62f4d
TESTDLL = setupapi.dll TESTDLL = setupapi.dll
IMPORTS = setupapi user32 advapi32 IMPORTS = setupapi user32 advapi32
EXTRADEFS = -U__WINESRC__ -DWINE_STRICT_PROTOTYPES -DWINE_NO_NAMELESS_EXTENSION -DWIDL_C_INLINE_WRAPPERS
C_SRCS = \ C_SRCS = \
devinst.c \ devinst.c \
......
...@@ -241,7 +241,7 @@ static void clean_devclass_key(void) ...@@ -241,7 +241,7 @@ static void clean_devclass_key(void)
* the keys under the DeviceClasses key after a SetupDiDestroyDeviceInfoList. * the keys under the DeviceClasses key after a SetupDiDestroyDeviceInfoList.
*/ */
RegOpenKeyW(HKEY_LOCAL_MACHINE, devclass, &key); RegOpenKeyW(HKEY_LOCAL_MACHINE, devclass, &key);
RegQueryInfoKey(key, NULL, NULL, NULL, &subkeys, NULL, NULL, NULL, NULL, NULL, NULL, NULL); RegQueryInfoKeyW(key, NULL, NULL, NULL, &subkeys, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
if (subkeys > 0) if (subkeys > 0)
{ {
trace("We are most likely on Windows 2000\n"); trace("We are most likely on Windows 2000\n");
...@@ -342,8 +342,8 @@ static void test_SetupDiOpenClassRegKeyExA(void) ...@@ -342,8 +342,8 @@ static void test_SetupDiOpenClassRegKeyExA(void)
static void create_inf_file(LPCSTR filename) static void create_inf_file(LPCSTR filename)
{ {
DWORD dwNumberOfBytesWritten; DWORD dwNumberOfBytesWritten;
HANDLE hf = CreateFile(filename, GENERIC_WRITE, 0, NULL, HANDLE hf = CreateFileA(filename, GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
static const char data[] = static const char data[] =
"[Version]\n" "[Version]\n"
...@@ -410,7 +410,7 @@ static void testInstallClass(void) ...@@ -410,7 +410,7 @@ static void testInstallClass(void)
ok(!RegDeleteKeyW(HKEY_LOCAL_MACHINE, classKey), ok(!RegDeleteKeyW(HKEY_LOCAL_MACHINE, classKey),
"Couldn't delete classkey\n"); "Couldn't delete classkey\n");
DeleteFile(tmpfile); DeleteFileA(tmpfile);
} }
static void testCreateDeviceInfo(void) static void testCreateDeviceInfo(void)
...@@ -533,7 +533,7 @@ static void testCreateDeviceInfo(void) ...@@ -533,7 +533,7 @@ static void testCreateDeviceInfo(void)
DWORD subkeys; DWORD subkeys;
/* Check if we have subkeys */ /* Check if we have subkeys */
RegQueryInfoKey(key, NULL, NULL, NULL, &subkeys, NULL, NULL, NULL, NULL, NULL, NULL, NULL); RegQueryInfoKeyA(key, NULL, NULL, NULL, &subkeys, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
if (subkeys > 0) if (subkeys > 0)
{ {
int i; int i;
......
...@@ -63,7 +63,7 @@ static BOOL (WINAPI *pSetupGetInfFileListW)(PCWSTR, DWORD, PWSTR, DWORD, PDWORD) ...@@ -63,7 +63,7 @@ static BOOL (WINAPI *pSetupGetInfFileListW)(PCWSTR, DWORD, PWSTR, DWORD, PDWORD)
static void create_inf_file(LPCSTR filename, const char *data) static void create_inf_file(LPCSTR filename, const char *data)
{ {
DWORD res; DWORD res;
HANDLE handle = CreateFile(filename, GENERIC_WRITE, 0, NULL, HANDLE handle = CreateFileA(filename, GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
assert(handle != INVALID_HANDLE_VALUE); assert(handle != INVALID_HANDLE_VALUE);
assert(WriteFile(handle, data, strlen(data), &res, NULL)); assert(WriteFile(handle, data, strlen(data), &res, NULL));
...@@ -107,7 +107,7 @@ static void ok_registry(BOOL expectsuccess) ...@@ -107,7 +107,7 @@ static void ok_registry(BOOL expectsuccess)
LONG ret; LONG ret;
/* Functional tests for success of install and clean up */ /* Functional tests for success of install and clean up */
ret = RegDeleteKey(HKEY_CURRENT_USER, "Software\\Wine\\setupapitest"); ret = RegDeleteKeyA(HKEY_CURRENT_USER, "Software\\Wine\\setupapitest");
ok((expectsuccess && ret == ERROR_SUCCESS) || ok((expectsuccess && ret == ERROR_SUCCESS) ||
(!expectsuccess && ret == ERROR_FILE_NOT_FOUND), (!expectsuccess && ret == ERROR_FILE_NOT_FOUND),
"Expected registry key Software\\Wine\\setupapitest to %s, RegDeleteKey returned %d\n", "Expected registry key Software\\Wine\\setupapitest to %s, RegDeleteKey returned %d\n",
...@@ -126,7 +126,7 @@ static void test_cmdline(void) ...@@ -126,7 +126,7 @@ static void test_cmdline(void)
sprintf(path, "%s\\%s", CURR_DIR, inffile); sprintf(path, "%s\\%s", CURR_DIR, inffile);
run_cmdline("DefaultInstall", 128, path); run_cmdline("DefaultInstall", 128, path);
ok_registry(TRUE); ok_registry(TRUE);
ret = DeleteFile(inffile); ret = DeleteFileA(inffile);
ok(ret, "Expected source inf to exist, last error was %d\n", GetLastError()); ok(ret, "Expected source inf to exist, last error was %d\n", GetLastError());
/* Test handling of spaces in path, unquoted and quoted */ /* Test handling of spaces in path, unquoted and quoted */
...@@ -140,7 +140,7 @@ static void test_cmdline(void) ...@@ -140,7 +140,7 @@ static void test_cmdline(void)
run_cmdline("DefaultInstall", 128, path); run_cmdline("DefaultInstall", 128, path);
ok_registry(FALSE); ok_registry(FALSE);
ret = DeleteFile(infwithspaces); ret = DeleteFileA(infwithspaces);
ok(ret, "Expected source inf to exist, last error was %d\n", GetLastError()); ok(ret, "Expected source inf to exist, last error was %d\n", GetLastError());
} }
...@@ -180,7 +180,7 @@ static void test_registry(void) ...@@ -180,7 +180,7 @@ static void test_registry(void)
RegDeleteKeyA(HKEY_CURRENT_USER, "Software\\Wine\\setupapitest\\setupapitest"); RegDeleteKeyA(HKEY_CURRENT_USER, "Software\\Wine\\setupapitest\\setupapitest");
RegDeleteKeyA(HKEY_CURRENT_USER, "Software\\Wine\\setupapitest"); RegDeleteKeyA(HKEY_CURRENT_USER, "Software\\Wine\\setupapitest");
} }
ret = DeleteFile(inffile); ret = DeleteFileA(inffile);
ok(ret, "Expected source inf to exist, last error was %d\n", GetLastError()); ok(ret, "Expected source inf to exist, last error was %d\n", GetLastError());
} }
...@@ -216,7 +216,7 @@ static void test_install_svc_from(void) ...@@ -216,7 +216,7 @@ static void test_install_svc_from(void)
ok(GetLastError() == ERROR_SECTION_NOT_FOUND, ok(GetLastError() == ERROR_SECTION_NOT_FOUND,
"Expected ERROR_SECTION_NOT_FOUND, got %08x\n", GetLastError()); "Expected ERROR_SECTION_NOT_FOUND, got %08x\n", GetLastError());
SetupCloseInfFile(infhandle); SetupCloseInfFile(infhandle);
DeleteFile(inffile); DeleteFileA(inffile);
/* Add the section */ /* Add the section */
strcat(inf, "[Winetest.Services]\n"); strcat(inf, "[Winetest.Services]\n");
...@@ -228,7 +228,7 @@ static void test_install_svc_from(void) ...@@ -228,7 +228,7 @@ static void test_install_svc_from(void)
ok(GetLastError() == ERROR_SECTION_NOT_FOUND, ok(GetLastError() == ERROR_SECTION_NOT_FOUND,
"Expected ERROR_SECTION_NOT_FOUND, got %08x\n", GetLastError()); "Expected ERROR_SECTION_NOT_FOUND, got %08x\n", GetLastError());
SetupCloseInfFile(infhandle); SetupCloseInfFile(infhandle);
DeleteFile(inffile); DeleteFileA(inffile);
/* Add a reference */ /* Add a reference */
strcat(inf, "AddService=Winetest,,Winetest.Service\n"); strcat(inf, "AddService=Winetest,,Winetest.Service\n");
...@@ -240,7 +240,7 @@ static void test_install_svc_from(void) ...@@ -240,7 +240,7 @@ static void test_install_svc_from(void)
ok(GetLastError() == ERROR_BAD_SERVICE_INSTALLSECT, ok(GetLastError() == ERROR_BAD_SERVICE_INSTALLSECT,
"Expected ERROR_BAD_SERVICE_INSTALLSECT, got %08x\n", GetLastError()); "Expected ERROR_BAD_SERVICE_INSTALLSECT, got %08x\n", GetLastError());
SetupCloseInfFile(infhandle); SetupCloseInfFile(infhandle);
DeleteFile(inffile); DeleteFileA(inffile);
/* Add the section */ /* Add the section */
strcat(inf, "[Winetest.Service]\n"); strcat(inf, "[Winetest.Service]\n");
...@@ -252,7 +252,7 @@ static void test_install_svc_from(void) ...@@ -252,7 +252,7 @@ static void test_install_svc_from(void)
ok(GetLastError() == ERROR_BAD_SERVICE_INSTALLSECT, ok(GetLastError() == ERROR_BAD_SERVICE_INSTALLSECT,
"Expected ERROR_BAD_SERVICE_INSTALLSECT, got %08x\n", GetLastError()); "Expected ERROR_BAD_SERVICE_INSTALLSECT, got %08x\n", GetLastError());
SetupCloseInfFile(infhandle); SetupCloseInfFile(infhandle);
DeleteFile(inffile); DeleteFileA(inffile);
/* Just the ServiceBinary */ /* Just the ServiceBinary */
strcat(inf, "ServiceBinary=%12%\\winetest.sys\n"); strcat(inf, "ServiceBinary=%12%\\winetest.sys\n");
...@@ -264,7 +264,7 @@ static void test_install_svc_from(void) ...@@ -264,7 +264,7 @@ static void test_install_svc_from(void)
ok(GetLastError() == ERROR_BAD_SERVICE_INSTALLSECT, ok(GetLastError() == ERROR_BAD_SERVICE_INSTALLSECT,
"Expected ERROR_BAD_SERVICE_INSTALLSECT, got %08x\n", GetLastError()); "Expected ERROR_BAD_SERVICE_INSTALLSECT, got %08x\n", GetLastError());
SetupCloseInfFile(infhandle); SetupCloseInfFile(infhandle);
DeleteFile(inffile); DeleteFileA(inffile);
/* Add the ServiceType */ /* Add the ServiceType */
strcat(inf, "ServiceType=1\n"); strcat(inf, "ServiceType=1\n");
...@@ -276,7 +276,7 @@ static void test_install_svc_from(void) ...@@ -276,7 +276,7 @@ static void test_install_svc_from(void)
ok(GetLastError() == ERROR_BAD_SERVICE_INSTALLSECT, ok(GetLastError() == ERROR_BAD_SERVICE_INSTALLSECT,
"Expected ERROR_BAD_SERVICE_INSTALLSECT, got %08x\n", GetLastError()); "Expected ERROR_BAD_SERVICE_INSTALLSECT, got %08x\n", GetLastError());
SetupCloseInfFile(infhandle); SetupCloseInfFile(infhandle);
DeleteFile(inffile); DeleteFileA(inffile);
/* Add the StartType */ /* Add the StartType */
strcat(inf, "StartType=4\n"); strcat(inf, "StartType=4\n");
...@@ -288,7 +288,7 @@ static void test_install_svc_from(void) ...@@ -288,7 +288,7 @@ static void test_install_svc_from(void)
ok(GetLastError() == ERROR_BAD_SERVICE_INSTALLSECT, ok(GetLastError() == ERROR_BAD_SERVICE_INSTALLSECT,
"Expected ERROR_BAD_SERVICE_INSTALLSECT, got %08x\n", GetLastError()); "Expected ERROR_BAD_SERVICE_INSTALLSECT, got %08x\n", GetLastError());
SetupCloseInfFile(infhandle); SetupCloseInfFile(infhandle);
DeleteFile(inffile); DeleteFileA(inffile);
/* This should be it, the minimal entries to install a service */ /* This should be it, the minimal entries to install a service */
strcat(inf, "ErrorControl=1"); strcat(inf, "ErrorControl=1");
...@@ -300,14 +300,14 @@ static void test_install_svc_from(void) ...@@ -300,14 +300,14 @@ static void test_install_svc_from(void)
{ {
skip("Not enough rights to install the service\n"); skip("Not enough rights to install the service\n");
SetupCloseInfFile(infhandle); SetupCloseInfFile(infhandle);
DeleteFile(inffile); DeleteFileA(inffile);
return; return;
} }
ok(ret, "Expected success\n"); ok(ret, "Expected success\n");
ok(GetLastError() == ERROR_SUCCESS, ok(GetLastError() == ERROR_SUCCESS,
"Expected ERROR_SUCCESS, got %08x\n", GetLastError()); "Expected ERROR_SUCCESS, got %08x\n", GetLastError());
SetupCloseInfFile(infhandle); SetupCloseInfFile(infhandle);
DeleteFile(inffile); DeleteFileA(inffile);
scm_handle = OpenSCManagerA(NULL, NULL, GENERIC_ALL); scm_handle = OpenSCManagerA(NULL, NULL, GENERIC_ALL);
...@@ -334,7 +334,7 @@ static void test_install_svc_from(void) ...@@ -334,7 +334,7 @@ static void test_install_svc_from(void)
ok(ret, "Expected success\n"); ok(ret, "Expected success\n");
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %08x\n", GetLastError()); ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %08x\n", GetLastError());
SetupCloseInfFile(infhandle); SetupCloseInfFile(infhandle);
DeleteFile(inffile); DeleteFileA(inffile);
/* TODO: Test the Flags */ /* TODO: Test the Flags */
} }
...@@ -395,7 +395,7 @@ static void test_driver_install(void) ...@@ -395,7 +395,7 @@ static void test_driver_install(void)
run_cmdline("DefaultInstall", 128, path); run_cmdline("DefaultInstall", 128, path);
/* Driver should have been installed */ /* Driver should have been installed */
attrs = GetFileAttributes(driver); attrs = GetFileAttributesA(driver);
ok(attrs != INVALID_FILE_ATTRIBUTES, "Expected driver to exist\n"); ok(attrs != INVALID_FILE_ATTRIBUTES, "Expected driver to exist\n");
scm_handle = OpenSCManagerA(NULL, NULL, GENERIC_ALL); scm_handle = OpenSCManagerA(NULL, NULL, GENERIC_ALL);
...@@ -412,9 +412,9 @@ static void test_driver_install(void) ...@@ -412,9 +412,9 @@ static void test_driver_install(void)
CloseServiceHandle(scm_handle); CloseServiceHandle(scm_handle);
/* File cleanup */ /* File cleanup */
DeleteFile(inffile); DeleteFileA(inffile);
DeleteFile("winetest.sys"); DeleteFileA("winetest.sys");
DeleteFile(driver); DeleteFileA(driver);
} }
static void test_profile_items(void) static void test_profile_items(void)
...@@ -458,34 +458,34 @@ static void test_profile_items(void) ...@@ -458,34 +458,34 @@ static void test_profile_items(void)
run_cmdline("DefaultInstall", 128, path); run_cmdline("DefaultInstall", 128, path);
snprintf(path, MAX_PATH, "%s\\TestItem.lnk", commonprogs); snprintf(path, MAX_PATH, "%s\\TestItem.lnk", commonprogs);
if (INVALID_FILE_ATTRIBUTES == GetFileAttributes(path)) if (INVALID_FILE_ATTRIBUTES == GetFileAttributesA(path))
{ {
win_skip("ProfileItems not implemented on this system\n"); win_skip("ProfileItems not implemented on this system\n");
} }
else else
{ {
snprintf(path, MAX_PATH, "%s\\TestDir", commonprogs); snprintf(path, MAX_PATH, "%s\\TestDir", commonprogs);
ok(INVALID_FILE_ATTRIBUTES != GetFileAttributes(path), "directory not created\n"); ok(INVALID_FILE_ATTRIBUTES != GetFileAttributesA(path), "directory not created\n");
snprintf(path, MAX_PATH, "%s\\TestDir\\TestItem2.lnk", commonprogs); snprintf(path, MAX_PATH, "%s\\TestDir\\TestItem2.lnk", commonprogs);
ok(INVALID_FILE_ATTRIBUTES != GetFileAttributes(path), "link not created\n"); ok(INVALID_FILE_ATTRIBUTES != GetFileAttributesA(path), "link not created\n");
snprintf(path, MAX_PATH, "%s\\TestGroup", commonprogs); snprintf(path, MAX_PATH, "%s\\TestGroup", commonprogs);
ok(INVALID_FILE_ATTRIBUTES != GetFileAttributes(path), "group not created\n"); ok(INVALID_FILE_ATTRIBUTES != GetFileAttributesA(path), "group not created\n");
} }
snprintf(path, MAX_PATH, "%s\\TestItem.lnk", commonprogs); snprintf(path, MAX_PATH, "%s\\TestItem.lnk", commonprogs);
DeleteFile(path); DeleteFileA(path);
snprintf(path, MAX_PATH, "%s\\TestDir\\TestItem2.lnk", commonprogs); snprintf(path, MAX_PATH, "%s\\TestDir\\TestItem2.lnk", commonprogs);
DeleteFile(path); DeleteFileA(path);
snprintf(path, MAX_PATH, "%s\\TestItem2.lnk", commonprogs); snprintf(path, MAX_PATH, "%s\\TestItem2.lnk", commonprogs);
DeleteFile(path); DeleteFileA(path);
snprintf(path, MAX_PATH, "%s\\TestDir", commonprogs); snprintf(path, MAX_PATH, "%s\\TestDir", commonprogs);
RemoveDirectory(path); RemoveDirectoryA(path);
snprintf(path, MAX_PATH, "%s\\TestGroup", commonprogs); snprintf(path, MAX_PATH, "%s\\TestGroup", commonprogs);
RemoveDirectory(path); RemoveDirectoryA(path);
cleanup: cleanup:
if (hShell32) FreeLibrary(hShell32); if (hShell32) FreeLibrary(hShell32);
DeleteFile(inffile); DeleteFileA(inffile);
} }
static void test_inffilelistA(void) static void test_inffilelistA(void)
...@@ -541,8 +541,8 @@ static void test_inffilelistA(void) ...@@ -541,8 +541,8 @@ static void test_inffilelistA(void)
ok(!lstrcmpA(p,inffile2) || !lstrcmpA(p,inffile), ok(!lstrcmpA(p,inffile2) || !lstrcmpA(p,inffile),
"unexpected filename %s\n",p); "unexpected filename %s\n",p);
DeleteFile(inffile); DeleteFileA(inffile);
DeleteFile(inffile2); DeleteFileA(inffile2);
SetCurrentDirectoryA(CURR_DIR); SetCurrentDirectoryA(CURR_DIR);
RemoveDirectoryA(dir); RemoveDirectoryA(dir);
} }
...@@ -711,22 +711,22 @@ static void test_inffilelist(void) ...@@ -711,22 +711,22 @@ static void test_inffilelist(void)
ok(!lstrcmpW(p,inffile2W) || !lstrcmpW(p,inffileW) || !lstrcmpW(p,invalid_infW), ok(!lstrcmpW(p,inffile2W) || !lstrcmpW(p,inffileW) || !lstrcmpW(p,invalid_infW),
"unexpected filename %s\n",wine_dbgstr_w(p)); "unexpected filename %s\n",wine_dbgstr_w(p));
DeleteFile(inffile); DeleteFileA(inffile);
DeleteFile(inffile2); DeleteFileA(inffile2);
DeleteFile(invalid_inf); DeleteFileA(invalid_inf);
SetCurrentDirectoryA(CURR_DIR); SetCurrentDirectoryA(CURR_DIR);
RemoveDirectoryA(dirA); RemoveDirectoryA(dirA);
} }
START_TEST(install) START_TEST(install)
{ {
HMODULE hsetupapi = GetModuleHandle("setupapi.dll"); HMODULE hsetupapi = GetModuleHandleA("setupapi.dll");
char temp_path[MAX_PATH], prev_path[MAX_PATH]; char temp_path[MAX_PATH], prev_path[MAX_PATH];
DWORD len; DWORD len;
GetCurrentDirectory(MAX_PATH, prev_path); GetCurrentDirectoryA(MAX_PATH, prev_path);
GetTempPath(MAX_PATH, temp_path); GetTempPathA(MAX_PATH, temp_path);
SetCurrentDirectory(temp_path); SetCurrentDirectoryA(temp_path);
strcpy(CURR_DIR, temp_path); strcpy(CURR_DIR, temp_path);
len = strlen(CURR_DIR); len = strlen(CURR_DIR);
...@@ -753,7 +753,7 @@ START_TEST(install) ...@@ -753,7 +753,7 @@ START_TEST(install)
skip("InstallHinfSectionA is broken (stub)\n"); skip("InstallHinfSectionA is broken (stub)\n");
pInstallHinfSectionA = NULL; pInstallHinfSectionA = NULL;
} }
ret = DeleteFile(inffile); ret = DeleteFileA(inffile);
ok(ret, "Expected source inf to exist, last error was %d\n", GetLastError()); ok(ret, "Expected source inf to exist, last error was %d\n", GetLastError());
} }
if (!pInstallHinfSectionW && !pInstallHinfSectionA) if (!pInstallHinfSectionW && !pInstallHinfSectionA)
...@@ -779,5 +779,5 @@ START_TEST(install) ...@@ -779,5 +779,5 @@ START_TEST(install)
test_inffilelist(); test_inffilelist();
test_inffilelistA(); test_inffilelistA();
SetCurrentDirectory(prev_path); SetCurrentDirectoryA(prev_path);
} }
...@@ -51,8 +51,8 @@ static BOOL (WINAPI *pSetupUninstallOEMInfA)(PCSTR, DWORD, PVOID); ...@@ -51,8 +51,8 @@ static BOOL (WINAPI *pSetupUninstallOEMInfA)(PCSTR, DWORD, PVOID);
static void create_inf_file(LPCSTR filename) static void create_inf_file(LPCSTR filename)
{ {
DWORD dwNumberOfBytesWritten; DWORD dwNumberOfBytesWritten;
HANDLE hf = CreateFile(filename, GENERIC_WRITE, 0, NULL, HANDLE hf = CreateFileA(filename, GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
static const char data[] = static const char data[] =
"[Version]\n" "[Version]\n"
...@@ -72,15 +72,15 @@ static void get_temp_filename(LPSTR path) ...@@ -72,15 +72,15 @@ static void get_temp_filename(LPSTR path)
CHAR temp[MAX_PATH]; CHAR temp[MAX_PATH];
LPSTR ptr; LPSTR ptr;
GetTempFileName(CURR_DIR, "set", 0, temp); GetTempFileNameA(CURR_DIR, "set", 0, temp);
ptr = strrchr(temp, '\\'); ptr = strrchr(temp, '\\');
lstrcpy(path, ptr + 1); strcpy(path, ptr + 1);
} }
static BOOL file_exists(LPSTR path) static BOOL file_exists(LPSTR path)
{ {
return GetFileAttributes(path) != INVALID_FILE_ATTRIBUTES; return GetFileAttributesA(path) != INVALID_FILE_ATTRIBUTES;
} }
static BOOL check_format(LPSTR path, LPSTR inf) static BOOL check_format(LPSTR path, LPSTR inf)
...@@ -90,19 +90,19 @@ static BOOL check_format(LPSTR path, LPSTR inf) ...@@ -90,19 +90,19 @@ static BOOL check_format(LPSTR path, LPSTR inf)
static const CHAR format[] = "\\INF\\oem"; static const CHAR format[] = "\\INF\\oem";
GetWindowsDirectory(check, MAX_PATH); GetWindowsDirectoryA(check, MAX_PATH);
lstrcat(check, format); strcat(check, format);
res = CompareString(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, check, -1, path, lstrlen(check)) == CSTR_EQUAL && res = CompareStringA(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, check, -1, path, strlen(check)) == CSTR_EQUAL &&
path[lstrlen(check)] != '\\'; path[strlen(check)] != '\\';
return (!inf) ? res : res && (inf == path + lstrlen(check) - 3); return (!inf) ? res : res && (inf == path + strlen(check) - 3);
} }
static void test_original_file_name(LPCSTR original, LPCSTR dest) static void test_original_file_name(LPCSTR original, LPCSTR dest)
{ {
HINF hinf; HINF hinf;
PSP_INF_INFORMATION pspii; PSP_INF_INFORMATION pspii;
SP_ORIGINAL_FILE_INFO spofi; SP_ORIGINAL_FILE_INFO_A spofi;
BOOL res; BOOL res;
DWORD size; DWORD size;
...@@ -115,12 +115,12 @@ static void test_original_file_name(LPCSTR original, LPCSTR dest) ...@@ -115,12 +115,12 @@ static void test_original_file_name(LPCSTR original, LPCSTR dest)
hinf = SetupOpenInfFileA(dest, NULL, INF_STYLE_WIN4, NULL); hinf = SetupOpenInfFileA(dest, NULL, INF_STYLE_WIN4, NULL);
ok(hinf != NULL, "SetupOpenInfFileA failed with error %d\n", GetLastError()); ok(hinf != NULL, "SetupOpenInfFileA failed with error %d\n", GetLastError());
res = SetupGetInfInformation(hinf, INFINFO_INF_SPEC_IS_HINF, NULL, 0, &size); res = SetupGetInfInformationA(hinf, INFINFO_INF_SPEC_IS_HINF, NULL, 0, &size);
ok(res, "SetupGetInfInformation failed with error %d\n", GetLastError()); ok(res, "SetupGetInfInformation failed with error %d\n", GetLastError());
pspii = HeapAlloc(GetProcessHeap(), 0, size); pspii = HeapAlloc(GetProcessHeap(), 0, size);
res = SetupGetInfInformation(hinf, INFINFO_INF_SPEC_IS_HINF, pspii, size, NULL); res = SetupGetInfInformationA(hinf, INFINFO_INF_SPEC_IS_HINF, pspii, size, NULL);
ok(res, "SetupGetInfInformation failed with error %d\n", GetLastError()); ok(res, "SetupGetInfInformation failed with error %d\n", GetLastError());
spofi.cbSize = 0; spofi.cbSize = 0;
...@@ -173,8 +173,8 @@ static void test_SetupCopyOEMInf(void) ...@@ -173,8 +173,8 @@ static void test_SetupCopyOEMInf(void)
"Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError()); "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
/* try an absolute nonexistent SourceInfFileName */ /* try an absolute nonexistent SourceInfFileName */
lstrcpy(path, CURR_DIR); strcpy(path, CURR_DIR);
lstrcat(path, "\\nonexistent"); strcat(path, "\\nonexistent");
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
res = pSetupCopyOEMInfA(path, NULL, 0, SP_COPY_NOOVERWRITE, NULL, 0, NULL, NULL); res = pSetupCopyOEMInfA(path, NULL, 0, SP_COPY_NOOVERWRITE, NULL, 0, NULL, NULL);
ok(res == FALSE, "Expected FALSE, got %d\n", res); ok(res == FALSE, "Expected FALSE, got %d\n", res);
...@@ -207,7 +207,7 @@ static void test_SetupCopyOEMInf(void) ...@@ -207,7 +207,7 @@ static void test_SetupCopyOEMInf(void)
* popups during the installation though as it also needs a catalog file (signed?). * popups during the installation though as it also needs a catalog file (signed?).
*/ */
win_skip("Needs a different inf file on Vista+\n"); win_skip("Needs a different inf file on Vista+\n");
DeleteFile(tmpfile); DeleteFileA(tmpfile);
return; return;
} }
...@@ -225,9 +225,9 @@ static void test_SetupCopyOEMInf(void) ...@@ -225,9 +225,9 @@ static void test_SetupCopyOEMInf(void)
ok(file_exists(tmpfile), "Expected source inf to exist\n"); ok(file_exists(tmpfile), "Expected source inf to exist\n");
/* try an absolute SourceInfFileName, without DestinationInfFileName */ /* try an absolute SourceInfFileName, without DestinationInfFileName */
lstrcpy(path, CURR_DIR); strcpy(path, CURR_DIR);
lstrcat(path, "\\"); strcat(path, "\\");
lstrcat(path, tmpfile); strcat(path, tmpfile);
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
res = pSetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, NULL, 0, NULL, NULL); res = pSetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, NULL, 0, NULL, NULL);
ok(res == TRUE, "Expected TRUE, got %d\n", res); ok(res == TRUE, "Expected TRUE, got %d\n", res);
...@@ -253,18 +253,18 @@ static void test_SetupCopyOEMInf(void) ...@@ -253,18 +253,18 @@ static void test_SetupCopyOEMInf(void)
res = pSetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, dest, MAX_PATH, NULL, NULL); res = pSetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, dest, MAX_PATH, NULL, NULL);
ok(res == TRUE, "Expected TRUE, got %d\n", res); ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError()); ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
ok(lstrlen(dest) != 0, "Expected a non-zero length string\n"); ok(strlen(dest) != 0, "Expected a non-zero length string\n");
ok(file_exists(dest), "Expected destination inf to exist\n"); ok(file_exists(dest), "Expected destination inf to exist\n");
ok(check_format(dest, NULL), "Expected %%windir%%\\inf\\OEMx.inf, got %s\n", dest); ok(check_format(dest, NULL), "Expected %%windir%%\\inf\\OEMx.inf, got %s\n", dest);
ok(file_exists(path), "Expected source inf to exist\n"); ok(file_exists(path), "Expected source inf to exist\n");
lstrcpy(dest_save, dest); strcpy(dest_save, dest);
DeleteFile(dest_save); DeleteFileA(dest_save);
/* get the DestinationInfFileName, DestinationInfFileNameSize is too small /* get the DestinationInfFileName, DestinationInfFileNameSize is too small
* - inf is still copied * - inf is still copied
*/ */
lstrcpy(dest, "aaa"); strcpy(dest, "aaa");
size = 0; size = 0;
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
res = pSetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, dest, 5, &size, NULL); res = pSetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, dest, 5, &size, NULL);
...@@ -273,19 +273,19 @@ static void test_SetupCopyOEMInf(void) ...@@ -273,19 +273,19 @@ static void test_SetupCopyOEMInf(void)
"Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError()); "Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
ok(file_exists(path), "Expected source inf to exist\n"); ok(file_exists(path), "Expected source inf to exist\n");
ok(file_exists(dest_save), "Expected dest inf to exist\n"); ok(file_exists(dest_save), "Expected dest inf to exist\n");
ok(!lstrcmp(dest, "aaa"), "Expected dest to be unchanged\n"); ok(!strcmp(dest, "aaa"), "Expected dest to be unchanged\n");
ok(size == lstrlen(dest_save) + 1, "Expected size to be lstrlen(dest_save) + 1\n"); ok(size == strlen(dest_save) + 1, "Expected size to be lstrlen(dest_save) + 1\n");
/* get the DestinationInfFileName and DestinationInfFileNameSize */ /* get the DestinationInfFileName and DestinationInfFileNameSize */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
res = pSetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, dest, MAX_PATH, &size, NULL); res = pSetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, dest, MAX_PATH, &size, NULL);
ok(res == TRUE, "Expected TRUE, got %d\n", res); ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError()); ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
ok(lstrlen(dest) + 1 == size, "Expected sizes to match, got (%d, %d)\n", lstrlen(dest), size); ok(lstrlenA(dest) + 1 == size, "Expected sizes to match, got (%d, %d)\n", lstrlenA(dest), size);
ok(file_exists(dest), "Expected destination inf to exist\n"); ok(file_exists(dest), "Expected destination inf to exist\n");
ok(check_format(dest, NULL), "Expected %%windir%%\\inf\\OEMx.inf, got %s\n", dest); ok(check_format(dest, NULL), "Expected %%windir%%\\inf\\OEMx.inf, got %s\n", dest);
ok(file_exists(path), "Expected source inf to exist\n"); ok(file_exists(path), "Expected source inf to exist\n");
ok(size == lstrlen(dest_save) + 1, "Expected size to be lstrlen(dest_save) + 1\n"); ok(size == lstrlenA(dest_save) + 1, "Expected size to be lstrlen(dest_save) + 1\n");
test_original_file_name(strrchr(path, '\\') + 1, dest); test_original_file_name(strrchr(path, '\\') + 1, dest);
...@@ -294,14 +294,14 @@ static void test_SetupCopyOEMInf(void) ...@@ -294,14 +294,14 @@ static void test_SetupCopyOEMInf(void)
res = pSetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, dest, MAX_PATH, &size, &inf); res = pSetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, dest, MAX_PATH, &size, &inf);
ok(res == TRUE, "Expected TRUE, got %d\n", res); ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError()); ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
ok(lstrlen(dest) + 1 == size, "Expected sizes to match, got (%d, %d)\n", lstrlen(dest), size); ok(lstrlenA(dest) + 1 == size, "Expected sizes to match, got (%d, %d)\n", lstrlenA(dest), size);
ok(file_exists(dest), "Expected destination inf to exist\n"); ok(file_exists(dest), "Expected destination inf to exist\n");
ok((inf && inf[0] != 0) || ok((inf && inf[0] != 0) ||
broken(!inf), /* Win98 */ broken(!inf), /* Win98 */
"Expected inf to point to the filename\n"); "Expected inf to point to the filename\n");
ok(check_format(dest, inf), "Expected %%windir%%\\inf\\OEMx.inf, got %s\n", dest); ok(check_format(dest, inf), "Expected %%windir%%\\inf\\OEMx.inf, got %s\n", dest);
ok(file_exists(path), "Expected source inf to exist\n"); ok(file_exists(path), "Expected source inf to exist\n");
ok(size == lstrlen(dest_save) + 1, "Expected size to be lstrlen(dest_save) + 1\n"); ok(size == lstrlenA(dest_save) + 1, "Expected size to be lstrlen(dest_save) + 1\n");
/* try SP_COPY_DELETESOURCE */ /* try SP_COPY_DELETESOURCE */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
...@@ -733,7 +733,7 @@ static void test_SetupUninstallOEMInf(void) ...@@ -733,7 +733,7 @@ static void test_SetupUninstallOEMInf(void)
START_TEST(misc) START_TEST(misc)
{ {
HMODULE hsetupapi = GetModuleHandle("setupapi.dll"); HMODULE hsetupapi = GetModuleHandleA("setupapi.dll");
pSetupGetFileCompressionInfoExA = (void*)GetProcAddress(hsetupapi, "SetupGetFileCompressionInfoExA"); pSetupGetFileCompressionInfoExA = (void*)GetProcAddress(hsetupapi, "SetupGetFileCompressionInfoExA");
pSetupCopyOEMInfA = (void*)GetProcAddress(hsetupapi, "SetupCopyOEMInfA"); pSetupCopyOEMInfA = (void*)GetProcAddress(hsetupapi, "SetupCopyOEMInfA");
......
...@@ -290,8 +290,8 @@ static void test_enum_sections(void) ...@@ -290,8 +290,8 @@ static void test_enum_sections(void)
ret = pSetupEnumInfSectionsA( hinf, index, buffer, sizeof(buffer), &len ); ret = pSetupEnumInfSectionsA( hinf, index, buffer, sizeof(buffer), &len );
ok( ret, "SetupEnumInfSectionsA failed err %u\n", GetLastError() ); ok( ret, "SetupEnumInfSectionsA failed err %u\n", GetLastError() );
ok( len == 3 || len == 8, "wrong len %u\n", len ); ok( len == 3 || len == 8, "wrong len %u\n", len );
ok( !lstrcmpi( buffer, "version" ) || !lstrcmpi( buffer, "s1" ) || ok( !lstrcmpiA( buffer, "version" ) || !lstrcmpiA( buffer, "s1" ) ||
!lstrcmpi( buffer, "s2" ) || !lstrcmpi( buffer, "s3" ) || !lstrcmpi( buffer, "strings" ), !lstrcmpiA( buffer, "s2" ) || !lstrcmpiA( buffer, "s3" ) || !lstrcmpiA( buffer, "strings" ),
"bad section '%s'\n", buffer ); "bad section '%s'\n", buffer );
} }
SetupCloseInfFile( hinf ); SetupCloseInfFile( hinf );
...@@ -542,7 +542,7 @@ static void test_pSetupGetField(void) ...@@ -542,7 +542,7 @@ static void test_pSetupGetField(void)
hinf = test_file_contents( contents, &err ); hinf = test_file_contents( contents, &err );
ok( hinf != NULL, "Expected valid INF file\n" ); ok( hinf != NULL, "Expected valid INF file\n" );
ret = SetupFindFirstLine( hinf, "FileBranchInfo", NULL, &context ); ret = SetupFindFirstLineA( hinf, "FileBranchInfo", NULL, &context );
ok( ret, "Failed to find first line\n" ); ok( ret, "Failed to find first line\n" );
/* native Windows crashes if a NULL context is sent in */ /* native Windows crashes if a NULL context is sent in */
......
...@@ -102,8 +102,8 @@ static const char inf_data6[] = ...@@ -102,8 +102,8 @@ static const char inf_data6[] =
static void create_inf_file(LPSTR filename, const char *data, DWORD size) static void create_inf_file(LPSTR filename, const char *data, DWORD size)
{ {
DWORD dwNumberOfBytesWritten; DWORD dwNumberOfBytesWritten;
HANDLE hf = CreateFile(filename, GENERIC_WRITE, 0, NULL, HANDLE hf = CreateFileA(filename, GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
WriteFile(hf, data, size, &dwNumberOfBytesWritten, NULL); WriteFile(hf, data, size, &dwNumberOfBytesWritten, NULL);
CloseHandle(hf); CloseHandle(hf);
} }
......
...@@ -91,7 +91,7 @@ static void test_invalid_parametersA(void) ...@@ -91,7 +91,7 @@ static void test_invalid_parametersA(void)
const struct const struct
{ {
PCSTR CabinetFile; PCSTR CabinetFile;
PSP_FILE_CALLBACK MsgHandler; PSP_FILE_CALLBACK_A MsgHandler;
DWORD expected_lasterror; DWORD expected_lasterror;
int todo_lasterror; int todo_lasterror;
} invalid_parameters[] = } invalid_parameters[] =
...@@ -161,7 +161,7 @@ static void test_invalid_parametersW(void) ...@@ -161,7 +161,7 @@ static void test_invalid_parametersW(void)
const struct const struct
{ {
PCWSTR CabinetFile; PCWSTR CabinetFile;
PSP_FILE_CALLBACK MsgHandler; PSP_FILE_CALLBACK_W MsgHandler;
DWORD expected_lasterror; DWORD expected_lasterror;
int todo_lasterror; int todo_lasterror;
} invalid_parameters[] = } invalid_parameters[] =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment