- Merge aicom-network-fixes up to r36740
[reactos.git] / rosapps / applications / sysutils / utils / nts2w32err / nts2w32err.c
1 /* $Id$
2 *
3 * Convert NTSTATUS codes to Win32 error codes: run it
4 * on a NT box AND on a ROS box, then diff the results.
5 *
6 * This utility should help keeping correct how Ros
7 * translates executive's errors codes into Win32 error
8 * codes.
9 *
10 * Usage: nts2w32err [MaxStatusCode] > log.txt
11 *
12 * 2004-01-10 Emanuele Aliberti
13 *
14 */
15 #define WIN32_NO_STATUS
16 #include <windows.h>
17 #include <stdlib.h>
18 #include <ntndk.h>
19 #include <stdio.h>
20
21 int main (int argc, char * argv [])
22 {
23 NTSTATUS Severity = 0;
24 NTSTATUS StatusCode = STATUS_SUCCESS;
25 NTSTATUS Status = STATUS_SUCCESS;
26 DWORD LastError = ERROR_SUCCESS;
27 DWORD Maximum = 0x40000;
28
29 if (2 == argc)
30 {
31 sscanf (argv[1], "%lx", & Maximum);
32 }
33
34 printf ("NT error codes 0x0-0x%lx that get translated *not* to ERROR_MR_MID_NOT_FOUND (317)\n\n", Maximum);
35
36 for ( Severity = 0;
37 Severity < 4;
38 Severity ++)
39 {
40 printf ("--- Severity %ld ---\n", Severity);
41
42 for ( StatusCode = STATUS_SUCCESS;
43 StatusCode <= Maximum ;
44 StatusCode ++)
45 {
46 Status = ((Severity << 30) | StatusCode);
47 LastError = RtlNtStatusToDosError (Status);
48 if (ERROR_MR_MID_NOT_FOUND != LastError)
49 {
50 printf ("0x%08lx => %ldL\n", Status, LastError);
51 }
52 }
53 }
54 return EXIT_SUCCESS;
55 }
56 /* EOF */