/*
* Unix SMB/CIFS implementation.
* error mapping functions
* Copyright (C) Andrew Tridgell 2001
* Copyright (C) Andrew Bartlett 2001
* Copyright (C) Tim Potter 2000
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see .
*/
#include "includes.h"
/* errmap NTSTATUS->Win32 */
static const struct {
NTSTATUS ntstatus;
WERROR werror;
} ntstatus_to_werror_map[] = {
{NT_STATUS(0x103), W_ERROR(0x3e5)},
{NT_STATUS(0x105), W_ERROR(0xea)},
{NT_STATUS(0x106), W_ERROR(0x514)},
{NT_STATUS(0x107), W_ERROR(0x515)},
{NT_STATUS(0x10c), W_ERROR(0x3fe)},
{NT_STATUS(0x10d), W_ERROR(0x516)},
{NT_STATUS(0x121), W_ERROR(0x2009)},
{NT_STATUS(0xc0000001), W_ERROR(0x1f)},
{NT_STATUS(0xc0000002), W_ERROR(0x1)},
{NT_STATUS(0xc0000003), W_ERROR(0x57)},
{NT_STATUS(0xc0000004), W_ERROR(0x18)},
{NT_STATUS(0xc0000005), W_ERROR(0x3e6)},
{NT_STATUS(0xc0000006), W_ERROR(0x3e7)},
{NT_STATUS(0xc0000007), W_ERROR(0x5ae)},
{NT_STATUS(0xc0000008), W_ERROR(0x6)},
{NT_STATUS(0xc0000009), W_ERROR(0x3e9)},
{NT_STATUS(0xc000000a), W_ERROR(0xc1)},
{NT_STATUS(0xc000000b), W_ERROR(0x57)},
{NT_STATUS(0xc000000d), W_ERROR(0x57)},
{NT_STATUS(0xc000000e), W_ERROR(0x2)},
{NT_STATUS(0xc000000f), W_ERROR(0x2)},
{NT_STATUS(0xc0000010), W_ERROR(0x1)},
{NT_STATUS(0xc0000011), W_ERROR(0x26)},
{NT_STATUS(0xc0000012), W_ERROR(0x22)},
{NT_STATUS(0xc0000013), W_ERROR(0x15)},
{NT_STATUS(0xc0000014), W_ERROR(0x6f9)},
{NT_STATUS(0xc0000015), W_ERROR(0x1b)},
{NT_STATUS(0xc0000016), W_ERROR(0xea)},
{NT_STATUS(0xc0000017), W_ERROR(0x8)},
{NT_STATUS(0xc0000018), W_ERROR(0x1e7)},
{NT_STATUS(0xc0000019), W_ERROR(0x1e7)},
{NT_STATUS(0xc000001a), W_ERROR(0x57)},
{NT_STATUS(0xc000001b), W_ERROR(0x57)},
{NT_STATUS(0xc000001c), W_ERROR(0x1)},
{NT_STATUS(0xc000001d), W_ERROR(0xc000001d)},
{NT_STATUS(0xc000001e), W_ERROR(0x5)},
{NT_STATUS(0xc000001f), W_ERROR(0x5)},
{NT_STATUS(0xc0000020), W_ERROR(0xc1)},
{NT_STATUS(0xc0000021), W_ERROR(0x5)},
{NT_STATUS(0xc0000022), W_ERROR(0x5)},
{NT_STATUS(0xc0000023), W_ERROR(0x7a)},
{NT_STATUS(0xc0000024), W_ERROR(0x6)},
{NT_STATUS(0xc0000025), W_ERROR(0xc0000025)},
{NT_STATUS(0xc0000026), W_ERROR(0xc0000026)},
{NT_STATUS(0xc000002a), W_ERROR(0x9e)},
{NT_STATUS(0xc000002b), W_ERROR(0xc000002b)},
{NT_STATUS(0xc000002c), W_ERROR(0x1e7)},
{NT_STATUS(0xc000002d), W_ERROR(0x1e7)},
{NT_STATUS(0xc0000030), W_ERROR(0x57)},
{NT_STATUS(0xc0000032), W_ERROR(0x571)},
{NT_STATUS(0xc0000033), W_ERROR(0x7b)},
{NT_STATUS(0xc0000034), W_ERROR(0x2)},
{NT_STATUS(0xc0000035), W_ERROR(0xb7)},
{NT_STATUS(0xc0000037), W_ERROR(0x6)},
{NT_STATUS(0xc0000039), W_ERROR(0xa1)},
{NT_STATUS(0xc000003a), W_ERROR(0x3)},
{NT_STATUS(0xc000003b), W_ERROR(0xa1)},
{NT_STATUS(0xc000003c), W_ERROR(0x45d)},
{NT_STATUS(0xc000003d), W_ERROR(0x45d)},
{NT_STATUS(0xc000003e), W_ERROR(0x17)},
{NT_STATUS(0xc000003f), W_ERROR(0x17)},
{NT_STATUS(0xc0000040), W_ERROR(0x8)},
{NT_STATUS(0xc0000041), W_ERROR(0x5)},
{NT_STATUS(0xc0000042), W_ERROR(0x6)},
{NT_STATUS(0xc0000043), W_ERROR(0x20)},
{NT_STATUS(0xc0000044), W_ERROR(0x718)},
{NT_STATUS(0xc0000045), W_ERROR(0x57)},
{NT_STATUS(0xc0000046), W_ERROR(0x120)},
{NT_STATUS(0xc0000047), W_ERROR(0x12a)},
{NT_STATUS(0xc0000048), W_ERROR(0x57)},
{NT_STATUS(0xc0000049), W_ERROR(0x57)},
{NT_STATUS(0xc000004a), W_ERROR(0x9c)},
{NT_STATUS(0xc000004b), W_ERROR(0x5)},
{NT_STATUS(0xc000004c), W_ERROR(0x57)},
{NT_STATUS(0xc000004d), W_ERROR(0x57)},
{NT_STATUS(0xc000004e), W_ERROR(0x57)},
{NT_STATUS(0xc000004f), W_ERROR(0x11a)},
{NT_STATUS(0xc0000050), W_ERROR(0xff)},
{NT_STATUS(0xc0000051), W_ERROR(0x570)},
{NT_STATUS(0xc0000052), W_ERROR(0x570)},
{NT_STATUS(0xc0000053), W_ERROR(0x570)},
{NT_STATUS(0xc0000054), W_ERROR(0x21)},
{NT_STATUS(0xc0000055), W_ERROR(0x21)},
{NT_STATUS(0xc0000056), W_ERROR(0x5)},
{NT_STATUS(0xc0000057), W_ERROR(0x32)},
{NT_STATUS(0xc0000058), W_ERROR(0x519)},
{NT_STATUS(0xc0000059), W_ERROR(0x51a)},
{NT_STATUS(0xc000005a), W_ERROR(0x51b)},
{NT_STATUS(0xc000005b), W_ERROR(0x51c)},
{NT_STATUS(0xc000005c), W_ERROR(0x51d)},
{NT_STATUS(0xc000005d), W_ERROR(0x51e)},
{NT_STATUS(0xc000005e), W_ERROR(0x51f)},
{NT_STATUS(0xc000005f), W_ERROR(0x520)},
{NT_STATUS(0xc0000060), W_ERROR(0x521)},
{NT_STATUS(0xc0000061), W_ERROR(0x522)},
{NT_STATUS(0xc0000062), W_ERROR(0x523)},
{NT_STATUS(0xc0000063), W_ERROR(0x524)},
{NT_STATUS(0xc0000064), W_ERROR(0x525)},
{NT_STATUS(0xc0000065), W_ERROR(0x526)},
{NT_STATUS(0xc0000066), W_ERROR(0x527)},
{NT_STATUS(0xc0000067), W_ERROR(0x528)},
{NT_STATUS(0xc0000068), W_ERROR(0x529)},
{NT_STATUS(0xc0000069), W_ERROR(0x52a)},
{NT_STATUS(0xc000006a), W_ERROR(0x56)},
{NT_STATUS(0xc000006b), W_ERROR(0x52c)},
{NT_STATUS(0xc000006c), W_ERROR(0x52d)},
{NT_STATUS(0xc000006d), W_ERROR(0x52e)},
{NT_STATUS(0xc000006e), W_ERROR(0x52f)},
{NT_STATUS(0xc000006f), W_ERROR(0x530)},
{NT_STATUS(0xc0000070), W_ERROR(0x531)},
{NT_STATUS(0xc0000071), W_ERROR(0x532)},
{NT_STATUS(0xc0000072), W_ERROR(0x533)},
{NT_STATUS(0xc0000073), W_ERROR(0x534)},
{NT_STATUS(0xc0000074), W_ERROR(0x535)},
{NT_STATUS(0xc0000075), W_ERROR(0x536)},
{NT_STATUS(0xc0000076), W_ERROR(0x537)},
{NT_STATUS(0xc0000077), W_ERROR(0x538)},
{NT_STATUS(0xc0000078), W_ERROR(0x539)},
{NT_STATUS(0xc0000079), W_ERROR(0x53a)},
{NT_STATUS(0xc000007a), W_ERROR(0x7f)},
{NT_STATUS(0xc000007b), W_ERROR(0xc1)},
{NT_STATUS(0xc000007c), W_ERROR(0x3f0)},
{NT_STATUS(0xc000007d), W_ERROR(0x53c)},
{NT_STATUS(0xc000007e), W_ERROR(0x9e)},
{NT_STATUS(0xc000007f), W_ERROR(0x70)},
{NT_STATUS(0xc0000080), W_ERROR(0x53d)},
{NT_STATUS(0xc0000081), W_ERROR(0x53e)},
{NT_STATUS(0xc0000082), W_ERROR(0x44)},
{NT_STATUS(0xc0000083), W_ERROR(0x103)},
{NT_STATUS(0xc0000084), W_ERROR(0x53f)},
{NT_STATUS(0xc0000085), W_ERROR(0x103)},
{NT_STATUS(0xc0000086), W_ERROR(0x9a)},
{NT_STATUS(0xc0000087), W_ERROR(0xe)},
{NT_STATUS(0xc0000088), W_ERROR(0x1e7)},
{NT_STATUS(0xc0000089), W_ERROR(0x714)},
{NT_STATUS(0xc000008a), W_ERROR(0x715)},
{NT_STATUS(0xc000008b), W_ERROR(0x716)},
{NT_STATUS(0xc000008c), W_ERROR(0xc000008c)},
{NT_STATUS(0xc000008d), W_ERROR(0xc000008d)},
{NT_STATUS(0xc000008e), W_ERROR(0xc000008e)},
{NT_STATUS(0xc000008f), W_ERROR(0xc000008f)},
{NT_STATUS(0xc0000090), W_ERROR(0xc0000090)},
{NT_STATUS(0xc0000091), W_ERROR(0xc0000091)},
{NT_STATUS(0xc0000092), W_ERROR(0xc0000092)},
{NT_STATUS(0xc0000093), W_ERROR(0xc0000093)},
{NT_STATUS(0xc0000094), W_ERROR(0xc0000094)},
{NT_STATUS(0xc0000095), W_ERROR(0x216)},
{NT_STATUS(0xc0000096), W_ERROR(0xc0000096)},
{NT_STATUS(0xc0000097), W_ERROR(0x8)},
{NT_STATUS(0xc0000098), W_ERROR(0x3ee)},
{NT_STATUS(0xc0000099), W_ERROR(0x540)},
{NT_STATUS(0xc000009a), W_ERROR(0x5aa)},
{NT_STATUS(0xc000009b), W_ERROR(0x3)},
{NT_STATUS(0xc000009c), W_ERROR(0x17)},
{NT_STATUS(0xc000009d), W_ERROR(0x48f)},
{NT_STATUS(0xc000009e), W_ERROR(0x15)},
{NT_STATUS(0xc000009f), W_ERROR(0x1e7)},
{NT_STATUS(0xc00000a0), W_ERROR(0x1e7)},
{NT_STATUS(0xc00000a1), W_ERROR(0x5ad)},
{NT_STATUS(0xc00000a2), W_ERROR(0x13)},
{NT_STATUS(0xc00000a3), W_ERROR(0x15)},
{NT_STATUS(0xc00000a4), W_ERROR(0x541)},
{NT_STATUS(0xc00000a5), W_ERROR(0x542)},
{NT_STATUS(0xc00000a6), W_ERROR(0x543)},
{NT_STATUS(0xc00000a7), W_ERROR(0x544)},
{NT_STATUS(0xc00000a8), W_ERROR(0x545)},
{NT_STATUS(0xc00000a9), W_ERROR(0x57)},
{NT_STATUS(0xc00000ab), W_ERROR(0xe7)},
{NT_STATUS(0xc00000ac), W_ERROR(0xe7)},
{NT_STATUS(0xc00000ad), W_ERROR(0xe6)},
{NT_STATUS(0xc00000ae), W_ERROR(0xe7)},
{NT_STATUS(0xc00000af), W_ERROR(0x1)},
{NT_STATUS(0xc00000b0), W_ERROR(0xe9)},
{NT_STATUS(0xc00000b1), W_ERROR(0xe8)},
{NT_STATUS(0xc00000b2), W_ERROR(0x217)},
{NT_STATUS(0xc00000b3), W_ERROR(0x218)},
{NT_STATUS(0xc00000b4), W_ERROR(0xe6)},
{NT_STATUS(0xc00000b5), W_ERROR(0x79)},
{NT_STATUS(0xc00000b6), W_ERROR(0x26)},
{NT_STATUS(0xc00000ba), W_ERROR(0x5)},
{NT_STATUS(0xc00000bb), W_ERROR(0x32)},
{NT_STATUS(0xc00000bc), W_ERROR(0x33)},
{NT_STATUS(0xc00000bd), W_ERROR(0x34)},
{NT_STATUS(0xc00000be), W_ERROR(0x35)},
{NT_STATUS(0xc00000bf), W_ERROR(0x36)},
{NT_STATUS(0xc00000c0), W_ERROR(0x37)},
{NT_STATUS(0xc00000c1), W_ERROR(0x38)},
{NT_STATUS(0xc00000c2), W_ERROR(0x39)},
{NT_STATUS(0xc00000c3), W_ERROR(0x3a)},
{NT_STATUS(0xc00000c4), W_ERROR(0x3b)},
{NT_STATUS(0xc00000c5), W_ERROR(0x3c)},
{NT_STATUS(0xc00000c6), W_ERROR(0x3d)},
{NT_STATUS(0xc00000c7), W_ERROR(0x3e)},
{NT_STATUS(0xc00000c8), W_ERROR(0x3f)},
{NT_STATUS(0xc00000c9), W_ERROR(0x40)},
{NT_STATUS(0xc00000ca), W_ERROR(0x41)},
{NT_STATUS(0xc00000cb), W_ERROR(0x42)},
{NT_STATUS(0xc00000cc), W_ERROR(0x43)},
{NT_STATUS(0xc00000cd), W_ERROR(0x44)},
{NT_STATUS(0xc00000ce), W_ERROR(0x45)},
{NT_STATUS(0xc00000cf), W_ERROR(0x46)},
{NT_STATUS(0xc00000d0), W_ERROR(0x47)},
{NT_STATUS(0xc00000d1), W_ERROR(0x48)},
{NT_STATUS(0xc00000d2), W_ERROR(0x58)},
{NT_STATUS(0xc00000d4), W_ERROR(0x11)},
{NT_STATUS(0xc00000d5), W_ERROR(0x5)},
{NT_STATUS(0xc00000d6), W_ERROR(0xf0)},
{NT_STATUS(0xc00000d7), W_ERROR(0x546)},
{NT_STATUS(0xc00000d9), W_ERROR(0xe8)},
{NT_STATUS(0xc00000da), W_ERROR(0x547)},
{NT_STATUS(0xc00000dc), W_ERROR(0x548)},
{NT_STATUS(0xc00000dd), W_ERROR(0x549)},
{NT_STATUS(0xc00000de), W_ERROR(0x54a)},
{NT_STATUS(0xc00000df), W_ERROR(0x54b)},
{NT_STATUS(0xc00000e0), W_ERROR(0x54c)},
{NT_STATUS(0xc00000e1), W_ERROR(0x54d)},
{NT_STATUS(0xc00000e2), W_ERROR(0x12c)},
{NT_STATUS(0xc00000e3), W_ERROR(0x12d)},
{NT_STATUS(0xc00000e4), W_ERROR(0x54e)},
{NT_STATUS(0xc00000e5), W_ERROR(0x54f)},
{NT_STATUS(0xc00000e6), W_ERROR(0x550)},
{NT_STATUS(0xc00000e7), W_ERROR(0x551)},
{NT_STATUS(0xc00000e8), W_ERROR(0x6f8)},
{NT_STATUS(0xc00000ed), W_ERROR(0x552)},
{NT_STATUS(0xc00000ee), W_ERROR(0x553)},
{NT_STATUS(0xc00000ef), W_ERROR(0x57)},
{NT_STATUS(0xc00000f0), W_ERROR(0x57)},
{NT_STATUS(0xc00000f1), W_ERROR(0x57)},
{NT_STATUS(0xc00000f2), W_ERROR(0x57)},
{NT_STATUS(0xc00000f3), W_ERROR(0x57)},
{NT_STATUS(0xc00000f4), W_ERROR(0x57)},
{NT_STATUS(0xc00000f5), W_ERROR(0x57)},
{NT_STATUS(0xc00000f6), W_ERROR(0x57)},
{NT_STATUS(0xc00000f7), W_ERROR(0x57)},
{NT_STATUS(0xc00000f8), W_ERROR(0x57)},
{NT_STATUS(0xc00000f9), W_ERROR(0x57)},
{NT_STATUS(0xc00000fa), W_ERROR(0x57)},
{NT_STATUS(0xc00000fb), W_ERROR(0x3)},
{NT_STATUS(0xc00000fd), W_ERROR(0x3e9)},
{NT_STATUS(0xc00000fe), W_ERROR(0x554)},
{NT_STATUS(0xc0000100), W_ERROR(0xcb)},
{NT_STATUS(0xc0000101), W_ERROR(0x91)},
{NT_STATUS(0xc0000102), W_ERROR(0x570)},
{NT_STATUS(0xc0000103), W_ERROR(0x10b)},
{NT_STATUS(0xc0000104), W_ERROR(0x555)},
{NT_STATUS(0xc0000105), W_ERROR(0x556)},
{NT_STATUS(0xc0000106), W_ERROR(0xce)},
{NT_STATUS(0xc0000107), W_ERROR(0x961)},
{NT_STATUS(0xc0000108), W_ERROR(0x964)},
{NT_STATUS(0xc000010a), W_ERROR(0x5)},
{NT_STATUS(0xc000010b), W_ERROR(0x557)},
{NT_STATUS(0xc000010d), W_ERROR(0x558)},
{NT_STATUS(0xc000010e), W_ERROR(0x420)},
{NT_STATUS(0xc0000117), W_ERROR(0x5a4)},
{NT_STATUS(0xc000011b), W_ERROR(0xc1)},
{NT_STATUS(0xc000011c), W_ERROR(0x559)},
{NT_STATUS(0xc000011d), W_ERROR(0x55a)},
{NT_STATUS(0xc000011e), W_ERROR(0x3ee)},
{NT_STATUS(0xc000011f), W_ERROR(0x4)},
{NT_STATUS(0xc0000120), W_ERROR(0x3e3)},
{NT_STATUS(0xc0000121), W_ERROR(0x5)},
{NT_STATUS(0xc0000122), W_ERROR(0x4ba)},
{NT_STATUS(0xc0000123), W_ERROR(0x5)},
{NT_STATUS(0xc0000124), W_ERROR(0x55b)},
{NT_STATUS(0xc0000125), W_ERROR(0x55c)},
{NT_STATUS(0xc0000126), W_ERROR(0x55d)},
{NT_STATUS(0xc0000127), W_ERROR(0x55e)},
{NT_STATUS(0xc0000128), W_ERROR(0x6)},
{NT_STATUS(0xc000012b), W_ERROR(0x55f)},
{NT_STATUS(0xc000012d), W_ERROR(0x5af)},
{NT_STATUS(0xc000012e), W_ERROR(0xc1)},
{NT_STATUS(0xc000012f), W_ERROR(0xc1)},
{NT_STATUS(0xc0000130), W_ERROR(0xc1)},
{NT_STATUS(0xc0000131), W_ERROR(0xc1)},
{NT_STATUS(0xc0000133), W_ERROR(0x576)},
{NT_STATUS(0xc0000135), W_ERROR(0x7e)},
{NT_STATUS(0xc0000138), W_ERROR(0xb6)},
{NT_STATUS(0xc0000139), W_ERROR(0x7f)},
{NT_STATUS(0xc000013b), W_ERROR(0x40)},
{NT_STATUS(0xc000013c), W_ERROR(0x40)},
{NT_STATUS(0xc000013d), W_ERROR(0x33)},
{NT_STATUS(0xc000013e), W_ERROR(0x3b)},
{NT_STATUS(0xc000013f), W_ERROR(0x3b)},
{NT_STATUS(0xc0000140), W_ERROR(0x3b)},
{NT_STATUS(0xc0000141), W_ERROR(0x3b)},
{NT_STATUS(0xc0000142), W_ERROR(0x45a)},
{NT_STATUS(0xc0000148), W_ERROR(0x7c)},
{NT_STATUS(0xc0000149), W_ERROR(0x56)},
{NT_STATUS(0xc000014b), W_ERROR(0x6d)},
{NT_STATUS(0xc000014c), W_ERROR(0x3f1)},
{NT_STATUS(0xc000014d), W_ERROR(0x3f8)},
{NT_STATUS(0xc000014f), W_ERROR(0x3ed)},
{NT_STATUS(0xc0000150), W_ERROR(0x45e)},
{NT_STATUS(0xc0000151), W_ERROR(0x560)},
{NT_STATUS(0xc0000152), W_ERROR(0x561)},
{NT_STATUS(0xc0000153), W_ERROR(0x562)},
{NT_STATUS(0xc0000154), W_ERROR(0x563)},
{NT_STATUS(0xc0000155), W_ERROR(0x564)},
{NT_STATUS(0xc0000156), W_ERROR(0x565)},
{NT_STATUS(0xc0000157), W_ERROR(0x566)},
{NT_STATUS(0xc0000158), W_ERROR(0x567)},
{NT_STATUS(0xc0000159), W_ERROR(0x3ef)},
{NT_STATUS(0xc000015a), W_ERROR(0x568)},
{NT_STATUS(0xc000015b), W_ERROR(0x569)},
{NT_STATUS(0xc000015c), W_ERROR(0x3f9)},
{NT_STATUS(0xc000015d), W_ERROR(0x56a)},
{NT_STATUS(0xc000015f), W_ERROR(0x45d)},
{NT_STATUS(0xc0000162), W_ERROR(0x459)},
{NT_STATUS(0xc0000165), W_ERROR(0x462)},
{NT_STATUS(0xc0000166), W_ERROR(0x463)},
{NT_STATUS(0xc0000167), W_ERROR(0x464)},
{NT_STATUS(0xc0000168), W_ERROR(0x465)},
{NT_STATUS(0xc0000169), W_ERROR(0x466)},
{NT_STATUS(0xc000016a), W_ERROR(0x467)},
{NT_STATUS(0xc000016b), W_ERROR(0x468)},
{NT_STATUS(0xc000016c), W_ERROR(0x45f)},
{NT_STATUS(0xc000016d), W_ERROR(0x45d)},
{NT_STATUS(0xc0000172), W_ERROR(0x451)},
{NT_STATUS(0xc0000173), W_ERROR(0x452)},
{NT_STATUS(0xc0000174), W_ERROR(0x453)},
{NT_STATUS(0xc0000175), W_ERROR(0x454)},
{NT_STATUS(0xc0000176), W_ERROR(0x455)},
{NT_STATUS(0xc0000177), W_ERROR(0x469)},
{NT_STATUS(0xc0000178), W_ERROR(0x458)},
{NT_STATUS(0xc000017a), W_ERROR(0x56b)},
{NT_STATUS(0xc000017b), W_ERROR(0x56c)},
{NT_STATUS(0xc000017c), W_ERROR(0x3fa)},
{NT_STATUS(0xc000017d), W_ERROR(0x3fb)},
{NT_STATUS(0xc000017e), W_ERROR(0x56d)},
{NT_STATUS(0xc000017f), W_ERROR(0x56e)},
{NT_STATUS(0xc0000180), W_ERROR(0x3fc)},
{NT_STATUS(0xc0000181), W_ERROR(0x3fd)},
{NT_STATUS(0xc0000182), W_ERROR(0x57)},
{NT_STATUS(0xc0000183), W_ERROR(0x45d)},
{NT_STATUS(0xc0000184), W_ERROR(0x16)},
{NT_STATUS(0xc0000185), W_ERROR(0x45d)},
{NT_STATUS(0xc0000186), W_ERROR(0x45d)},
{NT_STATUS(0xc0000188), W_ERROR(0x5de)},
{NT_STATUS(0xc0000189), W_ERROR(0x13)},
{NT_STATUS(0xc000018a), W_ERROR(0x6fa)},
{NT_STATUS(0xc000018b), W_ERROR(0x6fb)},
{NT_STATUS(0xc000018c), W_ERROR(0x6fc)},
{NT_STATUS(0xc000018d), W_ERROR(0x6fd)},
{NT_STATUS(0xc000018e), W_ERROR(0x5dc)},
{NT_STATUS(0xc000018f), W_ERROR(0x5dd)},
{NT_STATUS(0xc0000190), W_ERROR(0x6fe)},
{NT_STATUS(0xc0000192), W_ERROR(0x700)},
{NT_STATUS(0xc0000193), W_ERROR(0x701)},
{NT_STATUS(0xc0000194), W_ERROR(0x46b)},
{NT_STATUS(0xc0000195), W_ERROR(0x4c3)},
{NT_STATUS(0xc0000196), W_ERROR(0x4c4)},
{NT_STATUS(0xc0000197), W_ERROR(0x5df)},
{NT_STATUS(0xc0000198), W_ERROR(0x70f)},
{NT_STATUS(0xc0000199), W_ERROR(0x710)},
{NT_STATUS(0xc000019a), W_ERROR(0x711)},
{NT_STATUS(0xc000019b), W_ERROR(0x712)},
{NT_STATUS(0xc0000202), W_ERROR(0x572)},
{NT_STATUS(0xc0000203), W_ERROR(0x3b)},
{NT_STATUS(0xc0000204), W_ERROR(0x717)},
{NT_STATUS(0xc0000205), W_ERROR(0x46a)},
{NT_STATUS(0xc0000206), W_ERROR(0x6f8)},
{NT_STATUS(0xc0000207), W_ERROR(0x4be)},
{NT_STATUS(0xc0000208), W_ERROR(0x4be)},
{NT_STATUS(0xc0000209), W_ERROR(0x44)},
{NT_STATUS(0xc000020a), W_ERROR(0x34)},
{NT_STATUS(0xc000020b), W_ERROR(0x40)},
{NT_STATUS(0xc000020c), W_ERROR(0x40)},
{NT_STATUS(0xc000020d), W_ERROR(0x40)},
{NT_STATUS(0xc000020e), W_ERROR(0x44)},
{NT_STATUS(0xc000020f), W_ERROR(0x3b)},
{NT_STATUS(0xc0000210), W_ERROR(0x3b)},
{NT_STATUS(0xc0000211), W_ERROR(0x3b)},
{NT_STATUS(0xc0000212), W_ERROR(0x3b)},
{NT_STATUS(0xc0000213), W_ERROR(0x3b)},
{NT_STATUS(0xc0000214), W_ERROR(0x3b)},
{NT_STATUS(0xc0000215), W_ERROR(0x3b)},
{NT_STATUS(0xc0000216), W_ERROR(0x32)},
{NT_STATUS(0xc0000217), W_ERROR(0x32)},
{NT_STATUS(0xc000021c), W_ERROR(0x17e6)},
{NT_STATUS(0xc0000220), W_ERROR(0x46c)},
{NT_STATUS(0xc0000221), W_ERROR(0xc1)},
{NT_STATUS(0xc0000224), W_ERROR(0x773)},
{NT_STATUS(0xc0000225), W_ERROR(0x490)},
{NT_STATUS(0xc000022a), W_ERROR(0xc000022a)},
{NT_STATUS(0xc000022b), W_ERROR(0xc000022b)},
{NT_STATUS(0xc000022d), W_ERROR(0x4d5)},
{NT_STATUS(0xc0000230), W_ERROR(0x492)},
{NT_STATUS(0xc0000233), W_ERROR(0x774)},
{NT_STATUS(0xc0000234), W_ERROR(0x775)},
{NT_STATUS(0xc0000235), W_ERROR(0x6)},
{NT_STATUS(0xc0000236), W_ERROR(0x4c9)},
{NT_STATUS(0xc0000237), W_ERROR(0x4ca)},
{NT_STATUS(0xc0000238), W_ERROR(0x4cb)},
{NT_STATUS(0xc0000239), W_ERROR(0x4cc)},
{NT_STATUS(0xc000023a), W_ERROR(0x4cd)},
{NT_STATUS(0xc000023b), W_ERROR(0x4ce)},
{NT_STATUS(0xc000023c), W_ERROR(0x4cf)},
{NT_STATUS(0xc000023d), W_ERROR(0x4d0)},
{NT_STATUS(0xc000023e), W_ERROR(0x4d1)},
{NT_STATUS(0xc000023f), W_ERROR(0x4d2)},
{NT_STATUS(0xc0000240), W_ERROR(0x4d3)},
{NT_STATUS(0xc0000241), W_ERROR(0x4d4)},
{NT_STATUS(0xc0000243), W_ERROR(0x4c8)},
{NT_STATUS(0xc0000246), W_ERROR(0x4d6)},
{NT_STATUS(0xc0000247), W_ERROR(0x4d7)},
{NT_STATUS(0xc0000248), W_ERROR(0x4d8)},
{NT_STATUS(0xc0000249), W_ERROR(0xc1)},
{NT_STATUS(0xc0000253), W_ERROR(0x54f)},
{NT_STATUS(0xc0000257), W_ERROR(0x4d0)},
{NT_STATUS(0xc0000259), W_ERROR(0x573)},
{NT_STATUS(0xc000025e), W_ERROR(0x422)},
{NT_STATUS(0xc0000262), W_ERROR(0xb6)},
{NT_STATUS(0xc0000263), W_ERROR(0x7f)},
{NT_STATUS(0xc0000264), W_ERROR(0x120)},
{NT_STATUS(0xc0000265), W_ERROR(0x476)},
{NT_STATUS(0xc0000267), W_ERROR(0x10fe)},
{NT_STATUS(0xc000026c), W_ERROR(0x7d1)},
{NT_STATUS(0xc000026d), W_ERROR(0x4b1)},
{NT_STATUS(0xc000026e), W_ERROR(0x15)},
{NT_STATUS(0xc0000272), W_ERROR(0x491)},
{NT_STATUS(0xc0000275), W_ERROR(0x1126)},
{NT_STATUS(0xc0000276), W_ERROR(0x1129)},
{NT_STATUS(0xc0000277), W_ERROR(0x112a)},
{NT_STATUS(0xc0000278), W_ERROR(0x1128)},
{NT_STATUS(0xc0000279), W_ERROR(0x780)},
{NT_STATUS(0xc0000280), W_ERROR(0x781)},
{NT_STATUS(0xc0000281), W_ERROR(0xa1)},
{NT_STATUS(0xc0000283), W_ERROR(0x488)},
{NT_STATUS(0xc0000284), W_ERROR(0x489)},
{NT_STATUS(0xc0000285), W_ERROR(0x48a)},
{NT_STATUS(0xc0000286), W_ERROR(0x48b)},
{NT_STATUS(0xc0000287), W_ERROR(0x48c)},
{NT_STATUS(0xc000028a), W_ERROR(0x5)},
{NT_STATUS(0xc000028b), W_ERROR(0x5)},
{NT_STATUS(0xc000028d), W_ERROR(0x5)},
{NT_STATUS(0xc000028e), W_ERROR(0x5)},
{NT_STATUS(0xc000028f), W_ERROR(0x5)},
{NT_STATUS(0xc0000290), W_ERROR(0x5)},
{NT_STATUS(0xc0000291), W_ERROR(0x1777)},
{NT_STATUS(0xc0000292), W_ERROR(0x1778)},
{NT_STATUS(0xc0000293), W_ERROR(0x1772)},
{NT_STATUS(0xc0000295), W_ERROR(0x1068)},
{NT_STATUS(0xc0000296), W_ERROR(0x1069)},
{NT_STATUS(0xc0000297), W_ERROR(0x106a)},
{NT_STATUS(0xc0000298), W_ERROR(0x106b)},
{NT_STATUS(0xc0000299), W_ERROR(0x201a)},
{NT_STATUS(0xc000029a), W_ERROR(0x201b)},
{NT_STATUS(0xc000029b), W_ERROR(0x201c)},
{NT_STATUS(0xc000029c), W_ERROR(0x1)},
{NT_STATUS(0xc000029d), W_ERROR(0x10ff)},
{NT_STATUS(0xc000029e), W_ERROR(0x1100)},
{NT_STATUS(0xc000029f), W_ERROR(0x494)},
{NT_STATUS(0xc00002a1), W_ERROR(0x200a)},
{NT_STATUS(0xc00002a2), W_ERROR(0x200b)},
{NT_STATUS(0xc00002a3), W_ERROR(0x200c)},
{NT_STATUS(0xc00002a4), W_ERROR(0x200d)},
{NT_STATUS(0xc00002a5), W_ERROR(0x200e)},
{NT_STATUS(0xc00002a6), W_ERROR(0x200f)},
{NT_STATUS(0xc00002a7), W_ERROR(0x2010)},
{NT_STATUS(0xc00002a8), W_ERROR(0x2011)},
{NT_STATUS(0xc00002a9), W_ERROR(0x2012)},
{NT_STATUS(0xc00002aa), W_ERROR(0x2013)},
{NT_STATUS(0xc00002ab), W_ERROR(0x2014)},
{NT_STATUS(0xc00002ac), W_ERROR(0x2015)},
{NT_STATUS(0xc00002ad), W_ERROR(0x2016)},
{NT_STATUS(0xc00002ae), W_ERROR(0x2017)},
{NT_STATUS(0xc00002af), W_ERROR(0x2018)},
{NT_STATUS(0xc00002b0), W_ERROR(0x2019)},
{NT_STATUS(0xc00002b1), W_ERROR(0x211e)},
{NT_STATUS(0xc00002b2), W_ERROR(0x1127)},
{NT_STATUS(0xc00002b6), W_ERROR(0x651)},
{NT_STATUS(0xc00002b7), W_ERROR(0x49a)},
{NT_STATUS(0xc00002b8), W_ERROR(0x49b)},
{NT_STATUS(0xc00002c1), W_ERROR(0x2024)},
{NT_STATUS(0xc00002c3), W_ERROR(0x575)},
{NT_STATUS(0xc00002c5), W_ERROR(0x3e6)},
{NT_STATUS(0xc00002c6), W_ERROR(0x1075)},
{NT_STATUS(0xc00002c7), W_ERROR(0x1076)},
{NT_STATUS(0xc00002ca), W_ERROR(0x10e8)},
{NT_STATUS(0xc00002cb), W_ERROR(0x2138)},
{NT_STATUS(0xc00002cc), W_ERROR(0x4e3)},
{NT_STATUS(0xc00002cd), W_ERROR(0x2139)},
{NT_STATUS(0xc00002cf), W_ERROR(0x49d)},
{NT_STATUS(0xc00002d0), W_ERROR(0x213a)},
{NT_STATUS(0xc00002d4), W_ERROR(0x2141)},
{NT_STATUS(0xc00002d5), W_ERROR(0x2142)},
{NT_STATUS(0xc00002d6), W_ERROR(0x2143)},
{NT_STATUS(0xc00002d7), W_ERROR(0x2144)},
{NT_STATUS(0xc00002d8), W_ERROR(0x2145)},
{NT_STATUS(0xc00002d9), W_ERROR(0x2146)},
{NT_STATUS(0xc00002da), W_ERROR(0x2147)},
{NT_STATUS(0xc00002db), W_ERROR(0x2148)},
{NT_STATUS(0xc00002dc), W_ERROR(0x2149)},
{NT_STATUS(0xc00002dd), W_ERROR(0x32)},
{NT_STATUS(0xc00002df), W_ERROR(0x2151)},
{NT_STATUS(0xc00002e0), W_ERROR(0x2152)},
{NT_STATUS(0xc00002e1), W_ERROR(0x2153)},
{NT_STATUS(0xc00002e2), W_ERROR(0x2154)},
{NT_STATUS(0xc00002e3), W_ERROR(0x215d)},
{NT_STATUS(0xc00002e4), W_ERROR(0x2163)},
{NT_STATUS(0xc00002e5), W_ERROR(0x2164)},
{NT_STATUS(0xc00002e6), W_ERROR(0x2165)},
{NT_STATUS(0xc00002e7), W_ERROR(0x216d)},
{NT_STATUS(0xc00002fe), W_ERROR(0x45b)},
{NT_STATUS(0xc00002ff), W_ERROR(0x4e7)},
{NT_STATUS(0xc0000300), W_ERROR(0x4e6)},
{NT_STATUS(0x80000001), W_ERROR(0x80000001)},
{NT_STATUS(0x80000002), W_ERROR(0x3e6)},
{NT_STATUS(0x80000003), W_ERROR(0x80000003)},
{NT_STATUS(0x80000004), W_ERROR(0x80000004)},
{NT_STATUS(0x80000005), W_ERROR(0xea)},
{NT_STATUS(0x80000006), W_ERROR(0x12)},
{NT_STATUS(0x8000000b), W_ERROR(0x56f)},
{NT_STATUS(0x8000000d), W_ERROR(0x12b)},
{NT_STATUS(0x8000000e), W_ERROR(0x1c)},
{NT_STATUS(0x8000000f), W_ERROR(0x15)},
{NT_STATUS(0x80000010), W_ERROR(0x15)},
{NT_STATUS(0x80000011), W_ERROR(0xaa)},
{NT_STATUS(0x80000012), W_ERROR(0x103)},
{NT_STATUS(0x80000013), W_ERROR(0xfe)},
{NT_STATUS(0x80000014), W_ERROR(0xff)},
{NT_STATUS(0x80000015), W_ERROR(0xff)},
{NT_STATUS(0x80000016), W_ERROR(0x456)},
{NT_STATUS(0x8000001a), W_ERROR(0x103)},
{NT_STATUS(0x8000001b), W_ERROR(0x44d)},
{NT_STATUS(0x8000001c), W_ERROR(0x456)},
{NT_STATUS(0x8000001d), W_ERROR(0x457)},
{NT_STATUS(0x8000001e), W_ERROR(0x44c)},
{NT_STATUS(0x8000001f), W_ERROR(0x44e)},
{NT_STATUS(0x80000021), W_ERROR(0x44f)},
{NT_STATUS(0x80000022), W_ERROR(0x450)},
{NT_STATUS(0x80000025), W_ERROR(0x962)},
{NT_STATUS(0x80000288), W_ERROR(0x48d)},
{NT_STATUS(0x80000289), W_ERROR(0x48e)},
{NT_STATUS_OK, WERR_OK}};
static const struct {
WERROR werror;
NTSTATUS ntstatus;
} werror_to_ntstatus_map[] = {
{ W_ERROR(0x5), NT_STATUS_ACCESS_DENIED },
{ WERR_OK, NT_STATUS_OK }
};
bool ntstatus_check_dos_mapping = true;
/*
check if a DOS encoded NTSTATUS code maps to the given NTSTATUS code
*/
bool ntstatus_dos_equal(NTSTATUS status1, NTSTATUS status2)
{
/* when we negotiate nt status support, we don't want to consider
the mapping of dos codes, as we want to catch the cases where
a forced dos code is needed
*/
if (ntstatus_check_dos_mapping) {
return NT_STATUS_V(status1) == NT_STATUS_V(status2);
}
/* otherwise check if the mapping comes out right. Note that it is important
that we do the mapping only from ntstatus -> dos and not from dos -> ntstatus,
as that is the mapping that servers must do */
if (!NT_STATUS_IS_DOS(status1) && NT_STATUS_IS_DOS(status2)) {
uint8_t eclass;
uint32_t ecode;
ntstatus_to_dos(status1, &eclass, &ecode);
return eclass == NT_STATUS_DOS_CLASS(status2) &&
ecode == NT_STATUS_DOS_CODE(status2);
}
if (NT_STATUS_IS_DOS(status1) && !NT_STATUS_IS_DOS(status2)) {
uint8_t eclass;
uint32_t ecode;
ntstatus_to_dos(status2, &eclass, &ecode);
return eclass == NT_STATUS_DOS_CLASS(status1) &&
ecode == NT_STATUS_DOS_CODE(status1);
}
return NT_STATUS_V(status1) == NT_STATUS_V(status2);
}
/* Mapping between Unix, and NT error numbers */
static const struct {
int unix_error;
NTSTATUS nt_error;
} unix_nt_errmap[] = {
{ EAGAIN, STATUS_MORE_ENTRIES },
{ EINTR, STATUS_MORE_ENTRIES },
{ ENOBUFS, STATUS_MORE_ENTRIES },
#ifdef EWOULDBLOCK
{ EWOULDBLOCK, STATUS_MORE_ENTRIES },
#endif
{ EINPROGRESS, NT_STATUS_MORE_PROCESSING_REQUIRED },
{ EPERM, NT_STATUS_ACCESS_DENIED },
{ EACCES, NT_STATUS_ACCESS_DENIED },
{ ENOENT, NT_STATUS_OBJECT_NAME_NOT_FOUND },
{ ENOTDIR, NT_STATUS_NOT_A_DIRECTORY },
{ EIO, NT_STATUS_IO_DEVICE_ERROR },
{ EBADF, NT_STATUS_INVALID_HANDLE },
{ EINVAL, NT_STATUS_INVALID_PARAMETER },
{ EEXIST, NT_STATUS_OBJECT_NAME_COLLISION},
{ ENFILE, NT_STATUS_TOO_MANY_OPENED_FILES },
{ EMFILE, NT_STATUS_TOO_MANY_OPENED_FILES },
{ ENOSPC, NT_STATUS_DISK_FULL },
{ EISDIR, NT_STATUS_FILE_IS_A_DIRECTORY },
{ ENOTSOCK, NT_STATUS_INVALID_HANDLE },
{ EFAULT, NT_STATUS_INVALID_PARAMETER },
{ EMSGSIZE, NT_STATUS_INVALID_BUFFER_SIZE },
{ ENOMEM, NT_STATUS_NO_MEMORY },
{ EPIPE, NT_STATUS_CONNECTION_DISCONNECTED },
{ ECONNREFUSED, NT_STATUS_CONNECTION_REFUSED },
#ifdef ECONNRESET
{ ECONNRESET, NT_STATUS_CONNECTION_RESET },
#endif
{ EBUSY, NT_STATUS_SHARING_VIOLATION },
#ifdef ENOTSUP
{ ENOTSUP, NT_STATUS_NOT_SUPPORTED},
#endif
#ifdef EOPNOTSUPP
{ EOPNOTSUPP, NT_STATUS_NOT_SUPPORTED},
#endif
#ifdef EHOSTUNREACH
{ EHOSTUNREACH, NT_STATUS_HOST_UNREACHABLE },
#endif
#ifdef ENETUNREACH
{ ENETUNREACH, NT_STATUS_NETWORK_UNREACHABLE },
#endif
#ifdef ETIMEDOUT
{ ETIMEDOUT, NT_STATUS_IO_TIMEOUT },
#endif
#ifdef EADDRINUSE
{ EADDRINUSE, NT_STATUS_ADDRESS_ALREADY_ASSOCIATED },
#endif
#ifdef ENOATTR
{ ENOATTR, NT_STATUS_NOT_FOUND },
#endif
#ifdef ENODATA
{ ENODATA, NT_STATUS_NOT_FOUND },
#endif
#ifdef EDQUOT
{ EDQUOT, NT_STATUS_DISK_FULL }, /* Windows does NOT return NT_STATUS_QUOTA_EXCEEDED */
#endif
#ifdef ENOTEMPTY
{ ENOTEMPTY, NT_STATUS_DIRECTORY_NOT_EMPTY },
#endif
#ifdef EXDEV
{ EXDEV, NT_STATUS_NOT_SAME_DEVICE },
#endif
#ifdef EROFS
{ EROFS, NT_STATUS_MEDIA_WRITE_PROTECTED },
#endif
#ifdef ENAMETOOLONG
{ ENAMETOOLONG, NT_STATUS_NAME_TOO_LONG },
#endif
#ifdef EFBIG
{ EFBIG, NT_STATUS_DISK_FULL },
#endif
#ifdef EADDRNOTAVAIL
{ EADDRNOTAVAIL,NT_STATUS_ADDRESS_NOT_ASSOCIATED },
#endif
#ifdef ESOCKTNOSUPPORT
{ ESOCKTNOSUPPORT,NT_STATUS_INVALID_PARAMETER_MIX },
#endif
#ifdef EAFNOSUPPORT
{ EAFNOSUPPORT, NT_STATUS_INVALID_PARAMETER_MIX },
#endif
#ifdef ENOPROTOOPT
{ ENOPROTOOPT, NT_STATUS_INVALID_PARAMETER_MIX },
#endif
#ifdef ENODEV
{ ENODEV, NT_STATUS_NO_SUCH_DEVICE },
#endif
#ifdef ENOSYS
{ ENOSYS, NT_STATUS_INVALID_SYSTEM_SERVICE },
#endif
#ifdef ECANCELED
{ ECANCELED, NT_STATUS_CANCELLED },
#endif
{ 0, NT_STATUS_UNSUCCESSFUL }
};
/*********************************************************************
Map an NT error code from a Unix error code.
*********************************************************************/
NTSTATUS map_nt_error_from_unix(int unix_error)
{
int i;
/* Look through list */
for (i=0;i