Juan Lang : setupapi: Make sure machine name is non-empty before failing.
Alexandre Julliard
julliard at winehq.org
Fri Jun 10 11:16:18 CDT 2011
Module: wine
Branch: master
Commit: 4fe8cc61642c462883e748b566f93f984e3b4f2a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4fe8cc61642c462883e748b566f93f984e3b4f2a
Author: Juan Lang <juan.lang at gmail.com>
Date: Thu Jun 9 11:35:11 2011 -0700
setupapi: Make sure machine name is non-empty before failing.
---
dlls/setupapi/devinst.c | 6 +++---
dlls/setupapi/tests/devinst.c | 9 +++++++++
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index 0a3c3bd..9176554 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -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;
diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c
index 1905406..3c01f32 100644
--- a/dlls/setupapi/tests/devinst.c
+++ b/dlls/setupapi/tests/devinst.c
@@ -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)
More information about the wine-cvs
mailing list