[Setuapi] implement SetupDiCreateDeviceInfoListExW - try 3

Detlef Riekenberg wine.dev at web.de
Tue Jun 13 18:45:21 CDT 2006

Hi Christian Gmeiner:
> Sorry for the new version, but i got rid of the whitspace stuff and also
> added a check if Reserved != NULL.
> I hope that this patch is ready to commit now.

+    if (MachineName != NULL)
+    {
+        FIXME("remote support is not implemented");
+        goto cleanup;
+    }

A failure should always set an error.
You should add a test for this in the testsuite.
(winspool as example uses an empty servername the same way as NULL).

For external Servers, ERROR_ACCESS_DENIED is a very common Result.

+    if (Reserved != NULL)
+    {
+        goto cleanup;
+    }
Same here. This is simple to test in the testsuite.

-        SerialPortList *list = (SerialPortList *)devinfo;
+        struct DeviceInfoSet *list = (struct DeviceInfoSet *)devinfo;
-        if (list->magic == SETUP_SERIAL_PORT_MAGIC)
+        if (list->magic == SETUP_DEVICE_INFO_SET_MAGIC)

This is wrong.
Read: static HDEVINFO SETUP_CreateSerialDeviceList(void) (line 904)

In your test:

+    // create empty DeviceInfoList

C++ comments are not allow (not supported by some compiler)

+    devlist = SetupDiCreateDeviceInfoListExW(NULL, NULL, NULL, NULL);
+    ok(devlist && devlist != INVALID_HANDLE_VALUE,
"SetupDiCreateDeviceInfoListExW failed : %p %ld\n", devlist,

- You missed the "SetLastError(0xdeadbeef);" before the tested function.
- The first Part of your "ok()" - message
  ("SetupDiCreateDeviceInfoListExW failed :") has no additional infos.
  When a test fails, you will already get:
  "__FILE__:__LINE__: Test failed:"
  You know the dll, file and line of the failing "ok()" - statement.
info.c:932: Test failed: returned 0 with 1801 (expected '!=0' or '0'

You may want to look at my recent Tests / Implementations for
GetPrintProcessorDirectory or AddMonitor/DeleteMonitor (winspool.drv),
but do not use the macro "MAGIC_DEAD" in the tests
(it works, but 0xdeadbeef has more advantages).

As an Example, that we really need tests for every API-Function:
The second Parameter of "DeleteMonitor" is ignored in all tested 

By By ...
      ... Detlef

More information about the wine-devel mailing list