]> cygwin.com Git - cygwin-apps/cygutils.git/blame - src/lpr/Win32Utils.cc
Import relevant changes from MinGW and MSYS port
[cygwin-apps/cygutils.git] / src / lpr / Win32Utils.cc
CommitLineData
fe3a7d70 1/*
21006e63
CW
2 * lpr for cygwin/windows
3 *
4 * Copyright (C) 2000-2003 Rick Rankin
5 * http://www.cygwin.com/ml/cygwin/2000-07/msg00320.html
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation in version 2 of the License.
10 *
11 * This program 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
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#include "src/lpr/Win32Utils.hh"
fe3a7d70 22using namespace std;
21006e63
CW
23
24string Win32Utils::getErrorMessage()
25{
26 return Win32Utils::getErrorMessage(GetLastError());
27}
28
29string Win32Utils::getErrorMessage(DWORD code)
30{
31 char * lpMsgBuf;
32 FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
33 FORMAT_MESSAGE_FROM_SYSTEM |
34 FORMAT_MESSAGE_IGNORE_INSERTS,
35 NULL,
36 code,
37 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
38 (LPTSTR) &lpMsgBuf,
39 0,
40 NULL);
41
42 string msg = lpMsgBuf;
43 LocalFree(lpMsgBuf);
44
45 return msg;
46}
47
This page took 0.024061 seconds and 5 git commands to generate.