⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 win32err.c

📁 winNT技术操作系统,国外开放的原代码和LIUX一样
💻 C
字号:
/* $Id: win32err.c 16861 2005-07-29 13:46:03Z ea $
 *
 * win32err.c
 *
 * Copyright (c) 1998 Mark Russinovich
 *	Systems Internals
 *	http://www.sysinternals.com/
 *
 * --------------------------------------------------------------------
 *
 * This software is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this software; see the file COPYING.LIB. If
 * not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 * Cambridge, MA 02139, USA.
 *
 * --------------------------------------------------------------------
 *
 * Print a Win32 error.
 *
 * 1999 February (Emanuele Aliberti)
 * 	Taken from chkdskx.c and formatx.c by Mark Russinovich
 * 	to be used in all sysutils.
 */
#include <windows.h>
#include <stdio.h>

//----------------------------------------------------------------------
//
// PrintWin32Error
//
// Takes the win32 error code and prints the text version.
//
//----------------------------------------------------------------------
void
PrintWin32Error(
	PWCHAR	Message,
	DWORD	ErrorCode
	)
{
	PVOID lpMsgBuf;

	FormatMessageW(
		(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM),
		NULL,
		ErrorCode,
		MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
		(LPWSTR)& lpMsgBuf,
		0,
		NULL
		);
	wprintf(
		L"%s: %s\n",
		Message,
		lpMsgBuf
		);
	LocalFree( lpMsgBuf );
}


/* EOF */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -