ReactOS  0.4.12-dev-918-g6c6e7b8
format_msg.c
Go to the documentation of this file.
1 /*
2  * FormatMessage implementation
3  *
4  * Copyright 1996 Marcus Meissner
5  * Copyright 2009 Alexandre Julliard
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20  */
21 
22 #ifdef __REACTOS__
23 
24 #include <k32.h>
25 
26 #define NDEBUG
27 #include <debug.h>
29 
31 
32 #else /* __REACTOS__ */
33 
34 #include "config.h"
35 
36 #include <stdarg.h>
37 #include <stdio.h>
38 #include <string.h>
39 
40 #include "ntstatus.h"
41 #define WIN32_NO_STATUS
42 #include "windef.h"
43 #include "winbase.h"
44 #include "winerror.h"
45 #include "winternl.h"
46 #include "winuser.h"
47 #include "winnls.h"
48 #include "wine/unicode.h"
49 #include "kernel_private.h"
50 #include "wine/debug.h"
51 
53 
54 #endif /* __REACTOS__ */
55 
57 {
60  int last;
61 };
62 
63 /* Messages used by FormatMessage
64  *
65  * They can be specified either directly or using a message ID and
66  * loading them from the resource.
67  *
68  * The resourcedata has following format:
69  * start:
70  * 0: DWORD nrofentries
71  * nrofentries * subentry:
72  * 0: DWORD firstentry
73  * 4: DWORD lastentry
74  * 8: DWORD offset from start to the stringentries
75  *
76  * (lastentry-firstentry) * stringentry:
77  * 0: WORD len (0 marks end) [ includes the 4 byte header length ]
78  * 2: WORD flags
79  * 4: CHAR[len-4]
80  * (stringentry i of a subentry refers to the ID 'firstentry+i')
81  *
82  * Yes, ANSI strings in win32 resources. Go figure.
83  */
84 
85 /**********************************************************************
86  * load_message (internal)
87  */
89 {
90 #ifdef __REACTOS__
92 #else
93  const MESSAGE_RESOURCE_ENTRY *mre;
94 #endif
95  WCHAR *buffer;
97 
98  TRACE("module = %p, id = %08x\n", module, id );
99 
100  if (!module) module = GetModuleHandleW( NULL );
101 #ifdef __REACTOS__
103  if (!NT_SUCCESS(status))
104 #else
106 #endif
107  {
109  return NULL;
110  }
111 
112  if (mre->Flags & MESSAGE_RESOURCE_UNICODE)
113  {
114  int len = (strlenW( (const WCHAR *)mre->Text ) + 1) * sizeof(WCHAR);
115  if (!(buffer = HeapAlloc( GetProcessHeap(), 0, len ))) return NULL;
116  memcpy( buffer, mre->Text, len );
117  }
118  else
119  {
120  int len = MultiByteToWideChar( CP_ACP, 0, (const char *)mre->Text, -1, NULL, 0 );
121  if (!(buffer = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return NULL;
122  MultiByteToWideChar( CP_ACP, 0, (const char*)mre->Text, -1, buffer, len );
123  }
124  TRACE("returning %s\n", wine_dbgstr_w(buffer));
125  return buffer;
126 }
127 
129 {
130  LPWSTR from = NULL;
132  from = load_message( module, id, lang );
134  {
135  /* Fold win32 hresult to its embedded error code. */
136  if (HRESULT_SEVERITY(id) == SEVERITY_ERROR &&
138  {
139  id = HRESULT_CODE(id);
140  }
142  }
143  return from;
144 }
145 
146 /**********************************************************************
147  * get_arg (internal)
148  */
149 static ULONG_PTR get_arg( int nr, DWORD flags, struct format_args *args )
150 {
151  if (nr == -1) nr = args->last + 1;
152  if (args->list)
153  {
154  if (!args->args) args->args = HeapAlloc( GetProcessHeap(), 0, 99 * sizeof(ULONG_PTR) );
155  while (nr > args->last)
156  args->args[args->last++] = va_arg( *args->list, ULONG_PTR );
157  }
158  if (nr > args->last) args->last = nr;
159  return args->args[nr - 1];
160 }
161 
162 /**********************************************************************
163  * format_insert (internal)
164  */
165 static LPCWSTR format_insert( BOOL unicode_caller, int insert, LPCWSTR format,
166  DWORD flags, struct format_args *args,
167  LPWSTR *result )
168 {
169  static const WCHAR fmt_u[] = {'%','u',0};
170  WCHAR *wstring = NULL, *p, fmt[256];
171  ULONG_PTR arg;
172  int size;
173 
174  if (*format != '!') /* simple string */
175  {
176  arg = get_arg( insert, flags, args );
177  if (unicode_caller || !arg)
178  {
179  static const WCHAR nullW[] = {'(','n','u','l','l',')',0};
180  const WCHAR *str = (const WCHAR *)arg;
181 
182  if (!str) str = nullW;
183  *result = HeapAlloc( GetProcessHeap(), 0, (strlenW(str) + 1) * sizeof(WCHAR) );
184  strcpyW( *result, str );
185  }
186  else
187  {
188  const char *str = (const char *)arg;
189  DWORD length = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
190  *result = HeapAlloc( GetProcessHeap(), 0, length * sizeof(WCHAR) );
192  }
193  return format;
194  }
195 
196  format++;
197  p = fmt;
198  *p++ = '%';
199 
200  while (*format == '0' ||
201  *format == '+' ||
202  *format == '-' ||
203  *format == ' ' ||
204  *format == '*' ||
205  *format == '#')
206  {
207  if (*format == '*')
208  {
209  p += sprintfW( p, fmt_u, get_arg( insert, flags, args ));
210  insert = -1;
211  format++;
212  }
213  else *p++ = *format++;
214  }
215  while (isdigitW(*format)) *p++ = *format++;
216 
217  if (*format == '.')
218  {
219  *p++ = *format++;
220  if (*format == '*')
221  {
222  p += sprintfW( p, fmt_u, get_arg( insert, flags, args ));
223  insert = -1;
224  format++;
225  }
226  else
227  while (isdigitW(*format)) *p++ = *format++;
228  }
229 
230  /* replicate MS bug: drop an argument when using va_list with width/precision */
231  if (insert == -1 && args->list) args->last--;
232  arg = get_arg( insert, flags, args );
233 
234  /* check for ascii string format */
235  if ((format[0] == 'h' && format[1] == 's') ||
236  (format[0] == 'h' && format[1] == 'S') ||
237  (unicode_caller && format[0] == 'S') ||
238  (!unicode_caller && format[0] == 's'))
239  {
240  DWORD len = MultiByteToWideChar( CP_ACP, 0, (char *)arg, -1, NULL, 0 );
241  wstring = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
242  MultiByteToWideChar( CP_ACP, 0, (char *)arg, -1, wstring, len );
243  arg = (ULONG_PTR)wstring;
244  *p++ = 's';
245  }
246  /* check for ascii character format */
247  else if ((format[0] == 'h' && format[1] == 'c') ||
248  (format[0] == 'h' && format[1] == 'C') ||
249  (unicode_caller && format[0] == 'C') ||
250  (!unicode_caller && format[0] == 'c'))
251  {
252  char ch = arg;
253  wstring = HeapAlloc( GetProcessHeap(), 0, 2 * sizeof(WCHAR) );
254  MultiByteToWideChar( CP_ACP, 0, &ch, 1, wstring, 1 );
255  wstring[1] = 0;
256  arg = (ULONG_PTR)wstring;
257  *p++ = 's';
258  }
259  /* check for wide string format */
260  else if ((format[0] == 'l' && format[1] == 's') ||
261  (format[0] == 'l' && format[1] == 'S') ||
262  (format[0] == 'w' && format[1] == 's') ||
263  (!unicode_caller && format[0] == 'S'))
264  {
265  *p++ = 's';
266  }
267  /* check for wide character format */
268  else if ((format[0] == 'l' && format[1] == 'c') ||
269  (format[0] == 'l' && format[1] == 'C') ||
270  (format[0] == 'w' && format[1] == 'c') ||
271  (!unicode_caller && format[0] == 'C'))
272  {
273  *p++ = 'c';
274  }
275  /* FIXME: handle I64 etc. */
276  else while (*format && *format != '!') *p++ = *format++;
277 
278  *p = 0;
279  size = 256;
280  for (;;)
281  {
282  WCHAR *ret = HeapAlloc( GetProcessHeap(), 0, size * sizeof(WCHAR) );
283  int needed = snprintfW( ret, size, fmt, arg );
284  if (needed == -1 || needed >= size)
285  {
286  HeapFree( GetProcessHeap(), 0, ret );
287  size = max( needed + 1, size * 2 );
288  }
289  else
290  {
291  *result = ret;
292  break;
293  }
294  }
295 
296  while (*format && *format != '!') format++;
297  if (*format == '!') format++;
298 
299  HeapFree( GetProcessHeap(), 0, wstring );
300  return format;
301 }
302 
304 {
311 };
312 
313 static void format_add_char(struct _format_message_data *fmd, WCHAR c)
314 {
315  *fmd->t++ = c;
316  if (fmd->width && fmd->width != FORMAT_MESSAGE_MAX_WIDTH_MASK)
317  {
318  switch (c) {
319  case '\r':
320  case '\n':
321  fmd->space = NULL;
322  fmd->inspace = FALSE;
323  fmd->w = 0;
324  break;
325  case ' ':
326  if (!fmd->inspace)
327  fmd->space = fmd->t - 1;
328  fmd->inspace = TRUE;
329  fmd->w++;
330  break;
331  default:
332  fmd->inspace = FALSE;
333  fmd->w++;
334  }
335  if (fmd->w == fmd->width) {
336  LPWSTR notspace;
337  if (fmd->space) {
338  notspace = fmd->space;
339  while (notspace != fmd->t && *notspace == ' ')
340  notspace++;
341  } else
342  notspace = fmd->space = fmd->t;
343  fmd->w = fmd->t - notspace;
344  memmove(fmd->space+2, notspace, fmd->w * sizeof(*fmd->t));
345  *fmd->space++ = '\r';
346  *fmd->space++ = '\n';
347  fmd->t = fmd->space + fmd->w;
348  fmd->space = NULL;
349  fmd->inspace = FALSE;
350  }
351  }
352  if ((DWORD)(fmd->t - fmd->formatted) == fmd->size) {
353  DWORD_PTR ispace = fmd->space - fmd->formatted;
354  /* Allocate two extra characters so we can insert a '\r\n' in
355  * the middle of a word.
356  */
357  fmd->formatted = HeapReAlloc(GetProcessHeap(), 0, fmd->formatted, (fmd->size * 2 + 2) * sizeof(WCHAR));
358  fmd->t = fmd->formatted + fmd->size;
359  if (fmd->space)
360  fmd->space = fmd->formatted + ispace;
361  fmd->size *= 2;
362  }
363 }
364 
365 /**********************************************************************
366  * format_message (internal)
367  */
368 static LPWSTR format_message( BOOL unicode_caller, DWORD dwFlags, LPCWSTR fmtstr,
369  struct format_args *format_args )
370 {
371  struct _format_message_data fmd;
372  LPCWSTR f;
373  BOOL eos = FALSE;
374 
375  fmd.size = 100;
376  fmd.formatted = fmd.t = HeapAlloc( GetProcessHeap(), 0, (fmd.size + 2) * sizeof(WCHAR) );
377 
379  fmd.w = 0;
380  fmd.inspace = FALSE;
381  fmd.space = NULL;
382  f = fmtstr;
383  while (*f && !eos) {
384  if (*f=='%') {
385  int insertnr;
386  WCHAR *str,*x;
387 
388  f++;
389  switch (*f) {
390  case '1':case '2':case '3':case '4':case '5':
391  case '6':case '7':case '8':case '9':
393  goto ignore_inserts;
396  {
398  HeapFree(GetProcessHeap(), 0, fmd.formatted);
399  return NULL;
400  }
401  insertnr = *f-'0';
402  switch (f[1]) {
403  case '0':case '1':case '2':case '3':
404  case '4':case '5':case '6':case '7':
405  case '8':case '9':
406  f++;
407  insertnr = insertnr*10 + *f-'0';
408  f++;
409  break;
410  default:
411  f++;
412  break;
413  }
414  f = format_insert( unicode_caller, insertnr, f, dwFlags, format_args, &str );
415  for (x = str; *x; x++) format_add_char(&fmd, *x);
416  HeapFree( GetProcessHeap(), 0, str );
417  break;
418  case 'n':
419  format_add_char(&fmd, '\r');
420  format_add_char(&fmd, '\n');
421  f++;
422  break;
423  case 'r':
424  format_add_char(&fmd, '\r');
425  f++;
426  break;
427  case 't':
428  format_add_char(&fmd, '\t');
429  f++;
430  break;
431  case '0':
432  eos = TRUE;
433  f++;
434  break;
435  case '\0':
437  HeapFree(GetProcessHeap(), 0, fmd.formatted);
438  return NULL;
439  ignore_inserts:
440  default:
442  format_add_char(&fmd, '%');
443  format_add_char(&fmd, *f++);
444  break;
445  }
446  } else {
447  WCHAR ch = *f;
448  f++;
449  if (ch == '\r') {
450  if (*f == '\n')
451  f++;
452  if(fmd.width)
453  format_add_char(&fmd, ' ');
454  else
455  {
456  format_add_char(&fmd, '\r');
457  format_add_char(&fmd, '\n');
458  }
459  } else {
460  if (ch == '\n')
461  {
462  if(fmd.width)
463  format_add_char(&fmd, ' ');
464  else
465  {
466  format_add_char(&fmd, '\r');
467  format_add_char(&fmd, '\n');
468  }
469  }
470  else
471  format_add_char(&fmd, ch);
472  }
473  }
474  }
475  *fmd.t = '\0';
476 
477  return fmd.formatted;
478 }
479 
480 /***********************************************************************
481  * FormatMessageA (KERNEL32.@)
482  */
484  DWORD dwFlags,
485  LPCVOID lpSource,
486  DWORD dwMessageId,
487  DWORD dwLanguageId,
488  LPSTR lpBuffer,
489  DWORD nSize,
490  __ms_va_list* args )
491 {
492  struct format_args format_args;
493  DWORD ret = 0;
494  LPWSTR target;
495  DWORD destlength;
496  LPWSTR from;
497 
498  TRACE("(0x%x,%p,%d,0x%x,%p,%d,%p)\n",
499  dwFlags,lpSource,dwMessageId,dwLanguageId,lpBuffer,nSize,args);
500 
502  {
503  if (!lpBuffer)
504  {
506  return 0;
507  }
508  else
509  *(LPSTR *)lpBuffer = NULL;
510  }
511 
513  {
516  format_args.last = 0;
517  }
518  else
519  {
522  format_args.last = 0;
523  }
524 
525  from = NULL;
527  {
528  DWORD length = MultiByteToWideChar(CP_ACP, 0, lpSource, -1, NULL, 0);
529  from = HeapAlloc( GetProcessHeap(), 0, length * sizeof(WCHAR) );
530  MultiByteToWideChar(CP_ACP, 0, lpSource, -1, from, length);
531  }
533  {
534  from = search_message( dwFlags, (HMODULE)lpSource, dwMessageId, dwLanguageId );
535  if (!from) return 0;
536  }
537  else
538  {
540  return 0;
541  }
542 
544  if (!target)
545  goto failure;
546 
547  TRACE("-- %s\n", debugstr_w(target));
548 
549  /* Only try writing to an output buffer if there are processed characters
550  * in the temporary output buffer. */
551  if (*target)
552  {
553  destlength = WideCharToMultiByte(CP_ACP, 0, target, -1, NULL, 0, NULL, NULL);
555  {
556  LPSTR buf = LocalAlloc(LMEM_ZEROINIT, max(nSize, destlength));
557  WideCharToMultiByte(CP_ACP, 0, target, -1, buf, destlength, NULL, NULL);
558  *((LPSTR*)lpBuffer) = buf;
559  }
560  else
561  {
562  if (nSize < destlength)
563  {
565  goto failure;
566  }
567  WideCharToMultiByte(CP_ACP, 0, target, -1, lpBuffer, destlength, NULL, NULL);
568  }
569  ret = destlength - 1; /* null terminator */
570  }
571 
572 failure:
576  TRACE("-- returning %u\n", ret);
577  return ret;
578 }
579 
580 /***********************************************************************
581  * FormatMessageW (KERNEL32.@)
582  */
584  DWORD dwFlags,
585  LPCVOID lpSource,
586  DWORD dwMessageId,
587  DWORD dwLanguageId,
589  DWORD nSize,
590  __ms_va_list* args )
591 {
592  struct format_args format_args;
593  DWORD ret = 0;
594  LPWSTR target;
595  DWORD talloced;
596  LPWSTR from;
597 
598  TRACE("(0x%x,%p,%d,0x%x,%p,%d,%p)\n",
599  dwFlags,lpSource,dwMessageId,dwLanguageId,lpBuffer,nSize,args);
600 
601  if (!lpBuffer)
602  {
604  return 0;
605  }
606 
608  *(LPWSTR *)lpBuffer = NULL;
609 
611  {
614  format_args.last = 0;
615  }
616  else
617  {
620  format_args.last = 0;
621  }
622 
623  from = NULL;
625  from = HeapAlloc( GetProcessHeap(), 0, (strlenW(lpSource) + 1) *
626  sizeof(WCHAR) );
627  strcpyW( from, lpSource );
628  }
630  {
631  from = search_message( dwFlags, (HMODULE)lpSource, dwMessageId, dwLanguageId );
632  if (!from) return 0;
633  }
634  else
635  {
637  return 0;
638  }
639 
641  if (!target)
642  goto failure;
643 
644  talloced = strlenW(target)+1;
645  TRACE("-- %s\n",debugstr_w(target));
646 
647  /* Only allocate a buffer if there are processed characters in the
648  * temporary output buffer. If a caller supplies the buffer, then
649  * a null terminator will be written to it. */
651  {
652  if (*target)
653  {
654  /* nSize is the MINIMUM size */
655  *((LPVOID*)lpBuffer) = LocalAlloc(LMEM_ZEROINIT, max(nSize, talloced)*sizeof(WCHAR));
657  }
658  }
659  else
660  {
661  if (nSize < talloced)
662  {
664  goto failure;
665  }
667  }
668 
669  ret = talloced - 1; /* null terminator */
670 failure:
674  TRACE("-- returning %u\n", ret);
675  return ret;
676 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define MESSAGE_RESOURCE_UNICODE
Definition: rtltypes.h:354
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define max(a, b)
Definition: svc.c:63
static const char __ms_va_list
Definition: printf.c:70
Definition: rtltypes.h:1827
#define TRUE
Definition: types.h:120
HMODULE kernel32_handle
Definition: dllmain.c:26
ULONG_PTR * args
Definition: format_msg.c:58
#define FORMAT_MESSAGE_MAX_WIDTH_MASK
Definition: winbase.h:406
#define snprintfW
Definition: unicode.h:60
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define WideCharToMultiByte
Definition: compat.h:101
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
ULONG nr
Definition: thread.c:7
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define CP_ACP
Definition: compat.h:99
#define FORMAT_MESSAGE_ARGUMENT_ARRAY
Definition: winbase.h:405
#define FORMAT_MESSAGE_FROM_STRING
Definition: winbase.h:402
DWORD WINAPI FormatMessageA(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:483
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2024
LONG NTSTATUS
Definition: precomp.h:26
const char * fmt
Definition: wsprintf.c:30
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
NTSYSAPI NTSTATUS NTAPI RtlFindMessage(_In_ PVOID BaseAddress, _In_ ULONG Type, _In_ ULONG Language, _In_ ULONG MessageId, _Out_ PMESSAGE_RESOURCE_ENTRY *MessageResourceEntry)
GLuint buffer
Definition: glext.h:5915
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
void * arg
Definition: msvc.h:12
static int insert
Definition: xmllint.c:144
char * LPSTR
Definition: xmlstorage.h:182
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
USHORT Flags
Definition: rtltypes.h:1830
Definition: match.c:390
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
uint32_t ULONG_PTR
Definition: typedefs.h:63
static LPWSTR format_message(BOOL unicode_caller, DWORD dwFlags, LPCWSTR fmtstr, struct format_args *format_args)
Definition: format_msg.c:368
unsigned int BOOL
Definition: ntddk_ex.h:94
#define HRESULT_FACILITY(hr)
Definition: winerror.h:79
#define debugstr_w
Definition: kernel32.h:32
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:400
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: CString.cpp:62
const WCHAR * str
#define DEBUG_CHANNEL(args)
Definition: rdesktop.h:159
smooth NULL
Definition: ftsmooth.c:416
__ms_va_list * list
Definition: format_msg.c:59
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:404
#define FORMAT_MESSAGE_FROM_HMODULE
Definition: winbase.h:403
static const WCHAR lang[]
Definition: wbemdisp.c:287
GLfloat f
Definition: glext.h:7540
#define RT_MESSAGETABLE
Definition: pedump.c:373
#define TRACE(s)
Definition: solgame.cpp:4
UCHAR Text[ANYSIZE_ARRAY]
Definition: rtltypes.h:1831
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define LMEM_ZEROINIT
Definition: winbase.h:356
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
static LPWSTR search_message(DWORD flags, HMODULE module, UINT id, WORD lang)
Definition: format_msg.c:128
#define HRESULT_SEVERITY(hr)
Definition: winerror.h:82
#define WINAPI
Definition: msvc.h:8
const GLubyte * c
Definition: glext.h:8905
static LPWSTR load_message(HMODULE module, UINT id, WORD lang)
Definition: format_msg.c:88
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
#define SEVERITY_ERROR
Definition: winerror.h:65
GLbitfield flags
Definition: glext.h:7161
int ret
static LPCWSTR format_insert(BOOL unicode_caller, int insert, LPCWSTR format, DWORD flags, struct format_args *args, LPWSTR *result)
Definition: format_msg.c:165
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
uint32_t DWORD_PTR
Definition: typedefs.h:63
static ULONG_PTR get_arg(int nr, DWORD flags, struct format_args *args)
Definition: format_msg.c:149
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define FACILITY_WIN32
Definition: winerror.h:27
#define FORMAT_MESSAGE_IGNORE_INSERTS
Definition: winbase.h:401
#define va_arg(ap, T)
Definition: acmsvcex.h:89
WINE_DEFAULT_DEBUG_CHANNEL(resource)
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
#define f
Definition: ke_i.h:83
#define HeapReAlloc
Definition: compat.h:393
#define sprintfW
Definition: unicode.h:58
WINE_UNICODE_INLINE int isdigitW(WCHAR wc)
Definition: unicode.h:170
unsigned int UINT
Definition: ndis.h:50
static void format_add_char(struct _format_message_data *fmd, WCHAR c)
Definition: format_msg.c:313
#define MultiByteToWideChar
Definition: compat.h:100
CONST void * LPCVOID
Definition: windef.h:191
#define HRESULT_CODE(hr)
Definition: winerror.h:76
#define c
Definition: ke_i.h:80
GLenum target
Definition: glext.h:7315
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:845
#define ULONG_PTR
Definition: config.h:101
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
CardRegion * from
Definition: spigame.cpp:19
return STATUS_SUCCESS
Definition: btrfs.c:2725
GLuint64EXT * result
Definition: glext.h:11304
static SERVICE_STATUS status
Definition: service.c:31
#define args
Definition: format.c:66
Definition: dsound.c:943
#define HeapFree(x, y, z)
Definition: compat.h:394
static const WCHAR nullW[]
Definition: json.c:33
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
Definition: ps.c:97