ReactOS  0.4.12-dev-685-gf36cbf7
localui.c
Go to the documentation of this file.
1 /*
2  * Implementation of the Local Printmonitor User Interface
3  *
4  * Copyright 2007 Detlef Riekenberg
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20 
21 #include <stdarg.h>
22 
23 #include "windef.h"
24 #include "winbase.h"
25 #include "wingdi.h"
26 #include "winreg.h"
27 #include "winuser.h"
28 
29 #include "winspool.h"
30 #include "ddk/winsplp.h"
31 
32 #include "wine/debug.h"
33 #include "wine/unicode.h"
34 #include "localui.h"
35 
37 
38 /*****************************************************/
39 
41 
42 static const WCHAR cmd_AddPortW[] = {'A','d','d','P','o','r','t',0};
43 static const WCHAR cmd_ConfigureLPTPortCommandOKW[] = {'C','o','n','f','i','g','u','r','e',
44  'L','P','T','P','o','r','t',
45  'C','o','m','m','a','n','d','O','K',0};
46 static const WCHAR cmd_DeletePortW[] = {'D','e','l','e','t','e','P','o','r','t',0};
47 static const WCHAR cmd_GetDefaultCommConfigW[] = {'G','e','t',
48  'D','e','f','a','u','l','t',
49  'C','o','m','m','C','o','n','f','i','g',0};
50 static const WCHAR cmd_GetTransmissionRetryTimeoutW[] = {'G','e','t',
51  'T','r','a','n','s','m','i','s','s','i','o','n',
52  'R','e','t','r','y','T','i','m','e','o','u','t',0};
53 static const WCHAR cmd_PortIsValidW[] = {'P','o','r','t','I','s','V','a','l','i','d',0};
54 static const WCHAR cmd_SetDefaultCommConfigW[] = {'S','e','t',
55  'D','e','f','a','u','l','t',
56  'C','o','m','m','C','o','n','f','i','g',0};
57 
58 static const WCHAR fmt_uW[] = {'%','u',0};
59 static const WCHAR portname_LPT[] = {'L','P','T',0};
60 static const WCHAR portname_COM[] = {'C','O','M',0};
61 static const WCHAR portname_FILE[] = {'F','I','L','E',':',0};
62 static const WCHAR portname_CUPS[] = {'C','U','P','S',':',0};
63 static const WCHAR portname_LPR[] = {'L','P','R',':',0};
64 
65 static const WCHAR XcvMonitorW[] = {',','X','c','v','M','o','n','i','t','o','r',' ',0};
66 static const WCHAR XcvPortW[] = {',','X','c','v','P','o','r','t',' ',0};
67 
68 /*****************************************************/
69 
70 typedef struct tag_addportui_t {
73 } addportui_t;
74 
75 typedef struct tag_lptconfig_t {
78 } lptconfig_t;
79 
80 
82 
83 /*****************************************************
84  * strdupWW [internal]
85  */
86 
87 static LPWSTR strdupWW(LPCWSTR pPrefix, LPCWSTR pSuffix)
88 {
89  LPWSTR ptr;
90  DWORD len;
91 
92  len = lstrlenW(pPrefix) + (pSuffix ? lstrlenW(pSuffix) : 0) + 1;
93  ptr = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
94  if (ptr) {
95  lstrcpyW(ptr, pPrefix);
96  if (pSuffix) lstrcatW(ptr, pSuffix);
97  }
98  return ptr;
99 }
100 
101 /*****************************************************
102  * dlg_configure_com [internal]
103  *
104  */
105 
107 {
108  COMMCONFIG cfg;
109  LPWSTR shortname;
110  DWORD status;
111  DWORD dummy;
112  DWORD len;
113  BOOL res;
114 
115  /* strip the colon (pPortName is never empty here) */
116  len = lstrlenW(pPortName);
117  shortname = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
118  if (shortname) {
119  memcpy(shortname, pPortName, (len -1) * sizeof(WCHAR));
120  shortname[len-1] = '\0';
121 
122  /* get current settings */
123  len = FIELD_OFFSET(COMMCONFIG, wcProviderData[1]);
126  (PBYTE) shortname,
127  (lstrlenW(shortname) +1) * sizeof(WCHAR),
128  (PBYTE) &cfg, len, &len, &status);
129 
130  if (res && (status == ERROR_SUCCESS)) {
131  /* display the Dialog */
132  res = CommConfigDialogW(pPortName, hWnd, &cfg);
133  if (res) {
135  /* set new settings */
137  (PBYTE) &cfg, len,
138  (PBYTE) &dummy, 0, &len, &status);
139  }
140  }
141  HeapFree(GetProcessHeap(), 0, shortname);
142  return res;
143  }
144  return FALSE;
145 }
146 
147 
148 /*****************************************************
149  * dlg_configure_lpt [internal]
150  *
151  */
152 
154 {
156  BOOL res;
157 
158 
159  data.hXcv = hXcv;
160 
163 
164  TRACE("got %u with %u\n", res, GetLastError());
165 
167  return res;
168 }
169 
170 /******************************************************************
171  * dlg_port_already_exists [internal]
172  */
173 
174 static void dlg_port_already_exists(HWND hWnd, LPCWSTR portname)
175 {
176  WCHAR res_PortW[IDS_LOCALPORT_MAXLEN];
177  WCHAR res_PortExistsW[IDS_PORTEXISTS_MAXLEN];
178  LPWSTR message;
179  DWORD len;
180 
181  res_PortW[0] = '\0';
182  res_PortExistsW[0] = '\0';
185 
186  len = lstrlenW(portname) + IDS_PORTEXISTS_MAXLEN + 1;
187  message = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
188  if (message) {
189  message[0] = '\0';
190  snprintfW(message, len, res_PortExistsW, portname);
191  MessageBoxW(hWnd, message, res_PortW, MB_OK | MB_ICONERROR);
193  }
194 }
195 
196 /******************************************************************
197  * dlg_invalid_portname [internal]
198  */
199 
200 static void dlg_invalid_portname(HWND hWnd, LPCWSTR portname)
201 {
202  WCHAR res_PortW[IDS_LOCALPORT_MAXLEN];
203  WCHAR res_InvalidNameW[IDS_INVALIDNAME_MAXLEN];
204  LPWSTR message;
205  DWORD len;
206 
207  res_PortW[0] = '\0';
208  res_InvalidNameW[0] = '\0';
211 
212  len = lstrlenW(portname) + IDS_INVALIDNAME_MAXLEN;
213  message = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
214  if (message) {
215  message[0] = '\0';
216  snprintfW(message, len, res_InvalidNameW, portname);
217  MessageBoxW(hWnd, message, res_PortW, MB_OK | MB_ICONERROR);
219  }
220 }
221 
222 /******************************************************************
223  * display the Dialog "Nothing to configure"
224  *
225  */
226 
228 {
229  WCHAR res_PortW[IDS_LOCALPORT_MAXLEN];
230  WCHAR res_nothingW[IDS_NOTHINGTOCONFIG_MAXLEN];
231 
232  res_PortW[0] = '\0';
233  res_nothingW[0] = '\0';
236 
237  MessageBoxW(hWnd, res_nothingW, res_PortW, MB_OK | MB_ICONINFORMATION);
238 }
239 
240 /******************************************************************
241  * dlg_win32error [internal]
242  */
243 
244 static void dlg_win32error(HWND hWnd, DWORD lasterror)
245 {
246  WCHAR res_PortW[IDS_LOCALPORT_MAXLEN];
247  LPWSTR message = NULL;
248  DWORD res;
249 
250  res_PortW[0] = '\0';
252 
253 
255  NULL, lasterror, 0, (LPWSTR) &message, 0, NULL);
256 
257  if (res > 0) {
258  MessageBoxW(hWnd, message, res_PortW, MB_OK | MB_ICONERROR);
260  }
261 }
262 
263 /*****************************************************************************
264  *
265  */
266 
268 {
269  addportui_t * data;
270  DWORD status;
271  DWORD dummy;
272  DWORD len;
273  DWORD res;
274 
275  switch(msg)
276  {
277  case WM_INITDIALOG:
279  return TRUE;
280 
281  case WM_COMMAND:
282  if (wparam == MAKEWPARAM(IDOK, BN_CLICKED))
283  {
285  /* length in WCHAR, without the '\0' */
287  data->portname = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR));
288 
289  if (!data->portname) {
290  EndDialog(hwnd, FALSE);
291  return TRUE;
292  }
293  /* length is in WCHAR, including the '\0' */
294  GetDlgItemTextW(hwnd, ADDPORT_EDIT, data->portname, len + 1);
296  res = XcvDataW( data->hXcv, cmd_PortIsValidW, (PBYTE) data->portname,
297  (lstrlenW(data->portname) + 1) * sizeof(WCHAR),
298  (PBYTE) &dummy, 0, &len, &status);
299 
300  TRACE("got %u with status %u\n", res, status);
301  if (res && (status == ERROR_SUCCESS)) {
302  /* The caller must free data->portname */
303  EndDialog(hwnd, TRUE);
304  return TRUE;
305  }
306 
307  if (res && (status == ERROR_INVALID_NAME)) {
308  dlg_invalid_portname(hwnd, data->portname);
309  HeapFree(GetProcessHeap(), 0, data->portname);
310  data->portname = NULL;
311  return TRUE;
312  }
313 
315  HeapFree(GetProcessHeap(), 0, data->portname);
316  data->portname = NULL;
317  return TRUE;
318  }
319 
321  {
322  EndDialog(hwnd, FALSE);
323  return TRUE;
324  }
325  return FALSE;
326  }
327  return FALSE;
328 }
329 
330 /*****************************************************************************
331  * dlgproc_lptconfig [internal]
332  *
333  * Our message-proc is simple, as the range-check is done only during the
334  * command "OK" and the dialog is set to the start-value at "out of range".
335  *
336  * Native localui.dll does the check during keyboard-input and set the dialog
337  * to the previous value.
338  *
339  */
340 
342 {
343  lptconfig_t * data;
344  WCHAR bufferW[16];
345  DWORD status;
346  DWORD dummy;
347  DWORD len;
348  DWORD res;
349 
350 
351  switch(msg)
352  {
353  case WM_INITDIALOG:
355  data = (lptconfig_t *) lparam;
356 
357  /* Get current setting */
358  data->value = 45;
361  (PBYTE) &dummy, 0,
362  (PBYTE) &data->value, sizeof(data->value), &len, &status);
363 
364  TRACE("got %u with status %u\n", res, status);
365 
366  /* Set current setting as the initial value in the Dialog */
368  return TRUE;
369 
370  case WM_COMMAND:
371  if (wparam == MAKEWPARAM(IDOK, BN_CLICKED))
372  {
374 
375  status = FALSE;
377  /* length is in WCHAR, including the '\0' */
378  GetDlgItemTextW(hwnd, LPTCONFIG_EDIT, bufferW, sizeof(bufferW) / sizeof(bufferW[0]));
379  TRACE("got %s and %u (translated: %u)\n", debugstr_w(bufferW), res, status);
380 
381  /* native localui.dll use the same limits */
382  if ((res > 0) && (res < 1000000) && status) {
383  sprintfW(bufferW, fmt_uW, res);
385  (PBYTE) bufferW,
386  (lstrlenW(bufferW) +1) * sizeof(WCHAR),
387  (PBYTE) &dummy, 0, &len, &status);
388 
389  TRACE("got %u with status %u\n", res, status);
390  EndDialog(hwnd, TRUE);
391  return TRUE;
392  }
393 
394  /* Set initial value and rerun the Dialog */
396  return TRUE;
397  }
398 
400  {
401  EndDialog(hwnd, FALSE);
402  return TRUE;
403  }
404  return FALSE;
405  }
406  return FALSE;
407 }
408 
409 
410 /*****************************************************
411  * get_type_from_name (internal)
412  *
413  */
414 
416 {
417  HANDLE hfile;
418 
419  if (!strncmpiW(name, portname_LPT, sizeof(portname_LPT) / sizeof(WCHAR) -1))
420  return PORT_IS_LPT;
421 
422  if (!strncmpiW(name, portname_COM, sizeof(portname_COM) / sizeof(WCHAR) -1))
423  return PORT_IS_COM;
424 
425  if (!strcmpiW(name, portname_FILE))
426  return PORT_IS_FILE;
427 
428  if (name[0] == '/')
429  return PORT_IS_UNIXNAME;
430 
431  if (name[0] == '|')
432  return PORT_IS_PIPE;
433 
434  if (!strncmpW(name, portname_CUPS, sizeof(portname_CUPS) / sizeof(WCHAR) -1))
435  return PORT_IS_CUPS;
436 
437  if (!strncmpW(name, portname_LPR, sizeof(portname_LPR) / sizeof(WCHAR) -1))
438  return PORT_IS_LPR;
439 
440  /* Must be a file or a directory. Does the file exist ? */
442  TRACE("%p for OPEN_EXISTING on %s\n", hfile, debugstr_w(name));
443  if (hfile == INVALID_HANDLE_VALUE) {
444  /* Can we create the file? */
446  TRACE("%p for OPEN_ALWAYS\n", hfile);
447  }
448  if (hfile != INVALID_HANDLE_VALUE) {
449  CloseHandle(hfile);
450  return PORT_IS_FILENAME;
451  }
452  /* We can't use the name. use GetLastError() for the reason */
453  return PORT_IS_UNKNOWN;
454 }
455 
456 /*****************************************************
457  * open_monitor_by_name [internal]
458  *
459  */
460 static BOOL open_monitor_by_name(LPCWSTR pPrefix, LPCWSTR pPort, HANDLE * phandle)
461 {
463  LPWSTR fullname;
464  BOOL res;
465 
466  * phandle = 0;
467  TRACE("(%s,%s)\n", debugstr_w(pPrefix),debugstr_w(pPort) );
468 
469  fullname = strdupWW(pPrefix, pPort);
470  pd.pDatatype = NULL;
471  pd.pDevMode = NULL;
473 
474  res = OpenPrinterW(fullname, phandle, &pd);
475  HeapFree(GetProcessHeap(), 0, fullname);
476  return res;
477 }
478 
479 /*****************************************************
480  * localui_AddPortUI [exported through MONITORUI]
481  *
482  * Display a Dialog to add a local Port
483  *
484  * PARAMS
485  * pName [I] Servername or NULL (local Computer)
486  * hWnd [I] Handle to parent Window for the Dialog-Box or NULL
487  * pMonitorName[I] Name of the Monitor, that should be used to add a Port or NULL
488  * ppPortName [O] PTR to PTR of a buffer, that receive the Name of the new Port or NULL
489  *
490  * RETURNS
491  * Success: TRUE
492  * Failure: FALSE
493  *
494  * NOTES
495  * The caller must free the buffer (returned in ppPortName) with GlobalFree().
496  * Native localui.dll failed with ERROR_INVALID_PARAMETER, when the user tried
497  * to add a Port, that start with "COM" or "LPT".
498  *
499  */
500 static BOOL WINAPI localui_AddPortUI(PCWSTR pName, HWND hWnd, PCWSTR pMonitorName, PWSTR *ppPortName)
501 {
503  HANDLE hXcv;
504  DWORD needed;
505  DWORD dummy;
506  DWORD status;
507  DWORD res = FALSE;
508 
509  TRACE( "(%s, %p, %s, %p) (*ppPortName: %p)\n", debugstr_w(pName), hWnd,
510  debugstr_w(pMonitorName), ppPortName, ppPortName ? *ppPortName : NULL);
511 
512  if (open_monitor_by_name(XcvMonitorW, pMonitorName, &hXcv)) {
513 
514  ZeroMemory(&data, sizeof(addportui_t));
515  data.hXcv = hXcv;
518 
519  TRACE("got %u with %u for %s\n", res, GetLastError(), debugstr_w(data.portname));
520 
521  if (ppPortName) *ppPortName = NULL;
522 
523  if (res) {
524  res = XcvDataW(hXcv, cmd_AddPortW, (PBYTE) data.portname,
525  (lstrlenW(data.portname)+1) * sizeof(WCHAR),
526  (PBYTE) &dummy, 0, &needed, &status);
527 
528  TRACE("got %u with status %u\n", res, status);
529  if (res && (status == ERROR_SUCCESS) && ppPortName) {
530  /* Native localui uses GlobalAlloc also.
531  The caller must GlobalFree the buffer */
532  *ppPortName = GlobalAlloc(GPTR, (lstrlenW(data.portname)+1) * sizeof(WCHAR));
533  if (*ppPortName) lstrcpyW(*ppPortName, data.portname);
534  }
535 
536  if (res && (status == ERROR_ALREADY_EXISTS)) {
537  dlg_port_already_exists(hWnd, data.portname);
538  /* Native localui also return "TRUE" from AddPortUI in this case */
539  }
540 
541  HeapFree(GetProcessHeap(), 0, data.portname);
542  }
543  else
544  {
546  }
548  }
549 
550  TRACE("=> %u with %u\n", res, GetLastError());
551  return res;
552 }
553 
554 
555 /*****************************************************
556  * localui_ConfigurePortUI [exported through MONITORUI]
557  *
558  * Display the Configuration-Dialog for a specific Port
559  *
560  * PARAMS
561  * pName [I] Servername or NULL (local Computer)
562  * hWnd [I] Handle to parent Window for the Dialog-Box or NULL
563  * pPortName [I] Name of the Port, that should be configured
564  *
565  * RETURNS
566  * Success: TRUE
567  * Failure: FALSE
568  *
569  */
571 {
572  HANDLE hXcv;
573  DWORD res;
574 
575  TRACE("(%s, %p, %s)\n", debugstr_w(pName), hWnd, debugstr_w(pPortName));
576  if (open_monitor_by_name(XcvPortW, pPortName, &hXcv)) {
577 
578  res = get_type_from_name(pPortName);
579  switch(res)
580  {
581 
582  case PORT_IS_COM:
583  res = dlg_configure_com(hXcv, hWnd, pPortName);
584  break;
585 
586  case PORT_IS_LPT:
588  break;
589 
590  default:
593  res = FALSE;
594  }
595 
597  return res;
598  }
599  return FALSE;
600 
601 }
602 
603 /*****************************************************
604  * localui_DeletePortUI [exported through MONITORUI]
605  *
606  * Delete a specific Port
607  *
608  * PARAMS
609  * pName [I] Servername or NULL (local Computer)
610  * hWnd [I] Handle to parent Window
611  * pPortName [I] Name of the Port, that should be deleted
612  *
613  * RETURNS
614  * Success: TRUE
615  * Failure: FALSE
616  *
617  * NOTES
618  * Native localui does not allow deleting a COM/LPT port (ERROR_NOT_SUPPORTED)
619  *
620  */
622 {
623  HANDLE hXcv;
624  DWORD dummy;
625  DWORD needed;
626  DWORD status;
627 
628  TRACE("(%s, %p, %s)\n", debugstr_w(pName), hWnd, debugstr_w(pPortName));
629 
630  if ((!pPortName) || (!pPortName[0])) {
632  return FALSE;
633  }
634 
635  if (open_monitor_by_name(XcvPortW, pPortName, &hXcv)) {
636  /* native localui tests here for LPT / COM - Ports and failed with
637  ERROR_NOT_SUPPORTED. */
638  if (XcvDataW(hXcv, cmd_DeletePortW, (LPBYTE) pPortName,
639  (lstrlenW(pPortName)+1) * sizeof(WCHAR), (LPBYTE) &dummy, 0, &needed, &status)) {
640 
643  return (status == ERROR_SUCCESS);
644  }
646  return FALSE;
647  }
649  return FALSE;
650 }
651 
652 /*****************************************************
653  * InitializePrintMonitorUI (LOCALUI.@)
654  *
655  * Initialize the User-Interface for the Local Ports
656  *
657  * RETURNS
658  * Success: Pointer to a MONITORUI Structure
659  * Failure: NULL
660  *
661  */
662 
664 {
665  static MONITORUI mymonitorui =
666  {
667  sizeof(MONITORUI),
671  };
672 
673  TRACE("=> %p\n", &mymonitorui);
674  return &mymonitorui;
675 }
676 
677 /*****************************************************
678  * DllMain
679  */
681 {
682  TRACE("(%p, %d, %p)\n",hinstDLL, fdwReason, lpvReserved);
683 
684  switch(fdwReason)
685  {
686  case DLL_PROCESS_ATTACH:
687  DisableThreadLibraryCalls( hinstDLL );
688  LOCALUI_hInstance = hinstDLL;
689  break;
690  }
691  return TRUE;
692 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define WM_GETTEXTLENGTH
Definition: winuser.h:1601
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
const uint16_t * PCWSTR
Definition: typedefs.h:55
#define PORT_IS_CUPS
Definition: localui.h:58
Definition: tftpd.h:59
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2195
#define TRUE
Definition: types.h:120
#define MAKEWPARAM(l, h)
Definition: winuser.h:3916
static BOOL WINAPI localui_AddPortUI(PCWSTR pName, HWND hWnd, PCWSTR pMonitorName, PWSTR *ppPortName)
Definition: localui.c:500
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
#define IDOK
Definition: winuser.h:824
#define CloseHandle
Definition: compat.h:398
#define snprintfW
Definition: unicode.h:60
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define ERROR_SUCCESS
Definition: deptool.c:10
WINBOOL WINAPI XcvDataW(HANDLE hXcv, PCWSTR pszDataName, PBYTE pInputData, DWORD cbInputData, PBYTE pOutputData, DWORD cbOutputData, PDWORD pcbOutputNeeded, PDWORD pdwStatus)
Definition: printers.c:267
#define GPTR
Definition: winbase.h:293
#define ADDPORT_EDIT
Definition: localui.h:29
__wchar_t WCHAR
Definition: xmlstorage.h:180
uint16_t * PWSTR
Definition: typedefs.h:54
static HINSTANCE LOCALUI_hInstance
Definition: localui.c:40
GLenum GLuint GLenum GLsizei const GLchar * message
Definition: glext.h:5579
#define CALLBACK
Definition: compat.h:27
HWND hWnd
Definition: settings.c:17
struct _MONITORUI MONITORUI
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
static BOOL WINAPI localui_ConfigurePortUI(PCWSTR pName, HWND hWnd, PCWSTR pPortName)
Definition: localui.c:570
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
static BOOL open_monitor_by_name(LPCWSTR pPrefix, LPCWSTR pPort, HANDLE *phandle)
Definition: localui.c:460
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
static const WCHAR cmd_SetDefaultCommConfigW[]
Definition: localui.c:54
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1635
char * value
Definition: wpp.c:37
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
#define IDS_LOCALPORT
Definition: localui.h:35
#define LPTCONFIG_DIALOG
Definition: localui.h:31
#define GetWindowLongPtrW
Definition: winuser.h:4698
#define strncmpiW(s1, s2, n)
Definition: unicode.h:40
int32_t INT_PTR
Definition: typedefs.h:62
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
#define lstrlenW
Definition: compat.h:407
static const WCHAR cmd_GetDefaultCommConfigW[]
Definition: localui.c:47
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
static IN DWORD IN LPVOID lpvReserved
WINE_UNICODE_INLINE int strncmpW(const WCHAR *str1, const WCHAR *str2, int n)
Definition: unicode.h:235
UINT_PTR WPARAM
Definition: windef.h:207
LPDEVMODEW pDevMode
Definition: winspool.h:769
static const WCHAR portname_CUPS[]
Definition: localui.c:62
#define IDS_PORTEXISTS
Definition: localui.h:37
static const WCHAR cmd_DeletePortW[]
Definition: localui.c:46
static INT_PTR CALLBACK dlgproc_lptconfig(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: localui.c:341
#define PORT_IS_PIPE
Definition: localui.h:57
DWORD value
Definition: localui.c:77
static const WCHAR cmd_PortIsValidW[]
Definition: localui.c:53
unsigned char * LPBYTE
Definition: typedefs.h:52
LONG_PTR LPARAM
Definition: windef.h:208
static const WCHAR XcvPortW[]
Definition: localui.c:66
#define GENERIC_WRITE
Definition: nt_native.h:90
#define debugstr_w
Definition: kernel32.h:32
static PVOID ptr
Definition: dispmode.c:27
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:400
#define ERROR_UNKNOWN_PORT
Definition: winerror.h:1103
static LPWSTR strdupWW(LPCWSTR pPrefix, LPCWSTR pSuffix)
Definition: localui.c:87
WINBOOL WINAPI ClosePrinter(HANDLE hPrinter)
Definition: printers.c:12
static const WCHAR cmd_GetTransmissionRetryTimeoutW[]
Definition: localui.c:50
UINT msg
Definition: msvc.h:92
smooth NULL
Definition: ftsmooth.c:416
UINT WINAPI GetDlgItemInt(_In_ HWND, _In_ int, _Out_opt_ PBOOL, _In_ BOOL)
PMONITORUI WINAPI InitializePrintMonitorUI(void)
Definition: localui.c:663
#define PORT_IS_FILE
Definition: localui.h:51
HANDLE hXcv
Definition: localui.c:76
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:404
#define OPEN_EXISTING
Definition: compat.h:426
#define PORT_IS_LPT
Definition: localui.h:49
static BOOL WINAPI localui_DeletePortUI(PCWSTR pName, HWND hWnd, PCWSTR pPortName)
Definition: localui.c:621
#define TRACE(s)
Definition: solgame.cpp:4
static LPSTR pName
Definition: security.c:75
unsigned int BOOL
Definition: ntddk_ex.h:94
#define PORT_IS_LPR
Definition: localui.h:59
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
#define IDS_INVALIDNAME_MAXLEN
Definition: localui.h:42
#define PORT_IS_UNIXNAME
Definition: localui.h:56
static BOOL dlg_configure_lpt(HANDLE hXcv, HWND hWnd)
Definition: localui.c:153
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
Definition: localui.c:680
unsigned int UINT
Definition: ndis.h:50
#define FILE_FLAG_DELETE_ON_CLOSE
Definition: disk.h:42
#define BN_CLICKED
Definition: winuser.h:1886
unsigned long DWORD
Definition: ntddk_ex.h:95
ACCESS_MASK DesiredAccess
Definition: winspool.h:770
#define SetLastError(x)
Definition: compat.h:409
static void dlg_nothingtoconfig(HWND hWnd)
Definition: localui.c:227
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define OPEN_ALWAYS
Definition: disk.h:70
#define ADDPORT_DIALOG
Definition: localui.h:28
#define PORT_IS_FILENAME
Definition: localui.h:52
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static const WCHAR cmd_ConfigureLPTPortCommandOKW[]
Definition: localui.c:43
#define MB_ICONINFORMATION
Definition: winuser.h:796
static const WCHAR XcvMonitorW[]
Definition: localui.c:65
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
BOOL WINAPI SetDlgItemInt(_In_ HWND, _In_ int, _In_ UINT, _In_ BOOL)
#define DWLP_USER
Definition: winuser.h:866
#define MB_ICONERROR
Definition: winuser.h:781
#define IDS_NOTHINGTOCONFIG
Definition: localui.h:38
static INT_PTR CALLBACK dlgproc_addport(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: localui.c:267
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
static const WCHAR portname_COM[]
Definition: localui.c:60
#define WM_COMMAND
Definition: winuser.h:1716
LPWSTR portname
Definition: localui.c:71
static void dlg_invalid_portname(HWND hWnd, LPCWSTR portname)
Definition: localui.c:200
UINT WPARAM LPARAM lparam
Definition: msvc.h:92
#define WINAPI
Definition: msvc.h:20
#define strcmpiW(s1, s2)
Definition: unicode.h:39
static const WCHAR cmd_AddPortW[]
Definition: localui.c:42
WINBOOL WINAPI OpenPrinterW(LPWSTR pPrinterName, LPHANDLE phPrinter, LPPRINTER_DEFAULTSW pDefault)
Definition: printers.c:757
static DWORD get_type_from_name(LPCWSTR name)
Definition: localui.c:415
#define lstrcpyW
Definition: compat.h:406
#define ERROR_CANCELLED
Definition: winerror.h:726
#define IDS_PORTEXISTS_MAXLEN
Definition: localui.h:43
unsigned char dummy
Definition: maze.c:118
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define PORT_IS_UNKNOWN
Definition: localui.h:48
static void dlg_port_already_exists(HWND hWnd, LPCWSTR portname)
Definition: localui.c:174
#define IDS_INVALIDNAME
Definition: localui.h:36
#define sprintfW
Definition: unicode.h:58
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
WINE_DEFAULT_DEBUG_CHANNEL(localui)
static BOOL dlg_configure_com(HANDLE hXcv, HWND hWnd, PCWSTR pPortName)
Definition: localui.c:106
#define MB_OK
Definition: winuser.h:784
#define SERVER_ACCESS_ADMINISTER
Definition: winspool.h:1273
#define IDS_LOCALPORT_MAXLEN
Definition: localui.h:41
#define CreateFileW
Definition: compat.h:400
Definition: name.c:36
#define IDS_NOTHINGTOCONFIG_MAXLEN
Definition: localui.h:44
struct tag_addportui_t addportui_t
GLuint res
Definition: glext.h:9613
static const WCHAR fmt_uW[]
Definition: localui.c:58
#define LPTCONFIG_EDIT
Definition: localui.h:33
#define ERROR_INVALID_NAME
Definition: compat.h:93
BOOL WINAPI CommConfigDialogW(LPCWSTR lpszDevice, HWND hWnd, LPCOMMCONFIG lpCommConfig)
Definition: comm.c:1239
#define SetWindowLongPtrW
Definition: winuser.h:5215
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
static HANDLE hXcv
Definition: localmon.c:61
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define IDCANCEL
Definition: winuser.h:825
struct tag_lptconfig_t lptconfig_t
#define PORT_IS_COM
Definition: localui.h:50
HANDLE hXcv
Definition: localui.c:72
static const WCHAR portname_FILE[]
Definition: localui.c:61
static SERVICE_STATUS status
Definition: service.c:31
BYTE * PBYTE
Definition: pedump.c:66
#define WM_INITDIALOG
Definition: winuser.h:1715
static const WCHAR portname_LPT[]
Definition: localui.c:59
#define HeapFree(x, y, z)
Definition: compat.h:394
static const WCHAR portname_LPR[]
Definition: localui.c:63
static void dlg_win32error(HWND hWnd, DWORD lasterror)
Definition: localui.c:244
UINT WPARAM wparam
Definition: msvc.h:92
Definition: ps.c:97