* Sync with Wine 1.7.17.
CORE-8080
svn path=/trunk/; revision=62834
#include <stdarg.h>
#include <stdio.h>
+#undef __WINESRC__
#undef __ROS_LONG64__
#include "windef.h"
#include "winbase.h"
static BOOL (WINAPI *pSetupDiGetDeviceInterfaceDetailA)(HDEVINFO, PSP_DEVICE_INTERFACE_DATA, PSP_DEVICE_INTERFACE_DETAIL_DATA_A, DWORD, PDWORD, PSP_DEVINFO_DATA);
static BOOL (WINAPI *pSetupDiGetDeviceInterfaceDetailW)(HDEVINFO, PSP_DEVICE_INTERFACE_DATA, PSP_DEVICE_INTERFACE_DETAIL_DATA_W, DWORD, PDWORD, PSP_DEVINFO_DATA);
static BOOL (WINAPI *pSetupDiRegisterDeviceInfo)(HDEVINFO, PSP_DEVINFO_DATA, DWORD, PSP_DETSIG_CMPPROC, PVOID, PSP_DEVINFO_DATA);
-static HDEVINFO (WINAPI *pSetupDiGetClassDevsA)(CONST GUID *, LPCSTR, HWND, DWORD);
-static HDEVINFO (WINAPI *pSetupDiGetClassDevsW)(CONST GUID *, LPCWSTR, HWND, DWORD);
+static HDEVINFO (WINAPI *pSetupDiGetClassDevsA)(const GUID *, LPCSTR, HWND, DWORD);
+static HDEVINFO (WINAPI *pSetupDiGetClassDevsW)(const GUID *, LPCWSTR, HWND, DWORD);
static BOOL (WINAPI *pSetupDiSetDeviceRegistryPropertyA)(HDEVINFO, PSP_DEVINFO_DATA, DWORD, const BYTE *, DWORD);
static BOOL (WINAPI *pSetupDiSetDeviceRegistryPropertyW)(HDEVINFO, PSP_DEVINFO_DATA, DWORD, const BYTE *, DWORD);
static BOOL (WINAPI *pSetupDiGetDeviceRegistryPropertyA)(HDEVINFO, PSP_DEVINFO_DATA, DWORD, PDWORD, PBYTE, DWORD, PDWORD);
* the keys under the DeviceClasses key after a SetupDiDestroyDeviceInfoList.
*/
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)
{
trace("We are most likely on Windows 2000\n");
static void create_inf_file(LPCSTR filename)
{
DWORD dwNumberOfBytesWritten;
- HANDLE hf = CreateFile(filename, GENERIC_WRITE, 0, NULL,
- CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ HANDLE hf = CreateFileA(filename, GENERIC_WRITE, 0, NULL,
+ CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
static const char data[] =
"[Version]\n"
ok(!RegDeleteKeyW(HKEY_LOCAL_MACHINE, classKey),
"Couldn't delete classkey\n");
- DeleteFile(tmpfile);
+ DeleteFileA(tmpfile);
}
static void testCreateDeviceInfo(void)
DWORD 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)
{
int i;
{
static const char inffile[] = "winetest.inf";
static const char content[] = "[Version]\r\n\r\n";
+ static const char* signatures[] = {"\"$CHICAGO$\"", "\"$Windows NT$\""};
char cn[MAX_PATH];
char filename[MAX_PATH];
BOOL retval;
GUID guid;
HANDLE h;
+ int i;
if(!pSetupDiGetINFClassA)
{
retval = SetupDiGetINFClassA(filename, &guid, cn, MAX_PATH, &count);
ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
- h = CreateFileA(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
- FILE_ATTRIBUTE_NORMAL, NULL);
- if(h == INVALID_HANDLE_VALUE)
+ for(i=0; i < sizeof(signatures)/sizeof(char*); i++)
{
- win_skip("failed to create file %s (error %u)\n", filename, GetLastError());
- return;
- }
- WriteFile( h, content, sizeof(content), &count, NULL);
- CloseHandle( h);
-
- retval = SetupDiGetINFClassA(filename, &guid, cn, MAX_PATH, &count);
- ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
-
- WritePrivateProfileStringA("Version", "Signature", "\"$CHICAGO$\"", filename);
+ trace("testing signarture %s\n", signatures[i]);
+ h = CreateFileA(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL, NULL);
+ if(h == INVALID_HANDLE_VALUE)
+ {
+ win_skip("failed to create file %s (error %u)\n", filename, GetLastError());
+ return;
+ }
+ WriteFile( h, content, sizeof(content), &count, NULL);
+ CloseHandle( h);
- retval = SetupDiGetINFClassA(filename, &guid, cn, MAX_PATH, &count);
- ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
+ retval = SetupDiGetINFClassA(filename, &guid, cn, MAX_PATH, &count);
+ ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
- WritePrivateProfileStringA("Version", "Class", "WINE", filename);
+ WritePrivateProfileStringA("Version", "Signature", signatures[i], filename);
- count = 0xdeadbeef;
- retval = SetupDiGetINFClassA(filename, &guid, cn, MAX_PATH, &count);
- ok(retval, "expected SetupDiGetINFClassA to succeed! error %u\n", GetLastError());
- ok(count == 5, "expected count==5, got %u\n", count);
+ retval = SetupDiGetINFClassA(filename, &guid, cn, MAX_PATH, &count);
+ ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
- count = 0xdeadbeef;
- retval = SetupDiGetINFClassA(filename, &guid, cn, 5, &count);
- ok(retval, "expected SetupDiGetINFClassA to succeed! error %u\n", GetLastError());
- ok(count == 5, "expected count==5, got %u\n", count);
+ WritePrivateProfileStringA("Version", "Class", "WINE", filename);
- count = 0xdeadbeef;
- SetLastError(0xdeadbeef);
- retval = SetupDiGetINFClassA(filename, &guid, cn, 4, &count);
- ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
- ok(ERROR_INSUFFICIENT_BUFFER == GetLastError(),
- "expected error ERROR_INSUFFICIENT_BUFFER, got %u\n", GetLastError());
- ok(count == 5, "expected count==5, got %u\n", count);
+ count = 0xdeadbeef;
+ retval = SetupDiGetINFClassA(filename, &guid, cn, MAX_PATH, &count);
+ ok(retval, "expected SetupDiGetINFClassA to succeed! error %u\n", GetLastError());
+ ok(count == 5, "expected count==5, got %u\n", count);
- /* invalid parameter */
- SetLastError(0xdeadbeef);
- retval = SetupDiGetINFClassA(NULL, &guid, cn, MAX_PATH, &count);
- ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
- ok(ERROR_INVALID_PARAMETER == GetLastError(),
- "expected error ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+ count = 0xdeadbeef;
+ retval = SetupDiGetINFClassA(filename, &guid, cn, 5, &count);
+ ok(retval, "expected SetupDiGetINFClassA to succeed! error %u\n", GetLastError());
+ ok(count == 5, "expected count==5, got %u\n", count);
- SetLastError(0xdeadbeef);
- retval = SetupDiGetINFClassA(filename, NULL, cn, MAX_PATH, &count);
- ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
- ok(ERROR_INVALID_PARAMETER == GetLastError(),
- "expected error ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+ count = 0xdeadbeef;
+ SetLastError(0xdeadbeef);
+ retval = SetupDiGetINFClassA(filename, &guid, cn, 4, &count);
+ ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
+ ok(ERROR_INSUFFICIENT_BUFFER == GetLastError(),
+ "expected error ERROR_INSUFFICIENT_BUFFER, got %u\n", GetLastError());
+ ok(count == 5, "expected count==5, got %u\n", count);
- SetLastError(0xdeadbeef);
- retval = SetupDiGetINFClassA(filename, &guid, NULL, MAX_PATH, &count);
- ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
- ok(ERROR_INVALID_PARAMETER == GetLastError(),
- "expected error ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+ /* invalid parameter */
+ SetLastError(0xdeadbeef);
+ retval = SetupDiGetINFClassA(NULL, &guid, cn, MAX_PATH, &count);
+ ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
+ ok(ERROR_INVALID_PARAMETER == GetLastError(),
+ "expected error ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
- SetLastError(0xdeadbeef);
- retval = SetupDiGetINFClassA(filename, &guid, cn, 0, &count);
- ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
- ok(ERROR_INSUFFICIENT_BUFFER == GetLastError() ||
- ERROR_INVALID_PARAMETER == GetLastError(),
- "expected error ERROR_INSUFFICIENT_BUFFER or ERROR_INVALID_PARAMETER, "
- "got %u\n", GetLastError());
+ SetLastError(0xdeadbeef);
+ retval = SetupDiGetINFClassA(filename, NULL, cn, MAX_PATH, &count);
+ ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
+ ok(ERROR_INVALID_PARAMETER == GetLastError(),
+ "expected error ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
- DeleteFileA(filename);
+ SetLastError(0xdeadbeef);
+ retval = SetupDiGetINFClassA(filename, &guid, NULL, MAX_PATH, &count);
+ ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
+ ok(ERROR_INVALID_PARAMETER == GetLastError(),
+ "expected error ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
- WritePrivateProfileStringA("Version", "Signature", "\"$CHICAGO$\"", filename);
- WritePrivateProfileStringA("Version", "ClassGUID", "WINE", filename);
+ SetLastError(0xdeadbeef);
+ retval = SetupDiGetINFClassA(filename, &guid, cn, 0, &count);
+ ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
+ ok(ERROR_INSUFFICIENT_BUFFER == GetLastError() ||
+ ERROR_INVALID_PARAMETER == GetLastError(),
+ "expected error ERROR_INSUFFICIENT_BUFFER or ERROR_INVALID_PARAMETER, "
+ "got %u\n", GetLastError());
- SetLastError(0xdeadbeef);
- retval = SetupDiGetINFClassA(filename, &guid, cn, MAX_PATH, &count);
- ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
- ok(RPC_S_INVALID_STRING_UUID == GetLastError() ||
- ERROR_INVALID_PARAMETER == GetLastError(),
- "expected error RPC_S_INVALID_STRING_UUID or ERROR_INVALID_PARAMETER, "
- "got %u\n", GetLastError());
+ DeleteFileA(filename);
- /* network adapter guid */
- WritePrivateProfileStringA("Version", "ClassGUID",
- "{4d36e972-e325-11ce-bfc1-08002be10318}", filename);
+ WritePrivateProfileStringA("Version", "Signature", signatures[i], filename);
+ WritePrivateProfileStringA("Version", "ClassGUID", "WINE", filename);
- /* this test succeeds only if the guid is known to the system */
- count = 0xdeadbeef;
- retval = SetupDiGetINFClassA(filename, &guid, cn, MAX_PATH, &count);
- ok(retval, "expected SetupDiGetINFClassA to succeed! error %u\n", GetLastError());
- todo_wine
- ok(count == 4, "expected count==4, got %u(%s)\n", count, cn);
+ SetLastError(0xdeadbeef);
+ retval = SetupDiGetINFClassA(filename, &guid, cn, MAX_PATH, &count);
+ ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
+ ok(RPC_S_INVALID_STRING_UUID == GetLastError() ||
+ ERROR_INVALID_PARAMETER == GetLastError(),
+ "expected error RPC_S_INVALID_STRING_UUID or ERROR_INVALID_PARAMETER, "
+ "got %u\n", GetLastError());
+
+ /* network adapter guid */
+ WritePrivateProfileStringA("Version", "ClassGUID",
+ "{4d36e972-e325-11ce-bfc1-08002be10318}", filename);
+
+ /* this test succeeds only if the guid is known to the system */
+ count = 0xdeadbeef;
+ retval = SetupDiGetINFClassA(filename, &guid, cn, MAX_PATH, &count);
+ ok(retval, "expected SetupDiGetINFClassA to succeed! error %u\n", GetLastError());
+ todo_wine
+ ok(count == 4, "expected count==4, got %u(%s)\n", count, cn);
- DeleteFileA(filename);
+ DeleteFileA(filename);
+ }
}
START_TEST(devinst)
#include "wine/test.h"
+static BOOL is_win9x;
+
static void test_SetupCreateDiskSpaceListA(void)
{
HDSKSPC ret;
static void test_SetupDuplicateDiskSpaceListA(void)
{
HDSKSPC handle, duplicate;
- int is_win9x = !SetupCreateDiskSpaceListW((void *)0xdeadbeef, 0xdeadbeef, 0) &&
- GetLastError() == ERROR_CALL_NOT_IMPLEMENTED;
if (is_win9x)
win_skip("SetupDuplicateDiskSpaceListA crashes with NULL disk space handle on Win9x\n");
BOOL ret;
HDSKSPC handle;
LONGLONG space;
- int is_win9x = !SetupCreateDiskSpaceListW((void *)0xdeadbeef, 0xdeadbeef, 0) &&
- GetLastError() == ERROR_CALL_NOT_IMPLEMENTED;
if (is_win9x)
win_skip("SetupQuerySpaceRequiredOnDriveA crashes with NULL disk space handle on Win9x\n");
START_TEST(diskspace)
{
+ is_win9x = !SetupCreateDiskSpaceListW((void *)0xdeadbeef, 0xdeadbeef, 0) &&
+ GetLastError() == ERROR_CALL_NOT_IMPLEMENTED;
test_SetupCreateDiskSpaceListA();
test_SetupCreateDiskSpaceListW();
test_SetupDuplicateDiskSpaceListA();
static void create_inf_file(LPCSTR filename, const char *data)
{
DWORD res;
- HANDLE handle = CreateFile(filename, GENERIC_WRITE, 0, NULL,
+ HANDLE handle = CreateFileA(filename, GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
assert(handle != INVALID_HANDLE_VALUE);
assert(WriteFile(handle, data, strlen(data), &res, NULL));
LONG ret;
/* 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) ||
(!expectsuccess && ret == ERROR_FILE_NOT_FOUND),
"Expected registry key Software\\Wine\\setupapitest to %s, RegDeleteKey returned %d\n",
sprintf(path, "%s\\%s", CURR_DIR, inffile);
run_cmdline("DefaultInstall", 128, path);
ok_registry(TRUE);
- ret = DeleteFile(inffile);
+ ret = DeleteFileA(inffile);
ok(ret, "Expected source inf to exist, last error was %d\n", GetLastError());
/* Test handling of spaces in path, unquoted and quoted */
run_cmdline("DefaultInstall", 128, path);
ok_registry(FALSE);
- ret = DeleteFile(infwithspaces);
+ ret = DeleteFileA(infwithspaces);
ok(ret, "Expected source inf to exist, last error was %d\n", GetLastError());
}
RegDeleteKeyA(HKEY_CURRENT_USER, "Software\\Wine\\setupapitest\\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(GetLastError() == ERROR_SECTION_NOT_FOUND,
"Expected ERROR_SECTION_NOT_FOUND, got %08x\n", GetLastError());
SetupCloseInfFile(infhandle);
- DeleteFile(inffile);
+ DeleteFileA(inffile);
/* Add the section */
strcat(inf, "[Winetest.Services]\n");
ok(GetLastError() == ERROR_SECTION_NOT_FOUND,
"Expected ERROR_SECTION_NOT_FOUND, got %08x\n", GetLastError());
SetupCloseInfFile(infhandle);
- DeleteFile(inffile);
+ DeleteFileA(inffile);
/* Add a reference */
strcat(inf, "AddService=Winetest,,Winetest.Service\n");
ok(GetLastError() == ERROR_BAD_SERVICE_INSTALLSECT,
"Expected ERROR_BAD_SERVICE_INSTALLSECT, got %08x\n", GetLastError());
SetupCloseInfFile(infhandle);
- DeleteFile(inffile);
+ DeleteFileA(inffile);
/* Add the section */
strcat(inf, "[Winetest.Service]\n");
ok(GetLastError() == ERROR_BAD_SERVICE_INSTALLSECT,
"Expected ERROR_BAD_SERVICE_INSTALLSECT, got %08x\n", GetLastError());
SetupCloseInfFile(infhandle);
- DeleteFile(inffile);
+ DeleteFileA(inffile);
/* Just the ServiceBinary */
strcat(inf, "ServiceBinary=%12%\\winetest.sys\n");
ok(GetLastError() == ERROR_BAD_SERVICE_INSTALLSECT,
"Expected ERROR_BAD_SERVICE_INSTALLSECT, got %08x\n", GetLastError());
SetupCloseInfFile(infhandle);
- DeleteFile(inffile);
+ DeleteFileA(inffile);
/* Add the ServiceType */
strcat(inf, "ServiceType=1\n");
ok(GetLastError() == ERROR_BAD_SERVICE_INSTALLSECT,
"Expected ERROR_BAD_SERVICE_INSTALLSECT, got %08x\n", GetLastError());
SetupCloseInfFile(infhandle);
- DeleteFile(inffile);
+ DeleteFileA(inffile);
/* Add the StartType */
strcat(inf, "StartType=4\n");
ok(GetLastError() == ERROR_BAD_SERVICE_INSTALLSECT,
"Expected ERROR_BAD_SERVICE_INSTALLSECT, got %08x\n", GetLastError());
SetupCloseInfFile(infhandle);
- DeleteFile(inffile);
+ DeleteFileA(inffile);
/* This should be it, the minimal entries to install a service */
strcat(inf, "ErrorControl=1");
{
skip("Not enough rights to install the service\n");
SetupCloseInfFile(infhandle);
- DeleteFile(inffile);
+ DeleteFileA(inffile);
return;
}
ok(ret, "Expected success\n");
ok(GetLastError() == ERROR_SUCCESS,
"Expected ERROR_SUCCESS, got %08x\n", GetLastError());
SetupCloseInfFile(infhandle);
- DeleteFile(inffile);
+ DeleteFileA(inffile);
scm_handle = OpenSCManagerA(NULL, NULL, GENERIC_ALL);
ok(ret, "Expected success\n");
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %08x\n", GetLastError());
SetupCloseInfFile(infhandle);
- DeleteFile(inffile);
+ DeleteFileA(inffile);
/* TODO: Test the Flags */
}
run_cmdline("DefaultInstall", 128, path);
/* Driver should have been installed */
- attrs = GetFileAttributes(driver);
+ attrs = GetFileAttributesA(driver);
ok(attrs != INVALID_FILE_ATTRIBUTES, "Expected driver to exist\n");
scm_handle = OpenSCManagerA(NULL, NULL, GENERIC_ALL);
CloseServiceHandle(scm_handle);
/* File cleanup */
- DeleteFile(inffile);
- DeleteFile("winetest.sys");
- DeleteFile(driver);
+ DeleteFileA(inffile);
+ DeleteFileA("winetest.sys");
+ DeleteFileA(driver);
}
static void test_profile_items(void)
run_cmdline("DefaultInstall", 128, path);
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");
}
else
{
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);
- 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);
- 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);
- DeleteFile(path);
+ DeleteFileA(path);
snprintf(path, MAX_PATH, "%s\\TestDir\\TestItem2.lnk", commonprogs);
- DeleteFile(path);
+ DeleteFileA(path);
snprintf(path, MAX_PATH, "%s\\TestItem2.lnk", commonprogs);
- DeleteFile(path);
+ DeleteFileA(path);
snprintf(path, MAX_PATH, "%s\\TestDir", commonprogs);
- RemoveDirectory(path);
+ RemoveDirectoryA(path);
snprintf(path, MAX_PATH, "%s\\TestGroup", commonprogs);
- RemoveDirectory(path);
+ RemoveDirectoryA(path);
cleanup:
if (hShell32) FreeLibrary(hShell32);
- DeleteFile(inffile);
+ DeleteFileA(inffile);
}
static void test_inffilelistA(void)
ok(!lstrcmpA(p,inffile2) || !lstrcmpA(p,inffile),
"unexpected filename %s\n",p);
- DeleteFile(inffile);
- DeleteFile(inffile2);
+ DeleteFileA(inffile);
+ DeleteFileA(inffile2);
SetCurrentDirectoryA(CURR_DIR);
RemoveDirectoryA(dir);
}
ok(!lstrcmpW(p,inffile2W) || !lstrcmpW(p,inffileW) || !lstrcmpW(p,invalid_infW),
"unexpected filename %s\n",wine_dbgstr_w(p));
- DeleteFile(inffile);
- DeleteFile(inffile2);
- DeleteFile(invalid_inf);
+ DeleteFileA(inffile);
+ DeleteFileA(inffile2);
+ DeleteFileA(invalid_inf);
SetCurrentDirectoryA(CURR_DIR);
RemoveDirectoryA(dirA);
}
START_TEST(install)
{
- HMODULE hsetupapi = GetModuleHandle("setupapi.dll");
+ HMODULE hsetupapi = GetModuleHandleA("setupapi.dll");
char temp_path[MAX_PATH], prev_path[MAX_PATH];
DWORD len;
- GetCurrentDirectory(MAX_PATH, prev_path);
- GetTempPath(MAX_PATH, temp_path);
- SetCurrentDirectory(temp_path);
+ GetCurrentDirectoryA(MAX_PATH, prev_path);
+ GetTempPathA(MAX_PATH, temp_path);
+ SetCurrentDirectoryA(temp_path);
strcpy(CURR_DIR, temp_path);
len = strlen(CURR_DIR);
skip("InstallHinfSectionA is broken (stub)\n");
pInstallHinfSectionA = NULL;
}
- ret = DeleteFile(inffile);
+ ret = DeleteFileA(inffile);
ok(ret, "Expected source inf to exist, last error was %d\n", GetLastError());
}
if (!pInstallHinfSectionW && !pInstallHinfSectionA)
test_inffilelist();
test_inffilelistA();
- SetCurrentDirectory(prev_path);
+ SetCurrentDirectoryA(prev_path);
}
static void create_inf_file(LPCSTR filename)
{
DWORD dwNumberOfBytesWritten;
- HANDLE hf = CreateFile(filename, GENERIC_WRITE, 0, NULL,
- CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ HANDLE hf = CreateFileA(filename, GENERIC_WRITE, 0, NULL,
+ CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
static const char data[] =
"[Version]\n"
CHAR temp[MAX_PATH];
LPSTR ptr;
- GetTempFileName(CURR_DIR, "set", 0, temp);
+ GetTempFileNameA(CURR_DIR, "set", 0, temp);
ptr = strrchr(temp, '\\');
- lstrcpy(path, ptr + 1);
+ strcpy(path, ptr + 1);
}
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 const CHAR format[] = "\\INF\\oem";
- GetWindowsDirectory(check, MAX_PATH);
- lstrcat(check, format);
- res = CompareString(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, check, -1, path, lstrlen(check)) == CSTR_EQUAL &&
- path[lstrlen(check)] != '\\';
+ GetWindowsDirectoryA(check, MAX_PATH);
+ strcat(check, format);
+ res = CompareStringA(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, check, -1, path, strlen(check)) == CSTR_EQUAL &&
+ 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)
{
HINF hinf;
PSP_INF_INFORMATION pspii;
- SP_ORIGINAL_FILE_INFO spofi;
+ SP_ORIGINAL_FILE_INFO_A spofi;
BOOL res;
DWORD size;
hinf = SetupOpenInfFileA(dest, NULL, INF_STYLE_WIN4, NULL);
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());
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());
spofi.cbSize = 0;
"Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
/* try an absolute nonexistent SourceInfFileName */
- lstrcpy(path, CURR_DIR);
- lstrcat(path, "\\nonexistent");
+ strcpy(path, CURR_DIR);
+ strcat(path, "\\nonexistent");
SetLastError(0xdeadbeef);
res = pSetupCopyOEMInfA(path, NULL, 0, SP_COPY_NOOVERWRITE, NULL, 0, NULL, NULL);
ok(res == FALSE, "Expected FALSE, got %d\n", res);
* popups during the installation though as it also needs a catalog file (signed?).
*/
win_skip("Needs a different inf file on Vista+\n");
- DeleteFile(tmpfile);
+ DeleteFileA(tmpfile);
return;
}
ok(file_exists(tmpfile), "Expected source inf to exist\n");
/* try an absolute SourceInfFileName, without DestinationInfFileName */
- lstrcpy(path, CURR_DIR);
- lstrcat(path, "\\");
- lstrcat(path, tmpfile);
+ strcpy(path, CURR_DIR);
+ strcat(path, "\\");
+ strcat(path, tmpfile);
SetLastError(0xdeadbeef);
res = pSetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, NULL, 0, NULL, NULL);
ok(res == TRUE, "Expected TRUE, got %d\n", res);
res = pSetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, dest, MAX_PATH, NULL, NULL);
ok(res == TRUE, "Expected TRUE, got %d\n", res);
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(check_format(dest, NULL), "Expected %%windir%%\\inf\\OEMx.inf, got %s\n", dest);
ok(file_exists(path), "Expected source inf to exist\n");
- lstrcpy(dest_save, dest);
- DeleteFile(dest_save);
+ strcpy(dest_save, dest);
+ DeleteFileA(dest_save);
/* get the DestinationInfFileName, DestinationInfFileNameSize is too small
* - inf is still copied
*/
- lstrcpy(dest, "aaa");
+ strcpy(dest, "aaa");
size = 0;
SetLastError(0xdeadbeef);
res = pSetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, dest, 5, &size, NULL);
"Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
ok(file_exists(path), "Expected source 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(size == lstrlen(dest_save) + 1, "Expected size to be lstrlen(dest_save) + 1\n");
+ ok(!strcmp(dest, "aaa"), "Expected dest to be unchanged\n");
+ ok(size == strlen(dest_save) + 1, "Expected size to be lstrlen(dest_save) + 1\n");
/* get the DestinationInfFileName and DestinationInfFileNameSize */
SetLastError(0xdeadbeef);
res = pSetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, dest, MAX_PATH, &size, NULL);
ok(res == TRUE, "Expected TRUE, got %d\n", res);
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(check_format(dest, NULL), "Expected %%windir%%\\inf\\OEMx.inf, got %s\n", dest);
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);
res = pSetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, dest, MAX_PATH, &size, &inf);
ok(res == TRUE, "Expected TRUE, got %d\n", res);
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((inf && inf[0] != 0) ||
broken(!inf), /* Win98 */
"Expected inf to point to the filename\n");
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(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 */
SetLastError(0xdeadbeef);
START_TEST(misc)
{
- HMODULE hsetupapi = GetModuleHandle("setupapi.dll");
+ HMODULE hsetupapi = GetModuleHandleA("setupapi.dll");
pSetupGetFileCompressionInfoExA = (void*)GetProcAddress(hsetupapi, "SetupGetFileCompressionInfoExA");
pSetupCopyOEMInfA = (void*)GetProcAddress(hsetupapi, "SetupCopyOEMInfA");
const char *data;
DWORD error;
UINT err_line;
- int todo;
+ BOOL todo;
} invalid_files[] =
{
/* file contents expected error (or 0) errline todo */
- { "\r\n", ERROR_WRONG_INF_STYLE, 0, 0 },
- { "abcd\r\n", ERROR_WRONG_INF_STYLE, 0, 1 },
- { "[Version]\r\n", ERROR_WRONG_INF_STYLE, 0, 0 },
- { "[Version]\nSignature=", ERROR_WRONG_INF_STYLE, 0, 0 },
- { "[Version]\nSignature=foo", ERROR_WRONG_INF_STYLE, 0, 0 },
- { "[version]\nsignature=$chicago$", 0, 0, 0 },
- { "[VERSION]\nSIGNATURE=$CHICAGO$", 0, 0, 0 },
- { "[Version]\nSignature=$chicago$,abcd", 0, 0, 0 },
- { "[Version]\nabc=def\nSignature=$chicago$", 0, 0, 0 },
- { "[Version]\nabc=def\n[Version]\nSignature=$chicago$", 0, 0, 0 },
- { STD_HEADER, 0, 0, 0 },
- { STD_HEADER "[]\r\n", 0, 0, 0 },
- { STD_HEADER "]\r\n", 0, 0, 0 },
- { STD_HEADER "[" A255 "]\r\n", 0, 0, 0 },
- { STD_HEADER "[ab\r\n", ERROR_BAD_SECTION_NAME_LINE, 3, 0 },
- { STD_HEADER "\n\n[ab\x1a]\n", ERROR_BAD_SECTION_NAME_LINE, 5, 0 },
- { STD_HEADER "[" A256 "]\r\n", ERROR_SECTION_NAME_TOO_LONG, 3, 0 },
- { "[abc]\n" STD_HEADER, 0, 0, 0 },
- { "abc\r\n" STD_HEADER, ERROR_EXPECTED_SECTION_NAME, 1, 0 },
- { ";\n;\nabc\r\n" STD_HEADER, ERROR_EXPECTED_SECTION_NAME, 3, 0 },
- { ";\n;\nab\nab\n" STD_HEADER, ERROR_EXPECTED_SECTION_NAME, 3, 0 },
- { ";aa\n;bb\n" STD_HEADER, 0, 0, 0 },
- { STD_HEADER " [TestSection\x00]\n", ERROR_BAD_SECTION_NAME_LINE, 3, 0 },
- { STD_HEADER " [Test\x00Section]\n", ERROR_BAD_SECTION_NAME_LINE, 3, 0 },
- { STD_HEADER " [TestSection\x00]\n", ERROR_BAD_SECTION_NAME_LINE, 3, 0 },
- { STD_HEADER " [Test\x00Section]\n", ERROR_BAD_SECTION_NAME_LINE, 3, 0 },
+ { "\r\n", ERROR_WRONG_INF_STYLE, 0, FALSE },
+ { "abcd\r\n", ERROR_WRONG_INF_STYLE, 0, TRUE },
+ { "[Version]\r\n", ERROR_WRONG_INF_STYLE, 0, FALSE },
+ { "[Version]\nSignature=", ERROR_WRONG_INF_STYLE, 0, FALSE },
+ { "[Version]\nSignature=foo", ERROR_WRONG_INF_STYLE, 0, FALSE },
+ { "[version]\nsignature=$chicago$", 0, 0, FALSE },
+ { "[VERSION]\nSIGNATURE=$CHICAGO$", 0, 0, FALSE },
+ { "[Version]\nSignature=$chicago$,abcd", 0, 0, FALSE },
+ { "[Version]\nabc=def\nSignature=$chicago$", 0, 0, FALSE },
+ { "[Version]\nabc=def\n[Version]\nSignature=$chicago$", 0, 0, FALSE },
+ { STD_HEADER, 0, 0, FALSE },
+ { STD_HEADER "[]\r\n", 0, 0, FALSE },
+ { STD_HEADER "]\r\n", 0, 0, FALSE },
+ { STD_HEADER "[" A255 "]\r\n", 0, 0, FALSE },
+ { STD_HEADER "[ab\r\n", ERROR_BAD_SECTION_NAME_LINE, 3, FALSE },
+ { STD_HEADER "\n\n[ab\x1a]\n", ERROR_BAD_SECTION_NAME_LINE, 5, FALSE },
+ { STD_HEADER "[" A256 "]\r\n", ERROR_SECTION_NAME_TOO_LONG, 3, FALSE },
+ { "[abc]\n" STD_HEADER, 0, 0, FALSE },
+ { "abc\r\n" STD_HEADER, ERROR_EXPECTED_SECTION_NAME, 1, FALSE },
+ { ";\n;\nabc\r\n" STD_HEADER, ERROR_EXPECTED_SECTION_NAME, 3, FALSE },
+ { ";\n;\nab\nab\n" STD_HEADER, ERROR_EXPECTED_SECTION_NAME, 3, FALSE },
+ { ";aa\n;bb\n" STD_HEADER, 0, 0, FALSE },
+ { STD_HEADER " [TestSection\x00]\n", ERROR_BAD_SECTION_NAME_LINE, 3, FALSE },
+ { STD_HEADER " [Test\x00Section]\n", ERROR_BAD_SECTION_NAME_LINE, 3, FALSE },
+ { STD_HEADER " [TestSection\x00]\n", ERROR_BAD_SECTION_NAME_LINE, 3, FALSE },
+ { STD_HEADER " [Test\x00Section]\n", ERROR_BAD_SECTION_NAME_LINE, 3, FALSE },
};
static void test_invalid_files(void)
ret = pSetupEnumInfSectionsA( hinf, index, buffer, sizeof(buffer), &len );
ok( ret, "SetupEnumInfSectionsA failed err %u\n", GetLastError() );
ok( len == 3 || len == 8, "wrong len %u\n", len );
- ok( !lstrcmpi( buffer, "version" ) || !lstrcmpi( buffer, "s1" ) ||
- !lstrcmpi( buffer, "s2" ) || !lstrcmpi( buffer, "s3" ) || !lstrcmpi( buffer, "strings" ),
+ ok( !lstrcmpiA( buffer, "version" ) || !lstrcmpiA( buffer, "s1" ) ||
+ !lstrcmpiA( buffer, "s2" ) || !lstrcmpiA( buffer, "s3" ) || !lstrcmpiA( buffer, "strings" ),
"bad section '%s'\n", buffer );
}
SetupCloseInfFile( hinf );
hinf = test_file_contents( contents, &err );
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" );
/* native Windows crashes if a NULL context is sent in */
static void create_inf_file(LPSTR filename, const char *data, DWORD size)
{
DWORD dwNumberOfBytesWritten;
- HANDLE hf = CreateFile(filename, GENERIC_WRITE, 0, NULL,
- CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ HANDLE hf = CreateFileA(filename, GENERIC_WRITE, 0, NULL,
+ CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
WriteFile(hf, data, size, &dwNumberOfBytesWritten, NULL);
CloseHandle(hf);
}
const struct
{
PCSTR CabinetFile;
- PSP_FILE_CALLBACK MsgHandler;
+ PSP_FILE_CALLBACK_A MsgHandler;
DWORD expected_lasterror;
int todo_lasterror;
} invalid_parameters[] =
const struct
{
PCWSTR CabinetFile;
- PSP_FILE_CALLBACK MsgHandler;
+ PSP_FILE_CALLBACK_W MsgHandler;
DWORD expected_lasterror;
int todo_lasterror;
} invalid_parameters[] =
static DWORD (WINAPI *pStringTableLookUpString)(HSTRING_TABLE, LPWSTR, DWORD);
static DWORD (WINAPI *pStringTableLookUpStringEx)(HSTRING_TABLE, LPWSTR, DWORD, LPVOID, DWORD);
static LPWSTR (WINAPI *pStringTableStringFromId)(HSTRING_TABLE, DWORD);
-#if 0
-static BOOL (WINAPI *pStringTableStringFromIdEx)(HSTRING_TABLE, DWORD, LPWSTR, LPDWORD);
-static VOID (WINAPI *pStringTableTrim)(HSTRING_TABLE);
-#endif
static HMODULE hdll;
static WCHAR string[] = {'s','t','r','i','n','g',0};