[SETUPAPI_WINETEST]

* Sync with Wine 1.7.17.
CORE-8080

svn path=/trunk/; revision=62834
This commit is contained in:
Amine Khaldi 2014-04-20 12:37:05 +00:00
parent 5188874df0
commit ca20207552
9 changed files with 210 additions and 207 deletions

View file

@ -22,6 +22,7 @@
#include <stdarg.h>
#include <stdio.h>
#undef __WINESRC__
#undef __ROS_LONG64__
#include "windef.h"
#include "winbase.h"

View file

@ -52,8 +52,8 @@ static BOOL (WINAPI *pSetupDiGetDeviceInstanceIdA)(HDEVINFO, PSP_DEVINFO_DAT
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);
@ -241,7 +241,7 @@ static void clean_devclass_key(void)
* 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");
@ -342,8 +342,8 @@ static void test_SetupDiOpenClassRegKeyExA(void)
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"
@ -410,7 +410,7 @@ static void testInstallClass(void)
ok(!RegDeleteKeyW(HKEY_LOCAL_MACHINE, classKey),
"Couldn't delete classkey\n");
DeleteFile(tmpfile);
DeleteFileA(tmpfile);
}
static void testCreateDeviceInfo(void)
@ -533,7 +533,7 @@ 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;
@ -1370,6 +1370,7 @@ static void testSetupDiGetINFClassA(void)
{
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];
@ -1377,6 +1378,7 @@ static void testSetupDiGetINFClassA(void)
BOOL retval;
GUID guid;
HANDLE h;
int i;
if(!pSetupDiGetINFClassA)
{
@ -1444,96 +1446,100 @@ static void testSetupDiGetINFClassA(void)
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;
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");
WritePrivateProfileStringA("Version", "Signature", signatures[i], filename);
retval = SetupDiGetINFClassA(filename, &guid, cn, MAX_PATH, &count);
ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
WritePrivateProfileStringA("Version", "Class", "WINE", 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);
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);
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);
/* 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, 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());
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());
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());
DeleteFileA(filename);
WritePrivateProfileStringA("Version", "Signature", signatures[i], filename);
WritePrivateProfileStringA("Version", "ClassGUID", "WINE", filename);
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);
}
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);
retval = SetupDiGetINFClassA(filename, &guid, cn, MAX_PATH, &count);
ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
WritePrivateProfileStringA("Version", "Class", "WINE", 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);
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);
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);
/* 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, 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());
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());
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());
DeleteFileA(filename);
WritePrivateProfileStringA("Version", "Signature", "\"$CHICAGO$\"", filename);
WritePrivateProfileStringA("Version", "ClassGUID", "WINE", filename);
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);
}
START_TEST(devinst)

View file

@ -29,6 +29,8 @@
#include "wine/test.h"
static BOOL is_win9x;
static void test_SetupCreateDiskSpaceListA(void)
{
HDSKSPC ret;
@ -149,8 +151,6 @@ static void test_SetupCreateDiskSpaceListW(void)
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");
@ -305,8 +305,6 @@ static void test_SetupQuerySpaceRequiredOnDriveA(void)
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");
@ -476,6 +474,8 @@ static void test_SetupQuerySpaceRequiredOnDriveW(void)
START_TEST(diskspace)
{
is_win9x = !SetupCreateDiskSpaceListW((void *)0xdeadbeef, 0xdeadbeef, 0) &&
GetLastError() == ERROR_CALL_NOT_IMPLEMENTED;
test_SetupCreateDiskSpaceListA();
test_SetupCreateDiskSpaceListW();
test_SetupDuplicateDiskSpaceListA();

View file

@ -63,7 +63,7 @@ static BOOL (WINAPI *pSetupGetInfFileListW)(PCWSTR, DWORD, PWSTR, DWORD, PDWORD)
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));
@ -107,7 +107,7 @@ static void ok_registry(BOOL expectsuccess)
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",
@ -126,7 +126,7 @@ static void test_cmdline(void)
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 */
@ -140,7 +140,7 @@ static void test_cmdline(void)
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());
}
@ -180,7 +180,7 @@ static void test_registry(void)
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());
}
@ -216,7 +216,7 @@ static void test_install_svc_from(void)
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");
@ -228,7 +228,7 @@ static void test_install_svc_from(void)
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");
@ -240,7 +240,7 @@ static void test_install_svc_from(void)
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");
@ -252,7 +252,7 @@ static void test_install_svc_from(void)
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");
@ -264,7 +264,7 @@ static void test_install_svc_from(void)
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");
@ -276,7 +276,7 @@ static void test_install_svc_from(void)
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");
@ -288,7 +288,7 @@ static void test_install_svc_from(void)
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");
@ -300,14 +300,14 @@ static void test_install_svc_from(void)
{
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);
@ -334,7 +334,7 @@ static void test_install_svc_from(void)
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 */
}
@ -395,7 +395,7 @@ static void test_driver_install(void)
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);
@ -412,9 +412,9 @@ static void test_driver_install(void)
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)
@ -458,34 +458,34 @@ 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)
@ -541,8 +541,8 @@ 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);
}
@ -711,22 +711,22 @@ static void test_inffilelist(void)
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);
@ -753,7 +753,7 @@ START_TEST(install)
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)
@ -779,5 +779,5 @@ START_TEST(install)
test_inffilelist();
test_inffilelistA();
SetCurrentDirectory(prev_path);
SetCurrentDirectoryA(prev_path);
}

