]>
Commit | Line | Data |
---|---|---|
6dfbe297 CF |
1 | /* |
2 | * Copyright (c) 2000, Red Hat, Inc. | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
8 | * | |
9 | * A copy of the GNU General Public License can be found at | |
10 | * http://www.gnu.org/ | |
11 | * | |
12 | * Written by Ron Parker <parkerrd@hotmail.com> | |
13 | * | |
14 | */ | |
15 | ||
853b9e91 CF |
16 | #include <stdio.h> |
17 | #include <stdlib.h> | |
18 | #include <windows.h> | |
19 | #include "setup.h" | |
608de931 CF |
20 | |
21 | void | |
853b9e91 | 22 | lowmem () |
93014d67 | 23 | { |
608de931 CF |
24 | fputs ("Insufficient memory.\n", stderr); |
25 | exit (1); | |
26 | } | |
27 | ||
28 | void | |
853b9e91 | 29 | winerror () |
93014d67 | 30 | { |
608de931 CF |
31 | LPVOID msgbuf; |
32 | int lasterr = GetLastError (); | |
853b9e91 | 33 | |
608de931 CF |
34 | /* If !lasterr then assume a standard file error happened and was |
35 | already displayed. */ | |
36 | if (lasterr) | |
93014d67 | 37 | { |
608de931 CF |
38 | FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER |
39 | | FORMAT_MESSAGE_FROM_SYSTEM | |
40 | | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, lasterr, | |
41 | MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), | |
42 | (LPTSTR) & msgbuf, 0, NULL); | |
43 | if (msgbuf) | |
93014d67 | 44 | { |
1304023e | 45 | fprintf (stderr, "%s\n", (char *) msgbuf); |
608de931 CF |
46 | LocalFree (msgbuf); |
47 | } | |
93014d67 | 48 | else |
608de931 CF |
49 | fprintf (stderr, "Unexpected error #%d\n", lasterr); |
50 | } | |
51 | } |