[LOCALUI_WINETEST]: Sync with Wine 1.5.19.
[reactos.git] / rostests / winetests / localui / localui.c
index cb7a1cf..e32a376 100644 (file)
@@ -71,9 +71,14 @@ static PORT_INFO_2W * find_portinfo2(LPWSTR pPort)
 
     if (!pi_buffer) {
         res = EnumPortsW(NULL, 2, NULL, 0, &pi_needed, &pi_numports);
+        if (!res && (GetLastError() == RPC_S_SERVER_UNAVAILABLE)) {
+            win_skip("The service 'Spooler' is required for many tests\n");
+            return NULL;
+        }
+        ok(!res, "EnumPorts succeeded: got %d\n", res);
         pi_buffer = HeapAlloc(GetProcessHeap(), 0, pi_needed);
-        SetLastError(0xdeadbeef);
         res = EnumPortsW(NULL, 2, pi_buffer, pi_needed, &pi_needed, &pi_numports);
+        ok(res == 1, "EnumPorts failed: got %d\n", res);
     }
     if (pi_buffer) {
         pi = (PORT_INFO_2W *) pi_buffer;
@@ -160,12 +165,12 @@ static void test_AddPortUI(void)
         SetLastError(0xdeadbeef);
         new_portname = NULL;
         /*
-         * - On MSDN, you can read, that no dialogs should be displayed, when hWnd
+         * - On MSDN, you can read that no dialog should be displayed when hWnd
          *   is NULL, but native localui does not care
-         * - when the new port already exist,
+         * - When the new port already exists,
          *   TRUE is returned, but new_portname is NULL
-         * - when the new port starts with "COM" or "LPT",
-         *   FALSE is returned with ERROR_NOT_SUPPORTED in windows
+         * - When the new port starts with "COM" or "LPT",
+         *   FALSE is returned with ERROR_NOT_SUPPORTED on windows
          */
         res = pAddPortUI(NULL, NULL, localportW, &new_portname);
         ok( res ||
@@ -292,7 +297,13 @@ START_TEST(localui)
         }
     }
 
-    /* find installed Ports */
+    /* find installed ports */
+
+    /* "FILE:" */
+    file_present = find_portinfo2(portname_fileW);
+
+    if (!pi_numports)   /* Nothing to test without a port */
+        return;
 
     id = 0;
     /* "LPT1:" - "LPT9:" */
@@ -316,9 +327,6 @@ START_TEST(localui)
         if (!pi2 && (com_absent == NULL)) com_absent = strdupW(bufferW);
     }
 
-    /* "FILE:" */
-    file_present = find_portinfo2(portname_fileW);
-
     test_AddPortUI();
     test_ConfigurePortUI();