View file

@ -51,8 +51,8 @@ static BOOL (WINAPI *pSetupUninstallOEMInfA)(PCSTR, DWORD, PVOID);
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"
@ -72,15 +72,15 @@ static void get_temp_filename(LPSTR path)
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)
@ -90,19 +90,19 @@ 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;
@ -115,12 +115,12 @@ static void test_original_file_name(LPCSTR original, LPCSTR dest)
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;
@ -173,8 +173,8 @@ static void test_SetupCopyOEMInf(void)
"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);
@ -207,7 +207,7 @@ static void test_SetupCopyOEMInf(void)
* 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;
}
@ -225,9 +225,9 @@ static void test_SetupCopyOEMInf(void)
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);
@ -253,18 +253,18 @@ static void test_SetupCopyOEMInf(void)
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);
@ -273,19 +273,19 @@ static void test_SetupCopyOEMInf(void)
"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);
@ -294,14 +294,14 @@ static void test_SetupCopyOEMInf(void)
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);
@ -733,7 +733,7 @@ static void test_SetupUninstallOEMInf(void)
START_TEST(misc)
{
HMODULE hsetupapi = GetModuleHandle("setupapi.dll");
HMODULE hsetupapi = GetModuleHandleA("setupapi.dll");
pSetupGetFileCompressionInfoExA = (void*)GetProcAddress(hsetupapi, "SetupGetFileCompressionInfoExA");
pSetupCopyOEMInfA = (void*)GetProcAddress(hsetupapi, "SetupCopyOEMInfA");

View file

@ -103,36 +103,36 @@ static const struct
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)
@ -290,8 +290,8 @@ static void test_enum_sections(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 );
@ -542,7 +542,7 @@ static void test_pSetupGetField(void)
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 */

View file

@ -102,8 +102,8 @@ static const char inf_data6[] =
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);
}

View file

@ -91,7 +91,7 @@ static void test_invalid_parametersA(void)
const struct
{
PCSTR CabinetFile;
PSP_FILE_CALLBACK MsgHandler;
PSP_FILE_CALLBACK_A MsgHandler;
DWORD expected_lasterror;
int todo_lasterror;
} invalid_parameters[] =
@ -161,7 +161,7 @@ static void test_invalid_parametersW(void)
const struct
{
PCWSTR CabinetFile;
PSP_FILE_CALLBACK MsgHandler;
PSP_FILE_CALLBACK_W MsgHandler;
DWORD expected_lasterror;
int todo_lasterror;
} invalid_parameters[] =

View file

@ -48,10 +48,6 @@ static HSTRING_TABLE (WINAPI *pStringTableInitializeEx)(DWORD, DWORD);
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};