ReactOS 0.4.16-dev-297-gc569aee
printui.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winreg.h"
#include "winver.h"
#include "winnls.h"
#include "shellapi.h"
#include "wine/debug.h"
#include "printui_private.h"
Include dependency graph for printui.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (printui)
 
static LPWSTR get_next_wstr (context_t *cx)
 
static WCHAR get_next_wchar (context_t *cx, BOOL use_next_parameter)
 
static BOOL parse_rundll (context_t *cx)
 
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
 
void WINAPI PrintUIEntryW (HWND hWnd, HINSTANCE hInst, LPCWSTR pCommand, DWORD nCmdShow)
 

Variables

static const WCHAR optionsW [OPT_MAX+1] ={'a','b','c','f','h','j','l','m','n','t','r','v',0}
 
static const WCHAR flagsW [FLAG_MAX+1] ={'q','w','y','z','Z',0}
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 23 of file printui.c.

Function Documentation

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  hinstDLL,
DWORD  fdwReason,
LPVOID  lpvReserved 
)

Definition at line 216 of file printui.c.

217{
218 TRACE("(%p, %d, %p)\n",hinstDLL, fdwReason, lpvReserved);
219
220 switch(fdwReason)
221 {
222 case DLL_WINE_PREATTACH:
223 return FALSE; /* prefer native version */
224
226 DisableThreadLibraryCalls( hinstDLL );
227 break;
228 }
229 return TRUE;
230}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
static IN DWORD IN LPVOID lpvReserved
#define TRACE(s)
Definition: solgame.cpp:4

◆ get_next_wchar()

static WCHAR get_next_wchar ( context_t cx,
BOOL  use_next_parameter 
)
static

Definition at line 85 of file printui.c.

86{
87 WCHAR c;
88
89 /* Try the next WCHAR in the actual Parameter */
90 if (cx->pNextCharW) {
91 c = *cx->pNextCharW;
92 if (c) {
93 cx->pNextCharW++;
94 return c;
95 }
96 /* We reached the end of the Parameter */
97 cx->pNextCharW = NULL;
98 }
99
100 /* Get the next Parameter, when available and allowed */
101 if ((cx->pNextCharW == NULL) && (cx->next_arg < cx->argc) && (use_next_parameter)) {
102 cx->pNextCharW = cx->argv[cx->next_arg];
103 cx->next_arg++;
104 }
105
106 if (cx->pNextCharW) {
107 c = *cx->pNextCharW;
108 if (c) {
109 cx->pNextCharW++;
110 }
111 else
112 {
113 /* We reached the end of the Parameter */
114 cx->pNextCharW = NULL;
115 }
116 return c;
117 }
118 return '\0';
119}
#define NULL
Definition: types.h:112
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80
_Out_opt_ int * cx
Definition: commctrl.h:585
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by parse_rundll().

◆ get_next_wstr()

static LPWSTR get_next_wstr ( context_t cx)
static

Definition at line 55 of file printui.c.

56{
57 LPWSTR ptr;
58
59 ptr = cx->pNextCharW;
60 if (ptr && ptr[0]) {
61 cx->pNextCharW = NULL;
62 return ptr;
63 }
64
65 /* Get the next Parameter, when available */
66 if (cx->next_arg < cx->argc) {
67 ptr = cx->argv[cx->next_arg];
68 cx->next_arg++;
69 cx->pNextCharW = NULL;
70 return ptr;
71 }
72 return NULL;
73}
static PVOID ptr
Definition: dispmode.c:27
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by parse_rundll().

◆ parse_rundll()

static BOOL parse_rundll ( context_t cx)
static

Definition at line 122 of file printui.c.

