static BOOL (WINAPI *pConfigurePortUI)(PCWSTR, HWND, PCWSTR);
static BOOL (WINAPI *pDeletePortUI)(PCWSTR, HWND, PCWSTR);
-static WCHAR does_not_existW[] = {'d','o','e','s','_','n','o','t','_','e','x','i','s','t',0};
-static WCHAR emptyW[] = {0};
-static CHAR fmt_comA[] = {'C','O','M','%','u',':',0};
-static CHAR fmt_lptA[] = {'L','P','T','%','u',':',0};
-static WCHAR localportW[] = {'L','o','c','a','l',' ','P','o','r','t',0};
-static WCHAR portname_fileW[] = {'F','I','L','E',':',0};
+static const WCHAR does_not_existW[] = {'d','o','e','s','_','n','o','t','_','e','x','i','s','t',0};
+static const WCHAR emptyW[] = {0};
+static const CHAR fmt_comA[] = {'C','O','M','%','u',':',0};
+static const CHAR fmt_lptA[] = {'L','P','T','%','u',':',0};
+static const WCHAR localportW[] = {'L','o','c','a','l',' ','P','o','r','t',0};
+static const WCHAR portname_fileW[] = {'F','I','L','E',':',0};
static LPBYTE pi_buffer;
static DWORD pi_numports;
/* ########################### */
-static PORT_INFO_2W * find_portinfo2(LPWSTR pPort)
+static PORT_INFO_2W * find_portinfo2(LPCWSTR pPort)
{
PORT_INFO_2W * pi;
DWORD res;
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;
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 ||
}
}
- /* 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:" */
if (!pi2 && (com_absent == NULL)) com_absent = strdupW(bufferW);
}
- /* "FILE:" */
- file_present = find_portinfo2(portname_fileW);
-
test_AddPortUI();
test_ConfigurePortUI();