mirror of
https://github.com/reactos/reactos.git
synced 2025-05-07 18:56:48 +00:00
[SETUPAPI_WINETEST]
* Sync with Wine 1.7.1. CORE-7469 svn path=/trunk/; revision=60529
This commit is contained in:
parent
acb2207e13
commit
a614ebc27e
5 changed files with 250 additions and 48 deletions
|
@ -1,7 +1,4 @@
|
||||||
|
|
||||||
add_definitions(
|
|
||||||
-D__ROS_LONG64__)
|
|
||||||
|
|
||||||
list(APPEND SOURCE
|
list(APPEND SOURCE
|
||||||
devclass.c
|
devclass.c
|
||||||
devinst.c
|
devinst.c
|
||||||
|
@ -15,9 +12,8 @@ list(APPEND SOURCE
|
||||||
testlist.c)
|
testlist.c)
|
||||||
|
|
||||||
add_executable(setupapi_winetest ${SOURCE})
|
add_executable(setupapi_winetest ${SOURCE})
|
||||||
target_link_libraries(setupapi_winetest wine)
|
|
||||||
set_module_type(setupapi_winetest win32cui)
|
set_module_type(setupapi_winetest win32cui)
|
||||||
add_importlibs(setupapi_winetest advapi32 setupapi user32 msvcrt kernel32 ntdll)
|
add_importlibs(setupapi_winetest advapi32 setupapi user32 msvcrt kernel32)
|
||||||
add_cd_file(TARGET setupapi_winetest DESTINATION reactos/bin FOR all)
|
add_cd_file(TARGET setupapi_winetest DESTINATION reactos/bin FOR all)
|
||||||
|
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
|
|
|
@ -18,9 +18,9 @@
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "windef.h"
|
#include "windef.h"
|
||||||
#include "winbase.h"
|
#include "winbase.h"
|
||||||
#include "wingdi.h"
|
#include "wingdi.h"
|
||||||
|
@ -31,8 +31,9 @@
|
||||||
|
|
||||||
#include "wine/test.h"
|
#include "wine/test.h"
|
||||||
|
|
||||||
|
static BOOL is_wow64;
|
||||||
|
|
||||||
/* function pointers */
|
/* function pointers */
|
||||||
static HMODULE hSetupAPI;
|
|
||||||
static HDEVINFO (WINAPI *pSetupDiCreateDeviceInfoList)(GUID*,HWND);
|
static HDEVINFO (WINAPI *pSetupDiCreateDeviceInfoList)(GUID*,HWND);
|
||||||
static HDEVINFO (WINAPI *pSetupDiCreateDeviceInfoListExW)(GUID*,HWND,PCWSTR,PVOID);
|
static HDEVINFO (WINAPI *pSetupDiCreateDeviceInfoListExW)(GUID*,HWND,PCWSTR,PVOID);
|
||||||
static BOOL (WINAPI *pSetupDiCreateDeviceInterfaceA)(HDEVINFO, PSP_DEVINFO_DATA, const GUID *, PCSTR, DWORD, PSP_DEVICE_INTERFACE_DATA);
|
static BOOL (WINAPI *pSetupDiCreateDeviceInterfaceA)(HDEVINFO, PSP_DEVINFO_DATA, const GUID *, PCSTR, DWORD, PSP_DEVICE_INTERFACE_DATA);
|
||||||
|
@ -40,6 +41,7 @@ static BOOL (WINAPI *pSetupDiCallClassInstaller)(DI_FUNCTION, HDEVINFO, PSP_
|
||||||
static BOOL (WINAPI *pSetupDiDestroyDeviceInfoList)(HDEVINFO);
|
static BOOL (WINAPI *pSetupDiDestroyDeviceInfoList)(HDEVINFO);
|
||||||
static BOOL (WINAPI *pSetupDiEnumDeviceInfo)(HDEVINFO, DWORD, PSP_DEVINFO_DATA);
|
static BOOL (WINAPI *pSetupDiEnumDeviceInfo)(HDEVINFO, DWORD, PSP_DEVINFO_DATA);
|
||||||
static BOOL (WINAPI *pSetupDiEnumDeviceInterfaces)(HDEVINFO, PSP_DEVINFO_DATA, const GUID *, DWORD, PSP_DEVICE_INTERFACE_DATA);
|
static BOOL (WINAPI *pSetupDiEnumDeviceInterfaces)(HDEVINFO, PSP_DEVINFO_DATA, const GUID *, DWORD, PSP_DEVICE_INTERFACE_DATA);
|
||||||
|
static BOOL (WINAPI *pSetupDiGetINFClassA)(PCSTR, LPGUID, PSTR, DWORD, PDWORD);
|
||||||
static BOOL (WINAPI *pSetupDiInstallClassA)(HWND, PCSTR, DWORD, HSPFILEQ);
|
static BOOL (WINAPI *pSetupDiInstallClassA)(HWND, PCSTR, DWORD, HSPFILEQ);
|
||||||
static HKEY (WINAPI *pSetupDiOpenClassRegKeyExA)(GUID*,REGSAM,DWORD,PCSTR,PVOID);
|
static HKEY (WINAPI *pSetupDiOpenClassRegKeyExA)(GUID*,REGSAM,DWORD,PCSTR,PVOID);
|
||||||
static HKEY (WINAPI *pSetupDiOpenDevRegKey)(HDEVINFO, PSP_DEVINFO_DATA, DWORD, DWORD, DWORD, REGSAM);
|
static HKEY (WINAPI *pSetupDiOpenDevRegKey)(HDEVINFO, PSP_DEVINFO_DATA, DWORD, DWORD, DWORD, REGSAM);
|
||||||
|
@ -56,13 +58,15 @@ static BOOL (WINAPI *pSetupDiSetDeviceRegistryPropertyA)(HDEVINFO, PSP_DEVIN
|
||||||
static BOOL (WINAPI *pSetupDiSetDeviceRegistryPropertyW)(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);
|
static BOOL (WINAPI *pSetupDiGetDeviceRegistryPropertyA)(HDEVINFO, PSP_DEVINFO_DATA, DWORD, PDWORD, PBYTE, DWORD, PDWORD);
|
||||||
static BOOL (WINAPI *pSetupDiGetDeviceRegistryPropertyW)(HDEVINFO, PSP_DEVINFO_DATA, DWORD, PDWORD, PBYTE, DWORD, PDWORD);
|
static BOOL (WINAPI *pSetupDiGetDeviceRegistryPropertyW)(HDEVINFO, PSP_DEVINFO_DATA, DWORD, PDWORD, PBYTE, DWORD, PDWORD);
|
||||||
|
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
|
||||||
|
|
||||||
/* This is a unique guid for testing purposes */
|
/* This is a unique guid for testing purposes */
|
||||||
static GUID guid = {0x6a55b5a4, 0x3f65, 0x11db, {0xb7,0x04,0x00,0x11,0x95,0x5c,0x2b,0xdb}};
|
static GUID guid = {0x6a55b5a4, 0x3f65, 0x11db, {0xb7,0x04,0x00,0x11,0x95,0x5c,0x2b,0xdb}};
|
||||||
|
|
||||||
static void init_function_pointers(void)
|
static void init_function_pointers(void)
|
||||||
{
|
{
|
||||||
hSetupAPI = GetModuleHandleA("setupapi.dll");
|
HMODULE hSetupAPI = GetModuleHandleA("setupapi.dll");
|
||||||
|
HMODULE hKernel32 = GetModuleHandleA("kernel32.dll");
|
||||||
|
|
||||||
pSetupDiCreateDeviceInfoA = (void *)GetProcAddress(hSetupAPI, "SetupDiCreateDeviceInfoA");
|
pSetupDiCreateDeviceInfoA = (void *)GetProcAddress(hSetupAPI, "SetupDiCreateDeviceInfoA");
|
||||||
pSetupDiCreateDeviceInfoW = (void *)GetProcAddress(hSetupAPI, "SetupDiCreateDeviceInfoW");
|
pSetupDiCreateDeviceInfoW = (void *)GetProcAddress(hSetupAPI, "SetupDiCreateDeviceInfoW");
|
||||||
|
@ -83,10 +87,12 @@ static void init_function_pointers(void)
|
||||||
pSetupDiRegisterDeviceInfo = (void *)GetProcAddress(hSetupAPI, "SetupDiRegisterDeviceInfo");
|
pSetupDiRegisterDeviceInfo = (void *)GetProcAddress(hSetupAPI, "SetupDiRegisterDeviceInfo");
|
||||||
pSetupDiGetClassDevsA = (void *)GetProcAddress(hSetupAPI, "SetupDiGetClassDevsA");
|
pSetupDiGetClassDevsA = (void *)GetProcAddress(hSetupAPI, "SetupDiGetClassDevsA");
|
||||||
pSetupDiGetClassDevsW = (void *)GetProcAddress(hSetupAPI, "SetupDiGetClassDevsW");
|
pSetupDiGetClassDevsW = (void *)GetProcAddress(hSetupAPI, "SetupDiGetClassDevsW");
|
||||||
|
pSetupDiGetINFClassA = (void *)GetProcAddress(hSetupAPI, "SetupDiGetINFClassA");
|
||||||
pSetupDiSetDeviceRegistryPropertyA = (void *)GetProcAddress(hSetupAPI, "SetupDiSetDeviceRegistryPropertyA");
|
pSetupDiSetDeviceRegistryPropertyA = (void *)GetProcAddress(hSetupAPI, "SetupDiSetDeviceRegistryPropertyA");
|
||||||
pSetupDiSetDeviceRegistryPropertyW = (void *)GetProcAddress(hSetupAPI, "SetupDiSetDeviceRegistryPropertyW");
|
pSetupDiSetDeviceRegistryPropertyW = (void *)GetProcAddress(hSetupAPI, "SetupDiSetDeviceRegistryPropertyW");
|
||||||
pSetupDiGetDeviceRegistryPropertyA = (void *)GetProcAddress(hSetupAPI, "SetupDiGetDeviceRegistryPropertyA");
|
pSetupDiGetDeviceRegistryPropertyA = (void *)GetProcAddress(hSetupAPI, "SetupDiGetDeviceRegistryPropertyA");
|
||||||
pSetupDiGetDeviceRegistryPropertyW = (void *)GetProcAddress(hSetupAPI, "SetupDiGetDeviceRegistryPropertyW");
|
pSetupDiGetDeviceRegistryPropertyW = (void *)GetProcAddress(hSetupAPI, "SetupDiGetDeviceRegistryPropertyW");
|
||||||
|
pIsWow64Process = (void *)GetProcAddress(hKernel32, "IsWow64Process");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void change_reg_permissions(const WCHAR *regkey)
|
static void change_reg_permissions(const WCHAR *regkey)
|
||||||
|
@ -126,7 +132,7 @@ static BOOL remove_device(void)
|
||||||
{
|
{
|
||||||
HDEVINFO set;
|
HDEVINFO set;
|
||||||
SP_DEVINFO_DATA devInfo = { sizeof(devInfo), { 0 } };
|
SP_DEVINFO_DATA devInfo = { sizeof(devInfo), { 0 } };
|
||||||
BOOL ret;
|
BOOL ret, retval;
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
set = pSetupDiGetClassDevsA(&guid, NULL, 0, 0);
|
set = pSetupDiGetClassDevsA(&guid, NULL, 0, 0);
|
||||||
|
@ -134,19 +140,23 @@ static BOOL remove_device(void)
|
||||||
GetLastError());
|
GetLastError());
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
ok(pSetupDiEnumDeviceInfo(set, 0, &devInfo),
|
ret = pSetupDiEnumDeviceInfo(set, 0, &devInfo);
|
||||||
"SetupDiEnumDeviceInfo failed: %08x\n", GetLastError());
|
ok(ret, "SetupDiEnumDeviceInfo failed: %08x\n", GetLastError());
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
ret = pSetupDiCallClassInstaller(DIF_REMOVE, set, &devInfo);
|
retval = pSetupDiCallClassInstaller(DIF_REMOVE, set, &devInfo);
|
||||||
todo_wine
|
if(is_wow64)
|
||||||
ok(ret, "SetupDiCallClassInstaller(DIF_REMOVE...) failed: %08x\n", GetLastError());
|
todo_wine ok(!retval && GetLastError() == ERROR_IN_WOW64,
|
||||||
|
"SetupDiCallClassInstaller(DIF_REMOVE...) succeeded: %08x\n", GetLastError());
|
||||||
|
else
|
||||||
|
todo_wine ok(retval,
|
||||||
|
"SetupDiCallClassInstaller(DIF_REMOVE...) failed: %08x\n", GetLastError());
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
ok(pSetupDiDestroyDeviceInfoList(set),
|
ret = pSetupDiDestroyDeviceInfoList(set);
|
||||||
"SetupDiDestroyDeviceInfoList failed: %08x\n", GetLastError());
|
ok(ret, "SetupDiDestroyDeviceInfoList failed: %08x\n", GetLastError());
|
||||||
|
|
||||||
return ret;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* RegDeleteTreeW from dlls/advapi32/registry.c */
|
/* RegDeleteTreeW from dlls/advapi32/registry.c */
|
||||||
|
@ -251,6 +261,7 @@ static void test_SetupDiCreateDeviceInfoListEx(void)
|
||||||
DWORD error;
|
DWORD error;
|
||||||
static CHAR notnull[] = "NotNull";
|
static CHAR notnull[] = "NotNull";
|
||||||
static const WCHAR machine[] = { 'd','u','m','m','y',0 };
|
static const WCHAR machine[] = { 'd','u','m','m','y',0 };
|
||||||
|
static const WCHAR empty[] = { 0 };
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
/* create empty DeviceInfoList, but set Reserved to a value, which is not NULL */
|
/* create empty DeviceInfoList, but set Reserved to a value, which is not NULL */
|
||||||
|
@ -280,6 +291,14 @@ static void test_SetupDiCreateDeviceInfoListEx(void)
|
||||||
/* destroy DeviceInfoList */
|
/* destroy DeviceInfoList */
|
||||||
ret = pSetupDiDestroyDeviceInfoList(devlist);
|
ret = pSetupDiDestroyDeviceInfoList(devlist);
|
||||||
ok(ret, "SetupDiDestroyDeviceInfoList failed : %d\n", error);
|
ok(ret, "SetupDiDestroyDeviceInfoList failed : %d\n", error);
|
||||||
|
|
||||||
|
/* create empty DeviceInfoList with empty machine name */
|
||||||
|
devlist = pSetupDiCreateDeviceInfoListExW(NULL, NULL, empty, NULL);
|
||||||
|
ok(devlist && devlist != INVALID_HANDLE_VALUE, "SetupDiCreateDeviceInfoListExW failed : %p %d (expected != %p)\n", devlist, error, INVALID_HANDLE_VALUE);
|
||||||
|
|
||||||
|
/* destroy DeviceInfoList */
|
||||||
|
ret = pSetupDiDestroyDeviceInfoList(devlist);
|
||||||
|
ok(ret, "SetupDiDestroyDeviceInfoList failed : %d\n", error);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_SetupDiOpenClassRegKeyExA(void)
|
static void test_SetupDiOpenClassRegKeyExA(void)
|
||||||
|
@ -955,7 +974,6 @@ static void testDevRegKey(void)
|
||||||
key = pSetupDiOpenDevRegKey(set, &devInfo, DICS_FLAG_GLOBAL, 0,
|
key = pSetupDiOpenDevRegKey(set, &devInfo, DICS_FLAG_GLOBAL, 0,
|
||||||
DIREG_DRV, 0);
|
DIREG_DRV, 0);
|
||||||
/* The software key isn't created by default */
|
/* The software key isn't created by default */
|
||||||
todo_wine
|
|
||||||
ok(key == INVALID_HANDLE_VALUE &&
|
ok(key == INVALID_HANDLE_VALUE &&
|
||||||
GetLastError() == ERROR_KEY_DOES_NOT_EXIST,
|
GetLastError() == ERROR_KEY_DOES_NOT_EXIST,
|
||||||
"Expected ERROR_KEY_DOES_NOT_EXIST, got %08x\n", GetLastError());
|
"Expected ERROR_KEY_DOES_NOT_EXIST, got %08x\n", GetLastError());
|
||||||
|
@ -1005,8 +1023,8 @@ static void testDevRegKey(void)
|
||||||
|
|
||||||
/* Cleanup */
|
/* Cleanup */
|
||||||
ret = remove_device();
|
ret = remove_device();
|
||||||
todo_wine
|
if(!is_wow64)
|
||||||
ok(ret, "Expected the device to be removed: %08x\n", GetLastError());
|
todo_wine ok(ret, "Expected the device to be removed: %08x\n", GetLastError());
|
||||||
|
|
||||||
/* FIXME: Only do the RegDeleteKey, once Wine is fixed */
|
/* FIXME: Only do the RegDeleteKey, once Wine is fixed */
|
||||||
if (!ret)
|
if (!ret)
|
||||||
|
@ -1089,6 +1107,8 @@ static void testRegisterAndGetDetail(void)
|
||||||
{
|
{
|
||||||
static const char path[] =
|
static const char path[] =
|
||||||
"\\\\?\\root#legacy_bogus#0000#{6a55b5a4-3f65-11db-b704-0011955c2bdb}";
|
"\\\\?\\root#legacy_bogus#0000#{6a55b5a4-3f65-11db-b704-0011955c2bdb}";
|
||||||
|
static const char path_wow64[] =
|
||||||
|
"\\\\?\\root#legacy_bogus#0001#{6a55b5a4-3f65-11db-b704-0011955c2bdb}";
|
||||||
static const char path_w2k[] =
|
static const char path_w2k[] =
|
||||||
"\\\\?\\root#legacy_bogus#0000#{6a55b5a4-3f65-11db-b704-0011955c2bdb}\\";
|
"\\\\?\\root#legacy_bogus#0000#{6a55b5a4-3f65-11db-b704-0011955c2bdb}\\";
|
||||||
PSP_DEVICE_INTERFACE_DETAIL_DATA_A detail = NULL;
|
PSP_DEVICE_INTERFACE_DETAIL_DATA_A detail = NULL;
|
||||||
|
@ -1104,10 +1124,13 @@ static void testRegisterAndGetDetail(void)
|
||||||
/* FIXME: This one only worked because old data wasn't removed properly. As soon
|
/* FIXME: This one only worked because old data wasn't removed properly. As soon
|
||||||
* as all the tests are cleaned up correctly this has to be (or should be) fixed
|
* as all the tests are cleaned up correctly this has to be (or should be) fixed
|
||||||
*/
|
*/
|
||||||
todo_wine
|
if(is_wow64)
|
||||||
ok(!lstrcmpiA(path, detail->DevicePath) ||
|
ok(!lstrcmpiA(path_wow64, detail->DevicePath),
|
||||||
!lstrcmpiA(path_w2k, detail->DevicePath), "Unexpected path %s\n",
|
"Unexpected path %s\n", detail->DevicePath);
|
||||||
detail->DevicePath);
|
else
|
||||||
|
todo_wine ok(!lstrcmpiA(path, detail->DevicePath) ||
|
||||||
|
!lstrcmpiA(path_w2k, detail->DevicePath),
|
||||||
|
"Unexpected path %s\n", detail->DevicePath);
|
||||||
HeapFree(GetProcessHeap(), 0, detail);
|
HeapFree(GetProcessHeap(), 0, detail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1116,8 +1139,8 @@ static void testRegisterAndGetDetail(void)
|
||||||
|
|
||||||
/* Cleanup */
|
/* Cleanup */
|
||||||
ret = remove_device();
|
ret = remove_device();
|
||||||
todo_wine
|
if(!is_wow64)
|
||||||
ok(ret, "Expected the device to be removed: %08x\n", GetLastError());
|
todo_wine ok(ret, "Expected the device to be removed: %08x\n", GetLastError());
|
||||||
|
|
||||||
/* FIXME: Only do the RegDeleteKey, once Wine is fixed */
|
/* FIXME: Only do the RegDeleteKey, once Wine is fixed */
|
||||||
if (!ret)
|
if (!ret)
|
||||||
|
@ -1226,8 +1249,8 @@ static void testDeviceRegistryPropertyA(void)
|
||||||
pSetupDiDestroyDeviceInfoList(set);
|
pSetupDiDestroyDeviceInfoList(set);
|
||||||
|
|
||||||
res = RegOpenKeyA(HKEY_LOCAL_MACHINE, bogus, &key);
|
res = RegOpenKeyA(HKEY_LOCAL_MACHINE, bogus, &key);
|
||||||
todo_wine
|
if(!is_wow64)
|
||||||
ok(res == ERROR_FILE_NOT_FOUND, "Expected key to not exist\n");
|
todo_wine ok(res == ERROR_FILE_NOT_FOUND, "Expected key to not exist\n");
|
||||||
/* FIXME: Remove when Wine is fixed */
|
/* FIXME: Remove when Wine is fixed */
|
||||||
if (res == ERROR_SUCCESS)
|
if (res == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
|
@ -1332,8 +1355,8 @@ static void testDeviceRegistryPropertyW(void)
|
||||||
pSetupDiDestroyDeviceInfoList(set);
|
pSetupDiDestroyDeviceInfoList(set);
|
||||||
|
|
||||||
res = RegOpenKeyW(HKEY_LOCAL_MACHINE, bogus, &key);
|
res = RegOpenKeyW(HKEY_LOCAL_MACHINE, bogus, &key);
|
||||||
todo_wine
|
if(!is_wow64)
|
||||||
ok(res == ERROR_FILE_NOT_FOUND, "Expected key to not exist\n");
|
todo_wine ok(res == ERROR_FILE_NOT_FOUND, "Expected key to not exist\n");
|
||||||
/* FIXME: Remove when Wine is fixed */
|
/* FIXME: Remove when Wine is fixed */
|
||||||
if (res == ERROR_SUCCESS)
|
if (res == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
|
@ -1343,24 +1366,183 @@ static void testDeviceRegistryPropertyW(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
START_TEST(devinst)
|
static void testSetupDiGetINFClassA(void)
|
||||||
{
|
{
|
||||||
HDEVINFO set;
|
static const char inffile[] = "winetest.inf";
|
||||||
|
static const char content[] = "[Version]\r\n\r\n";
|
||||||
|
|
||||||
init_function_pointers();
|
char cn[MAX_PATH];
|
||||||
|
char filename[MAX_PATH];
|
||||||
|
DWORD count;
|
||||||
|
BOOL retval;
|
||||||
|
GUID guid;
|
||||||
|
HANDLE h;
|
||||||
|
|
||||||
/* Win9x/WinMe does things totally different so we skip all the tests
|
if(!pSetupDiGetINFClassA)
|
||||||
*
|
|
||||||
* We don't want to exclude NT4 so hence this check.
|
|
||||||
*/
|
|
||||||
SetLastError(0xdeadbeef);
|
|
||||||
set = pSetupDiGetClassDevsW(NULL, NULL, 0, 0);
|
|
||||||
if (set == INVALID_HANDLE_VALUE && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
|
|
||||||
{
|
{
|
||||||
win_skip("Win9x/WinMe has totally different behavior\n");
|
win_skip("SetupDiGetINFClassA not present\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
count = GetTempPathA(MAX_PATH, filename);
|
||||||
|
if(!count)
|
||||||
|
{
|
||||||
|
win_skip("GetTempPathA failed\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
strcat(filename, inffile);
|
||||||
|
DeleteFileA(filename);
|
||||||
|
|
||||||
|
/* not existing file */
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
retval = SetupDiGetINFClassA(filename, &guid, cn, MAX_PATH, &count);
|
||||||
|
ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
|
||||||
|
if (ERROR_CALL_NOT_IMPLEMENTED == GetLastError())
|
||||||
|
{
|
||||||
|
skip("SetupDiGetINFClassA is not implemented\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ok(ERROR_FILE_NOT_FOUND == GetLastError(),
|
||||||
|
"expected error ERROR_FILE_NOT_FOUND, got %u\n", GetLastError());
|
||||||
|
|
||||||
|
/* missing file wins against other invalid parameter */
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
retval = SetupDiGetINFClassA(filename, NULL, cn, MAX_PATH, &count);
|
||||||
|
ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
|
||||||
|
ok(ERROR_FILE_NOT_FOUND == GetLastError(),
|
||||||
|
"expected error ERROR_FILE_NOT_FOUND, got %u\n", GetLastError());
|
||||||
|
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
retval = SetupDiGetINFClassA(filename, &guid, NULL, MAX_PATH, &count);
|
||||||
|
ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
|
||||||
|
ok(ERROR_FILE_NOT_FOUND == GetLastError(),
|
||||||
|
"expected error ERROR_FILE_NOT_FOUND, got %u\n", GetLastError());
|
||||||
|
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
retval = SetupDiGetINFClassA(filename, &guid, cn, 0, &count);
|
||||||
|
ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
|
||||||
|
ok(ERROR_FILE_NOT_FOUND == GetLastError(),
|
||||||
|
"expected error ERROR_FILE_NOT_FOUND, got %u\n", GetLastError());
|
||||||
|
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
retval = SetupDiGetINFClassA(filename, &guid, cn, MAX_PATH, NULL);
|
||||||
|
ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
|
||||||
|
ok(ERROR_FILE_NOT_FOUND == GetLastError(),
|
||||||
|
"expected error ERROR_FILE_NOT_FOUND, got %u\n", GetLastError());
|
||||||
|
|
||||||
|
/* test file content */
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
CloseHandle( h);
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
init_function_pointers();
|
||||||
|
|
||||||
|
if (pIsWow64Process)
|
||||||
|
pIsWow64Process(GetCurrentProcess(), &is_wow64);
|
||||||
|
|
||||||
if (pSetupDiCreateDeviceInfoListExW)
|
if (pSetupDiCreateDeviceInfoListExW)
|
||||||
test_SetupDiCreateDeviceInfoListEx();
|
test_SetupDiCreateDeviceInfoListEx();
|
||||||
else
|
else
|
||||||
|
@ -1381,4 +1563,13 @@ START_TEST(devinst)
|
||||||
testRegisterAndGetDetail();
|
testRegisterAndGetDetail();
|
||||||
testDeviceRegistryPropertyA();
|
testDeviceRegistryPropertyA();
|
||||||
testDeviceRegistryPropertyW();
|
testDeviceRegistryPropertyW();
|
||||||
|
|
||||||
|
if (!winetest_interactive)
|
||||||
|
{
|
||||||
|
win_skip("testSetupDiGetINFClassA(), ROSTESTS-124.\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
testSetupDiGetINFClassA();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -322,6 +322,20 @@ static void test_install_svc_from(void)
|
||||||
CloseServiceHandle(svc_handle);
|
CloseServiceHandle(svc_handle);
|
||||||
CloseServiceHandle(scm_handle);
|
CloseServiceHandle(scm_handle);
|
||||||
|
|
||||||
|
strcpy(inf, "[Version]\nSignature=\"$Chicago$\"\n");
|
||||||
|
strcat(inf, "[XSP.InstallPerVer]\n");
|
||||||
|
strcat(inf, "AddReg=AspEventlogMsg.Reg,Perf.Reg,AspVersions.Reg,FreeADO.Reg,IndexServer.Reg\n");
|
||||||
|
create_inf_file(inffile, inf);
|
||||||
|
sprintf(path, "%s\\%s", CURR_DIR, inffile);
|
||||||
|
infhandle = SetupOpenInfFileA(path, NULL, INF_STYLE_WIN4, NULL);
|
||||||
|
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
ret = SetupInstallServicesFromInfSectionA(infhandle, "XSP.InstallPerVer", 0);
|
||||||
|
ok(ret, "Expected success\n");
|
||||||
|
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %08x\n", GetLastError());
|
||||||
|
SetupCloseInfFile(infhandle);
|
||||||
|
DeleteFile(inffile);
|
||||||
|
|
||||||
/* TODO: Test the Flags */
|
/* TODO: Test the Flags */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#include "windef.h"
|
#include "windef.h"
|
||||||
|
@ -424,7 +423,12 @@ static void test_key_names(void)
|
||||||
if (hinf == INVALID_HANDLE_VALUE) continue;
|
if (hinf == INVALID_HANDLE_VALUE) continue;
|
||||||
|
|
||||||
ret = SetupFindFirstLineA( hinf, "Test", 0, &context );
|
ret = SetupFindFirstLineA( hinf, "Test", 0, &context );
|
||||||
assert( ret );
|
ok(ret, "SetupFindFirstLineA failed: le=%u\n", GetLastError());
|
||||||
|
if (!ret)
|
||||||
|
{
|
||||||
|
SetupCloseInfFile( hinf );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
check_key( &context, key_names[i].key );
|
check_key( &context, key_names[i].key );
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
/* Automatically generated file; DO NOT EDIT!! */
|
/* Automatically generated file; DO NOT EDIT!! */
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
#define STANDALONE
|
#define STANDALONE
|
||||||
#include "wine/test.h"
|
#include <wine/test.h>
|
||||||
|
|
||||||
extern void func_devclass(void);
|
extern void func_devclass(void);
|
||||||
extern void func_devinst(void);
|
extern void func_devinst(void);
|
||||||
|
|
Loading…
Reference in a new issue