Commit 4fe8cc61 authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

setupapi: Make sure machine name is non-empty before failing.

parent ad4c995c
......@@ -1163,7 +1163,7 @@ SetupDiCreateDeviceInfoListExW(const GUID *ClassGuid,
TRACE("%s %p %s %p\n", debugstr_guid(ClassGuid), hwndParent,
debugstr_w(MachineName), Reserved);
if (MachineName != NULL)
if (MachineName && *MachineName)
{
FIXME("remote support is not implemented\n");
SetLastError(ERROR_INVALID_MACHINENAME);
......@@ -2371,7 +2371,7 @@ HDEVINFO WINAPI SetupDiGetClassDevsExW(
set = SetupDiCreateDeviceInfoListExW(class, parent, machine, reserved);
if (set)
{
if (machine)
if (machine && *machine)
FIXME("%s: unimplemented for remote machines\n",
debugstr_w(machine));
else if (flags & DIGCF_DEVICEINTERFACE)
......@@ -3562,7 +3562,7 @@ HKEY WINAPI SetupDiOpenClassRegKeyExW(
LPCWSTR lpKeyName;
LONG l;
if (MachineName != NULL)
if (MachineName && *MachineName)
{
FIXME("Remote access not supported yet!\n");
return INVALID_HANDLE_VALUE;
......
......@@ -261,6 +261,7 @@ static void test_SetupDiCreateDeviceInfoListEx(void)
DWORD error;
static CHAR notnull[] = "NotNull";
static const WCHAR machine[] = { 'd','u','m','m','y',0 };
static const WCHAR empty[] = { 0 };
SetLastError(0xdeadbeef);
/* create empty DeviceInfoList, but set Reserved to a value, which is not NULL */
......@@ -290,6 +291,14 @@ static void test_SetupDiCreateDeviceInfoListEx(void)
/* destroy DeviceInfoList */
ret = pSetupDiDestroyDeviceInfoList(devlist);
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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment