xref: /dflybsd-src/contrib/tcpdump/smbutil.c (revision 59c07fbdf8168fa08c76c515186d561b5a92690c)
141c99275SPeter Avalos /*
241c99275SPeter Avalos  * Copyright (C) Andrew Tridgell 1995-1999
341c99275SPeter Avalos  *
441c99275SPeter Avalos  * This software may be distributed either under the terms of the
541c99275SPeter Avalos  * BSD-style license that accompanies tcpdump or the GNU GPL version 2
641c99275SPeter Avalos  * or later
741c99275SPeter Avalos  */
841c99275SPeter Avalos 
941c99275SPeter Avalos #ifdef HAVE_CONFIG_H
10*ed775ee7SAntonio Huete Jimenez #include <config.h>
1141c99275SPeter Avalos #endif
1241c99275SPeter Avalos 
13*ed775ee7SAntonio Huete Jimenez #include "netdissect-stdinc.h"
1441c99275SPeter Avalos 
1541c99275SPeter Avalos #include <stdio.h>
1641c99275SPeter Avalos #include <stdlib.h>
1741c99275SPeter Avalos #include <string.h>
1841c99275SPeter Avalos 
19*ed775ee7SAntonio Huete Jimenez #include "netdissect-ctype.h"
20*ed775ee7SAntonio Huete Jimenez 
21411677aeSAaron LI #include "netdissect.h"
2241c99275SPeter Avalos #include "extract.h"
2341c99275SPeter Avalos #include "smb.h"
2441c99275SPeter Avalos 
25*ed775ee7SAntonio Huete Jimenez static int stringlen_is_set;
26411677aeSAaron LI static uint32_t stringlen;
2741c99275SPeter Avalos extern const u_char *startbuf;
2841c99275SPeter Avalos 
2941c99275SPeter Avalos /*
30*ed775ee7SAntonio Huete Jimenez  * Reset SMB state.
31*ed775ee7SAntonio Huete Jimenez  */
32*ed775ee7SAntonio Huete Jimenez void
smb_reset(void)33*ed775ee7SAntonio Huete Jimenez smb_reset(void)
34*ed775ee7SAntonio Huete Jimenez {
35*ed775ee7SAntonio Huete Jimenez     stringlen_is_set = 0;
36*ed775ee7SAntonio Huete Jimenez     stringlen = 0;
37*ed775ee7SAntonio Huete Jimenez }
38*ed775ee7SAntonio Huete Jimenez 
39*ed775ee7SAntonio Huete Jimenez /*
4041c99275SPeter Avalos  * interpret a 32 bit dos packed date/time to some parameters
4141c99275SPeter Avalos  */
4241c99275SPeter Avalos static void
interpret_dos_date(uint32_t date,struct tm * tp)43411677aeSAaron LI interpret_dos_date(uint32_t date, struct tm *tp)
4441c99275SPeter Avalos {
45411677aeSAaron LI     uint32_t p0, p1, p2, p3;
4641c99275SPeter Avalos 
4741c99275SPeter Avalos     p0 = date & 0xFF;
4841c99275SPeter Avalos     p1 = ((date & 0xFF00) >> 8) & 0xFF;
4941c99275SPeter Avalos     p2 = ((date & 0xFF0000) >> 16) & 0xFF;
5041c99275SPeter Avalos     p3 = ((date & 0xFF000000) >> 24) & 0xFF;
5141c99275SPeter Avalos 
5241c99275SPeter Avalos     tp->tm_sec = 2 * (p0 & 0x1F);
5341c99275SPeter Avalos     tp->tm_min = ((p0 >> 5) & 0xFF) + ((p1 & 0x7) << 3);
5441c99275SPeter Avalos     tp->tm_hour = (p1 >> 3) & 0xFF;
5541c99275SPeter Avalos     tp->tm_mday = (p2 & 0x1F);
5641c99275SPeter Avalos     tp->tm_mon = ((p2 >> 5) & 0xFF) + ((p3 & 0x1) << 3) - 1;
5741c99275SPeter Avalos     tp->tm_year = ((p3 >> 1) & 0xFF) + 80;
5841c99275SPeter Avalos }
5941c99275SPeter Avalos 
6041c99275SPeter Avalos /*
6141c99275SPeter Avalos  * common portion:
6241c99275SPeter Avalos  * create a unix date from a dos date
6341c99275SPeter Avalos  */
6441c99275SPeter Avalos static time_t
int_unix_date(uint32_t dos_date)65411677aeSAaron LI int_unix_date(uint32_t dos_date)
6641c99275SPeter Avalos {
6741c99275SPeter Avalos     struct tm t;
6841c99275SPeter Avalos 
6941c99275SPeter Avalos     if (dos_date == 0)
7041c99275SPeter Avalos 	return(0);
7141c99275SPeter Avalos 
7241c99275SPeter Avalos     interpret_dos_date(dos_date, &t);
7341c99275SPeter Avalos     t.tm_wday = 1;
7441c99275SPeter Avalos     t.tm_yday = 1;
7541c99275SPeter Avalos     t.tm_isdst = 0;
7641c99275SPeter Avalos 
7741c99275SPeter Avalos     return (mktime(&t));
7841c99275SPeter Avalos }
7941c99275SPeter Avalos 
8041c99275SPeter Avalos /*
8141c99275SPeter Avalos  * create a unix date from a dos date
8241c99275SPeter Avalos  * in network byte order
8341c99275SPeter Avalos  */
8441c99275SPeter Avalos static time_t
make_unix_date(netdissect_options * ndo,const u_char * date_ptr)85*ed775ee7SAntonio Huete Jimenez make_unix_date(netdissect_options *ndo, const u_char *date_ptr)
8641c99275SPeter Avalos {
87411677aeSAaron LI     uint32_t dos_date = 0;
8841c99275SPeter Avalos 
89*ed775ee7SAntonio Huete Jimenez     dos_date = GET_LE_U_4(date_ptr);
9041c99275SPeter Avalos 
9141c99275SPeter Avalos     return int_unix_date(dos_date);
9241c99275SPeter Avalos }
9341c99275SPeter Avalos 
9441c99275SPeter Avalos /*
9541c99275SPeter Avalos  * create a unix date from a dos date
9641c99275SPeter Avalos  * in halfword-swapped network byte order!
9741c99275SPeter Avalos  */
9841c99275SPeter Avalos static time_t
make_unix_date2(netdissect_options * ndo,const u_char * date_ptr)99*ed775ee7SAntonio Huete Jimenez make_unix_date2(netdissect_options *ndo, const u_char *date_ptr)
10041c99275SPeter Avalos {
101411677aeSAaron LI     uint32_t x, x2;
10241c99275SPeter Avalos 
103*ed775ee7SAntonio Huete Jimenez     x = GET_LE_U_4(date_ptr);
10441c99275SPeter Avalos     x2 = ((x & 0xFFFF) << 16) | ((x & 0xFFFF0000) >> 16);
10541c99275SPeter Avalos     return int_unix_date(x2);
10641c99275SPeter Avalos }
10741c99275SPeter Avalos 
10841c99275SPeter Avalos /*
10941c99275SPeter Avalos  * interpret an 8 byte "filetime" structure to a time_t
11041c99275SPeter Avalos  * It's originally in "100ns units since jan 1st 1601"
11141c99275SPeter Avalos  */
11241c99275SPeter Avalos static time_t
interpret_long_date(netdissect_options * ndo,const u_char * p)113*ed775ee7SAntonio Huete Jimenez interpret_long_date(netdissect_options *ndo, const u_char *p)
11441c99275SPeter Avalos {
11541c99275SPeter Avalos     double d;
11641c99275SPeter Avalos     time_t ret;
11741c99275SPeter Avalos 
11841c99275SPeter Avalos     /* this gives us seconds since jan 1st 1601 (approx) */
119*ed775ee7SAntonio Huete Jimenez     d = (GET_LE_U_4(p + 4) * 256.0 + GET_U_1(p + 3)) * (1.0e-7 * (1 << 24));
12041c99275SPeter Avalos 
12141c99275SPeter Avalos     /* now adjust by 369 years to make the secs since 1970 */
12241c99275SPeter Avalos     d -= 369.0 * 365.25 * 24 * 60 * 60;
12341c99275SPeter Avalos 
12441c99275SPeter Avalos     /* and a fudge factor as we got it wrong by a few days */
12541c99275SPeter Avalos     d += (3 * 24 * 60 * 60 + 6 * 60 * 60 + 2);
12641c99275SPeter Avalos 
12741c99275SPeter Avalos     if (d < 0)
12841c99275SPeter Avalos 	return(0);
12941c99275SPeter Avalos 
13041c99275SPeter Avalos     ret = (time_t)d;
13141c99275SPeter Avalos 
13241c99275SPeter Avalos     return(ret);
13341c99275SPeter Avalos }
13441c99275SPeter Avalos 
13541c99275SPeter Avalos /*
13641c99275SPeter Avalos  * interpret the weird netbios "name". Return the name type, or -1 if
13741c99275SPeter Avalos  * we run past the end of the buffer
13841c99275SPeter Avalos  */
13941c99275SPeter Avalos static int
name_interpret(netdissect_options * ndo,const u_char * in,const u_char * maxbuf,char * out)140411677aeSAaron LI name_interpret(netdissect_options *ndo,
141411677aeSAaron LI                const u_char *in, const u_char *maxbuf, char *out)
14241c99275SPeter Avalos {
14341c99275SPeter Avalos     int ret;
144*ed775ee7SAntonio Huete Jimenez     u_int len;
14541c99275SPeter Avalos 
14641c99275SPeter Avalos     if (in >= maxbuf)
14741c99275SPeter Avalos 	return(-1);	/* name goes past the end of the buffer */
148*ed775ee7SAntonio Huete Jimenez     len = GET_U_1(in) / 2;
149*ed775ee7SAntonio Huete Jimenez     in++;
15041c99275SPeter Avalos 
15141c99275SPeter Avalos     *out=0;
15241c99275SPeter Avalos 
153*ed775ee7SAntonio Huete Jimenez     if (len > 30 || len == 0)
15441c99275SPeter Avalos 	return(0);
15541c99275SPeter Avalos 
156*ed775ee7SAntonio Huete Jimenez     while (len) {
157*ed775ee7SAntonio Huete Jimenez 	ND_TCHECK_2(in);
15841c99275SPeter Avalos 	if (in + 1 >= maxbuf)
15941c99275SPeter Avalos 	    return(-1);	/* name goes past the end of the buffer */
160*ed775ee7SAntonio Huete Jimenez 	if (GET_U_1(in) < 'A' || GET_U_1(in) > 'P' ||
161*ed775ee7SAntonio Huete Jimenez 	    GET_U_1(in + 1) < 'A' || GET_U_1(in + 1) > 'P') {
16241c99275SPeter Avalos 	    *out = 0;
16341c99275SPeter Avalos 	    return(0);
16441c99275SPeter Avalos 	}
165*ed775ee7SAntonio Huete Jimenez 	*out = ((GET_U_1(in) - 'A') << 4) + (GET_U_1(in + 1) - 'A');
16641c99275SPeter Avalos 	in += 2;
16741c99275SPeter Avalos 	out++;
168*ed775ee7SAntonio Huete Jimenez 	len--;
16941c99275SPeter Avalos     }
17041c99275SPeter Avalos     *out = 0;
17141c99275SPeter Avalos     ret = out[-1];
17241c99275SPeter Avalos 
17341c99275SPeter Avalos     return(ret);
17441c99275SPeter Avalos 
17541c99275SPeter Avalos trunc:
17641c99275SPeter Avalos     return(-1);
17741c99275SPeter Avalos }
17841c99275SPeter Avalos 
17941c99275SPeter Avalos /*
18041c99275SPeter Avalos  * find a pointer to a netbios name
18141c99275SPeter Avalos  */
18241c99275SPeter Avalos static const u_char *
name_ptr(netdissect_options * ndo,const u_char * buf,u_int ofs,const u_char * maxbuf)183411677aeSAaron LI name_ptr(netdissect_options *ndo,
184*ed775ee7SAntonio Huete Jimenez          const u_char *buf, u_int ofs, const u_char *maxbuf)
18541c99275SPeter Avalos {
18641c99275SPeter Avalos     const u_char *p;
18741c99275SPeter Avalos     u_char c;
18841c99275SPeter Avalos 
18941c99275SPeter Avalos     p = buf + ofs;
19041c99275SPeter Avalos     if (p >= maxbuf)
19141c99275SPeter Avalos 	return(NULL);	/* name goes past the end of the buffer */
19241c99275SPeter Avalos 
193*ed775ee7SAntonio Huete Jimenez     c = GET_U_1(p);
19441c99275SPeter Avalos 
19541c99275SPeter Avalos     /* XXX - this should use the same code that the DNS dissector does */
19641c99275SPeter Avalos     if ((c & 0xC0) == 0xC0) {
197411677aeSAaron LI 	uint16_t l;
19841c99275SPeter Avalos 
199*ed775ee7SAntonio Huete Jimenez 	ND_TCHECK_2(p);
20041c99275SPeter Avalos 	if ((p + 1) >= maxbuf)
20141c99275SPeter Avalos 	    return(NULL);	/* name goes past the end of the buffer */
202*ed775ee7SAntonio Huete Jimenez 	l = GET_BE_U_2(p) & 0x3FFF;
20341c99275SPeter Avalos 	if (l == 0) {
20441c99275SPeter Avalos 	    /* We have a pointer that points to itself. */
20541c99275SPeter Avalos 	    return(NULL);
20641c99275SPeter Avalos 	}
20741c99275SPeter Avalos 	p = buf + l;
20841c99275SPeter Avalos 	if (p >= maxbuf)
20941c99275SPeter Avalos 	    return(NULL);	/* name goes past the end of the buffer */
210*ed775ee7SAntonio Huete Jimenez 	ND_TCHECK_1(p);
21141c99275SPeter Avalos     }
21241c99275SPeter Avalos     return(p);
21341c99275SPeter Avalos 
21441c99275SPeter Avalos trunc:
21541c99275SPeter Avalos     return(NULL);	/* name goes past the end of the buffer */
21641c99275SPeter Avalos }
21741c99275SPeter Avalos 
21841c99275SPeter Avalos /*
21941c99275SPeter Avalos  * extract a netbios name from a buf
22041c99275SPeter Avalos  */
22141c99275SPeter Avalos static int
name_extract(netdissect_options * ndo,const u_char * buf,u_int ofs,const u_char * maxbuf,char * name)222411677aeSAaron LI name_extract(netdissect_options *ndo,
223*ed775ee7SAntonio Huete Jimenez              const u_char *buf, u_int ofs, const u_char *maxbuf, char *name)
22441c99275SPeter Avalos {
225411677aeSAaron LI     const u_char *p = name_ptr(ndo, buf, ofs, maxbuf);
22641c99275SPeter Avalos     if (p == NULL)
22741c99275SPeter Avalos 	return(-1);	/* error (probably name going past end of buffer) */
22841c99275SPeter Avalos     name[0] = '\0';
229411677aeSAaron LI     return(name_interpret(ndo, p, maxbuf, name));
23041c99275SPeter Avalos }
23141c99275SPeter Avalos 
23241c99275SPeter Avalos 
23341c99275SPeter Avalos /*
23441c99275SPeter Avalos  * return the total storage length of a mangled name
23541c99275SPeter Avalos  */
23641c99275SPeter Avalos static int
name_len(netdissect_options * ndo,const u_char * s,const u_char * maxbuf)237411677aeSAaron LI name_len(netdissect_options *ndo,
238*ed775ee7SAntonio Huete Jimenez          const u_char *s, const u_char *maxbuf)
23941c99275SPeter Avalos {
240*ed775ee7SAntonio Huete Jimenez     const u_char *s0 = s;
24141c99275SPeter Avalos     unsigned char c;
24241c99275SPeter Avalos 
24341c99275SPeter Avalos     if (s >= maxbuf)
24441c99275SPeter Avalos 	return(-1);	/* name goes past the end of the buffer */
245*ed775ee7SAntonio Huete Jimenez     c = GET_U_1(s);
24641c99275SPeter Avalos     if ((c & 0xC0) == 0xC0)
24741c99275SPeter Avalos 	return(2);
248*ed775ee7SAntonio Huete Jimenez     while (GET_U_1(s)) {
24941c99275SPeter Avalos 	if (s >= maxbuf)
25041c99275SPeter Avalos 	    return(-1);	/* name goes past the end of the buffer */
251*ed775ee7SAntonio Huete Jimenez 	s += GET_U_1(s) + 1;
252*ed775ee7SAntonio Huete Jimenez 	ND_TCHECK_1(s);
25341c99275SPeter Avalos     }
254*ed775ee7SAntonio Huete Jimenez     return(ND_BYTES_BETWEEN(s, s0) + 1);
25541c99275SPeter Avalos 
25641c99275SPeter Avalos trunc:
25741c99275SPeter Avalos     return(-1);	/* name goes past the end of the buffer */
25841c99275SPeter Avalos }
25941c99275SPeter Avalos 
26041c99275SPeter Avalos static void
print_asc(netdissect_options * ndo,const u_char * buf,u_int len)261411677aeSAaron LI print_asc(netdissect_options *ndo,
262*ed775ee7SAntonio Huete Jimenez           const u_char *buf, u_int len)
26341c99275SPeter Avalos {
264*ed775ee7SAntonio Huete Jimenez     u_int i;
26541c99275SPeter Avalos     for (i = 0; i < len; i++)
266*ed775ee7SAntonio Huete Jimenez         fn_print_char(ndo, GET_U_1(buf + i));
26741c99275SPeter Avalos }
26841c99275SPeter Avalos 
26941c99275SPeter Avalos static const char *
name_type_str(int name_type)27041c99275SPeter Avalos name_type_str(int name_type)
27141c99275SPeter Avalos {
27241c99275SPeter Avalos     const char *f = NULL;
27341c99275SPeter Avalos 
27441c99275SPeter Avalos     switch (name_type) {
27541c99275SPeter Avalos     case 0:    f = "Workstation"; break;
27641c99275SPeter Avalos     case 0x03: f = "Client?"; break;
27741c99275SPeter Avalos     case 0x20: f = "Server"; break;
27841c99275SPeter Avalos     case 0x1d: f = "Master Browser"; break;
27941c99275SPeter Avalos     case 0x1b: f = "Domain Controller"; break;
28041c99275SPeter Avalos     case 0x1e: f = "Browser Server"; break;
28141c99275SPeter Avalos     default:   f = "Unknown"; break;
28241c99275SPeter Avalos     }
28341c99275SPeter Avalos     return(f);
28441c99275SPeter Avalos }
28541c99275SPeter Avalos 
28641c99275SPeter Avalos void
smb_data_print(netdissect_options * ndo,const u_char * buf,u_int len)287*ed775ee7SAntonio Huete Jimenez smb_data_print(netdissect_options *ndo, const u_char *buf, u_int len)
28841c99275SPeter Avalos {
289*ed775ee7SAntonio Huete Jimenez     u_int i = 0;
29041c99275SPeter Avalos 
291*ed775ee7SAntonio Huete Jimenez     if (len == 0)
29241c99275SPeter Avalos 	return;
293*ed775ee7SAntonio Huete Jimenez     ND_PRINT("[%03X] ", i);
29441c99275SPeter Avalos     for (i = 0; i < len; /*nothing*/) {
295*ed775ee7SAntonio Huete Jimenez 	ND_PRINT("%02X ", GET_U_1(buf + i) & 0xff);
29641c99275SPeter Avalos 	i++;
29741c99275SPeter Avalos 	if (i%8 == 0)
298*ed775ee7SAntonio Huete Jimenez 	    ND_PRINT(" ");
29941c99275SPeter Avalos 	if (i % 16 == 0) {
300*ed775ee7SAntonio Huete Jimenez 	    print_asc(ndo, buf + i - 16, 8);
301*ed775ee7SAntonio Huete Jimenez 	    ND_PRINT(" ");
302*ed775ee7SAntonio Huete Jimenez 	    print_asc(ndo, buf + i - 8, 8);
303*ed775ee7SAntonio Huete Jimenez 	    ND_PRINT("\n");
30441c99275SPeter Avalos 	    if (i < len)
305*ed775ee7SAntonio Huete Jimenez 		ND_PRINT("[%03X] ", i);
30641c99275SPeter Avalos 	}
30741c99275SPeter Avalos     }
30841c99275SPeter Avalos     if (i % 16) {
30941c99275SPeter Avalos 	int n;
31041c99275SPeter Avalos 
31141c99275SPeter Avalos 	n = 16 - (i % 16);
312*ed775ee7SAntonio Huete Jimenez 	ND_PRINT(" ");
31341c99275SPeter Avalos 	if (n>8)
314*ed775ee7SAntonio Huete Jimenez 	    ND_PRINT(" ");
31541c99275SPeter Avalos 	while (n--)
316*ed775ee7SAntonio Huete Jimenez 	    ND_PRINT("   ");
31741c99275SPeter Avalos 
318*ed775ee7SAntonio Huete Jimenez 	n = ND_MIN(8, i % 16);
319*ed775ee7SAntonio Huete Jimenez 	print_asc(ndo, buf + i - (i % 16), n);
320*ed775ee7SAntonio Huete Jimenez 	ND_PRINT(" ");
32141c99275SPeter Avalos 	n = (i % 16) - n;
32241c99275SPeter Avalos 	if (n > 0)
323*ed775ee7SAntonio Huete Jimenez 	    print_asc(ndo, buf + i - n, n);
324*ed775ee7SAntonio Huete Jimenez 	ND_PRINT("\n");
32541c99275SPeter Avalos     }
32641c99275SPeter Avalos }
32741c99275SPeter Avalos 
32841c99275SPeter Avalos 
32941c99275SPeter Avalos static void
write_bits(netdissect_options * ndo,unsigned int val,const char * fmt)330411677aeSAaron LI write_bits(netdissect_options *ndo,
331411677aeSAaron LI            unsigned int val, const char *fmt)
33241c99275SPeter Avalos {
33341c99275SPeter Avalos     const char *p = fmt;
334*ed775ee7SAntonio Huete Jimenez     u_int i = 0;
33541c99275SPeter Avalos 
33641c99275SPeter Avalos     while ((p = strchr(fmt, '|'))) {
337*ed775ee7SAntonio Huete Jimenez 	u_int l = ND_BYTES_BETWEEN(p, fmt);
33841c99275SPeter Avalos 	if (l && (val & (1 << i)))
339*ed775ee7SAntonio Huete Jimenez 	    ND_PRINT("%.*s ", (int)l, fmt);
34041c99275SPeter Avalos 	fmt = p + 1;
34141c99275SPeter Avalos 	i++;
34241c99275SPeter Avalos     }
34341c99275SPeter Avalos }
34441c99275SPeter Avalos 
345411677aeSAaron LI /* convert a UCS-2 string into an ASCII string */
34641c99275SPeter Avalos #define MAX_UNISTR_SIZE	1000
347*ed775ee7SAntonio Huete Jimenez static const u_char *
unistr(netdissect_options * ndo,char (* buf)[MAX_UNISTR_SIZE+1],const u_char * s,uint32_t strsize,int is_null_terminated,int use_unicode)348*ed775ee7SAntonio Huete Jimenez unistr(netdissect_options *ndo, char (*buf)[MAX_UNISTR_SIZE+1],
349*ed775ee7SAntonio Huete Jimenez        const u_char *s, uint32_t strsize, int is_null_terminated,
350*ed775ee7SAntonio Huete Jimenez        int use_unicode)
35141c99275SPeter Avalos {
352*ed775ee7SAntonio Huete Jimenez     u_int c;
35341c99275SPeter Avalos     size_t l = 0;
35441c99275SPeter Avalos     const u_char *sp;
35541c99275SPeter Avalos 
35641c99275SPeter Avalos     if (use_unicode) {
35741c99275SPeter Avalos 	/*
35841c99275SPeter Avalos 	 * Skip padding that puts the string on an even boundary.
35941c99275SPeter Avalos 	 */
36041c99275SPeter Avalos 	if (((s - startbuf) % 2) != 0) {
361*ed775ee7SAntonio Huete Jimenez 	    ND_TCHECK_1(s);
36241c99275SPeter Avalos 	    s++;
36341c99275SPeter Avalos 	}
36441c99275SPeter Avalos     }
365*ed775ee7SAntonio Huete Jimenez     if (is_null_terminated) {
36641c99275SPeter Avalos 	/*
36741c99275SPeter Avalos 	 * Null-terminated string.
368*ed775ee7SAntonio Huete Jimenez 	 * Find the length, counting the terminating NUL.
36941c99275SPeter Avalos 	 */
37041c99275SPeter Avalos 	strsize = 0;
37141c99275SPeter Avalos 	sp = s;
37241c99275SPeter Avalos 	if (!use_unicode) {
37341c99275SPeter Avalos 	    for (;;) {
374*ed775ee7SAntonio Huete Jimenez 		c = GET_U_1(sp);
37541c99275SPeter Avalos 		sp++;
376*ed775ee7SAntonio Huete Jimenez 		strsize++;
377*ed775ee7SAntonio Huete Jimenez 		if (c == '\0')
378*ed775ee7SAntonio Huete Jimenez 		    break;
37941c99275SPeter Avalos 	    }
38041c99275SPeter Avalos 	} else {
38141c99275SPeter Avalos 	    for (;;) {
382*ed775ee7SAntonio Huete Jimenez 		c = GET_LE_U_2(sp);
38341c99275SPeter Avalos 		sp += 2;
384*ed775ee7SAntonio Huete Jimenez 		strsize += 2;
385*ed775ee7SAntonio Huete Jimenez 		if (c == '\0')
386*ed775ee7SAntonio Huete Jimenez 		    break;
38741c99275SPeter Avalos 	    }
38841c99275SPeter Avalos 	}
38941c99275SPeter Avalos     }
39041c99275SPeter Avalos     if (!use_unicode) {
39141c99275SPeter Avalos     	while (strsize != 0) {
392*ed775ee7SAntonio Huete Jimenez 	    c = GET_U_1(s);
39341c99275SPeter Avalos 	    s++;
39441c99275SPeter Avalos 	    strsize--;
395*ed775ee7SAntonio Huete Jimenez 	    if (c == 0) {
396*ed775ee7SAntonio Huete Jimenez 		/*
397*ed775ee7SAntonio Huete Jimenez 		 * Even counted strings may have embedded null
398*ed775ee7SAntonio Huete Jimenez 		 * terminators, so quit here, and skip past
399*ed775ee7SAntonio Huete Jimenez 		 * the rest of the data.
400*ed775ee7SAntonio Huete Jimenez 		 *
401*ed775ee7SAntonio Huete Jimenez 		 * Make sure, however, that the rest of the data
402*ed775ee7SAntonio Huete Jimenez 		 * is there, so we don't overflow the buffer when
403*ed775ee7SAntonio Huete Jimenez 		 * skipping past it.
404*ed775ee7SAntonio Huete Jimenez 		 */
405*ed775ee7SAntonio Huete Jimenez 		ND_TCHECK_LEN(s, strsize);
406*ed775ee7SAntonio Huete Jimenez 		s += strsize;
407*ed775ee7SAntonio Huete Jimenez 		strsize = 0;
40841c99275SPeter Avalos 		break;
409*ed775ee7SAntonio Huete Jimenez 	    }
410*ed775ee7SAntonio Huete Jimenez 	    if (l < MAX_UNISTR_SIZE) {
411*ed775ee7SAntonio Huete Jimenez 		if (ND_ASCII_ISPRINT(c)) {
41241c99275SPeter Avalos 		    /* It's a printable ASCII character */
413*ed775ee7SAntonio Huete Jimenez 		    (*buf)[l] = (char)c;
41441c99275SPeter Avalos 		} else {
41541c99275SPeter Avalos 		    /* It's a non-ASCII character or a non-printable ASCII character */
416*ed775ee7SAntonio Huete Jimenez 		    (*buf)[l] = '.';
41741c99275SPeter Avalos 		}
41841c99275SPeter Avalos 		l++;
419*ed775ee7SAntonio Huete Jimenez 	    }
420*ed775ee7SAntonio Huete Jimenez 	}
421*ed775ee7SAntonio Huete Jimenez     } else {
422*ed775ee7SAntonio Huete Jimenez 	while (strsize > 1) {
423*ed775ee7SAntonio Huete Jimenez 	    c = GET_LE_U_2(s);
42441c99275SPeter Avalos 	    s += 2;
42541c99275SPeter Avalos 	    strsize -= 2;
426*ed775ee7SAntonio Huete Jimenez 	    if (c == 0) {
427*ed775ee7SAntonio Huete Jimenez 		/*
428*ed775ee7SAntonio Huete Jimenez 		 * Even counted strings may have embedded null
429*ed775ee7SAntonio Huete Jimenez 		 * terminators, so quit here, and skip past
430*ed775ee7SAntonio Huete Jimenez 		 * the rest of the data.
431*ed775ee7SAntonio Huete Jimenez 		 *
432*ed775ee7SAntonio Huete Jimenez 		 * Make sure, however, that the rest of the data
433*ed775ee7SAntonio Huete Jimenez 		 * is there, so we don't overflow the buffer when
434*ed775ee7SAntonio Huete Jimenez 		 * skipping past it.
435*ed775ee7SAntonio Huete Jimenez 		 */
436*ed775ee7SAntonio Huete Jimenez 		ND_TCHECK_LEN(s, strsize);
437*ed775ee7SAntonio Huete Jimenez 		s += strsize;
438*ed775ee7SAntonio Huete Jimenez 		strsize = 0;
439*ed775ee7SAntonio Huete Jimenez 		break;
440*ed775ee7SAntonio Huete Jimenez 	    }
441*ed775ee7SAntonio Huete Jimenez 	    if (l < MAX_UNISTR_SIZE) {
442*ed775ee7SAntonio Huete Jimenez 		if (ND_ASCII_ISPRINT(c)) {
443*ed775ee7SAntonio Huete Jimenez 		    /* It's a printable ASCII character */
444*ed775ee7SAntonio Huete Jimenez 		    (*buf)[l] = (char)c;
445*ed775ee7SAntonio Huete Jimenez 		} else {
446*ed775ee7SAntonio Huete Jimenez 		    /* It's a non-ASCII character or a non-printable ASCII character */
447*ed775ee7SAntonio Huete Jimenez 		    (*buf)[l] = '.';
448*ed775ee7SAntonio Huete Jimenez 		}
449*ed775ee7SAntonio Huete Jimenez 		l++;
45041c99275SPeter Avalos 	    }
45141c99275SPeter Avalos 	}
452*ed775ee7SAntonio Huete Jimenez 	if (strsize == 1) {
453*ed775ee7SAntonio Huete Jimenez 	    /* We have half of a code point; skip past it */
454*ed775ee7SAntonio Huete Jimenez 	    ND_TCHECK_1(s);
455*ed775ee7SAntonio Huete Jimenez 	    s++;
456*ed775ee7SAntonio Huete Jimenez 	}
457*ed775ee7SAntonio Huete Jimenez     }
458*ed775ee7SAntonio Huete Jimenez     (*buf)[l] = 0;
459*ed775ee7SAntonio Huete Jimenez     return s;
46041c99275SPeter Avalos 
46141c99275SPeter Avalos trunc:
462*ed775ee7SAntonio Huete Jimenez     (*buf)[l] = 0;
46341c99275SPeter Avalos     return NULL;
46441c99275SPeter Avalos }
46541c99275SPeter Avalos 
46641c99275SPeter Avalos static const u_char *
smb_fdata1(netdissect_options * ndo,const u_char * buf,const char * fmt,const u_char * maxbuf,int unicodestr)467411677aeSAaron LI smb_fdata1(netdissect_options *ndo,
468411677aeSAaron LI            const u_char *buf, const char *fmt, const u_char *maxbuf,
46941c99275SPeter Avalos            int unicodestr)
47041c99275SPeter Avalos {
47141c99275SPeter Avalos     int reverse = 0;
47241c99275SPeter Avalos     const char *attrib_fmt = "READONLY|HIDDEN|SYSTEM|VOLUME|DIR|ARCHIVE|";
473*ed775ee7SAntonio Huete Jimenez     char strbuf[MAX_UNISTR_SIZE+1];
47441c99275SPeter Avalos 
47541c99275SPeter Avalos     while (*fmt && buf<maxbuf) {
47641c99275SPeter Avalos 	switch (*fmt) {
47741c99275SPeter Avalos 	case 'a':
478*ed775ee7SAntonio Huete Jimenez 	    write_bits(ndo, GET_U_1(buf), attrib_fmt);
47941c99275SPeter Avalos 	    buf++;
48041c99275SPeter Avalos 	    fmt++;
48141c99275SPeter Avalos 	    break;
48241c99275SPeter Avalos 
48341c99275SPeter Avalos 	case 'A':
484*ed775ee7SAntonio Huete Jimenez 	    write_bits(ndo, GET_LE_U_2(buf), attrib_fmt);
48541c99275SPeter Avalos 	    buf += 2;
48641c99275SPeter Avalos 	    fmt++;
48741c99275SPeter Avalos 	    break;
48841c99275SPeter Avalos 
48941c99275SPeter Avalos 	case '{':
49041c99275SPeter Avalos 	  {
49141c99275SPeter Avalos 	    char bitfmt[128];
49241c99275SPeter Avalos 	    char *p;
493*ed775ee7SAntonio Huete Jimenez 	    u_int l;
49441c99275SPeter Avalos 
49541c99275SPeter Avalos 	    p = strchr(++fmt, '}');
496*ed775ee7SAntonio Huete Jimenez 	    l = ND_BYTES_BETWEEN(p, fmt);
49741c99275SPeter Avalos 
498*ed775ee7SAntonio Huete Jimenez 	    if (l > sizeof(bitfmt) - 1)
49941c99275SPeter Avalos 		l = sizeof(bitfmt)-1;
50041c99275SPeter Avalos 
50141c99275SPeter Avalos 	    strncpy(bitfmt, fmt, l);
50241c99275SPeter Avalos 	    bitfmt[l] = '\0';
50341c99275SPeter Avalos 	    fmt = p + 1;
504*ed775ee7SAntonio Huete Jimenez 	    write_bits(ndo, GET_U_1(buf), bitfmt);
50541c99275SPeter Avalos 	    buf++;
50641c99275SPeter Avalos 	    break;
50741c99275SPeter Avalos 	  }
50841c99275SPeter Avalos 
50941c99275SPeter Avalos 	case 'P':
51041c99275SPeter Avalos 	  {
51141c99275SPeter Avalos 	    int l = atoi(fmt + 1);
512*ed775ee7SAntonio Huete Jimenez 	    ND_TCHECK_LEN(buf, l);
51341c99275SPeter Avalos 	    buf += l;
51441c99275SPeter Avalos 	    fmt++;
515*ed775ee7SAntonio Huete Jimenez 	    while (ND_ASCII_ISDIGIT(*fmt))
51641c99275SPeter Avalos 		fmt++;
51741c99275SPeter Avalos 	    break;
51841c99275SPeter Avalos 	  }
51941c99275SPeter Avalos 	case 'r':
52041c99275SPeter Avalos 	    reverse = !reverse;
52141c99275SPeter Avalos 	    fmt++;
52241c99275SPeter Avalos 	    break;
52341c99275SPeter Avalos 	case 'b':
52441c99275SPeter Avalos 	  {
52541c99275SPeter Avalos 	    unsigned int x;
526*ed775ee7SAntonio Huete Jimenez 	    x = GET_U_1(buf);
527*ed775ee7SAntonio Huete Jimenez 	    ND_PRINT("%u (0x%x)", x, x);
52841c99275SPeter Avalos 	    buf += 1;
52941c99275SPeter Avalos 	    fmt++;
53041c99275SPeter Avalos 	    break;
53141c99275SPeter Avalos 	  }
53241c99275SPeter Avalos 	case 'd':
53341c99275SPeter Avalos 	  {
534*ed775ee7SAntonio Huete Jimenez 	    int x;
535*ed775ee7SAntonio Huete Jimenez 	    x = reverse ? GET_BE_S_2(buf) :
536*ed775ee7SAntonio Huete Jimenez 			  GET_LE_S_2(buf);
537*ed775ee7SAntonio Huete Jimenez 	    ND_PRINT("%d (0x%x)", x, x);
53841c99275SPeter Avalos 	    buf += 2;
53941c99275SPeter Avalos 	    fmt++;
54041c99275SPeter Avalos 	    break;
54141c99275SPeter Avalos 	  }
54241c99275SPeter Avalos 	case 'D':
54341c99275SPeter Avalos 	  {
544*ed775ee7SAntonio Huete Jimenez 	    int x;
545*ed775ee7SAntonio Huete Jimenez 	    x = reverse ? GET_BE_S_4(buf) :
546*ed775ee7SAntonio Huete Jimenez 			  GET_LE_S_4(buf);
547*ed775ee7SAntonio Huete Jimenez 	    ND_PRINT("%d (0x%x)", x, x);
54841c99275SPeter Avalos 	    buf += 4;
54941c99275SPeter Avalos 	    fmt++;
55041c99275SPeter Avalos 	    break;
55141c99275SPeter Avalos 	  }
55241c99275SPeter Avalos 	case 'L':
55341c99275SPeter Avalos 	  {
554411677aeSAaron LI 	    uint64_t x;
555*ed775ee7SAntonio Huete Jimenez 	    x = reverse ? GET_BE_U_8(buf) :
556*ed775ee7SAntonio Huete Jimenez 			  GET_LE_U_8(buf);
557*ed775ee7SAntonio Huete Jimenez 	    ND_PRINT("%" PRIu64 " (0x%" PRIx64 ")", x, x);
55841c99275SPeter Avalos 	    buf += 8;
55941c99275SPeter Avalos 	    fmt++;
56041c99275SPeter Avalos 	    break;
56141c99275SPeter Avalos 	  }
562*ed775ee7SAntonio Huete Jimenez 	case 'u':
563*ed775ee7SAntonio Huete Jimenez 	  {
564*ed775ee7SAntonio Huete Jimenez 	    unsigned int x;
565*ed775ee7SAntonio Huete Jimenez 	    x = reverse ? GET_BE_U_2(buf) :
566*ed775ee7SAntonio Huete Jimenez 			  GET_LE_U_2(buf);
567*ed775ee7SAntonio Huete Jimenez 	    ND_PRINT("%u (0x%x)", x, x);
568*ed775ee7SAntonio Huete Jimenez 	    buf += 2;
569*ed775ee7SAntonio Huete Jimenez 	    fmt++;
570*ed775ee7SAntonio Huete Jimenez 	    break;
571*ed775ee7SAntonio Huete Jimenez 	  }
572*ed775ee7SAntonio Huete Jimenez 	case 'U':
573*ed775ee7SAntonio Huete Jimenez 	  {
574*ed775ee7SAntonio Huete Jimenez 	    unsigned int x;
575*ed775ee7SAntonio Huete Jimenez 	    x = reverse ? GET_BE_U_4(buf) :
576*ed775ee7SAntonio Huete Jimenez 			  GET_LE_U_4(buf);
577*ed775ee7SAntonio Huete Jimenez 	    ND_PRINT("%u (0x%x)", x, x);
578*ed775ee7SAntonio Huete Jimenez 	    buf += 4;
579*ed775ee7SAntonio Huete Jimenez 	    fmt++;
580*ed775ee7SAntonio Huete Jimenez 	    break;
581*ed775ee7SAntonio Huete Jimenez 	  }
58241c99275SPeter Avalos 	case 'M':
58341c99275SPeter Avalos 	  {
58441c99275SPeter Avalos 	    /* Weird mixed-endian length values in 64-bit locks */
585411677aeSAaron LI 	    uint32_t x1, x2;
586411677aeSAaron LI 	    uint64_t x;
587*ed775ee7SAntonio Huete Jimenez 	    ND_TCHECK_8(buf);
588*ed775ee7SAntonio Huete Jimenez 	    x1 = reverse ? GET_BE_U_4(buf) :
589*ed775ee7SAntonio Huete Jimenez 			   GET_LE_U_4(buf);
590*ed775ee7SAntonio Huete Jimenez 	    x2 = reverse ? GET_BE_U_4(buf + 4) :
591*ed775ee7SAntonio Huete Jimenez 			   GET_LE_U_4(buf + 4);
592411677aeSAaron LI 	    x = (((uint64_t)x1) << 32) | x2;
593*ed775ee7SAntonio Huete Jimenez 	    ND_PRINT("%" PRIu64 " (0x%" PRIx64 ")", x, x);
59441c99275SPeter Avalos 	    buf += 8;
59541c99275SPeter Avalos 	    fmt++;
59641c99275SPeter Avalos 	    break;
59741c99275SPeter Avalos 	  }
59841c99275SPeter Avalos 	case 'B':
59941c99275SPeter Avalos 	  {
60041c99275SPeter Avalos 	    unsigned int x;
601*ed775ee7SAntonio Huete Jimenez 	    x = GET_U_1(buf);
602*ed775ee7SAntonio Huete Jimenez 	    ND_PRINT("0x%X", x);
60341c99275SPeter Avalos 	    buf += 1;
60441c99275SPeter Avalos 	    fmt++;
60541c99275SPeter Avalos 	    break;
60641c99275SPeter Avalos 	  }
60741c99275SPeter Avalos 	case 'w':
60841c99275SPeter Avalos 	  {
60941c99275SPeter Avalos 	    unsigned int x;
610*ed775ee7SAntonio Huete Jimenez 	    x = reverse ? GET_BE_U_2(buf) :
611*ed775ee7SAntonio Huete Jimenez 			  GET_LE_U_2(buf);
612*ed775ee7SAntonio Huete Jimenez 	    ND_PRINT("0x%X", x);
61341c99275SPeter Avalos 	    buf += 2;
61441c99275SPeter Avalos 	    fmt++;
61541c99275SPeter Avalos 	    break;
61641c99275SPeter Avalos 	  }
61741c99275SPeter Avalos 	case 'W':
61841c99275SPeter Avalos 	  {
61941c99275SPeter Avalos 	    unsigned int x;
620*ed775ee7SAntonio Huete Jimenez 	    x = reverse ? GET_BE_U_4(buf) :
621*ed775ee7SAntonio Huete Jimenez 			  GET_LE_U_4(buf);
622*ed775ee7SAntonio Huete Jimenez 	    ND_PRINT("0x%X", x);
62341c99275SPeter Avalos 	    buf += 4;
62441c99275SPeter Avalos 	    fmt++;
62541c99275SPeter Avalos 	    break;
62641c99275SPeter Avalos 	  }
62741c99275SPeter Avalos 	case 'l':
62841c99275SPeter Avalos 	  {
62941c99275SPeter Avalos 	    fmt++;
63041c99275SPeter Avalos 	    switch (*fmt) {
63141c99275SPeter Avalos 
63241c99275SPeter Avalos 	    case 'b':
633*ed775ee7SAntonio Huete Jimenez 		stringlen = GET_U_1(buf);
634*ed775ee7SAntonio Huete Jimenez 		stringlen_is_set = 1;
635*ed775ee7SAntonio Huete Jimenez 		ND_PRINT("%u", stringlen);
63641c99275SPeter Avalos 		buf += 1;
63741c99275SPeter Avalos 		break;
63841c99275SPeter Avalos 
63941c99275SPeter Avalos 	    case 'd':
640*ed775ee7SAntonio Huete Jimenez 	    case 'u':
641*ed775ee7SAntonio Huete Jimenez 		stringlen = reverse ? GET_BE_U_2(buf) :
642*ed775ee7SAntonio Huete Jimenez 				      GET_LE_U_2(buf);
643*ed775ee7SAntonio Huete Jimenez 		stringlen_is_set = 1;
644*ed775ee7SAntonio Huete Jimenez 		ND_PRINT("%u", stringlen);
64541c99275SPeter Avalos 		buf += 2;
64641c99275SPeter Avalos 		break;
64741c99275SPeter Avalos 
64841c99275SPeter Avalos 	    case 'D':
649*ed775ee7SAntonio Huete Jimenez 	    case 'U':
650*ed775ee7SAntonio Huete Jimenez 		stringlen = reverse ? GET_BE_U_4(buf) :
651*ed775ee7SAntonio Huete Jimenez 				      GET_LE_U_4(buf);
652*ed775ee7SAntonio Huete Jimenez 		stringlen_is_set = 1;
653*ed775ee7SAntonio Huete Jimenez 		ND_PRINT("%u", stringlen);
65441c99275SPeter Avalos 		buf += 4;
65541c99275SPeter Avalos 		break;
65641c99275SPeter Avalos 	    }
65741c99275SPeter Avalos 	    fmt++;
65841c99275SPeter Avalos 	    break;
65941c99275SPeter Avalos 	  }
66041c99275SPeter Avalos 	case 'S':
66141c99275SPeter Avalos 	case 'R':	/* like 'S', but always ASCII */
66241c99275SPeter Avalos 	  {
66341c99275SPeter Avalos 	    /*XXX unistr() */
664*ed775ee7SAntonio Huete Jimenez 	    buf = unistr(ndo, &strbuf, buf, 0, 1, (*fmt == 'R') ? 0 : unicodestr);
665*ed775ee7SAntonio Huete Jimenez 	    ND_PRINT("%s", strbuf);
666*ed775ee7SAntonio Huete Jimenez 	    if (buf == NULL)
66741c99275SPeter Avalos 		goto trunc;
66841c99275SPeter Avalos 	    fmt++;
66941c99275SPeter Avalos 	    break;
67041c99275SPeter Avalos 	  }
67141c99275SPeter Avalos 	case 'Z':
67241c99275SPeter Avalos 	case 'Y':	/* like 'Z', but always ASCII */
67341c99275SPeter Avalos 	  {
674*ed775ee7SAntonio Huete Jimenez 	    if (GET_U_1(buf) != 4 && GET_U_1(buf) != 2) {
675*ed775ee7SAntonio Huete Jimenez 		ND_PRINT("Error! ASCIIZ buffer of type %u", GET_U_1(buf));
67641c99275SPeter Avalos 		return maxbuf;	/* give up */
67741c99275SPeter Avalos 	    }
678*ed775ee7SAntonio Huete Jimenez 	    buf = unistr(ndo, &strbuf, buf + 1, 0, 1, (*fmt == 'Y') ? 0 : unicodestr);
679*ed775ee7SAntonio Huete Jimenez 	    ND_PRINT("%s", strbuf);
680*ed775ee7SAntonio Huete Jimenez 	    if (buf == NULL)
68141c99275SPeter Avalos 		goto trunc;
68241c99275SPeter Avalos 	    fmt++;
68341c99275SPeter Avalos 	    break;
68441c99275SPeter Avalos 	  }
68541c99275SPeter Avalos 	case 's':
68641c99275SPeter Avalos 	  {
68741c99275SPeter Avalos 	    int l = atoi(fmt + 1);
688*ed775ee7SAntonio Huete Jimenez 	    ND_TCHECK_LEN(buf, l);
689*ed775ee7SAntonio Huete Jimenez 	    ND_PRINT("%-*.*s", l, l, buf);
69041c99275SPeter Avalos 	    buf += l;
69141c99275SPeter Avalos 	    fmt++;
692*ed775ee7SAntonio Huete Jimenez 	    while (ND_ASCII_ISDIGIT(*fmt))
69341c99275SPeter Avalos 		fmt++;
69441c99275SPeter Avalos 	    break;
69541c99275SPeter Avalos 	  }
69641c99275SPeter Avalos 	case 'c':
69741c99275SPeter Avalos 	  {
698*ed775ee7SAntonio Huete Jimenez             if (!stringlen_is_set) {
699*ed775ee7SAntonio Huete Jimenez                 ND_PRINT("{stringlen not set}");
700*ed775ee7SAntonio Huete Jimenez                 goto trunc;
701*ed775ee7SAntonio Huete Jimenez             }
702*ed775ee7SAntonio Huete Jimenez 	    ND_TCHECK_LEN(buf, stringlen);
703*ed775ee7SAntonio Huete Jimenez 	    ND_PRINT("%-*.*s", (int)stringlen, (int)stringlen, buf);
70441c99275SPeter Avalos 	    buf += stringlen;
70541c99275SPeter Avalos 	    fmt++;
706*ed775ee7SAntonio Huete Jimenez 	    while (ND_ASCII_ISDIGIT(*fmt))
70741c99275SPeter Avalos 		fmt++;
70841c99275SPeter Avalos 	    break;
70941c99275SPeter Avalos 	  }
71041c99275SPeter Avalos 	case 'C':
71141c99275SPeter Avalos 	  {
712*ed775ee7SAntonio Huete Jimenez             if (!stringlen_is_set) {
713*ed775ee7SAntonio Huete Jimenez                 ND_PRINT("{stringlen not set}");
71441c99275SPeter Avalos                 goto trunc;
715*ed775ee7SAntonio Huete Jimenez             }
716*ed775ee7SAntonio Huete Jimenez 	    buf = unistr(ndo, &strbuf, buf, stringlen, 0, unicodestr);
717*ed775ee7SAntonio Huete Jimenez 	    ND_PRINT("%s", strbuf);
718*ed775ee7SAntonio Huete Jimenez 	    if (buf == NULL)
719*ed775ee7SAntonio Huete Jimenez 		goto trunc;
72041c99275SPeter Avalos 	    fmt++;
72141c99275SPeter Avalos 	    break;
72241c99275SPeter Avalos 	  }
72341c99275SPeter Avalos 	case 'h':
72441c99275SPeter Avalos 	  {
72541c99275SPeter Avalos 	    int l = atoi(fmt + 1);
726*ed775ee7SAntonio Huete Jimenez 	    ND_TCHECK_LEN(buf, l);
727*ed775ee7SAntonio Huete Jimenez 	    while (l--) {
728*ed775ee7SAntonio Huete Jimenez 		ND_PRINT("%02x", GET_U_1(buf));
729*ed775ee7SAntonio Huete Jimenez 		buf++;
730*ed775ee7SAntonio Huete Jimenez 	    }
73141c99275SPeter Avalos 	    fmt++;
732*ed775ee7SAntonio Huete Jimenez 	    while (ND_ASCII_ISDIGIT(*fmt))
73341c99275SPeter Avalos 		fmt++;
73441c99275SPeter Avalos 	    break;
73541c99275SPeter Avalos 	  }
73641c99275SPeter Avalos 	case 'n':
73741c99275SPeter Avalos 	  {
73841c99275SPeter Avalos 	    int t = atoi(fmt+1);
73941c99275SPeter Avalos 	    char nbuf[255];
74041c99275SPeter Avalos 	    int name_type;
74141c99275SPeter Avalos 	    int len;
74241c99275SPeter Avalos 
74341c99275SPeter Avalos 	    switch (t) {
74441c99275SPeter Avalos 	    case 1:
745*ed775ee7SAntonio Huete Jimenez 		name_type = name_extract(ndo, startbuf, ND_BYTES_BETWEEN(buf, startbuf),
74641c99275SPeter Avalos 		    maxbuf, nbuf);
74741c99275SPeter Avalos 		if (name_type < 0)
74841c99275SPeter Avalos 		    goto trunc;
749411677aeSAaron LI 		len = name_len(ndo, buf, maxbuf);
75041c99275SPeter Avalos 		if (len < 0)
75141c99275SPeter Avalos 		    goto trunc;
75241c99275SPeter Avalos 		buf += len;
753*ed775ee7SAntonio Huete Jimenez 		ND_PRINT("%-15.15s NameType=0x%02X (%s)", nbuf, name_type,
754*ed775ee7SAntonio Huete Jimenez 		    name_type_str(name_type));
75541c99275SPeter Avalos 		break;
75641c99275SPeter Avalos 	    case 2:
757*ed775ee7SAntonio Huete Jimenez 		name_type = GET_U_1(buf + 15);
758*ed775ee7SAntonio Huete Jimenez 		ND_PRINT("%-15.15s NameType=0x%02X (%s)", buf, name_type,
759*ed775ee7SAntonio Huete Jimenez 		    name_type_str(name_type));
76041c99275SPeter Avalos 		buf += 16;
76141c99275SPeter Avalos 		break;
76241c99275SPeter Avalos 	    }
76341c99275SPeter Avalos 	    fmt++;
764*ed775ee7SAntonio Huete Jimenez 	    while (ND_ASCII_ISDIGIT(*fmt))
76541c99275SPeter Avalos 		fmt++;
76641c99275SPeter Avalos 	    break;
76741c99275SPeter Avalos 	  }
76841c99275SPeter Avalos 	case 'T':
76941c99275SPeter Avalos 	  {
77041c99275SPeter Avalos 	    time_t t;
77141c99275SPeter Avalos 	    struct tm *lt;
77241c99275SPeter Avalos 	    const char *tstring;
773411677aeSAaron LI 	    uint32_t x;
77441c99275SPeter Avalos 
77541c99275SPeter Avalos 	    switch (atoi(fmt + 1)) {
77641c99275SPeter Avalos 	    case 1:
777*ed775ee7SAntonio Huete Jimenez 		x = GET_LE_U_4(buf);
77841c99275SPeter Avalos 		if (x == 0 || x == 0xFFFFFFFF)
77941c99275SPeter Avalos 		    t = 0;
78041c99275SPeter Avalos 		else
781*ed775ee7SAntonio Huete Jimenez 		    t = make_unix_date(ndo, buf);
78241c99275SPeter Avalos 		buf += 4;
78341c99275SPeter Avalos 		break;
78441c99275SPeter Avalos 	    case 2:
785*ed775ee7SAntonio Huete Jimenez 		x = GET_LE_U_4(buf);
78641c99275SPeter Avalos 		if (x == 0 || x == 0xFFFFFFFF)
78741c99275SPeter Avalos 		    t = 0;
78841c99275SPeter Avalos 		else
789*ed775ee7SAntonio Huete Jimenez 		    t = make_unix_date2(ndo, buf);
79041c99275SPeter Avalos 		buf += 4;
79141c99275SPeter Avalos 		break;
79241c99275SPeter Avalos 	    case 3:
793*ed775ee7SAntonio Huete Jimenez 		ND_TCHECK_8(buf);
794*ed775ee7SAntonio Huete Jimenez 		t = interpret_long_date(ndo, buf);
79541c99275SPeter Avalos 		buf += 8;
79641c99275SPeter Avalos 		break;
79741c99275SPeter Avalos 	    default:
79841c99275SPeter Avalos 		t = 0;
79941c99275SPeter Avalos 		break;
80041c99275SPeter Avalos 	    }
80141c99275SPeter Avalos 	    if (t != 0) {
80241c99275SPeter Avalos 		lt = localtime(&t);
80341c99275SPeter Avalos 		if (lt != NULL)
80441c99275SPeter Avalos 		    tstring = asctime(lt);
80541c99275SPeter Avalos 		else
80641c99275SPeter Avalos 		    tstring = "(Can't convert time)\n";
80741c99275SPeter Avalos 	    } else
80841c99275SPeter Avalos 		tstring = "NULL\n";
809*ed775ee7SAntonio Huete Jimenez 	    ND_PRINT("%s", tstring);
81041c99275SPeter Avalos 	    fmt++;
811*ed775ee7SAntonio Huete Jimenez 	    while (ND_ASCII_ISDIGIT(*fmt))
81241c99275SPeter Avalos 		fmt++;
81341c99275SPeter Avalos 	    break;
81441c99275SPeter Avalos 	  }
81541c99275SPeter Avalos 	default:
816*ed775ee7SAntonio Huete Jimenez 	    ND_PRINT("%c", *fmt);
81741c99275SPeter Avalos 	    fmt++;
81841c99275SPeter Avalos 	    break;
81941c99275SPeter Avalos 	}
82041c99275SPeter Avalos     }
82141c99275SPeter Avalos 
82241c99275SPeter Avalos     if (buf >= maxbuf && *fmt)
823*ed775ee7SAntonio Huete Jimenez 	ND_PRINT("END OF BUFFER\n");
82441c99275SPeter Avalos 
82541c99275SPeter Avalos     return(buf);
82641c99275SPeter Avalos 
82741c99275SPeter Avalos trunc:
828*ed775ee7SAntonio Huete Jimenez     nd_print_trunc(ndo);
82941c99275SPeter Avalos     return(NULL);
83041c99275SPeter Avalos }
83141c99275SPeter Avalos 
83241c99275SPeter Avalos const u_char *
smb_fdata(netdissect_options * ndo,const u_char * buf,const char * fmt,const u_char * maxbuf,int unicodestr)833411677aeSAaron LI smb_fdata(netdissect_options *ndo,
834411677aeSAaron LI           const u_char *buf, const char *fmt, const u_char *maxbuf,
83541c99275SPeter Avalos           int unicodestr)
83641c99275SPeter Avalos {
83741c99275SPeter Avalos     static int depth = 0;
83841c99275SPeter Avalos     char s[128];
83941c99275SPeter Avalos     char *p;
84041c99275SPeter Avalos 
84141c99275SPeter Avalos     while (*fmt) {
84241c99275SPeter Avalos 	switch (*fmt) {
84341c99275SPeter Avalos 	case '*':
844411677aeSAaron LI 	    /*
845411677aeSAaron LI 	     * List of multiple instances of something described by the
846411677aeSAaron LI 	     * remainder of the string (which may itself include a list
847411677aeSAaron LI 	     * of multiple instances of something, so we recurse).
848411677aeSAaron LI 	     */
84941c99275SPeter Avalos 	    fmt++;
85041c99275SPeter Avalos 	    while (buf < maxbuf) {
85141c99275SPeter Avalos 		const u_char *buf2;
85241c99275SPeter Avalos 		depth++;
853411677aeSAaron LI 		/*
854411677aeSAaron LI 		 * In order to avoid stack exhaustion recurse at most 10
855411677aeSAaron LI 		 * levels; that "should not happen", as no SMB structure
856411677aeSAaron LI 		 * should be nested *that* deeply, and we thus shouldn't
857411677aeSAaron LI 		 * have format strings with that level of nesting.
858411677aeSAaron LI 		 */
859411677aeSAaron LI 		if (depth == 10) {
860*ed775ee7SAntonio Huete Jimenez 			ND_PRINT("(too many nested levels, not recursing)");
861411677aeSAaron LI 			buf2 = buf;
862411677aeSAaron LI 		} else
863411677aeSAaron LI 			buf2 = smb_fdata(ndo, buf, fmt, maxbuf, unicodestr);
86441c99275SPeter Avalos 		depth--;
86541c99275SPeter Avalos 		if (buf2 == NULL)
86641c99275SPeter Avalos 		    return(NULL);
86741c99275SPeter Avalos 		if (buf2 == buf)
86841c99275SPeter Avalos 		    return(buf);
86941c99275SPeter Avalos 		buf = buf2;
87041c99275SPeter Avalos 	    }
87141c99275SPeter Avalos 	    return(buf);
87241c99275SPeter Avalos 
87341c99275SPeter Avalos 	case '|':
874411677aeSAaron LI 	    /*
875411677aeSAaron LI 	     * Just do a bounds check.
876411677aeSAaron LI 	     */
87741c99275SPeter Avalos 	    fmt++;
87841c99275SPeter Avalos 	    if (buf >= maxbuf)
87941c99275SPeter Avalos 		return(buf);
88041c99275SPeter Avalos 	    break;
88141c99275SPeter Avalos 
88241c99275SPeter Avalos 	case '%':
883411677aeSAaron LI 	    /*
884411677aeSAaron LI 	     * XXX - unused?
885411677aeSAaron LI 	     */
88641c99275SPeter Avalos 	    fmt++;
88741c99275SPeter Avalos 	    buf = maxbuf;
88841c99275SPeter Avalos 	    break;
88941c99275SPeter Avalos 
89041c99275SPeter Avalos 	case '#':
891411677aeSAaron LI 	    /*
892411677aeSAaron LI 	     * Done?
893411677aeSAaron LI 	     */
89441c99275SPeter Avalos 	    fmt++;
89541c99275SPeter Avalos 	    return(buf);
89641c99275SPeter Avalos 	    break;
89741c99275SPeter Avalos 
89841c99275SPeter Avalos 	case '[':
899411677aeSAaron LI 	    /*
900411677aeSAaron LI 	     * Format of an item, enclosed in square brackets; dissect
901411677aeSAaron LI 	     * the item with smb_fdata1().
902411677aeSAaron LI 	     */
90341c99275SPeter Avalos 	    fmt++;
90441c99275SPeter Avalos 	    if (buf >= maxbuf)
90541c99275SPeter Avalos 		return(buf);
90641c99275SPeter Avalos 	    memset(s, 0, sizeof(s));
90741c99275SPeter Avalos 	    p = strchr(fmt, ']');
90841c99275SPeter Avalos 	    if ((size_t)(p - fmt + 1) > sizeof(s)) {
90941c99275SPeter Avalos 		/* overrun */
91041c99275SPeter Avalos 		return(buf);
91141c99275SPeter Avalos 	    }
91241c99275SPeter Avalos 	    strncpy(s, fmt, p - fmt);
91341c99275SPeter Avalos 	    s[p - fmt] = '\0';
91441c99275SPeter Avalos 	    fmt = p + 1;
915411677aeSAaron LI 	    buf = smb_fdata1(ndo, buf, s, maxbuf, unicodestr);
916*ed775ee7SAntonio Huete Jimenez 	    if (buf == NULL) {
917*ed775ee7SAntonio Huete Jimenez 		/*
918*ed775ee7SAntonio Huete Jimenez 		 * Truncated.
919*ed775ee7SAntonio Huete Jimenez 		 * Is the next character a newline?
920*ed775ee7SAntonio Huete Jimenez 		 * If so, print it before quitting, so we don't
921*ed775ee7SAntonio Huete Jimenez 		 * get stuff in the middle of the line.
922*ed775ee7SAntonio Huete Jimenez 		 */
923*ed775ee7SAntonio Huete Jimenez 		if (*fmt == '\n')
924*ed775ee7SAntonio Huete Jimenez 		    ND_PRINT("\n");
92541c99275SPeter Avalos 		return(NULL);
926411677aeSAaron LI 	    }
92741c99275SPeter Avalos 	    break;
92841c99275SPeter Avalos 
92941c99275SPeter Avalos 	default:
930411677aeSAaron LI 	    /*
931411677aeSAaron LI 	     * Not a formatting character, so just print it.
932411677aeSAaron LI 	     */
933*ed775ee7SAntonio Huete Jimenez 	    ND_PRINT("%c", *fmt);
93441c99275SPeter Avalos 	    fmt++;
93541c99275SPeter Avalos 	    break;
93641c99275SPeter Avalos 	}
93741c99275SPeter Avalos     }
93841c99275SPeter Avalos     if (!depth && buf < maxbuf) {
939*ed775ee7SAntonio Huete Jimenez 	u_int len = ND_BYTES_BETWEEN(maxbuf, buf);
940*ed775ee7SAntonio Huete Jimenez 	ND_PRINT("Data: (%u bytes)\n", len);
941*ed775ee7SAntonio Huete Jimenez 	smb_data_print(ndo, buf, len);
94241c99275SPeter Avalos 	return(buf + len);
94341c99275SPeter Avalos     }
94441c99275SPeter Avalos     return(buf);
94541c99275SPeter Avalos }
94641c99275SPeter Avalos 
94741c99275SPeter Avalos typedef struct {
94841c99275SPeter Avalos     const char *name;
94941c99275SPeter Avalos     int code;
95041c99275SPeter Avalos     const char *message;
95141c99275SPeter Avalos } err_code_struct;
95241c99275SPeter Avalos 
95341c99275SPeter Avalos /* DOS Error Messages */
95441c99275SPeter Avalos static const err_code_struct dos_msgs[] = {
95541c99275SPeter Avalos     { "ERRbadfunc", 1, "Invalid function." },
95641c99275SPeter Avalos     { "ERRbadfile", 2, "File not found." },
95741c99275SPeter Avalos     { "ERRbadpath", 3, "Directory invalid." },
95841c99275SPeter Avalos     { "ERRnofids", 4, "No file descriptors available" },
95941c99275SPeter Avalos     { "ERRnoaccess", 5, "Access denied." },
96041c99275SPeter Avalos     { "ERRbadfid", 6, "Invalid file handle." },
96141c99275SPeter Avalos     { "ERRbadmcb", 7, "Memory control blocks destroyed." },
96241c99275SPeter Avalos     { "ERRnomem", 8, "Insufficient server memory to perform the requested function." },
96341c99275SPeter Avalos     { "ERRbadmem", 9, "Invalid memory block address." },
96441c99275SPeter Avalos     { "ERRbadenv", 10, "Invalid environment." },
96541c99275SPeter Avalos     { "ERRbadformat", 11, "Invalid format." },
96641c99275SPeter Avalos     { "ERRbadaccess", 12, "Invalid open mode." },
96741c99275SPeter Avalos     { "ERRbaddata", 13, "Invalid data." },
96841c99275SPeter Avalos     { "ERR", 14, "reserved." },
96941c99275SPeter Avalos     { "ERRbaddrive", 15, "Invalid drive specified." },
97041c99275SPeter Avalos     { "ERRremcd", 16, "A Delete Directory request attempted to remove the server's current directory." },
97141c99275SPeter Avalos     { "ERRdiffdevice", 17, "Not same device." },
97241c99275SPeter Avalos     { "ERRnofiles", 18, "A File Search command can find no more files matching the specified criteria." },
97341c99275SPeter Avalos     { "ERRbadshare", 32, "The sharing mode specified for an Open conflicts with existing FIDs on the file." },
97441c99275SPeter Avalos     { "ERRlock", 33, "A Lock request conflicted with an existing lock or specified an invalid mode, or an Unlock requested attempted to remove a lock held by another process." },
97541c99275SPeter Avalos     { "ERRfilexists", 80, "The file named in a Create Directory, Make New File or Link request already exists." },
97641c99275SPeter Avalos     { "ERRbadpipe", 230, "Pipe invalid." },
97741c99275SPeter Avalos     { "ERRpipebusy", 231, "All instances of the requested pipe are busy." },
97841c99275SPeter Avalos     { "ERRpipeclosing", 232, "Pipe close in progress." },
97941c99275SPeter Avalos     { "ERRnotconnected", 233, "No process on other end of pipe." },
98041c99275SPeter Avalos     { "ERRmoredata", 234, "There is more data to be returned." },
98141c99275SPeter Avalos     { NULL, -1, NULL }
98241c99275SPeter Avalos  };
98341c99275SPeter Avalos 
98441c99275SPeter Avalos /* Server Error Messages */
98527bfbee1SPeter Avalos static const err_code_struct server_msgs[] = {
98641c99275SPeter Avalos     { "ERRerror", 1, "Non-specific error code." },
98741c99275SPeter Avalos     { "ERRbadpw", 2, "Bad password - name/password pair in a Tree Connect or Session Setup are invalid." },
98841c99275SPeter Avalos     { "ERRbadtype", 3, "reserved." },
98941c99275SPeter Avalos     { "ERRaccess", 4, "The requester does not have the necessary access rights within the specified context for the requested function. The context is defined by the TID or the UID." },
99041c99275SPeter Avalos     { "ERRinvnid", 5, "The tree ID (TID) specified in a command was invalid." },
99141c99275SPeter Avalos     { "ERRinvnetname", 6, "Invalid network name in tree connect." },
99241c99275SPeter Avalos     { "ERRinvdevice", 7, "Invalid device - printer request made to non-printer connection or non-printer request made to printer connection." },
99341c99275SPeter Avalos     { "ERRqfull", 49, "Print queue full (files) -- returned by open print file." },
99441c99275SPeter Avalos     { "ERRqtoobig", 50, "Print queue full -- no space." },
99541c99275SPeter Avalos     { "ERRqeof", 51, "EOF on print queue dump." },
99641c99275SPeter Avalos     { "ERRinvpfid", 52, "Invalid print file FID." },
99741c99275SPeter Avalos     { "ERRsmbcmd", 64, "The server did not recognize the command received." },
99841c99275SPeter Avalos     { "ERRsrverror", 65, "The server encountered an internal error, e.g., system file unavailable." },
99941c99275SPeter Avalos     { "ERRfilespecs", 67, "The file handle (FID) and pathname parameters contained an invalid combination of values." },
100041c99275SPeter Avalos     { "ERRreserved", 68, "reserved." },
100141c99275SPeter Avalos     { "ERRbadpermits", 69, "The access permissions specified for a file or directory are not a valid combination.  The server cannot set the requested attribute." },
100241c99275SPeter Avalos     { "ERRreserved", 70, "reserved." },
100341c99275SPeter Avalos     { "ERRsetattrmode", 71, "The attribute mode in the Set File Attribute request is invalid." },
100441c99275SPeter Avalos     { "ERRpaused", 81, "Server is paused." },
100541c99275SPeter Avalos     { "ERRmsgoff", 82, "Not receiving messages." },
100641c99275SPeter Avalos     { "ERRnoroom", 83, "No room to buffer message." },
100741c99275SPeter Avalos     { "ERRrmuns", 87, "Too many remote user names." },
100841c99275SPeter Avalos     { "ERRtimeout", 88, "Operation timed out." },
100941c99275SPeter Avalos     { "ERRnoresource", 89, "No resources currently available for request." },
101041c99275SPeter Avalos     { "ERRtoomanyuids", 90, "Too many UIDs active on this session." },
101141c99275SPeter Avalos     { "ERRbaduid", 91, "The UID is not known as a valid ID on this session." },
101241c99275SPeter Avalos     { "ERRusempx", 250, "Temp unable to support Raw, use MPX mode." },
101341c99275SPeter Avalos     { "ERRusestd", 251, "Temp unable to support Raw, use standard read/write." },
101441c99275SPeter Avalos     { "ERRcontmpx", 252, "Continue in MPX mode." },
101541c99275SPeter Avalos     { "ERRreserved", 253, "reserved." },
101641c99275SPeter Avalos     { "ERRreserved", 254, "reserved." },
101741c99275SPeter Avalos     { "ERRnosupport", 0xFFFF, "Function not supported." },
101841c99275SPeter Avalos     { NULL, -1, NULL }
101941c99275SPeter Avalos };
102041c99275SPeter Avalos 
102141c99275SPeter Avalos /* Hard Error Messages */
102227bfbee1SPeter Avalos static const err_code_struct hard_msgs[] = {
102341c99275SPeter Avalos     { "ERRnowrite", 19, "Attempt to write on write-protected diskette." },
102441c99275SPeter Avalos     { "ERRbadunit", 20, "Unknown unit." },
102541c99275SPeter Avalos     { "ERRnotready", 21, "Drive not ready." },
102641c99275SPeter Avalos     { "ERRbadcmd", 22, "Unknown command." },
102741c99275SPeter Avalos     { "ERRdata", 23, "Data error (CRC)." },
102841c99275SPeter Avalos     { "ERRbadreq", 24, "Bad request structure length." },
102941c99275SPeter Avalos     { "ERRseek", 25 , "Seek error." },
103041c99275SPeter Avalos     { "ERRbadmedia", 26, "Unknown media type." },
103141c99275SPeter Avalos     { "ERRbadsector", 27, "Sector not found." },
103241c99275SPeter Avalos     { "ERRnopaper", 28, "Printer out of paper." },
103341c99275SPeter Avalos     { "ERRwrite", 29, "Write fault." },
103441c99275SPeter Avalos     { "ERRread", 30, "Read fault." },
103541c99275SPeter Avalos     { "ERRgeneral", 31, "General failure." },
103641c99275SPeter Avalos     { "ERRbadshare", 32, "A open conflicts with an existing open." },
103741c99275SPeter Avalos     { "ERRlock", 33, "A Lock request conflicted with an existing lock or specified an invalid mode, or an Unlock requested attempted to remove a lock held by another process." },
103841c99275SPeter Avalos     { "ERRwrongdisk", 34, "The wrong disk was found in a drive." },
103941c99275SPeter Avalos     { "ERRFCBUnavail", 35, "No FCBs are available to process request." },
104041c99275SPeter Avalos     { "ERRsharebufexc", 36, "A sharing buffer has been exceeded." },
104141c99275SPeter Avalos     { NULL, -1, NULL }
104241c99275SPeter Avalos };
104341c99275SPeter Avalos 
104441c99275SPeter Avalos static const struct {
104541c99275SPeter Avalos     int code;
104641c99275SPeter Avalos     const char *class;
104741c99275SPeter Avalos     const err_code_struct *err_msgs;
104841c99275SPeter Avalos } err_classes[] = {
104941c99275SPeter Avalos     { 0, "SUCCESS", NULL },
105041c99275SPeter Avalos     { 0x01, "ERRDOS", dos_msgs },
105141c99275SPeter Avalos     { 0x02, "ERRSRV", server_msgs },
105241c99275SPeter Avalos     { 0x03, "ERRHRD", hard_msgs },
105341c99275SPeter Avalos     { 0x04, "ERRXOS", NULL },
105441c99275SPeter Avalos     { 0xE1, "ERRRMX1", NULL },
105541c99275SPeter Avalos     { 0xE2, "ERRRMX2", NULL },
105641c99275SPeter Avalos     { 0xE3, "ERRRMX3", NULL },
105741c99275SPeter Avalos     { 0xFF, "ERRCMD", NULL },
105841c99275SPeter Avalos     { -1, NULL, NULL }
105941c99275SPeter Avalos };
106041c99275SPeter Avalos 
106141c99275SPeter Avalos /*
106241c99275SPeter Avalos  * return a SMB error string from a SMB buffer
106341c99275SPeter Avalos  */
1064*ed775ee7SAntonio Huete Jimenez const char *
smb_errstr(int class,int num)106541c99275SPeter Avalos smb_errstr(int class, int num)
106641c99275SPeter Avalos {
106741c99275SPeter Avalos     static char ret[128];
106841c99275SPeter Avalos     int i, j;
106941c99275SPeter Avalos 
107041c99275SPeter Avalos     ret[0] = 0;
107141c99275SPeter Avalos 
107241c99275SPeter Avalos     for (i = 0; err_classes[i].class; i++)
107341c99275SPeter Avalos 	if (err_classes[i].code == class) {
107441c99275SPeter Avalos 	    if (err_classes[i].err_msgs) {
107541c99275SPeter Avalos 		const err_code_struct *err = err_classes[i].err_msgs;
107641c99275SPeter Avalos 		for (j = 0; err[j].name; j++)
107741c99275SPeter Avalos 		    if (num == err[j].code) {
107841c99275SPeter Avalos 			snprintf(ret, sizeof(ret), "%s - %s (%s)",
107941c99275SPeter Avalos 			    err_classes[i].class, err[j].name, err[j].message);
108041c99275SPeter Avalos 			return ret;
108141c99275SPeter Avalos 		    }
108241c99275SPeter Avalos 	    }
108341c99275SPeter Avalos 
108441c99275SPeter Avalos 	    snprintf(ret, sizeof(ret), "%s - %d", err_classes[i].class, num);
108541c99275SPeter Avalos 	    return ret;
108641c99275SPeter Avalos 	}
108741c99275SPeter Avalos 
108841c99275SPeter Avalos     snprintf(ret, sizeof(ret), "ERROR: Unknown error (%d,%d)", class, num);
108941c99275SPeter Avalos     return(ret);
109041c99275SPeter Avalos }
109141c99275SPeter Avalos 
109241c99275SPeter Avalos typedef struct {
1093411677aeSAaron LI     uint32_t code;
109441c99275SPeter Avalos     const char *name;
109541c99275SPeter Avalos } nt_err_code_struct;
109641c99275SPeter Avalos 
109741c99275SPeter Avalos /*
109841c99275SPeter Avalos  * NT Error codes
109941c99275SPeter Avalos  */
110041c99275SPeter Avalos static const nt_err_code_struct nt_errors[] = {
110141c99275SPeter Avalos   { 0x00000000, "STATUS_SUCCESS" },
110241c99275SPeter Avalos   { 0x00000000, "STATUS_WAIT_0" },
110341c99275SPeter Avalos   { 0x00000001, "STATUS_WAIT_1" },
110441c99275SPeter Avalos   { 0x00000002, "STATUS_WAIT_2" },
110541c99275SPeter Avalos   { 0x00000003, "STATUS_WAIT_3" },
110641c99275SPeter Avalos   { 0x0000003F, "STATUS_WAIT_63" },
110741c99275SPeter Avalos   { 0x00000080, "STATUS_ABANDONED" },
110841c99275SPeter Avalos   { 0x00000080, "STATUS_ABANDONED_WAIT_0" },
110941c99275SPeter Avalos   { 0x000000BF, "STATUS_ABANDONED_WAIT_63" },
111041c99275SPeter Avalos   { 0x000000C0, "STATUS_USER_APC" },
111141c99275SPeter Avalos   { 0x00000100, "STATUS_KERNEL_APC" },
111241c99275SPeter Avalos   { 0x00000101, "STATUS_ALERTED" },
111341c99275SPeter Avalos   { 0x00000102, "STATUS_TIMEOUT" },
111441c99275SPeter Avalos   { 0x00000103, "STATUS_PENDING" },
111541c99275SPeter Avalos   { 0x00000104, "STATUS_REPARSE" },
111641c99275SPeter Avalos   { 0x00000105, "STATUS_MORE_ENTRIES" },
111741c99275SPeter Avalos   { 0x00000106, "STATUS_NOT_ALL_ASSIGNED" },
111841c99275SPeter Avalos   { 0x00000107, "STATUS_SOME_NOT_MAPPED" },
111941c99275SPeter Avalos   { 0x00000108, "STATUS_OPLOCK_BREAK_IN_PROGRESS" },
112041c99275SPeter Avalos   { 0x00000109, "STATUS_VOLUME_MOUNTED" },
112141c99275SPeter Avalos   { 0x0000010A, "STATUS_RXACT_COMMITTED" },
112241c99275SPeter Avalos   { 0x0000010B, "STATUS_NOTIFY_CLEANUP" },
112341c99275SPeter Avalos   { 0x0000010C, "STATUS_NOTIFY_ENUM_DIR" },
112441c99275SPeter Avalos   { 0x0000010D, "STATUS_NO_QUOTAS_FOR_ACCOUNT" },
112541c99275SPeter Avalos   { 0x0000010E, "STATUS_PRIMARY_TRANSPORT_CONNECT_FAILED" },
112641c99275SPeter Avalos   { 0x00000110, "STATUS_PAGE_FAULT_TRANSITION" },
112741c99275SPeter Avalos   { 0x00000111, "STATUS_PAGE_FAULT_DEMAND_ZERO" },
112841c99275SPeter Avalos   { 0x00000112, "STATUS_PAGE_FAULT_COPY_ON_WRITE" },
112941c99275SPeter Avalos   { 0x00000113, "STATUS_PAGE_FAULT_GUARD_PAGE" },
113041c99275SPeter Avalos   { 0x00000114, "STATUS_PAGE_FAULT_PAGING_FILE" },
113141c99275SPeter Avalos   { 0x00000115, "STATUS_CACHE_PAGE_LOCKED" },
113241c99275SPeter Avalos   { 0x00000116, "STATUS_CRASH_DUMP" },
113341c99275SPeter Avalos   { 0x00000117, "STATUS_BUFFER_ALL_ZEROS" },
113441c99275SPeter Avalos   { 0x00000118, "STATUS_REPARSE_OBJECT" },
113541c99275SPeter Avalos   { 0x0000045C, "STATUS_NO_SHUTDOWN_IN_PROGRESS" },
113641c99275SPeter Avalos   { 0x40000000, "STATUS_OBJECT_NAME_EXISTS" },
113741c99275SPeter Avalos   { 0x40000001, "STATUS_THREAD_WAS_SUSPENDED" },
113841c99275SPeter Avalos   { 0x40000002, "STATUS_WORKING_SET_LIMIT_RANGE" },
113941c99275SPeter Avalos   { 0x40000003, "STATUS_IMAGE_NOT_AT_BASE" },
114041c99275SPeter Avalos   { 0x40000004, "STATUS_RXACT_STATE_CREATED" },
114141c99275SPeter Avalos   { 0x40000005, "STATUS_SEGMENT_NOTIFICATION" },
114241c99275SPeter Avalos   { 0x40000006, "STATUS_LOCAL_USER_SESSION_KEY" },
114341c99275SPeter Avalos   { 0x40000007, "STATUS_BAD_CURRENT_DIRECTORY" },
114441c99275SPeter Avalos   { 0x40000008, "STATUS_SERIAL_MORE_WRITES" },
114541c99275SPeter Avalos   { 0x40000009, "STATUS_REGISTRY_RECOVERED" },
114641c99275SPeter Avalos   { 0x4000000A, "STATUS_FT_READ_RECOVERY_FROM_BACKUP" },
114741c99275SPeter Avalos   { 0x4000000B, "STATUS_FT_WRITE_RECOVERY" },
114841c99275SPeter Avalos   { 0x4000000C, "STATUS_SERIAL_COUNTER_TIMEOUT" },
114941c99275SPeter Avalos   { 0x4000000D, "STATUS_NULL_LM_PASSWORD" },
115041c99275SPeter Avalos   { 0x4000000E, "STATUS_IMAGE_MACHINE_TYPE_MISMATCH" },
115141c99275SPeter Avalos   { 0x4000000F, "STATUS_RECEIVE_PARTIAL" },
115241c99275SPeter Avalos   { 0x40000010, "STATUS_RECEIVE_EXPEDITED" },
115341c99275SPeter Avalos   { 0x40000011, "STATUS_RECEIVE_PARTIAL_EXPEDITED" },
115441c99275SPeter Avalos   { 0x40000012, "STATUS_EVENT_DONE" },
115541c99275SPeter Avalos   { 0x40000013, "STATUS_EVENT_PENDING" },
115641c99275SPeter Avalos   { 0x40000014, "STATUS_CHECKING_FILE_SYSTEM" },
115741c99275SPeter Avalos   { 0x40000015, "STATUS_FATAL_APP_EXIT" },
115841c99275SPeter Avalos   { 0x40000016, "STATUS_PREDEFINED_HANDLE" },
115941c99275SPeter Avalos   { 0x40000017, "STATUS_WAS_UNLOCKED" },
116041c99275SPeter Avalos   { 0x40000018, "STATUS_SERVICE_NOTIFICATION" },
116141c99275SPeter Avalos   { 0x40000019, "STATUS_WAS_LOCKED" },
116241c99275SPeter Avalos   { 0x4000001A, "STATUS_LOG_HARD_ERROR" },
116341c99275SPeter Avalos   { 0x4000001B, "STATUS_ALREADY_WIN32" },
116441c99275SPeter Avalos   { 0x4000001C, "STATUS_WX86_UNSIMULATE" },
116541c99275SPeter Avalos   { 0x4000001D, "STATUS_WX86_CONTINUE" },
116641c99275SPeter Avalos   { 0x4000001E, "STATUS_WX86_SINGLE_STEP" },
116741c99275SPeter Avalos   { 0x4000001F, "STATUS_WX86_BREAKPOINT" },
116841c99275SPeter Avalos   { 0x40000020, "STATUS_WX86_EXCEPTION_CONTINUE" },
116941c99275SPeter Avalos   { 0x40000021, "STATUS_WX86_EXCEPTION_LASTCHANCE" },
117041c99275SPeter Avalos   { 0x40000022, "STATUS_WX86_EXCEPTION_CHAIN" },
117141c99275SPeter Avalos   { 0x40000023, "STATUS_IMAGE_MACHINE_TYPE_MISMATCH_EXE" },
117241c99275SPeter Avalos   { 0x40000024, "STATUS_NO_YIELD_PERFORMED" },
117341c99275SPeter Avalos   { 0x40000025, "STATUS_TIMER_RESUME_IGNORED" },
117441c99275SPeter Avalos   { 0x80000001, "STATUS_GUARD_PAGE_VIOLATION" },
117541c99275SPeter Avalos   { 0x80000002, "STATUS_DATATYPE_MISALIGNMENT" },
117641c99275SPeter Avalos   { 0x80000003, "STATUS_BREAKPOINT" },
117741c99275SPeter Avalos   { 0x80000004, "STATUS_SINGLE_STEP" },
117841c99275SPeter Avalos   { 0x80000005, "STATUS_BUFFER_OVERFLOW" },
117941c99275SPeter Avalos   { 0x80000006, "STATUS_NO_MORE_FILES" },
118041c99275SPeter Avalos   { 0x80000007, "STATUS_WAKE_SYSTEM_DEBUGGER" },
118141c99275SPeter Avalos   { 0x8000000A, "STATUS_HANDLES_CLOSED" },
118241c99275SPeter Avalos   { 0x8000000B, "STATUS_NO_INHERITANCE" },
118341c99275SPeter Avalos   { 0x8000000C, "STATUS_GUID_SUBSTITUTION_MADE" },
118441c99275SPeter Avalos   { 0x8000000D, "STATUS_PARTIAL_COPY" },
118541c99275SPeter Avalos   { 0x8000000E, "STATUS_DEVICE_PAPER_EMPTY" },
118641c99275SPeter Avalos   { 0x8000000F, "STATUS_DEVICE_POWERED_OFF" },
118741c99275SPeter Avalos   { 0x80000010, "STATUS_DEVICE_OFF_LINE" },
118841c99275SPeter Avalos   { 0x80000011, "STATUS_DEVICE_BUSY" },
118941c99275SPeter Avalos   { 0x80000012, "STATUS_NO_MORE_EAS" },
119041c99275SPeter Avalos   { 0x80000013, "STATUS_INVALID_EA_NAME" },
119141c99275SPeter Avalos   { 0x80000014, "STATUS_EA_LIST_INCONSISTENT" },
119241c99275SPeter Avalos   { 0x80000015, "STATUS_INVALID_EA_FLAG" },
119341c99275SPeter Avalos   { 0x80000016, "STATUS_VERIFY_REQUIRED" },
119441c99275SPeter Avalos   { 0x80000017, "STATUS_EXTRANEOUS_INFORMATION" },
119541c99275SPeter Avalos   { 0x80000018, "STATUS_RXACT_COMMIT_NECESSARY" },
119641c99275SPeter Avalos   { 0x8000001A, "STATUS_NO_MORE_ENTRIES" },
119741c99275SPeter Avalos   { 0x8000001B, "STATUS_FILEMARK_DETECTED" },
119841c99275SPeter Avalos   { 0x8000001C, "STATUS_MEDIA_CHANGED" },
119941c99275SPeter Avalos   { 0x8000001D, "STATUS_BUS_RESET" },
120041c99275SPeter Avalos   { 0x8000001E, "STATUS_END_OF_MEDIA" },
120141c99275SPeter Avalos   { 0x8000001F, "STATUS_BEGINNING_OF_MEDIA" },
120241c99275SPeter Avalos   { 0x80000020, "STATUS_MEDIA_CHECK" },
120341c99275SPeter Avalos   { 0x80000021, "STATUS_SETMARK_DETECTED" },
120441c99275SPeter Avalos   { 0x80000022, "STATUS_NO_DATA_DETECTED" },
120541c99275SPeter Avalos   { 0x80000023, "STATUS_REDIRECTOR_HAS_OPEN_HANDLES" },
120641c99275SPeter Avalos   { 0x80000024, "STATUS_SERVER_HAS_OPEN_HANDLES" },
120741c99275SPeter Avalos   { 0x80000025, "STATUS_ALREADY_DISCONNECTED" },
120841c99275SPeter Avalos   { 0x80000026, "STATUS_LONGJUMP" },
120941c99275SPeter Avalos   { 0x80040111, "MAPI_E_LOGON_FAILED" },
121041c99275SPeter Avalos   { 0x80090300, "SEC_E_INSUFFICIENT_MEMORY" },
121141c99275SPeter Avalos   { 0x80090301, "SEC_E_INVALID_HANDLE" },
121241c99275SPeter Avalos   { 0x80090302, "SEC_E_UNSUPPORTED_FUNCTION" },
121341c99275SPeter Avalos   { 0x8009030B, "SEC_E_NO_IMPERSONATION" },
121441c99275SPeter Avalos   { 0x8009030D, "SEC_E_UNKNOWN_CREDENTIALS" },
121541c99275SPeter Avalos   { 0x8009030E, "SEC_E_NO_CREDENTIALS" },
121641c99275SPeter Avalos   { 0x8009030F, "SEC_E_MESSAGE_ALTERED" },
121741c99275SPeter Avalos   { 0x80090310, "SEC_E_OUT_OF_SEQUENCE" },
121841c99275SPeter Avalos   { 0x80090311, "SEC_E_NO_AUTHENTICATING_AUTHORITY" },
121941c99275SPeter Avalos   { 0xC0000001, "STATUS_UNSUCCESSFUL" },
122041c99275SPeter Avalos   { 0xC0000002, "STATUS_NOT_IMPLEMENTED" },
122141c99275SPeter Avalos   { 0xC0000003, "STATUS_INVALID_INFO_CLASS" },
122241c99275SPeter Avalos   { 0xC0000004, "STATUS_INFO_LENGTH_MISMATCH" },
122341c99275SPeter Avalos   { 0xC0000005, "STATUS_ACCESS_VIOLATION" },
122441c99275SPeter Avalos   { 0xC0000006, "STATUS_IN_PAGE_ERROR" },
122541c99275SPeter Avalos   { 0xC0000007, "STATUS_PAGEFILE_QUOTA" },
122641c99275SPeter Avalos   { 0xC0000008, "STATUS_INVALID_HANDLE" },
122741c99275SPeter Avalos   { 0xC0000009, "STATUS_BAD_INITIAL_STACK" },
122841c99275SPeter Avalos   { 0xC000000A, "STATUS_BAD_INITIAL_PC" },
122941c99275SPeter Avalos   { 0xC000000B, "STATUS_INVALID_CID" },
123041c99275SPeter Avalos   { 0xC000000C, "STATUS_TIMER_NOT_CANCELED" },
123141c99275SPeter Avalos   { 0xC000000D, "STATUS_INVALID_PARAMETER" },
123241c99275SPeter Avalos   { 0xC000000E, "STATUS_NO_SUCH_DEVICE" },
123341c99275SPeter Avalos   { 0xC000000F, "STATUS_NO_SUCH_FILE" },
123441c99275SPeter Avalos   { 0xC0000010, "STATUS_INVALID_DEVICE_REQUEST" },
123541c99275SPeter Avalos   { 0xC0000011, "STATUS_END_OF_FILE" },
123641c99275SPeter Avalos   { 0xC0000012, "STATUS_WRONG_VOLUME" },
123741c99275SPeter Avalos   { 0xC0000013, "STATUS_NO_MEDIA_IN_DEVICE" },
123841c99275SPeter Avalos   { 0xC0000014, "STATUS_UNRECOGNIZED_MEDIA" },
123941c99275SPeter Avalos   { 0xC0000015, "STATUS_NONEXISTENT_SECTOR" },
124041c99275SPeter Avalos   { 0xC0000016, "STATUS_MORE_PROCESSING_REQUIRED" },
124141c99275SPeter Avalos   { 0xC0000017, "STATUS_NO_MEMORY" },
124241c99275SPeter Avalos   { 0xC0000018, "STATUS_CONFLICTING_ADDRESSES" },
124341c99275SPeter Avalos   { 0xC0000019, "STATUS_NOT_MAPPED_VIEW" },
124441c99275SPeter Avalos   { 0xC000001A, "STATUS_UNABLE_TO_FREE_VM" },
124541c99275SPeter Avalos   { 0xC000001B, "STATUS_UNABLE_TO_DELETE_SECTION" },
124641c99275SPeter Avalos   { 0xC000001C, "STATUS_INVALID_SYSTEM_SERVICE" },
124741c99275SPeter Avalos   { 0xC000001D, "STATUS_ILLEGAL_INSTRUCTION" },
124841c99275SPeter Avalos   { 0xC000001E, "STATUS_INVALID_LOCK_SEQUENCE" },
124941c99275SPeter Avalos   { 0xC000001F, "STATUS_INVALID_VIEW_SIZE" },
125041c99275SPeter Avalos   { 0xC0000020, "STATUS_INVALID_FILE_FOR_SECTION" },
125141c99275SPeter Avalos   { 0xC0000021, "STATUS_ALREADY_COMMITTED" },
125241c99275SPeter Avalos   { 0xC0000022, "STATUS_ACCESS_DENIED" },
125341c99275SPeter Avalos   { 0xC0000023, "STATUS_BUFFER_TOO_SMALL" },
125441c99275SPeter Avalos   { 0xC0000024, "STATUS_OBJECT_TYPE_MISMATCH" },
125541c99275SPeter Avalos   { 0xC0000025, "STATUS_NONCONTINUABLE_EXCEPTION" },
125641c99275SPeter Avalos   { 0xC0000026, "STATUS_INVALID_DISPOSITION" },
125741c99275SPeter Avalos   { 0xC0000027, "STATUS_UNWIND" },
125841c99275SPeter Avalos   { 0xC0000028, "STATUS_BAD_STACK" },
125941c99275SPeter Avalos   { 0xC0000029, "STATUS_INVALID_UNWIND_TARGET" },
126041c99275SPeter Avalos   { 0xC000002A, "STATUS_NOT_LOCKED" },
126141c99275SPeter Avalos   { 0xC000002B, "STATUS_PARITY_ERROR" },
126241c99275SPeter Avalos   { 0xC000002C, "STATUS_UNABLE_TO_DECOMMIT_VM" },
126341c99275SPeter Avalos   { 0xC000002D, "STATUS_NOT_COMMITTED" },
126441c99275SPeter Avalos   { 0xC000002E, "STATUS_INVALID_PORT_ATTRIBUTES" },
126541c99275SPeter Avalos   { 0xC000002F, "STATUS_PORT_MESSAGE_TOO_LONG" },
126641c99275SPeter Avalos   { 0xC0000030, "STATUS_INVALID_PARAMETER_MIX" },
126741c99275SPeter Avalos   { 0xC0000031, "STATUS_INVALID_QUOTA_LOWER" },
126841c99275SPeter Avalos   { 0xC0000032, "STATUS_DISK_CORRUPT_ERROR" },
126941c99275SPeter Avalos   { 0xC0000033, "STATUS_OBJECT_NAME_INVALID" },
127041c99275SPeter Avalos   { 0xC0000034, "STATUS_OBJECT_NAME_NOT_FOUND" },
127141c99275SPeter Avalos   { 0xC0000035, "STATUS_OBJECT_NAME_COLLISION" },
127241c99275SPeter Avalos   { 0xC0000037, "STATUS_PORT_DISCONNECTED" },
127341c99275SPeter Avalos   { 0xC0000038, "STATUS_DEVICE_ALREADY_ATTACHED" },
127441c99275SPeter Avalos   { 0xC0000039, "STATUS_OBJECT_PATH_INVALID" },
127541c99275SPeter Avalos   { 0xC000003A, "STATUS_OBJECT_PATH_NOT_FOUND" },
127641c99275SPeter Avalos   { 0xC000003B, "STATUS_OBJECT_PATH_SYNTAX_BAD" },
127741c99275SPeter Avalos   { 0xC000003C, "STATUS_DATA_OVERRUN" },
127841c99275SPeter Avalos   { 0xC000003D, "STATUS_DATA_LATE_ERROR" },
127941c99275SPeter Avalos   { 0xC000003E, "STATUS_DATA_ERROR" },
128041c99275SPeter Avalos   { 0xC000003F, "STATUS_CRC_ERROR" },
128141c99275SPeter Avalos   { 0xC0000040, "STATUS_SECTION_TOO_BIG" },
128241c99275SPeter Avalos   { 0xC0000041, "STATUS_PORT_CONNECTION_REFUSED" },
128341c99275SPeter Avalos   { 0xC0000042, "STATUS_INVALID_PORT_HANDLE" },
128441c99275SPeter Avalos   { 0xC0000043, "STATUS_SHARING_VIOLATION" },
128541c99275SPeter Avalos   { 0xC0000044, "STATUS_QUOTA_EXCEEDED" },
128641c99275SPeter Avalos   { 0xC0000045, "STATUS_INVALID_PAGE_PROTECTION" },
128741c99275SPeter Avalos   { 0xC0000046, "STATUS_MUTANT_NOT_OWNED" },
128841c99275SPeter Avalos   { 0xC0000047, "STATUS_SEMAPHORE_LIMIT_EXCEEDED" },
128941c99275SPeter Avalos   { 0xC0000048, "STATUS_PORT_ALREADY_SET" },
129041c99275SPeter Avalos   { 0xC0000049, "STATUS_SECTION_NOT_IMAGE" },
129141c99275SPeter Avalos   { 0xC000004A, "STATUS_SUSPEND_COUNT_EXCEEDED" },
129241c99275SPeter Avalos   { 0xC000004B, "STATUS_THREAD_IS_TERMINATING" },
129341c99275SPeter Avalos   { 0xC000004C, "STATUS_BAD_WORKING_SET_LIMIT" },
129441c99275SPeter Avalos   { 0xC000004D, "STATUS_INCOMPATIBLE_FILE_MAP" },
129541c99275SPeter Avalos   { 0xC000004E, "STATUS_SECTION_PROTECTION" },
129641c99275SPeter Avalos   { 0xC000004F, "STATUS_EAS_NOT_SUPPORTED" },
129741c99275SPeter Avalos   { 0xC0000050, "STATUS_EA_TOO_LARGE" },
129841c99275SPeter Avalos   { 0xC0000051, "STATUS_NONEXISTENT_EA_ENTRY" },
129941c99275SPeter Avalos   { 0xC0000052, "STATUS_NO_EAS_ON_FILE" },
130041c99275SPeter Avalos   { 0xC0000053, "STATUS_EA_CORRUPT_ERROR" },
130141c99275SPeter Avalos   { 0xC0000054, "STATUS_FILE_LOCK_CONFLICT" },
130241c99275SPeter Avalos   { 0xC0000055, "STATUS_LOCK_NOT_GRANTED" },
130341c99275SPeter Avalos   { 0xC0000056, "STATUS_DELETE_PENDING" },
130441c99275SPeter Avalos   { 0xC0000057, "STATUS_CTL_FILE_NOT_SUPPORTED" },
130541c99275SPeter Avalos   { 0xC0000058, "STATUS_UNKNOWN_REVISION" },
130641c99275SPeter Avalos   { 0xC0000059, "STATUS_REVISION_MISMATCH" },
130741c99275SPeter Avalos   { 0xC000005A, "STATUS_INVALID_OWNER" },
130841c99275SPeter Avalos   { 0xC000005B, "STATUS_INVALID_PRIMARY_GROUP" },
130941c99275SPeter Avalos   { 0xC000005C, "STATUS_NO_IMPERSONATION_TOKEN" },
131041c99275SPeter Avalos   { 0xC000005D, "STATUS_CANT_DISABLE_MANDATORY" },
131141c99275SPeter Avalos   { 0xC000005E, "STATUS_NO_LOGON_SERVERS" },
131241c99275SPeter Avalos   { 0xC000005F, "STATUS_NO_SUCH_LOGON_SESSION" },
131341c99275SPeter Avalos   { 0xC0000060, "STATUS_NO_SUCH_PRIVILEGE" },
131441c99275SPeter Avalos   { 0xC0000061, "STATUS_PRIVILEGE_NOT_HELD" },
131541c99275SPeter Avalos   { 0xC0000062, "STATUS_INVALID_ACCOUNT_NAME" },
131641c99275SPeter Avalos   { 0xC0000063, "STATUS_USER_EXISTS" },
131741c99275SPeter Avalos   { 0xC0000064, "STATUS_NO_SUCH_USER" },
131841c99275SPeter Avalos   { 0xC0000065, "STATUS_GROUP_EXISTS" },
131941c99275SPeter Avalos   { 0xC0000066, "STATUS_NO_SUCH_GROUP" },
132041c99275SPeter Avalos   { 0xC0000067, "STATUS_MEMBER_IN_GROUP" },
132141c99275SPeter Avalos   { 0xC0000068, "STATUS_MEMBER_NOT_IN_GROUP" },
132241c99275SPeter Avalos   { 0xC0000069, "STATUS_LAST_ADMIN" },
132341c99275SPeter Avalos   { 0xC000006A, "STATUS_WRONG_PASSWORD" },
132441c99275SPeter Avalos   { 0xC000006B, "STATUS_ILL_FORMED_PASSWORD" },
132541c99275SPeter Avalos   { 0xC000006C, "STATUS_PASSWORD_RESTRICTION" },
132641c99275SPeter Avalos   { 0xC000006D, "STATUS_LOGON_FAILURE" },
132741c99275SPeter Avalos   { 0xC000006E, "STATUS_ACCOUNT_RESTRICTION" },
132841c99275SPeter Avalos   { 0xC000006F, "STATUS_INVALID_LOGON_HOURS" },
132941c99275SPeter Avalos   { 0xC0000070, "STATUS_INVALID_WORKSTATION" },
133041c99275SPeter Avalos   { 0xC0000071, "STATUS_PASSWORD_EXPIRED" },
133141c99275SPeter Avalos   { 0xC0000072, "STATUS_ACCOUNT_DISABLED" },
133241c99275SPeter Avalos   { 0xC0000073, "STATUS_NONE_MAPPED" },
133341c99275SPeter Avalos   { 0xC0000074, "STATUS_TOO_MANY_LUIDS_REQUESTED" },
133441c99275SPeter Avalos   { 0xC0000075, "STATUS_LUIDS_EXHAUSTED" },
133541c99275SPeter Avalos   { 0xC0000076, "STATUS_INVALID_SUB_AUTHORITY" },
133641c99275SPeter Avalos   { 0xC0000077, "STATUS_INVALID_ACL" },
133741c99275SPeter Avalos   { 0xC0000078, "STATUS_INVALID_SID" },
133841c99275SPeter Avalos   { 0xC0000079, "STATUS_INVALID_SECURITY_DESCR" },
133941c99275SPeter Avalos   { 0xC000007A, "STATUS_PROCEDURE_NOT_FOUND" },
134041c99275SPeter Avalos   { 0xC000007B, "STATUS_INVALID_IMAGE_FORMAT" },
134141c99275SPeter Avalos   { 0xC000007C, "STATUS_NO_TOKEN" },
134241c99275SPeter Avalos   { 0xC000007D, "STATUS_BAD_INHERITANCE_ACL" },
134341c99275SPeter Avalos   { 0xC000007E, "STATUS_RANGE_NOT_LOCKED" },
134441c99275SPeter Avalos   { 0xC000007F, "STATUS_DISK_FULL" },
134541c99275SPeter Avalos   { 0xC0000080, "STATUS_SERVER_DISABLED" },
134641c99275SPeter Avalos   { 0xC0000081, "STATUS_SERVER_NOT_DISABLED" },
134741c99275SPeter Avalos   { 0xC0000082, "STATUS_TOO_MANY_GUIDS_REQUESTED" },
134841c99275SPeter Avalos   { 0xC0000083, "STATUS_GUIDS_EXHAUSTED" },
134941c99275SPeter Avalos   { 0xC0000084, "STATUS_INVALID_ID_AUTHORITY" },
135041c99275SPeter Avalos   { 0xC0000085, "STATUS_AGENTS_EXHAUSTED" },
135141c99275SPeter Avalos   { 0xC0000086, "STATUS_INVALID_VOLUME_LABEL" },
135241c99275SPeter Avalos   { 0xC0000087, "STATUS_SECTION_NOT_EXTENDED" },
135341c99275SPeter Avalos   { 0xC0000088, "STATUS_NOT_MAPPED_DATA" },
135441c99275SPeter Avalos   { 0xC0000089, "STATUS_RESOURCE_DATA_NOT_FOUND" },
135541c99275SPeter Avalos   { 0xC000008A, "STATUS_RESOURCE_TYPE_NOT_FOUND" },
135641c99275SPeter Avalos   { 0xC000008B, "STATUS_RESOURCE_NAME_NOT_FOUND" },
135741c99275SPeter Avalos   { 0xC000008C, "STATUS_ARRAY_BOUNDS_EXCEEDED" },
135841c99275SPeter Avalos   { 0xC000008D, "STATUS_FLOAT_DENORMAL_OPERAND" },
135941c99275SPeter Avalos   { 0xC000008E, "STATUS_FLOAT_DIVIDE_BY_ZERO" },
136041c99275SPeter Avalos   { 0xC000008F, "STATUS_FLOAT_INEXACT_RESULT" },
136141c99275SPeter Avalos   { 0xC0000090, "STATUS_FLOAT_INVALID_OPERATION" },
136241c99275SPeter Avalos   { 0xC0000091, "STATUS_FLOAT_OVERFLOW" },
136341c99275SPeter Avalos   { 0xC0000092, "STATUS_FLOAT_STACK_CHECK" },
136441c99275SPeter Avalos   { 0xC0000093, "STATUS_FLOAT_UNDERFLOW" },
136541c99275SPeter Avalos   { 0xC0000094, "STATUS_INTEGER_DIVIDE_BY_ZERO" },
136641c99275SPeter Avalos   { 0xC0000095, "STATUS_INTEGER_OVERFLOW" },
136741c99275SPeter Avalos   { 0xC0000096, "STATUS_PRIVILEGED_INSTRUCTION" },
136841c99275SPeter Avalos   { 0xC0000097, "STATUS_TOO_MANY_PAGING_FILES" },
136941c99275SPeter Avalos   { 0xC0000098, "STATUS_FILE_INVALID" },
137041c99275SPeter Avalos   { 0xC0000099, "STATUS_ALLOTTED_SPACE_EXCEEDED" },
137141c99275SPeter Avalos   { 0xC000009A, "STATUS_INSUFFICIENT_RESOURCES" },
137241c99275SPeter Avalos   { 0xC000009B, "STATUS_DFS_EXIT_PATH_FOUND" },
137341c99275SPeter Avalos   { 0xC000009C, "STATUS_DEVICE_DATA_ERROR" },
137441c99275SPeter Avalos   { 0xC000009D, "STATUS_DEVICE_NOT_CONNECTED" },
137541c99275SPeter Avalos   { 0xC000009E, "STATUS_DEVICE_POWER_FAILURE" },
137641c99275SPeter Avalos   { 0xC000009F, "STATUS_FREE_VM_NOT_AT_BASE" },
137741c99275SPeter Avalos   { 0xC00000A0, "STATUS_MEMORY_NOT_ALLOCATED" },
137841c99275SPeter Avalos   { 0xC00000A1, "STATUS_WORKING_SET_QUOTA" },
137941c99275SPeter Avalos   { 0xC00000A2, "STATUS_MEDIA_WRITE_PROTECTED" },
138041c99275SPeter Avalos   { 0xC00000A3, "STATUS_DEVICE_NOT_READY" },
138141c99275SPeter Avalos   { 0xC00000A4, "STATUS_INVALID_GROUP_ATTRIBUTES" },
138241c99275SPeter Avalos   { 0xC00000A5, "STATUS_BAD_IMPERSONATION_LEVEL" },
138341c99275SPeter Avalos   { 0xC00000A6, "STATUS_CANT_OPEN_ANONYMOUS" },
138441c99275SPeter Avalos   { 0xC00000A7, "STATUS_BAD_VALIDATION_CLASS" },
138541c99275SPeter Avalos   { 0xC00000A8, "STATUS_BAD_TOKEN_TYPE" },
138641c99275SPeter Avalos   { 0xC00000A9, "STATUS_BAD_MASTER_BOOT_RECORD" },
138741c99275SPeter Avalos   { 0xC00000AA, "STATUS_INSTRUCTION_MISALIGNMENT" },
138841c99275SPeter Avalos   { 0xC00000AB, "STATUS_INSTANCE_NOT_AVAILABLE" },
138941c99275SPeter Avalos   { 0xC00000AC, "STATUS_PIPE_NOT_AVAILABLE" },
139041c99275SPeter Avalos   { 0xC00000AD, "STATUS_INVALID_PIPE_STATE" },
139141c99275SPeter Avalos   { 0xC00000AE, "STATUS_PIPE_BUSY" },
139241c99275SPeter Avalos   { 0xC00000AF, "STATUS_ILLEGAL_FUNCTION" },
139341c99275SPeter Avalos   { 0xC00000B0, "STATUS_PIPE_DISCONNECTED" },
139441c99275SPeter Avalos   { 0xC00000B1, "STATUS_PIPE_CLOSING" },
139541c99275SPeter Avalos   { 0xC00000B2, "STATUS_PIPE_CONNECTED" },
139641c99275SPeter Avalos   { 0xC00000B3, "STATUS_PIPE_LISTENING" },
139741c99275SPeter Avalos   { 0xC00000B4, "STATUS_INVALID_READ_MODE" },
139841c99275SPeter Avalos   { 0xC00000B5, "STATUS_IO_TIMEOUT" },
139941c99275SPeter Avalos   { 0xC00000B6, "STATUS_FILE_FORCED_CLOSED" },
140041c99275SPeter Avalos   { 0xC00000B7, "STATUS_PROFILING_NOT_STARTED" },
140141c99275SPeter Avalos   { 0xC00000B8, "STATUS_PROFILING_NOT_STOPPED" },
140241c99275SPeter Avalos   { 0xC00000B9, "STATUS_COULD_NOT_INTERPRET" },
140341c99275SPeter Avalos   { 0xC00000BA, "STATUS_FILE_IS_A_DIRECTORY" },
140441c99275SPeter Avalos   { 0xC00000BB, "STATUS_NOT_SUPPORTED" },
140541c99275SPeter Avalos   { 0xC00000BC, "STATUS_REMOTE_NOT_LISTENING" },
140641c99275SPeter Avalos   { 0xC00000BD, "STATUS_DUPLICATE_NAME" },
140741c99275SPeter Avalos   { 0xC00000BE, "STATUS_BAD_NETWORK_PATH" },
140841c99275SPeter Avalos   { 0xC00000BF, "STATUS_NETWORK_BUSY" },
140941c99275SPeter Avalos   { 0xC00000C0, "STATUS_DEVICE_DOES_NOT_EXIST" },
141041c99275SPeter Avalos   { 0xC00000C1, "STATUS_TOO_MANY_COMMANDS" },
141141c99275SPeter Avalos   { 0xC00000C2, "STATUS_ADAPTER_HARDWARE_ERROR" },
141241c99275SPeter Avalos   { 0xC00000C3, "STATUS_INVALID_NETWORK_RESPONSE" },
141341c99275SPeter Avalos   { 0xC00000C4, "STATUS_UNEXPECTED_NETWORK_ERROR" },
141441c99275SPeter Avalos   { 0xC00000C5, "STATUS_BAD_REMOTE_ADAPTER" },
141541c99275SPeter Avalos   { 0xC00000C6, "STATUS_PRINT_QUEUE_FULL" },
141641c99275SPeter Avalos   { 0xC00000C7, "STATUS_NO_SPOOL_SPACE" },
141741c99275SPeter Avalos   { 0xC00000C8, "STATUS_PRINT_CANCELLED" },
141841c99275SPeter Avalos   { 0xC00000C9, "STATUS_NETWORK_NAME_DELETED" },
141941c99275SPeter Avalos   { 0xC00000CA, "STATUS_NETWORK_ACCESS_DENIED" },
142041c99275SPeter Avalos   { 0xC00000CB, "STATUS_BAD_DEVICE_TYPE" },
142141c99275SPeter Avalos   { 0xC00000CC, "STATUS_BAD_NETWORK_NAME" },
142241c99275SPeter Avalos   { 0xC00000CD, "STATUS_TOO_MANY_NAMES" },
142341c99275SPeter Avalos   { 0xC00000CE, "STATUS_TOO_MANY_SESSIONS" },
142441c99275SPeter Avalos   { 0xC00000CF, "STATUS_SHARING_PAUSED" },
142541c99275SPeter Avalos   { 0xC00000D0, "STATUS_REQUEST_NOT_ACCEPTED" },
142641c99275SPeter Avalos   { 0xC00000D1, "STATUS_REDIRECTOR_PAUSED" },
142741c99275SPeter Avalos   { 0xC00000D2, "STATUS_NET_WRITE_FAULT" },
142841c99275SPeter Avalos   { 0xC00000D3, "STATUS_PROFILING_AT_LIMIT" },
142941c99275SPeter Avalos   { 0xC00000D4, "STATUS_NOT_SAME_DEVICE" },
143041c99275SPeter Avalos   { 0xC00000D5, "STATUS_FILE_RENAMED" },
143141c99275SPeter Avalos   { 0xC00000D6, "STATUS_VIRTUAL_CIRCUIT_CLOSED" },
143241c99275SPeter Avalos   { 0xC00000D7, "STATUS_NO_SECURITY_ON_OBJECT" },
143341c99275SPeter Avalos   { 0xC00000D8, "STATUS_CANT_WAIT" },
143441c99275SPeter Avalos   { 0xC00000D9, "STATUS_PIPE_EMPTY" },
143541c99275SPeter Avalos   { 0xC00000DA, "STATUS_CANT_ACCESS_DOMAIN_INFO" },
143641c99275SPeter Avalos   { 0xC00000DB, "STATUS_CANT_TERMINATE_SELF" },
143741c99275SPeter Avalos   { 0xC00000DC, "STATUS_INVALID_SERVER_STATE" },
143841c99275SPeter Avalos   { 0xC00000DD, "STATUS_INVALID_DOMAIN_STATE" },
143941c99275SPeter Avalos   { 0xC00000DE, "STATUS_INVALID_DOMAIN_ROLE" },
144041c99275SPeter Avalos   { 0xC00000DF, "STATUS_NO_SUCH_DOMAIN" },
144141c99275SPeter Avalos   { 0xC00000E0, "STATUS_DOMAIN_EXISTS" },
144241c99275SPeter Avalos   { 0xC00000E1, "STATUS_DOMAIN_LIMIT_EXCEEDED" },
144341c99275SPeter Avalos   { 0xC00000E2, "STATUS_OPLOCK_NOT_GRANTED" },
144441c99275SPeter Avalos   { 0xC00000E3, "STATUS_INVALID_OPLOCK_PROTOCOL" },
144541c99275SPeter Avalos   { 0xC00000E4, "STATUS_INTERNAL_DB_CORRUPTION" },
144641c99275SPeter Avalos   { 0xC00000E5, "STATUS_INTERNAL_ERROR" },
144741c99275SPeter Avalos   { 0xC00000E6, "STATUS_GENERIC_NOT_MAPPED" },
144841c99275SPeter Avalos   { 0xC00000E7, "STATUS_BAD_DESCRIPTOR_FORMAT" },
144941c99275SPeter Avalos   { 0xC00000E8, "STATUS_INVALID_USER_BUFFER" },
145041c99275SPeter Avalos   { 0xC00000E9, "STATUS_UNEXPECTED_IO_ERROR" },
145141c99275SPeter Avalos   { 0xC00000EA, "STATUS_UNEXPECTED_MM_CREATE_ERR" },
145241c99275SPeter Avalos   { 0xC00000EB, "STATUS_UNEXPECTED_MM_MAP_ERROR" },
145341c99275SPeter Avalos   { 0xC00000EC, "STATUS_UNEXPECTED_MM_EXTEND_ERR" },
145441c99275SPeter Avalos   { 0xC00000ED, "STATUS_NOT_LOGON_PROCESS" },
145541c99275SPeter Avalos   { 0xC00000EE, "STATUS_LOGON_SESSION_EXISTS" },
145641c99275SPeter Avalos   { 0xC00000EF, "STATUS_INVALID_PARAMETER_1" },
145741c99275SPeter Avalos   { 0xC00000F0, "STATUS_INVALID_PARAMETER_2" },
145841c99275SPeter Avalos   { 0xC00000F1, "STATUS_INVALID_PARAMETER_3" },
145941c99275SPeter Avalos   { 0xC00000F2, "STATUS_INVALID_PARAMETER_4" },
146041c99275SPeter Avalos   { 0xC00000F3, "STATUS_INVALID_PARAMETER_5" },
146141c99275SPeter Avalos   { 0xC00000F4, "STATUS_INVALID_PARAMETER_6" },
146241c99275SPeter Avalos   { 0xC00000F5, "STATUS_INVALID_PARAMETER_7" },
146341c99275SPeter Avalos   { 0xC00000F6, "STATUS_INVALID_PARAMETER_8" },
146441c99275SPeter Avalos   { 0xC00000F7, "STATUS_INVALID_PARAMETER_9" },
146541c99275SPeter Avalos   { 0xC00000F8, "STATUS_INVALID_PARAMETER_10" },
146641c99275SPeter Avalos   { 0xC00000F9, "STATUS_INVALID_PARAMETER_11" },
146741c99275SPeter Avalos   { 0xC00000FA, "STATUS_INVALID_PARAMETER_12" },
146841c99275SPeter Avalos   { 0xC00000FB, "STATUS_REDIRECTOR_NOT_STARTED" },
146941c99275SPeter Avalos   { 0xC00000FC, "STATUS_REDIRECTOR_STARTED" },
147041c99275SPeter Avalos   { 0xC00000FD, "STATUS_STACK_OVERFLOW" },
147141c99275SPeter Avalos   { 0xC00000FE, "STATUS_NO_SUCH_PACKAGE" },
147241c99275SPeter Avalos   { 0xC00000FF, "STATUS_BAD_FUNCTION_TABLE" },
147341c99275SPeter Avalos   { 0xC0000100, "STATUS_VARIABLE_NOT_FOUND" },
147441c99275SPeter Avalos   { 0xC0000101, "STATUS_DIRECTORY_NOT_EMPTY" },
147541c99275SPeter Avalos   { 0xC0000102, "STATUS_FILE_CORRUPT_ERROR" },
147641c99275SPeter Avalos   { 0xC0000103, "STATUS_NOT_A_DIRECTORY" },
147741c99275SPeter Avalos   { 0xC0000104, "STATUS_BAD_LOGON_SESSION_STATE" },
147841c99275SPeter Avalos   { 0xC0000105, "STATUS_LOGON_SESSION_COLLISION" },
147941c99275SPeter Avalos   { 0xC0000106, "STATUS_NAME_TOO_LONG" },
148041c99275SPeter Avalos   { 0xC0000107, "STATUS_FILES_OPEN" },
148141c99275SPeter Avalos   { 0xC0000108, "STATUS_CONNECTION_IN_USE" },
148241c99275SPeter Avalos   { 0xC0000109, "STATUS_MESSAGE_NOT_FOUND" },
148341c99275SPeter Avalos   { 0xC000010A, "STATUS_PROCESS_IS_TERMINATING" },
148441c99275SPeter Avalos   { 0xC000010B, "STATUS_INVALID_LOGON_TYPE" },
148541c99275SPeter Avalos   { 0xC000010C, "STATUS_NO_GUID_TRANSLATION" },
148641c99275SPeter Avalos   { 0xC000010D, "STATUS_CANNOT_IMPERSONATE" },
148741c99275SPeter Avalos   { 0xC000010E, "STATUS_IMAGE_ALREADY_LOADED" },
148841c99275SPeter Avalos   { 0xC000010F, "STATUS_ABIOS_NOT_PRESENT" },
148941c99275SPeter Avalos   { 0xC0000110, "STATUS_ABIOS_LID_NOT_EXIST" },
149041c99275SPeter Avalos   { 0xC0000111, "STATUS_ABIOS_LID_ALREADY_OWNED" },
149141c99275SPeter Avalos   { 0xC0000112, "STATUS_ABIOS_NOT_LID_OWNER" },
149241c99275SPeter Avalos   { 0xC0000113, "STATUS_ABIOS_INVALID_COMMAND" },
149341c99275SPeter Avalos   { 0xC0000114, "STATUS_ABIOS_INVALID_LID" },
149441c99275SPeter Avalos   { 0xC0000115, "STATUS_ABIOS_SELECTOR_NOT_AVAILABLE" },
149541c99275SPeter Avalos   { 0xC0000116, "STATUS_ABIOS_INVALID_SELECTOR" },
149641c99275SPeter Avalos   { 0xC0000117, "STATUS_NO_LDT" },
149741c99275SPeter Avalos   { 0xC0000118, "STATUS_INVALID_LDT_SIZE" },
149841c99275SPeter Avalos   { 0xC0000119, "STATUS_INVALID_LDT_OFFSET" },
149941c99275SPeter Avalos   { 0xC000011A, "STATUS_INVALID_LDT_DESCRIPTOR" },
150041c99275SPeter Avalos   { 0xC000011B, "STATUS_INVALID_IMAGE_NE_FORMAT" },
150141c99275SPeter Avalos   { 0xC000011C, "STATUS_RXACT_INVALID_STATE" },
150241c99275SPeter Avalos   { 0xC000011D, "STATUS_RXACT_COMMIT_FAILURE" },
150341c99275SPeter Avalos   { 0xC000011E, "STATUS_MAPPED_FILE_SIZE_ZERO" },
150441c99275SPeter Avalos   { 0xC000011F, "STATUS_TOO_MANY_OPENED_FILES" },
150541c99275SPeter Avalos   { 0xC0000120, "STATUS_CANCELLED" },
150641c99275SPeter Avalos   { 0xC0000121, "STATUS_CANNOT_DELETE" },
150741c99275SPeter Avalos   { 0xC0000122, "STATUS_INVALID_COMPUTER_NAME" },
150841c99275SPeter Avalos   { 0xC0000123, "STATUS_FILE_DELETED" },
150941c99275SPeter Avalos   { 0xC0000124, "STATUS_SPECIAL_ACCOUNT" },
151041c99275SPeter Avalos   { 0xC0000125, "STATUS_SPECIAL_GROUP" },
151141c99275SPeter Avalos   { 0xC0000126, "STATUS_SPECIAL_USER" },
151241c99275SPeter Avalos   { 0xC0000127, "STATUS_MEMBERS_PRIMARY_GROUP" },
151341c99275SPeter Avalos   { 0xC0000128, "STATUS_FILE_CLOSED" },
151441c99275SPeter Avalos   { 0xC0000129, "STATUS_TOO_MANY_THREADS" },
151541c99275SPeter Avalos   { 0xC000012A, "STATUS_THREAD_NOT_IN_PROCESS" },
151641c99275SPeter Avalos   { 0xC000012B, "STATUS_TOKEN_ALREADY_IN_USE" },
151741c99275SPeter Avalos   { 0xC000012C, "STATUS_PAGEFILE_QUOTA_EXCEEDED" },
151841c99275SPeter Avalos   { 0xC000012D, "STATUS_COMMITMENT_LIMIT" },
151941c99275SPeter Avalos   { 0xC000012E, "STATUS_INVALID_IMAGE_LE_FORMAT" },
152041c99275SPeter Avalos   { 0xC000012F, "STATUS_INVALID_IMAGE_NOT_MZ" },
152141c99275SPeter Avalos   { 0xC0000130, "STATUS_INVALID_IMAGE_PROTECT" },
152241c99275SPeter Avalos   { 0xC0000131, "STATUS_INVALID_IMAGE_WIN_16" },
152341c99275SPeter Avalos   { 0xC0000132, "STATUS_LOGON_SERVER_CONFLICT" },
152441c99275SPeter Avalos   { 0xC0000133, "STATUS_TIME_DIFFERENCE_AT_DC" },
152541c99275SPeter Avalos   { 0xC0000134, "STATUS_SYNCHRONIZATION_REQUIRED" },
152641c99275SPeter Avalos   { 0xC0000135, "STATUS_DLL_NOT_FOUND" },
152741c99275SPeter Avalos   { 0xC0000136, "STATUS_OPEN_FAILED" },
152841c99275SPeter Avalos   { 0xC0000137, "STATUS_IO_PRIVILEGE_FAILED" },
152941c99275SPeter Avalos   { 0xC0000138, "STATUS_ORDINAL_NOT_FOUND" },
153041c99275SPeter Avalos   { 0xC0000139, "STATUS_ENTRYPOINT_NOT_FOUND" },
153141c99275SPeter Avalos   { 0xC000013A, "STATUS_CONTROL_C_EXIT" },
153241c99275SPeter Avalos   { 0xC000013B, "STATUS_LOCAL_DISCONNECT" },
153341c99275SPeter Avalos   { 0xC000013C, "STATUS_REMOTE_DISCONNECT" },
153441c99275SPeter Avalos   { 0xC000013D, "STATUS_REMOTE_RESOURCES" },
153541c99275SPeter Avalos   { 0xC000013E, "STATUS_LINK_FAILED" },
153641c99275SPeter Avalos   { 0xC000013F, "STATUS_LINK_TIMEOUT" },
153741c99275SPeter Avalos   { 0xC0000140, "STATUS_INVALID_CONNECTION" },
153841c99275SPeter Avalos   { 0xC0000141, "STATUS_INVALID_ADDRESS" },
153941c99275SPeter Avalos   { 0xC0000142, "STATUS_DLL_INIT_FAILED" },
154041c99275SPeter Avalos   { 0xC0000143, "STATUS_MISSING_SYSTEMFILE" },
154141c99275SPeter Avalos   { 0xC0000144, "STATUS_UNHANDLED_EXCEPTION" },
154241c99275SPeter Avalos   { 0xC0000145, "STATUS_APP_INIT_FAILURE" },
154341c99275SPeter Avalos   { 0xC0000146, "STATUS_PAGEFILE_CREATE_FAILED" },
154441c99275SPeter Avalos   { 0xC0000147, "STATUS_NO_PAGEFILE" },
154541c99275SPeter Avalos   { 0xC0000148, "STATUS_INVALID_LEVEL" },
154641c99275SPeter Avalos   { 0xC0000149, "STATUS_WRONG_PASSWORD_CORE" },
154741c99275SPeter Avalos   { 0xC000014A, "STATUS_ILLEGAL_FLOAT_CONTEXT" },
154841c99275SPeter Avalos   { 0xC000014B, "STATUS_PIPE_BROKEN" },
154941c99275SPeter Avalos   { 0xC000014C, "STATUS_REGISTRY_CORRUPT" },
155041c99275SPeter Avalos   { 0xC000014D, "STATUS_REGISTRY_IO_FAILED" },
155141c99275SPeter Avalos   { 0xC000014E, "STATUS_NO_EVENT_PAIR" },
155241c99275SPeter Avalos   { 0xC000014F, "STATUS_UNRECOGNIZED_VOLUME" },
155341c99275SPeter Avalos   { 0xC0000150, "STATUS_SERIAL_NO_DEVICE_INITED" },
155441c99275SPeter Avalos   { 0xC0000151, "STATUS_NO_SUCH_ALIAS" },
155541c99275SPeter Avalos   { 0xC0000152, "STATUS_MEMBER_NOT_IN_ALIAS" },
155641c99275SPeter Avalos   { 0xC0000153, "STATUS_MEMBER_IN_ALIAS" },
155741c99275SPeter Avalos   { 0xC0000154, "STATUS_ALIAS_EXISTS" },
155841c99275SPeter Avalos   { 0xC0000155, "STATUS_LOGON_NOT_GRANTED" },
155941c99275SPeter Avalos   { 0xC0000156, "STATUS_TOO_MANY_SECRETS" },
156041c99275SPeter Avalos   { 0xC0000157, "STATUS_SECRET_TOO_LONG" },
156141c99275SPeter Avalos   { 0xC0000158, "STATUS_INTERNAL_DB_ERROR" },
156241c99275SPeter Avalos   { 0xC0000159, "STATUS_FULLSCREEN_MODE" },
156341c99275SPeter Avalos   { 0xC000015A, "STATUS_TOO_MANY_CONTEXT_IDS" },
156441c99275SPeter Avalos   { 0xC000015B, "STATUS_LOGON_TYPE_NOT_GRANTED" },
156541c99275SPeter Avalos   { 0xC000015C, "STATUS_NOT_REGISTRY_FILE" },
156641c99275SPeter Avalos   { 0xC000015D, "STATUS_NT_CROSS_ENCRYPTION_REQUIRED" },
156741c99275SPeter Avalos   { 0xC000015E, "STATUS_DOMAIN_CTRLR_CONFIG_ERROR" },
156841c99275SPeter Avalos   { 0xC000015F, "STATUS_FT_MISSING_MEMBER" },
156941c99275SPeter Avalos   { 0xC0000160, "STATUS_ILL_FORMED_SERVICE_ENTRY" },
157041c99275SPeter Avalos   { 0xC0000161, "STATUS_ILLEGAL_CHARACTER" },
157141c99275SPeter Avalos   { 0xC0000162, "STATUS_UNMAPPABLE_CHARACTER" },
157241c99275SPeter Avalos   { 0xC0000163, "STATUS_UNDEFINED_CHARACTER" },
157341c99275SPeter Avalos   { 0xC0000164, "STATUS_FLOPPY_VOLUME" },
157441c99275SPeter Avalos   { 0xC0000165, "STATUS_FLOPPY_ID_MARK_NOT_FOUND" },
157541c99275SPeter Avalos   { 0xC0000166, "STATUS_FLOPPY_WRONG_CYLINDER" },
157641c99275SPeter Avalos   { 0xC0000167, "STATUS_FLOPPY_UNKNOWN_ERROR" },
157741c99275SPeter Avalos   { 0xC0000168, "STATUS_FLOPPY_BAD_REGISTERS" },
157841c99275SPeter Avalos   { 0xC0000169, "STATUS_DISK_RECALIBRATE_FAILED" },
157941c99275SPeter Avalos   { 0xC000016A, "STATUS_DISK_OPERATION_FAILED" },
158041c99275SPeter Avalos   { 0xC000016B, "STATUS_DISK_RESET_FAILED" },
158141c99275SPeter Avalos   { 0xC000016C, "STATUS_SHARED_IRQ_BUSY" },
158241c99275SPeter Avalos   { 0xC000016D, "STATUS_FT_ORPHANING" },
158341c99275SPeter Avalos   { 0xC000016E, "STATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT" },
158441c99275SPeter Avalos   { 0xC0000172, "STATUS_PARTITION_FAILURE" },
158541c99275SPeter Avalos   { 0xC0000173, "STATUS_INVALID_BLOCK_LENGTH" },
158641c99275SPeter Avalos   { 0xC0000174, "STATUS_DEVICE_NOT_PARTITIONED" },
158741c99275SPeter Avalos   { 0xC0000175, "STATUS_UNABLE_TO_LOCK_MEDIA" },
158841c99275SPeter Avalos   { 0xC0000176, "STATUS_UNABLE_TO_UNLOAD_MEDIA" },
158941c99275SPeter Avalos   { 0xC0000177, "STATUS_EOM_OVERFLOW" },
159041c99275SPeter Avalos   { 0xC0000178, "STATUS_NO_MEDIA" },
159141c99275SPeter Avalos   { 0xC000017A, "STATUS_NO_SUCH_MEMBER" },
159241c99275SPeter Avalos   { 0xC000017B, "STATUS_INVALID_MEMBER" },
159341c99275SPeter Avalos   { 0xC000017C, "STATUS_KEY_DELETED" },
159441c99275SPeter Avalos   { 0xC000017D, "STATUS_NO_LOG_SPACE" },
159541c99275SPeter Avalos   { 0xC000017E, "STATUS_TOO_MANY_SIDS" },
159641c99275SPeter Avalos   { 0xC000017F, "STATUS_LM_CROSS_ENCRYPTION_REQUIRED" },
159741c99275SPeter Avalos   { 0xC0000180, "STATUS_KEY_HAS_CHILDREN" },
159841c99275SPeter Avalos   { 0xC0000181, "STATUS_CHILD_MUST_BE_VOLATILE" },
159941c99275SPeter Avalos   { 0xC0000182, "STATUS_DEVICE_CONFIGURATION_ERROR" },
160041c99275SPeter Avalos   { 0xC0000183, "STATUS_DRIVER_INTERNAL_ERROR" },
160141c99275SPeter Avalos   { 0xC0000184, "STATUS_INVALID_DEVICE_STATE" },
160241c99275SPeter Avalos   { 0xC0000185, "STATUS_IO_DEVICE_ERROR" },
160341c99275SPeter Avalos   { 0xC0000186, "STATUS_DEVICE_PROTOCOL_ERROR" },
160441c99275SPeter Avalos   { 0xC0000187, "STATUS_BACKUP_CONTROLLER" },
160541c99275SPeter Avalos   { 0xC0000188, "STATUS_LOG_FILE_FULL" },
160641c99275SPeter Avalos   { 0xC0000189, "STATUS_TOO_LATE" },
160741c99275SPeter Avalos   { 0xC000018A, "STATUS_NO_TRUST_LSA_SECRET" },
160841c99275SPeter Avalos   { 0xC000018B, "STATUS_NO_TRUST_SAM_ACCOUNT" },
160941c99275SPeter Avalos   { 0xC000018C, "STATUS_TRUSTED_DOMAIN_FAILURE" },
161041c99275SPeter Avalos   { 0xC000018D, "STATUS_TRUSTED_RELATIONSHIP_FAILURE" },
161141c99275SPeter Avalos   { 0xC000018E, "STATUS_EVENTLOG_FILE_CORRUPT" },
161241c99275SPeter Avalos   { 0xC000018F, "STATUS_EVENTLOG_CANT_START" },
161341c99275SPeter Avalos   { 0xC0000190, "STATUS_TRUST_FAILURE" },
161441c99275SPeter Avalos   { 0xC0000191, "STATUS_MUTANT_LIMIT_EXCEEDED" },
161541c99275SPeter Avalos   { 0xC0000192, "STATUS_NETLOGON_NOT_STARTED" },
161641c99275SPeter Avalos   { 0xC0000193, "STATUS_ACCOUNT_EXPIRED" },
161741c99275SPeter Avalos   { 0xC0000194, "STATUS_POSSIBLE_DEADLOCK" },
161841c99275SPeter Avalos   { 0xC0000195, "STATUS_NETWORK_CREDENTIAL_CONFLICT" },
161941c99275SPeter Avalos   { 0xC0000196, "STATUS_REMOTE_SESSION_LIMIT" },
162041c99275SPeter Avalos   { 0xC0000197, "STATUS_EVENTLOG_FILE_CHANGED" },
162141c99275SPeter Avalos   { 0xC0000198, "STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT" },
162241c99275SPeter Avalos   { 0xC0000199, "STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT" },
162341c99275SPeter Avalos   { 0xC000019A, "STATUS_NOLOGON_SERVER_TRUST_ACCOUNT" },
162441c99275SPeter Avalos   { 0xC000019B, "STATUS_DOMAIN_TRUST_INCONSISTENT" },
162541c99275SPeter Avalos   { 0xC000019C, "STATUS_FS_DRIVER_REQUIRED" },
162641c99275SPeter Avalos   { 0xC0000202, "STATUS_NO_USER_SESSION_KEY" },
162741c99275SPeter Avalos   { 0xC0000203, "STATUS_USER_SESSION_DELETED" },
162841c99275SPeter Avalos   { 0xC0000204, "STATUS_RESOURCE_LANG_NOT_FOUND" },
162941c99275SPeter Avalos   { 0xC0000205, "STATUS_INSUFF_SERVER_RESOURCES" },
163041c99275SPeter Avalos   { 0xC0000206, "STATUS_INVALID_BUFFER_SIZE" },
163141c99275SPeter Avalos   { 0xC0000207, "STATUS_INVALID_ADDRESS_COMPONENT" },
163241c99275SPeter Avalos   { 0xC0000208, "STATUS_INVALID_ADDRESS_WILDCARD" },
163341c99275SPeter Avalos   { 0xC0000209, "STATUS_TOO_MANY_ADDRESSES" },
163441c99275SPeter Avalos   { 0xC000020A, "STATUS_ADDRESS_ALREADY_EXISTS" },
163541c99275SPeter Avalos   { 0xC000020B, "STATUS_ADDRESS_CLOSED" },
163641c99275SPeter Avalos   { 0xC000020C, "STATUS_CONNECTION_DISCONNECTED" },
163741c99275SPeter Avalos   { 0xC000020D, "STATUS_CONNECTION_RESET" },
163841c99275SPeter Avalos   { 0xC000020E, "STATUS_TOO_MANY_NODES" },
163941c99275SPeter Avalos   { 0xC000020F, "STATUS_TRANSACTION_ABORTED" },
164041c99275SPeter Avalos   { 0xC0000210, "STATUS_TRANSACTION_TIMED_OUT" },
164141c99275SPeter Avalos   { 0xC0000211, "STATUS_TRANSACTION_NO_RELEASE" },
164241c99275SPeter Avalos   { 0xC0000212, "STATUS_TRANSACTION_NO_MATCH" },
164341c99275SPeter Avalos   { 0xC0000213, "STATUS_TRANSACTION_RESPONDED" },
164441c99275SPeter Avalos   { 0xC0000214, "STATUS_TRANSACTION_INVALID_ID" },
164541c99275SPeter Avalos   { 0xC0000215, "STATUS_TRANSACTION_INVALID_TYPE" },
164641c99275SPeter Avalos   { 0xC0000216, "STATUS_NOT_SERVER_SESSION" },
164741c99275SPeter Avalos   { 0xC0000217, "STATUS_NOT_CLIENT_SESSION" },
164841c99275SPeter Avalos   { 0xC0000218, "STATUS_CANNOT_LOAD_REGISTRY_FILE" },
164941c99275SPeter Avalos   { 0xC0000219, "STATUS_DEBUG_ATTACH_FAILED" },
165041c99275SPeter Avalos   { 0xC000021A, "STATUS_SYSTEM_PROCESS_TERMINATED" },
165141c99275SPeter Avalos   { 0xC000021B, "STATUS_DATA_NOT_ACCEPTED" },
165241c99275SPeter Avalos   { 0xC000021C, "STATUS_NO_BROWSER_SERVERS_FOUND" },
165341c99275SPeter Avalos   { 0xC000021D, "STATUS_VDM_HARD_ERROR" },
165441c99275SPeter Avalos   { 0xC000021E, "STATUS_DRIVER_CANCEL_TIMEOUT" },
165541c99275SPeter Avalos   { 0xC000021F, "STATUS_REPLY_MESSAGE_MISMATCH" },
165641c99275SPeter Avalos   { 0xC0000220, "STATUS_MAPPED_ALIGNMENT" },
165741c99275SPeter Avalos   { 0xC0000221, "STATUS_IMAGE_CHECKSUM_MISMATCH" },
165841c99275SPeter Avalos   { 0xC0000222, "STATUS_LOST_WRITEBEHIND_DATA" },
165941c99275SPeter Avalos   { 0xC0000223, "STATUS_CLIENT_SERVER_PARAMETERS_INVALID" },
166041c99275SPeter Avalos   { 0xC0000224, "STATUS_PASSWORD_MUST_CHANGE" },
166141c99275SPeter Avalos   { 0xC0000225, "STATUS_NOT_FOUND" },
166241c99275SPeter Avalos   { 0xC0000226, "STATUS_NOT_TINY_STREAM" },
166341c99275SPeter Avalos   { 0xC0000227, "STATUS_RECOVERY_FAILURE" },
166441c99275SPeter Avalos   { 0xC0000228, "STATUS_STACK_OVERFLOW_READ" },
166541c99275SPeter Avalos   { 0xC0000229, "STATUS_FAIL_CHECK" },
166641c99275SPeter Avalos   { 0xC000022A, "STATUS_DUPLICATE_OBJECTID" },
166741c99275SPeter Avalos   { 0xC000022B, "STATUS_OBJECTID_EXISTS" },
166841c99275SPeter Avalos   { 0xC000022C, "STATUS_CONVERT_TO_LARGE" },
166941c99275SPeter Avalos   { 0xC000022D, "STATUS_RETRY" },
167041c99275SPeter Avalos   { 0xC000022E, "STATUS_FOUND_OUT_OF_SCOPE" },
167141c99275SPeter Avalos   { 0xC000022F, "STATUS_ALLOCATE_BUCKET" },
167241c99275SPeter Avalos   { 0xC0000230, "STATUS_PROPSET_NOT_FOUND" },
167341c99275SPeter Avalos   { 0xC0000231, "STATUS_MARSHALL_OVERFLOW" },
167441c99275SPeter Avalos   { 0xC0000232, "STATUS_INVALID_VARIANT" },
167541c99275SPeter Avalos   { 0xC0000233, "STATUS_DOMAIN_CONTROLLER_NOT_FOUND" },
167641c99275SPeter Avalos   { 0xC0000234, "STATUS_ACCOUNT_LOCKED_OUT" },
167741c99275SPeter Avalos   { 0xC0000235, "STATUS_HANDLE_NOT_CLOSABLE" },
167841c99275SPeter Avalos   { 0xC0000236, "STATUS_CONNECTION_REFUSED" },
167941c99275SPeter Avalos   { 0xC0000237, "STATUS_GRACEFUL_DISCONNECT" },
168041c99275SPeter Avalos   { 0xC0000238, "STATUS_ADDRESS_ALREADY_ASSOCIATED" },
168141c99275SPeter Avalos   { 0xC0000239, "STATUS_ADDRESS_NOT_ASSOCIATED" },
168241c99275SPeter Avalos   { 0xC000023A, "STATUS_CONNECTION_INVALID" },
168341c99275SPeter Avalos   { 0xC000023B, "STATUS_CONNECTION_ACTIVE" },
168441c99275SPeter Avalos   { 0xC000023C, "STATUS_NETWORK_UNREACHABLE" },
168541c99275SPeter Avalos   { 0xC000023D, "STATUS_HOST_UNREACHABLE" },
168641c99275SPeter Avalos   { 0xC000023E, "STATUS_PROTOCOL_UNREACHABLE" },
168741c99275SPeter Avalos   { 0xC000023F, "STATUS_PORT_UNREACHABLE" },
168841c99275SPeter Avalos   { 0xC0000240, "STATUS_REQUEST_ABORTED" },
168941c99275SPeter Avalos   { 0xC0000241, "STATUS_CONNECTION_ABORTED" },
169041c99275SPeter Avalos   { 0xC0000242, "STATUS_BAD_COMPRESSION_BUFFER" },
169141c99275SPeter Avalos   { 0xC0000243, "STATUS_USER_MAPPED_FILE" },
169241c99275SPeter Avalos   { 0xC0000244, "STATUS_AUDIT_FAILED" },
169341c99275SPeter Avalos   { 0xC0000245, "STATUS_TIMER_RESOLUTION_NOT_SET" },
169441c99275SPeter Avalos   { 0xC0000246, "STATUS_CONNECTION_COUNT_LIMIT" },
169541c99275SPeter Avalos   { 0xC0000247, "STATUS_LOGIN_TIME_RESTRICTION" },
169641c99275SPeter Avalos   { 0xC0000248, "STATUS_LOGIN_WKSTA_RESTRICTION" },
169741c99275SPeter Avalos   { 0xC0000249, "STATUS_IMAGE_MP_UP_MISMATCH" },
169841c99275SPeter Avalos   { 0xC0000250, "STATUS_INSUFFICIENT_LOGON_INFO" },
169941c99275SPeter Avalos   { 0xC0000251, "STATUS_BAD_DLL_ENTRYPOINT" },
170041c99275SPeter Avalos   { 0xC0000252, "STATUS_BAD_SERVICE_ENTRYPOINT" },
170141c99275SPeter Avalos   { 0xC0000253, "STATUS_LPC_REPLY_LOST" },
170241c99275SPeter Avalos   { 0xC0000254, "STATUS_IP_ADDRESS_CONFLICT1" },
170341c99275SPeter Avalos   { 0xC0000255, "STATUS_IP_ADDRESS_CONFLICT2" },
170441c99275SPeter Avalos   { 0xC0000256, "STATUS_REGISTRY_QUOTA_LIMIT" },
170541c99275SPeter Avalos   { 0xC0000257, "STATUS_PATH_NOT_COVERED" },
170641c99275SPeter Avalos   { 0xC0000258, "STATUS_NO_CALLBACK_ACTIVE" },
170741c99275SPeter Avalos   { 0xC0000259, "STATUS_LICENSE_QUOTA_EXCEEDED" },
170841c99275SPeter Avalos   { 0xC000025A, "STATUS_PWD_TOO_SHORT" },
170941c99275SPeter Avalos   { 0xC000025B, "STATUS_PWD_TOO_RECENT" },
171041c99275SPeter Avalos   { 0xC000025C, "STATUS_PWD_HISTORY_CONFLICT" },
171141c99275SPeter Avalos   { 0xC000025E, "STATUS_PLUGPLAY_NO_DEVICE" },
171241c99275SPeter Avalos   { 0xC000025F, "STATUS_UNSUPPORTED_COMPRESSION" },
171341c99275SPeter Avalos   { 0xC0000260, "STATUS_INVALID_HW_PROFILE" },
171441c99275SPeter Avalos   { 0xC0000261, "STATUS_INVALID_PLUGPLAY_DEVICE_PATH" },
171541c99275SPeter Avalos   { 0xC0000262, "STATUS_DRIVER_ORDINAL_NOT_FOUND" },
171641c99275SPeter Avalos   { 0xC0000263, "STATUS_DRIVER_ENTRYPOINT_NOT_FOUND" },
171741c99275SPeter Avalos   { 0xC0000264, "STATUS_RESOURCE_NOT_OWNED" },
171841c99275SPeter Avalos   { 0xC0000265, "STATUS_TOO_MANY_LINKS" },
171941c99275SPeter Avalos   { 0xC0000266, "STATUS_QUOTA_LIST_INCONSISTENT" },
172041c99275SPeter Avalos   { 0xC0000267, "STATUS_FILE_IS_OFFLINE" },
172141c99275SPeter Avalos   { 0xC0000268, "STATUS_EVALUATION_EXPIRATION" },
172241c99275SPeter Avalos   { 0xC0000269, "STATUS_ILLEGAL_DLL_RELOCATION" },
172341c99275SPeter Avalos   { 0xC000026A, "STATUS_LICENSE_VIOLATION" },
172441c99275SPeter Avalos   { 0xC000026B, "STATUS_DLL_INIT_FAILED_LOGOFF" },
172541c99275SPeter Avalos   { 0xC000026C, "STATUS_DRIVER_UNABLE_TO_LOAD" },
172641c99275SPeter Avalos   { 0xC000026D, "STATUS_DFS_UNAVAILABLE" },
172741c99275SPeter Avalos   { 0xC000026E, "STATUS_VOLUME_DISMOUNTED" },
172841c99275SPeter Avalos   { 0xC000026F, "STATUS_WX86_INTERNAL_ERROR" },
172941c99275SPeter Avalos   { 0xC0000270, "STATUS_WX86_FLOAT_STACK_CHECK" },
173041c99275SPeter Avalos   { 0xC0000271, "STATUS_VALIDATE_CONTINUE" },
173141c99275SPeter Avalos   { 0xC0000272, "STATUS_NO_MATCH" },
173241c99275SPeter Avalos   { 0xC0000273, "STATUS_NO_MORE_MATCHES" },
173341c99275SPeter Avalos   { 0xC0000275, "STATUS_NOT_A_REPARSE_POINT" },
173441c99275SPeter Avalos   { 0xC0000276, "STATUS_IO_REPARSE_TAG_INVALID" },
173541c99275SPeter Avalos   { 0xC0000277, "STATUS_IO_REPARSE_TAG_MISMATCH" },
173641c99275SPeter Avalos   { 0xC0000278, "STATUS_IO_REPARSE_DATA_INVALID" },
173741c99275SPeter Avalos   { 0xC0000279, "STATUS_IO_REPARSE_TAG_NOT_HANDLED" },
173841c99275SPeter Avalos   { 0xC0000280, "STATUS_REPARSE_POINT_NOT_RESOLVED" },
173941c99275SPeter Avalos   { 0xC0000281, "STATUS_DIRECTORY_IS_A_REPARSE_POINT" },
174041c99275SPeter Avalos   { 0xC0000282, "STATUS_RANGE_LIST_CONFLICT" },
174141c99275SPeter Avalos   { 0xC0000283, "STATUS_SOURCE_ELEMENT_EMPTY" },
174241c99275SPeter Avalos   { 0xC0000284, "STATUS_DESTINATION_ELEMENT_FULL" },
174341c99275SPeter Avalos   { 0xC0000285, "STATUS_ILLEGAL_ELEMENT_ADDRESS" },
174441c99275SPeter Avalos   { 0xC0000286, "STATUS_MAGAZINE_NOT_PRESENT" },
174541c99275SPeter Avalos   { 0xC0000287, "STATUS_REINITIALIZATION_NEEDED" },
174641c99275SPeter Avalos   { 0x80000288, "STATUS_DEVICE_REQUIRES_CLEANING" },
174741c99275SPeter Avalos   { 0x80000289, "STATUS_DEVICE_DOOR_OPEN" },
174841c99275SPeter Avalos   { 0xC000028A, "STATUS_ENCRYPTION_FAILED" },
174941c99275SPeter Avalos   { 0xC000028B, "STATUS_DECRYPTION_FAILED" },
175041c99275SPeter Avalos   { 0xC000028C, "STATUS_RANGE_NOT_FOUND" },
175141c99275SPeter Avalos   { 0xC000028D, "STATUS_NO_RECOVERY_POLICY" },
175241c99275SPeter Avalos   { 0xC000028E, "STATUS_NO_EFS" },
175341c99275SPeter Avalos   { 0xC000028F, "STATUS_WRONG_EFS" },
175441c99275SPeter Avalos   { 0xC0000290, "STATUS_NO_USER_KEYS" },
175541c99275SPeter Avalos   { 0xC0000291, "STATUS_FILE_NOT_ENCRYPTED" },
175641c99275SPeter Avalos   { 0xC0000292, "STATUS_NOT_EXPORT_FORMAT" },
175741c99275SPeter Avalos   { 0xC0000293, "STATUS_FILE_ENCRYPTED" },
175841c99275SPeter Avalos   { 0x40000294, "STATUS_WAKE_SYSTEM" },
175941c99275SPeter Avalos   { 0xC0000295, "STATUS_WMI_GUID_NOT_FOUND" },
176041c99275SPeter Avalos   { 0xC0000296, "STATUS_WMI_INSTANCE_NOT_FOUND" },
176141c99275SPeter Avalos   { 0xC0000297, "STATUS_WMI_ITEMID_NOT_FOUND" },
176241c99275SPeter Avalos   { 0xC0000298, "STATUS_WMI_TRY_AGAIN" },
176341c99275SPeter Avalos   { 0xC0000299, "STATUS_SHARED_POLICY" },
176441c99275SPeter Avalos   { 0xC000029A, "STATUS_POLICY_OBJECT_NOT_FOUND" },
176541c99275SPeter Avalos   { 0xC000029B, "STATUS_POLICY_ONLY_IN_DS" },
176641c99275SPeter Avalos   { 0xC000029C, "STATUS_VOLUME_NOT_UPGRADED" },
176741c99275SPeter Avalos   { 0xC000029D, "STATUS_REMOTE_STORAGE_NOT_ACTIVE" },
176841c99275SPeter Avalos   { 0xC000029E, "STATUS_REMOTE_STORAGE_MEDIA_ERROR" },
176941c99275SPeter Avalos   { 0xC000029F, "STATUS_NO_TRACKING_SERVICE" },
177041c99275SPeter Avalos   { 0xC00002A0, "STATUS_SERVER_SID_MISMATCH" },
177141c99275SPeter Avalos   { 0xC00002A1, "STATUS_DS_NO_ATTRIBUTE_OR_VALUE" },
177241c99275SPeter Avalos   { 0xC00002A2, "STATUS_DS_INVALID_ATTRIBUTE_SYNTAX" },
177341c99275SPeter Avalos   { 0xC00002A3, "STATUS_DS_ATTRIBUTE_TYPE_UNDEFINED" },
177441c99275SPeter Avalos   { 0xC00002A4, "STATUS_DS_ATTRIBUTE_OR_VALUE_EXISTS" },
177541c99275SPeter Avalos   { 0xC00002A5, "STATUS_DS_BUSY" },
177641c99275SPeter Avalos   { 0xC00002A6, "STATUS_DS_UNAVAILABLE" },
177741c99275SPeter Avalos   { 0xC00002A7, "STATUS_DS_NO_RIDS_ALLOCATED" },
177841c99275SPeter Avalos   { 0xC00002A8, "STATUS_DS_NO_MORE_RIDS" },
177941c99275SPeter Avalos   { 0xC00002A9, "STATUS_DS_INCORRECT_ROLE_OWNER" },
178041c99275SPeter Avalos   { 0xC00002AA, "STATUS_DS_RIDMGR_INIT_ERROR" },
178141c99275SPeter Avalos   { 0xC00002AB, "STATUS_DS_OBJ_CLASS_VIOLATION" },
178241c99275SPeter Avalos   { 0xC00002AC, "STATUS_DS_CANT_ON_NON_LEAF" },
178341c99275SPeter Avalos   { 0xC00002AD, "STATUS_DS_CANT_ON_RDN" },
178441c99275SPeter Avalos   { 0xC00002AE, "STATUS_DS_CANT_MOD_OBJ_CLASS" },
178541c99275SPeter Avalos   { 0xC00002AF, "STATUS_DS_CROSS_DOM_MOVE_FAILED" },
178641c99275SPeter Avalos   { 0xC00002B0, "STATUS_DS_GC_NOT_AVAILABLE" },
178741c99275SPeter Avalos   { 0xC00002B1, "STATUS_DIRECTORY_SERVICE_REQUIRED" },
178841c99275SPeter Avalos   { 0xC00002B2, "STATUS_REPARSE_ATTRIBUTE_CONFLICT" },
178941c99275SPeter Avalos   { 0xC00002B3, "STATUS_CANT_ENABLE_DENY_ONLY" },
179041c99275SPeter Avalos   { 0xC00002B4, "STATUS_FLOAT_MULTIPLE_FAULTS" },
179141c99275SPeter Avalos   { 0xC00002B5, "STATUS_FLOAT_MULTIPLE_TRAPS" },
179241c99275SPeter Avalos   { 0xC00002B6, "STATUS_DEVICE_REMOVED" },
179341c99275SPeter Avalos   { 0xC00002B7, "STATUS_JOURNAL_DELETE_IN_PROGRESS" },
179441c99275SPeter Avalos   { 0xC00002B8, "STATUS_JOURNAL_NOT_ACTIVE" },
179541c99275SPeter Avalos   { 0xC00002B9, "STATUS_NOINTERFACE" },
179641c99275SPeter Avalos   { 0xC00002C1, "STATUS_DS_ADMIN_LIMIT_EXCEEDED" },
179741c99275SPeter Avalos   { 0xC00002C2, "STATUS_DRIVER_FAILED_SLEEP" },
179841c99275SPeter Avalos   { 0xC00002C3, "STATUS_MUTUAL_AUTHENTICATION_FAILED" },
179941c99275SPeter Avalos   { 0xC00002C4, "STATUS_CORRUPT_SYSTEM_FILE" },
180041c99275SPeter Avalos   { 0xC00002C5, "STATUS_DATATYPE_MISALIGNMENT_ERROR" },
180141c99275SPeter Avalos   { 0xC00002C6, "STATUS_WMI_READ_ONLY" },
180241c99275SPeter Avalos   { 0xC00002C7, "STATUS_WMI_SET_FAILURE" },
180341c99275SPeter Avalos   { 0xC00002C8, "STATUS_COMMITMENT_MINIMUM" },
180441c99275SPeter Avalos   { 0xC00002C9, "STATUS_REG_NAT_CONSUMPTION" },
180541c99275SPeter Avalos   { 0xC00002CA, "STATUS_TRANSPORT_FULL" },
180641c99275SPeter Avalos   { 0xC00002CB, "STATUS_DS_SAM_INIT_FAILURE" },
180741c99275SPeter Avalos   { 0xC00002CC, "STATUS_ONLY_IF_CONNECTED" },
180841c99275SPeter Avalos   { 0xC00002CD, "STATUS_DS_SENSITIVE_GROUP_VIOLATION" },
180941c99275SPeter Avalos   { 0xC00002CE, "STATUS_PNP_RESTART_ENUMERATION" },
181041c99275SPeter Avalos   { 0xC00002CF, "STATUS_JOURNAL_ENTRY_DELETED" },
181141c99275SPeter Avalos   { 0xC00002D0, "STATUS_DS_CANT_MOD_PRIMARYGROUPID" },
181241c99275SPeter Avalos   { 0xC00002D1, "STATUS_SYSTEM_IMAGE_BAD_SIGNATURE" },
181341c99275SPeter Avalos   { 0xC00002D2, "STATUS_PNP_REBOOT_REQUIRED" },
181441c99275SPeter Avalos   { 0xC00002D3, "STATUS_POWER_STATE_INVALID" },
181541c99275SPeter Avalos   { 0xC00002D4, "STATUS_DS_INVALID_GROUP_TYPE" },
181641c99275SPeter Avalos   { 0xC00002D5, "STATUS_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN" },
181741c99275SPeter Avalos   { 0xC00002D6, "STATUS_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN" },
181841c99275SPeter Avalos   { 0xC00002D7, "STATUS_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER" },
181941c99275SPeter Avalos   { 0xC00002D8, "STATUS_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER" },
182041c99275SPeter Avalos   { 0xC00002D9, "STATUS_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER" },
182141c99275SPeter Avalos   { 0xC00002DA, "STATUS_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER" },
182241c99275SPeter Avalos   { 0xC00002DB, "STATUS_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER" },
182341c99275SPeter Avalos   { 0xC00002DC, "STATUS_DS_HAVE_PRIMARY_MEMBERS" },
182441c99275SPeter Avalos   { 0xC00002DD, "STATUS_WMI_NOT_SUPPORTED" },
182541c99275SPeter Avalos   { 0xC00002DE, "STATUS_INSUFFICIENT_POWER" },
182641c99275SPeter Avalos   { 0xC00002DF, "STATUS_SAM_NEED_BOOTKEY_PASSWORD" },
182741c99275SPeter Avalos   { 0xC00002E0, "STATUS_SAM_NEED_BOOTKEY_FLOPPY" },
182841c99275SPeter Avalos   { 0xC00002E1, "STATUS_DS_CANT_START" },
182941c99275SPeter Avalos   { 0xC00002E2, "STATUS_DS_INIT_FAILURE" },
183041c99275SPeter Avalos   { 0xC00002E3, "STATUS_SAM_INIT_FAILURE" },
183141c99275SPeter Avalos   { 0xC00002E4, "STATUS_DS_GC_REQUIRED" },
183241c99275SPeter Avalos   { 0xC00002E5, "STATUS_DS_LOCAL_MEMBER_OF_LOCAL_ONLY" },
183341c99275SPeter Avalos   { 0xC00002E6, "STATUS_DS_NO_FPO_IN_UNIVERSAL_GROUPS" },
183441c99275SPeter Avalos   { 0xC00002E7, "STATUS_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED" },
183541c99275SPeter Avalos   { 0xC00002E8, "STATUS_MULTIPLE_FAULT_VIOLATION" },
183641c99275SPeter Avalos   { 0xC0000300, "STATUS_NOT_SUPPORTED_ON_SBS" },
183741c99275SPeter Avalos   { 0xC0009898, "STATUS_WOW_ASSERTION" },
183841c99275SPeter Avalos   { 0xC0020001, "RPC_NT_INVALID_STRING_BINDING" },
183941c99275SPeter Avalos   { 0xC0020002, "RPC_NT_WRONG_KIND_OF_BINDING" },
184041c99275SPeter Avalos   { 0xC0020003, "RPC_NT_INVALID_BINDING" },
184141c99275SPeter Avalos   { 0xC0020004, "RPC_NT_PROTSEQ_NOT_SUPPORTED" },
184241c99275SPeter Avalos   { 0xC0020005, "RPC_NT_INVALID_RPC_PROTSEQ" },
184341c99275SPeter Avalos   { 0xC0020006, "RPC_NT_INVALID_STRING_UUID" },
184441c99275SPeter Avalos   { 0xC0020007, "RPC_NT_INVALID_ENDPOINT_FORMAT" },
184541c99275SPeter Avalos   { 0xC0020008, "RPC_NT_INVALID_NET_ADDR" },
184641c99275SPeter Avalos   { 0xC0020009, "RPC_NT_NO_ENDPOINT_FOUND" },
184741c99275SPeter Avalos   { 0xC002000A, "RPC_NT_INVALID_TIMEOUT" },
184841c99275SPeter Avalos   { 0xC002000B, "RPC_NT_OBJECT_NOT_FOUND" },
184941c99275SPeter Avalos   { 0xC002000C, "RPC_NT_ALREADY_REGISTERED" },
185041c99275SPeter Avalos   { 0xC002000D, "RPC_NT_TYPE_ALREADY_REGISTERED" },
185141c99275SPeter Avalos   { 0xC002000E, "RPC_NT_ALREADY_LISTENING" },
185241c99275SPeter Avalos   { 0xC002000F, "RPC_NT_NO_PROTSEQS_REGISTERED" },
185341c99275SPeter Avalos   { 0xC0020010, "RPC_NT_NOT_LISTENING" },
185441c99275SPeter Avalos   { 0xC0020011, "RPC_NT_UNKNOWN_MGR_TYPE" },
185541c99275SPeter Avalos   { 0xC0020012, "RPC_NT_UNKNOWN_IF" },
185641c99275SPeter Avalos   { 0xC0020013, "RPC_NT_NO_BINDINGS" },
185741c99275SPeter Avalos   { 0xC0020014, "RPC_NT_NO_PROTSEQS" },
185841c99275SPeter Avalos   { 0xC0020015, "RPC_NT_CANT_CREATE_ENDPOINT" },
185941c99275SPeter Avalos   { 0xC0020016, "RPC_NT_OUT_OF_RESOURCES" },
186041c99275SPeter Avalos   { 0xC0020017, "RPC_NT_SERVER_UNAVAILABLE" },
186141c99275SPeter Avalos   { 0xC0020018, "RPC_NT_SERVER_TOO_BUSY" },
186241c99275SPeter Avalos   { 0xC0020019, "RPC_NT_INVALID_NETWORK_OPTIONS" },
186341c99275SPeter Avalos   { 0xC002001A, "RPC_NT_NO_CALL_ACTIVE" },
186441c99275SPeter Avalos   { 0xC002001B, "RPC_NT_CALL_FAILED" },
186541c99275SPeter Avalos   { 0xC002001C, "RPC_NT_CALL_FAILED_DNE" },
186641c99275SPeter Avalos   { 0xC002001D, "RPC_NT_PROTOCOL_ERROR" },
186741c99275SPeter Avalos   { 0xC002001F, "RPC_NT_UNSUPPORTED_TRANS_SYN" },
186841c99275SPeter Avalos   { 0xC0020021, "RPC_NT_UNSUPPORTED_TYPE" },
186941c99275SPeter Avalos   { 0xC0020022, "RPC_NT_INVALID_TAG" },
187041c99275SPeter Avalos   { 0xC0020023, "RPC_NT_INVALID_BOUND" },
187141c99275SPeter Avalos   { 0xC0020024, "RPC_NT_NO_ENTRY_NAME" },
187241c99275SPeter Avalos   { 0xC0020025, "RPC_NT_INVALID_NAME_SYNTAX" },
187341c99275SPeter Avalos   { 0xC0020026, "RPC_NT_UNSUPPORTED_NAME_SYNTAX" },
187441c99275SPeter Avalos   { 0xC0020028, "RPC_NT_UUID_NO_ADDRESS" },
187541c99275SPeter Avalos   { 0xC0020029, "RPC_NT_DUPLICATE_ENDPOINT" },
187641c99275SPeter Avalos   { 0xC002002A, "RPC_NT_UNKNOWN_AUTHN_TYPE" },
187741c99275SPeter Avalos   { 0xC002002B, "RPC_NT_MAX_CALLS_TOO_SMALL" },
187841c99275SPeter Avalos   { 0xC002002C, "RPC_NT_STRING_TOO_LONG" },
187941c99275SPeter Avalos   { 0xC002002D, "RPC_NT_PROTSEQ_NOT_FOUND" },
188041c99275SPeter Avalos   { 0xC002002E, "RPC_NT_PROCNUM_OUT_OF_RANGE" },
188141c99275SPeter Avalos   { 0xC002002F, "RPC_NT_BINDING_HAS_NO_AUTH" },
188241c99275SPeter Avalos   { 0xC0020030, "RPC_NT_UNKNOWN_AUTHN_SERVICE" },
188341c99275SPeter Avalos   { 0xC0020031, "RPC_NT_UNKNOWN_AUTHN_LEVEL" },
188441c99275SPeter Avalos   { 0xC0020032, "RPC_NT_INVALID_AUTH_IDENTITY" },
188541c99275SPeter Avalos   { 0xC0020033, "RPC_NT_UNKNOWN_AUTHZ_SERVICE" },
188641c99275SPeter Avalos   { 0xC0020034, "EPT_NT_INVALID_ENTRY" },
188741c99275SPeter Avalos   { 0xC0020035, "EPT_NT_CANT_PERFORM_OP" },
188841c99275SPeter Avalos   { 0xC0020036, "EPT_NT_NOT_REGISTERED" },
188941c99275SPeter Avalos   { 0xC0020037, "RPC_NT_NOTHING_TO_EXPORT" },
189041c99275SPeter Avalos   { 0xC0020038, "RPC_NT_INCOMPLETE_NAME" },
189141c99275SPeter Avalos   { 0xC0020039, "RPC_NT_INVALID_VERS_OPTION" },
189241c99275SPeter Avalos   { 0xC002003A, "RPC_NT_NO_MORE_MEMBERS" },
189341c99275SPeter Avalos   { 0xC002003B, "RPC_NT_NOT_ALL_OBJS_UNEXPORTED" },
189441c99275SPeter Avalos   { 0xC002003C, "RPC_NT_INTERFACE_NOT_FOUND" },
189541c99275SPeter Avalos   { 0xC002003D, "RPC_NT_ENTRY_ALREADY_EXISTS" },
189641c99275SPeter Avalos   { 0xC002003E, "RPC_NT_ENTRY_NOT_FOUND" },
189741c99275SPeter Avalos   { 0xC002003F, "RPC_NT_NAME_SERVICE_UNAVAILABLE" },
189841c99275SPeter Avalos   { 0xC0020040, "RPC_NT_INVALID_NAF_ID" },
189941c99275SPeter Avalos   { 0xC0020041, "RPC_NT_CANNOT_SUPPORT" },
190041c99275SPeter Avalos   { 0xC0020042, "RPC_NT_NO_CONTEXT_AVAILABLE" },
190141c99275SPeter Avalos   { 0xC0020043, "RPC_NT_INTERNAL_ERROR" },
190241c99275SPeter Avalos   { 0xC0020044, "RPC_NT_ZERO_DIVIDE" },
190341c99275SPeter Avalos   { 0xC0020045, "RPC_NT_ADDRESS_ERROR" },
190441c99275SPeter Avalos   { 0xC0020046, "RPC_NT_FP_DIV_ZERO" },
190541c99275SPeter Avalos   { 0xC0020047, "RPC_NT_FP_UNDERFLOW" },
190641c99275SPeter Avalos   { 0xC0020048, "RPC_NT_FP_OVERFLOW" },
190741c99275SPeter Avalos   { 0xC0021007, "RPC_P_RECEIVE_ALERTED" },
190841c99275SPeter Avalos   { 0xC0021008, "RPC_P_CONNECTION_CLOSED" },
190941c99275SPeter Avalos   { 0xC0021009, "RPC_P_RECEIVE_FAILED" },
191041c99275SPeter Avalos   { 0xC002100A, "RPC_P_SEND_FAILED" },
191141c99275SPeter Avalos   { 0xC002100B, "RPC_P_TIMEOUT" },
191241c99275SPeter Avalos   { 0xC002100C, "RPC_P_SERVER_TRANSPORT_ERROR" },
1913*ed775ee7SAntonio Huete Jimenez   { 0xC002100E, "RPC_P_EXCEPTION_OCCURRED" },
191441c99275SPeter Avalos   { 0xC0021012, "RPC_P_CONNECTION_SHUTDOWN" },
191541c99275SPeter Avalos   { 0xC0021015, "RPC_P_THREAD_LISTENING" },
191641c99275SPeter Avalos   { 0xC0030001, "RPC_NT_NO_MORE_ENTRIES" },
191741c99275SPeter Avalos   { 0xC0030002, "RPC_NT_SS_CHAR_TRANS_OPEN_FAIL" },
191841c99275SPeter Avalos   { 0xC0030003, "RPC_NT_SS_CHAR_TRANS_SHORT_FILE" },
191941c99275SPeter Avalos   { 0xC0030004, "RPC_NT_SS_IN_NULL_CONTEXT" },
192041c99275SPeter Avalos   { 0xC0030005, "RPC_NT_SS_CONTEXT_MISMATCH" },
192141c99275SPeter Avalos   { 0xC0030006, "RPC_NT_SS_CONTEXT_DAMAGED" },
192241c99275SPeter Avalos   { 0xC0030007, "RPC_NT_SS_HANDLES_MISMATCH" },
192341c99275SPeter Avalos   { 0xC0030008, "RPC_NT_SS_CANNOT_GET_CALL_HANDLE" },
192441c99275SPeter Avalos   { 0xC0030009, "RPC_NT_NULL_REF_POINTER" },
192541c99275SPeter Avalos   { 0xC003000A, "RPC_NT_ENUM_VALUE_OUT_OF_RANGE" },
192641c99275SPeter Avalos   { 0xC003000B, "RPC_NT_BYTE_COUNT_TOO_SMALL" },
192741c99275SPeter Avalos   { 0xC003000C, "RPC_NT_BAD_STUB_DATA" },
192841c99275SPeter Avalos   { 0xC0020049, "RPC_NT_CALL_IN_PROGRESS" },
192941c99275SPeter Avalos   { 0xC002004A, "RPC_NT_NO_MORE_BINDINGS" },
193041c99275SPeter Avalos   { 0xC002004B, "RPC_NT_GROUP_MEMBER_NOT_FOUND" },
193141c99275SPeter Avalos   { 0xC002004C, "EPT_NT_CANT_CREATE" },
193241c99275SPeter Avalos   { 0xC002004D, "RPC_NT_INVALID_OBJECT" },
193341c99275SPeter Avalos   { 0xC002004F, "RPC_NT_NO_INTERFACES" },
193441c99275SPeter Avalos   { 0xC0020050, "RPC_NT_CALL_CANCELLED" },
193541c99275SPeter Avalos   { 0xC0020051, "RPC_NT_BINDING_INCOMPLETE" },
193641c99275SPeter Avalos   { 0xC0020052, "RPC_NT_COMM_FAILURE" },
193741c99275SPeter Avalos   { 0xC0020053, "RPC_NT_UNSUPPORTED_AUTHN_LEVEL" },
193841c99275SPeter Avalos   { 0xC0020054, "RPC_NT_NO_PRINC_NAME" },
193941c99275SPeter Avalos   { 0xC0020055, "RPC_NT_NOT_RPC_ERROR" },
194041c99275SPeter Avalos   { 0x40020056, "RPC_NT_UUID_LOCAL_ONLY" },
194141c99275SPeter Avalos   { 0xC0020057, "RPC_NT_SEC_PKG_ERROR" },
194241c99275SPeter Avalos   { 0xC0020058, "RPC_NT_NOT_CANCELLED" },
194341c99275SPeter Avalos   { 0xC0030059, "RPC_NT_INVALID_ES_ACTION" },
194441c99275SPeter Avalos   { 0xC003005A, "RPC_NT_WRONG_ES_VERSION" },
194541c99275SPeter Avalos   { 0xC003005B, "RPC_NT_WRONG_STUB_VERSION" },
194641c99275SPeter Avalos   { 0xC003005C, "RPC_NT_INVALID_PIPE_OBJECT" },
194741c99275SPeter Avalos   { 0xC003005D, "RPC_NT_INVALID_PIPE_OPERATION" },
194841c99275SPeter Avalos   { 0xC003005E, "RPC_NT_WRONG_PIPE_VERSION" },
194941c99275SPeter Avalos   { 0x400200AF, "RPC_NT_SEND_INCOMPLETE" },
195041c99275SPeter Avalos   { 0,          NULL }
195141c99275SPeter Avalos };
195241c99275SPeter Avalos 
195341c99275SPeter Avalos /*
195441c99275SPeter Avalos  * return an NT error string from a SMB buffer
195541c99275SPeter Avalos  */
195641c99275SPeter Avalos const char *
nt_errstr(uint32_t err)1957411677aeSAaron LI nt_errstr(uint32_t err)
195841c99275SPeter Avalos {
195941c99275SPeter Avalos     static char ret[128];
196041c99275SPeter Avalos     int i;
196141c99275SPeter Avalos 
196241c99275SPeter Avalos     ret[0] = 0;
196341c99275SPeter Avalos 
196441c99275SPeter Avalos     for (i = 0; nt_errors[i].name; i++) {
196541c99275SPeter Avalos 	if (err == nt_errors[i].code)
196641c99275SPeter Avalos 	    return nt_errors[i].name;
196741c99275SPeter Avalos     }
196841c99275SPeter Avalos 
196941c99275SPeter Avalos     snprintf(ret, sizeof(ret), "0x%08x", err);
197041c99275SPeter Avalos     return ret;
197141c99275SPeter Avalos }
1972