ReactOS 0.4.15-dev-8061-g57b775e
win32err.c
Go to the documentation of this file.
1/*
2 * win32err.c
3 *
4 * Copyright (c) 1998 Mark Russinovich
5 * Systems Internals
6 * http://www.sysinternals.com/
7 *
8 * --------------------------------------------------------------------
9 *
10 * This software is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Library General Public License as
12 * published by the Free Software Foundation; either version 2 of the
13 * License, or (at your option) any later version.
14 *
15 * This software is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Library General Public License for more details.
19 *
20 * You should have received a copy of the GNU Library General Public
21 * License along with this software; see the file COPYING.LIB. If
22 * not, write to the Free Software Foundation, Inc., 675 Mass Ave,
23 * Cambridge, MA 02139, USA.
24 *
25 * --------------------------------------------------------------------
26 *
27 * Print a Win32 error.
28 *
29 * 1999 February (Emanuele Aliberti)
30 * Taken from chkdskx.c and formatx.c by Mark Russinovich
31 * to be used in all sysutils.
32 */
33#include <windows.h>
34#include <stdio.h>
35
36//----------------------------------------------------------------------
37//
38// PrintWin32Error
39//
40// Takes the win32 error code and prints the text version.
41//
42//----------------------------------------------------------------------
43void
47 )
48{
49 LPWSTR lpMsgBuf;
50
53 NULL,
56 (LPWSTR)& lpMsgBuf,
57 0,
58 NULL
59 );
60 wprintf(
61 L"%s: %s\n",
62 Message,
63 lpMsgBuf
64 );
65 LocalFree( lpMsgBuf );
66}
67
68
69/* EOF */
#define NULL
Definition: types.h:112
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
static const WCHAR Message[]
Definition: register.c:74
unsigned long DWORD
Definition: ntddk_ex.h:95
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
#define L(x)
Definition: ntvdm.h:50
#define LANG_NEUTRAL
Definition: nls.h:22
#define MAKELANGID(p, s)
Definition: nls.h:15
#define SUBLANG_DEFAULT
Definition: nls.h:168
uint16_t * PWCHAR
Definition: typedefs.h:56
#define wprintf(...)
Definition: whoami.c:18
void PrintWin32Error(PWCHAR Message, DWORD ErrorCode)
Definition: win32err.c:44
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:423
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:419
WCHAR * LPWSTR
Definition: xmlstorage.h:184