123{
124 LPWSTR ptr;
125 DWORD index;
126 WCHAR txtW[2];
127 WCHAR c;
128
129
131 txtW[1] = '\0';
132
133 while (c)
134 {
135
136 while ( (c == ' ') || (c == '\t'))
137 {
139 }
140 txtW[0] = c;
141
142 if (c == '@') {
143 /* read commands from a File */
145 FIXME("redir not supported: %s\n", debugstr_w(ptr));
146 return FALSE;
147 }
148 else if (c == '/') {
150 while ( c )
151 {
152 txtW[0] = c;
153 ptr = wcschr(optionsW, c);
154 if (ptr) {
155 index = ptr - optionsW;
156 cx->options[index] = get_next_wstr(cx);
157 TRACE(" opt: %s %s\n", debugstr_w(txtW), debugstr_w(cx->options[index]));
158 c = 0;
159 }
160 else
161 {
162 ptr = wcschr(flagsW, c);
163 if (ptr) {
164 index = ptr - flagsW;
165 cx->flags[index] = TRUE;
166 TRACE("flag: %s\n", debugstr_w(txtW));
167 }
168 else
169 {
170 cx->command = c;
171 cx->subcommand = '\0';
172 TRACE(" cmd: %s\n", debugstr_w(txtW));
173 }
174
175 /* help has priority over all commands */
176 if (c == '?') {
177 return TRUE;
178 }
179
181
182 /* Some commands use two wchar */
183 if ((cx->command == 'd') || (cx->command == 'g') || (cx->command == 'i') ||
184 (cx->command == 'S') || (cx->command == 'X') ){
185 cx->subcommand = c;
186 txtW[0] = c;
187 TRACE(" sub: %s\n", debugstr_w(txtW));
189 }
190 }
191 }
193
194 }
195 else
196 {
197 /* The commands 'S' and 'X' have additional Parameter */
198 if ((cx->command == 'S') || (cx->command == 'X')) {
199
200 /* the actual WCHAR is the start from the extra Parameter */
201 cx->pNextCharW--;
202 TRACE("%d extra Parameter, starting with %s\n", 1 + (cx->argc - cx->next_arg), debugstr_w(cx->pNextCharW));
203 return TRUE;
204 }
205 FIXME("0x%x: %s is unknown\n", c, debugstr_wn(&c, 1));
206 return FALSE;
207 }
208
209 }
210 return TRUE;
211}
#define index(s, c)
Definition: various.h:29
#define FIXME(fmt,...)
Definition: precomp.h:53
#define wcschr
Definition: compat.h:17
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint index
Definition: glext.h:6031
#define debugstr_wn
Definition: kernel32.h:33
#define debugstr_w
Definition: kernel32.h:32
static const WCHAR optionsW[OPT_MAX+1]
Definition: printui.c:42
static WCHAR get_next_wchar(context_t *cx, BOOL use_next_parameter)
Definition: printui.c:85
static const WCHAR flagsW[FLAG_MAX+1]
Definition: printui.c:45
static LPWSTR get_next_wstr(context_t *cx)
Definition: printui.c:55

Referenced by PrintUIEntryW().

◆ PrintUIEntryW()

void WINAPI PrintUIEntryW ( HWND  hWnd,
HINSTANCE  hInst,
LPCWSTR  pCommand,
DWORD  nCmdShow 
)

Definition at line 238 of file printui.c.

239{
241 BOOL res = FALSE;
242
243 TRACE("(%p, %p, %s, 0x%x)\n", hWnd, hInst, debugstr_w(pCommand), nCmdShow);
244
245 memset(&cx, 0, sizeof(context_t));
246 cx.hWnd = hWnd;
247 cx.nCmdShow = nCmdShow;
248
249 if ((pCommand) && (pCommand[0])) {
250 /* result is allocated with GlobalAlloc() */
251 cx.argv = CommandLineToArgvW(pCommand, &cx.argc);
252 TRACE("got %d args at %p\n", cx.argc, cx.argv);
253
254 res = parse_rundll(&cx);
255 }
256
257 if (res && cx.command) {
258 switch (cx.command)
259 {
260
261 default:
262 {
263 WCHAR txtW[3];
264 txtW[0] = cx.command;
265 txtW[1] = cx.subcommand;
266 txtW[2] = '\0';
267 FIXME("command not implemented: %s\n", debugstr_w(txtW));
268 }
269 }
270 }
271
272 if ((res == FALSE) || (cx.command == '\0')) {
273 FIXME("dialog: Printer / The operation was not successful\n");
274 }
275
276 GlobalFree(cx.argv);
277
278}
HWND hWnd
Definition: settings.c:17
HINSTANCE hInst
Definition: dxdiag.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint res
Definition: glext.h:9613
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
static BOOL parse_rundll(context_t *cx)
Definition: printui.c:122
#define memset(x, y, z)
Definition: compat.h:39
LPWSTR *WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int *numargs)
Definition: shell32_main.c:79

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( printui  )

Variable Documentation

◆ flagsW

const WCHAR flagsW[FLAG_MAX+1] ={'q','w','y','z','Z',0}
static

Definition at line 45 of file printui.c.

Referenced by parse_rundll().

◆ optionsW

const WCHAR optionsW[OPT_MAX+1] ={'a','b','c','f','h','j','l','m','n','t','r','v',0}
static

Definition at line 42 of file printui.c.

Referenced by parse_rundll().