From de07ca77e7310af23fa494defbf7cc235afdac68 Mon Sep 17 00:00:00 2001 From: Shawn Landden Date: Sun, 19 Jan 2020 22:05:38 +0400 Subject: [PATCH 01/60] rb: just use @include("std") we already have to use --override-std-dir when running std tests, and having it this way makes it much easier to run just the tests of this file. --- lib/std/rb.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/std/rb.zig b/lib/std/rb.zig index c41a269a2..0e87eb1eb 100644 --- a/lib/std/rb.zig +++ b/lib/std/rb.zig @@ -1,4 +1,4 @@ -const std = @import("std.zig"); +const std = @import("std"); const assert = std.debug.assert; const testing = std.testing; const Order = std.math.Order; From e19008292222d37b3a08a4e6a9d41553ecfcfd7e Mon Sep 17 00:00:00 2001 From: Shawn Landden Date: Sun, 19 Jan 2020 22:08:05 +0400 Subject: [PATCH 02/60] rb: *breaking* make API thread-safe use @fieldParentPtr to access your context fields, which lie if you struct that contains a rb.Tree member (without a pointer). Also simplifies the init() function so rb.Tree can be initialized in a single line, without having to use "undefined". --- lib/std/rb.zig | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/lib/std/rb.zig b/lib/std/rb.zig index 0e87eb1eb..0fefa033a 100644 --- a/lib/std/rb.zig +++ b/lib/std/rb.zig @@ -132,7 +132,7 @@ pub const Node = struct { pub const Tree = struct { root: ?*Node, - compareFn: fn (*Node, *Node) Order, + compareFn: fn (*Node, *Node, *Tree) Order, /// If you have a need for a version that caches this, please file a bug. pub fn first(tree: *Tree) ?*Node { @@ -389,7 +389,7 @@ pub const Tree = struct { var new = newconst; // I assume this can get optimized out if the caller already knows. - if (tree.compareFn(old, new) != .eq) return ReplaceError.NotEqual; + if (tree.compareFn(old, new, tree) != .eq) return ReplaceError.NotEqual; if (old.getParent()) |parent| { parent.setChild(new, parent.left == old); @@ -404,9 +404,11 @@ pub const Tree = struct { new.* = old.*; } - pub fn init(tree: *Tree, f: fn (*Node, *Node) Order) void { - tree.root = null; - tree.compareFn = f; + pub fn init(f: fn (*Node, *Node, *Tree) Order) Tree { + return Tree{ + .root = null, + .compareFn = f, + }; } }; @@ -469,7 +471,7 @@ fn doLookup(key: *Node, tree: *Tree, pparent: *?*Node, is_left: *bool) ?*Node { is_left.* = false; while (maybe_node) |node| { - const res = tree.compareFn(node, key); + const res = tree.compareFn(node, key, tree); if (res == .eq) { return node; } @@ -498,7 +500,7 @@ fn testGetNumber(node: *Node) *testNumber { return @fieldParentPtr(testNumber, "node", node); } -fn testCompare(l: *Node, r: *Node) Order { +fn testCompare(l: *Node, r: *Node, contextIgnored: *Tree) Order { var left = testGetNumber(l); var right = testGetNumber(r); @@ -518,7 +520,7 @@ test "rb" { return error.SkipZigTest; } - var tree: Tree = undefined; + var tree = Tree.init(testCompare); var ns: [10]testNumber = undefined; ns[0].value = 42; ns[1].value = 41; @@ -534,7 +536,6 @@ test "rb" { var dup: testNumber = undefined; dup.value = 32345; - tree.init(testCompare); _ = tree.insert(&ns[1].node); _ = tree.insert(&ns[2].node); _ = tree.insert(&ns[3].node); @@ -557,8 +558,7 @@ test "rb" { } test "inserting and looking up" { - var tree: Tree = undefined; - tree.init(testCompare); + var tree = Tree.init(testCompare); var number: testNumber = undefined; number.value = 1000; _ = tree.insert(&number.node); @@ -582,8 +582,7 @@ test "multiple inserts, followed by calling first and last" { // TODO https://github.com/ziglang/zig/issues/3288 return error.SkipZigTest; } - var tree: Tree = undefined; - tree.init(testCompare); + var tree = Tree.init(testCompare); var zeroth: testNumber = undefined; zeroth.value = 0; var first: testNumber = undefined; From 4ab9678b9553d77bc0683ee69a8936524f6a7808 Mon Sep 17 00:00:00 2001 From: Shawn Landden Date: Sun, 19 Jan 2020 22:10:21 +0400 Subject: [PATCH 03/60] rb: add sort() that re-sorts tree with new compare function You can also specify the same compare function, but after updating the context that the function will use (connected to the rb.Tree) before. --- lib/std/rb.zig | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lib/std/rb.zig b/lib/std/rb.zig index 0fefa033a..78e1e3aed 100644 --- a/lib/std/rb.zig +++ b/lib/std/rb.zig @@ -134,6 +134,20 @@ pub const Tree = struct { root: ?*Node, compareFn: fn (*Node, *Node, *Tree) Order, + /// Re-sorts a tree with a new compare function + pub fn sort(tree: *Tree, newCompareFn: fn (*Node, *Node, *Tree) Order) !void { + var newTree = Tree.init(newCompareFn); + var node: *Node = undefined; + while (true) { + node = tree.first() orelse break; + tree.remove(node); + if (newTree.insert(node) != null) { + return error.NotUnique; // EEXISTS + } + } + tree.* = newTree; + } + /// If you have a need for a version that caches this, please file a bug. pub fn first(tree: *Tree) ?*Node { var node: *Node = tree.root orelse return null; @@ -244,6 +258,7 @@ pub const Tree = struct { return doLookup(key, tree, &parent, &is_left); } + /// If node is not part of tree, behavior is undefined. pub fn remove(tree: *Tree, nodeconst: *Node) void { var node = nodeconst; // as this has the same value as node, it is unsafe to access node after newnode @@ -514,6 +529,10 @@ fn testCompare(l: *Node, r: *Node, contextIgnored: *Tree) Order { unreachable; } +fn testCompareReverse(l: *Node, r: *Node, contextIgnored: *Tree) Order { + return testCompare(r, l, contextIgnored); +} + test "rb" { if (@import("builtin").arch == .aarch64) { // TODO https://github.com/ziglang/zig/issues/3288 @@ -600,4 +619,8 @@ test "multiple inserts, followed by calling first and last" { var lookupNode: testNumber = undefined; lookupNode.value = 3; assert(tree.lookup(&lookupNode.node) == &third.node); + tree.sort(testCompareReverse) catch unreachable; + assert(testGetNumber(tree.first().?).value == 3); + assert(testGetNumber(tree.last().?).value == 0); + assert(tree.lookup(&lookupNode.node) == &third.node); } From ad15a73240324fce93a659fbee9dab7be24dfbb0 Mon Sep 17 00:00:00 2001 From: Shawn Landden Date: Sun, 19 Jan 2020 23:35:56 +0400 Subject: [PATCH 04/60] rb: type Tree.sort with SortError --- lib/std/rb.zig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/std/rb.zig b/lib/std/rb.zig index 78e1e3aed..d7840b75b 100644 --- a/lib/std/rb.zig +++ b/lib/std/rb.zig @@ -11,6 +11,7 @@ const Red = Color.Red; const Black = Color.Black; const ReplaceError = error{NotEqual}; +const SortError = error{NotUnique}; // The new comparison function results in duplicates. /// Insert this into your struct that you want to add to a red-black tree. /// Do not use a pointer. Turn the *rb.Node results of the functions in rb @@ -135,7 +136,7 @@ pub const Tree = struct { compareFn: fn (*Node, *Node, *Tree) Order, /// Re-sorts a tree with a new compare function - pub fn sort(tree: *Tree, newCompareFn: fn (*Node, *Node, *Tree) Order) !void { + pub fn sort(tree: *Tree, newCompareFn: fn (*Node, *Node, *Tree) Order) SortError!void { var newTree = Tree.init(newCompareFn); var node: *Node = undefined; while (true) { From 3500b41bfed159b54b951b7cee5ff404ae5fbbda Mon Sep 17 00:00:00 2001 From: Rocknest <35231115+Rocknest@users.noreply.github.com> Date: Wed, 29 Jan 2020 16:57:43 +0200 Subject: [PATCH 05/60] Add an advanced segfault handler on windows --- lib/std/debug.zig | 278 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 273 insertions(+), 5 deletions(-) diff --git a/lib/std/debug.zig b/lib/std/debug.zig index d035707a5..561993fb9 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -2307,16 +2307,284 @@ fn handleSegfaultLinux(sig: i32, info: *const os.siginfo_t, ctx_ptr: *const c_vo } fn handleSegfaultWindows(info: *windows.EXCEPTION_POINTERS) callconv(.Stdcall) c_long { - const exception_address = @ptrToInt(info.ExceptionRecord.ExceptionAddress); switch (info.ExceptionRecord.ExceptionCode) { - windows.EXCEPTION_DATATYPE_MISALIGNMENT => panicExtra(null, exception_address, "Unaligned Memory Access", .{}), - windows.EXCEPTION_ACCESS_VIOLATION => panicExtra(null, exception_address, "Segmentation fault at address 0x{x}", .{info.ExceptionRecord.ExceptionInformation[1]}), - windows.EXCEPTION_ILLEGAL_INSTRUCTION => panicExtra(null, exception_address, "Illegal Instruction", .{}), - windows.EXCEPTION_STACK_OVERFLOW => panicExtra(null, exception_address, "Stack Overflow", .{}), + windows.EXCEPTION_DATATYPE_MISALIGNMENT => handleSegfaultWindowsExtra(info, 0, "Unaligned Memory Access"), + windows.EXCEPTION_ACCESS_VIOLATION => handleSegfaultWindowsExtra(info, 1, null), + windows.EXCEPTION_ILLEGAL_INSTRUCTION => handleSegfaultWindowsExtra(info, 2, null), + windows.EXCEPTION_STACK_OVERFLOW => handleSegfaultWindowsExtra(info, 0, "Stack Overflow"), else => return windows.EXCEPTION_CONTINUE_SEARCH, } } +// zig won't let me use an anon enum here +fn handleSegfaultWindowsExtra(info: *windows.EXCEPTION_POINTERS, comptime msg: u8, comptime format: ?[]const u8) noreturn { + const exception_address = @ptrToInt(info.ExceptionRecord.ExceptionAddress); + if (comptime windows_exception_context.haveContext) { + const regs = windows_exception_context.getRegs(info.ContextRecord); + switch (msg) { + 0 => std.debug.warn("{}\n", .{format.?}), + 1 => std.debug.warn("Segmentation fault at address 0x{x}\n", .{info.ExceptionRecord.ExceptionInformation[1]}), + 2 => std.debug.warn("Illegal instruction at address 0x{x}\n", .{regs.ip}), + else => unreachable, + } + + dumpStackTraceFromBase(regs.bp, regs.ip); + os.abort(); + } else { + switch (msg) { + 0 => panicExtra(null, exception_address, format.?, .{}), + 1 => panicExtra(null, exception_address, "Segmentation fault at address 0x{x}", .{info.ExceptionRecord.ExceptionInformation[1]}), + 2 => panicExtra(null, exception_address, "Illegal Instruction", .{}), + else => unreachable, + } + } +} + +pub const windows_exception_context = switch (builtin.arch) { + .i386 => struct { + pub const haveContext = true; + + pub fn getRegs(ptr: *c_void) struct {bp: usize, ip: usize} { + const ctx = @ptrCast(*const CONTEXT, @alignCast(@alignOf(CONTEXT), ptr)); + return .{.bp = @intCast(usize, ctx.Ebp), .ip = @intCast(usize, ctx.Eip)}; + } + + pub const CONTEXT = extern struct { + ContextFlags: DWORD, + Dr0: DWORD, + Dr1: DWORD, + Dr2: DWORD, + Dr3: DWORD, + Dr6: DWORD, + Dr7: DWORD, + FloatSave: FLOATING_SAVE_AREA, + SegGs: DWORD, + SegFs: DWORD, + SegEs: DWORD, + SegDs: DWORD, + Edi: DWORD, + Esi: DWORD, + Ebx: DWORD, + Edx: DWORD, + Ecx: DWORD, + Eax: DWORD, + Ebp: DWORD, + Eip: DWORD, + SegCs: DWORD, + EFlags: DWORD, + Esp: DWORD, + SegSs: DWORD, + ExtendedRegisters: [512]BYTE, + }; + + pub const FLOATING_SAVE_AREA = extern struct { + ControlWord: DWORD, + StatusWord: DWORD, + TagWord: DWORD, + ErrorOffset: DWORD, + ErrorSelector: DWORD, + DataOffset: DWORD, + DataSelector: DWORD, + RegisterArea: [80]BYTE, + Cr0NpxState: DWORD, + }; + + pub const BYTE = u8; + pub const DWORD = c_ulong; + }, + .x86_64 => struct { + pub const haveContext = true; + + pub fn getRegs(ptr: *c_void) struct {bp: usize, ip: usize} { + const ctx = @ptrCast(*const CONTEXT, @alignCast(@alignOf(CONTEXT), ptr)); + return .{.bp = @intCast(usize, ctx.Rbp), .ip = @intCast(usize, ctx.Rip)}; + } + + pub const CONTEXT = extern struct { + P1Home: DWORD64, + P2Home: DWORD64, + P3Home: DWORD64, + P4Home: DWORD64, + P5Home: DWORD64, + P6Home: DWORD64, + ContextFlags: DWORD, + MxCsr: DWORD, + SegCs: WORD, + SegDs: WORD, + SegEs: WORD, + SegFs: WORD, + SegGs: WORD, + SegSs: WORD, + EFlags: DWORD, + Dr0: DWORD64, + Dr1: DWORD64, + Dr2: DWORD64, + Dr3: DWORD64, + Dr6: DWORD64, + Dr7: DWORD64, + Rax: DWORD64, + Rcx: DWORD64, + Rdx: DWORD64, + Rbx: DWORD64, + Rsp: DWORD64, + Rbp: DWORD64, + Rsi: DWORD64, + Rdi: DWORD64, + R8: DWORD64, + R9: DWORD64, + R10: DWORD64, + R11: DWORD64, + R12: DWORD64, + R13: DWORD64, + R14: DWORD64, + R15: DWORD64, + Rip: DWORD64, + DUMMYUNIONNAME: extern union { + FltSave: XMM_SAVE_AREA32, + FloatSave: XMM_SAVE_AREA32, + DUMMYSTRUCTNAME: extern struct { + Header: [2]M128A, + Legacy: [8]M128A, + Xmm0: M128A, + Xmm1: M128A, + Xmm2: M128A, + Xmm3: M128A, + Xmm4: M128A, + Xmm5: M128A, + Xmm6: M128A, + Xmm7: M128A, + Xmm8: M128A, + Xmm9: M128A, + Xmm10: M128A, + Xmm11: M128A, + Xmm12: M128A, + Xmm13: M128A, + Xmm14: M128A, + Xmm15: M128A, + }, + }, + VectorRegister: [26]M128A, + VectorControl: DWORD64, + DebugControl: DWORD64, + LastBranchToRip: DWORD64, + LastBranchFromRip: DWORD64, + LastExceptionToRip: DWORD64, + LastExceptionFromRip: DWORD64, + }; + + pub const XMM_SAVE_AREA32 = extern struct { + ControlWord: WORD, + StatusWord: WORD, + TagWord: BYTE, + Reserved1: BYTE, + ErrorOpcode: WORD, + ErrorOffset: DWORD, + ErrorSelector: WORD, + Reserved2: WORD, + DataOffset: DWORD, + DataSelector: WORD, + Reserved3: WORD, + MxCsr: DWORD, + MxCsr_Mask: DWORD, + FloatRegisters: [8]M128A, + XmmRegisters: [16]M128A, + Reserved4: [96]BYTE, + }; + + pub const M128A = extern struct { + Low: ULONGLONG, + High: LONGLONG, + }; + + pub const BYTE = u8; + pub const WORD = u16; + pub const DWORD = u32; + pub const DWORD64 = u64; + pub const LONGLONG = c_longlong; + pub const ULONGLONG = c_ulonglong; + }, + .aarch64 => struct { + pub const haveContext = true; + + pub fn getRegs(ptr: *c_void) struct {bp: usize, ip: usize} { + const ctx = @ptrCast(*const CONTEXT, @alignCast(@alignOf(CONTEXT), ptr)); + return .{.bp = @intCast(usize, ctx.Fp), .ip = @intCast(usize, ctx.Pc)}; + } + + pub const CONTEXT = extern struct { + ContextFlags: ULONG, + Cpsr: ULONG, + DUMMYUNIONNAME: extern union { + DUMMYSTRUCTNAME: extern struct { + X0: DWORD64, + X1: DWORD64, + X2: DWORD64, + X3: DWORD64, + X4: DWORD64, + X5: DWORD64, + X6: DWORD64, + X7: DWORD64, + X8: DWORD64, + X9: DWORD64, + X10: DWORD64, + X11: DWORD64, + X12: DWORD64, + X13: DWORD64, + X14: DWORD64, + X15: DWORD64, + X16: DWORD64, + X17: DWORD64, + X18: DWORD64, + X19: DWORD64, + X20: DWORD64, + X21: DWORD64, + X22: DWORD64, + X23: DWORD64, + X24: DWORD64, + X25: DWORD64, + X26: DWORD64, + X27: DWORD64, + X28: DWORD64, + Fp: DWORD64, + Lr: DWORD64, + }, + X: [31]DWORD64, + }, + Sp: DWORD64, + Pc: DWORD64, + V: [32]NEON128, + Fpcr: DWORD, + Fpsr: DWORD, + Bcr: [8]DWORD, + Bvr: [8]DWORD64, + Wcr: [2]DWORD, + Wvr: [2]DWORD64, + }; + + pub const NEON128 = extern union { + DUMMYSTRUCTNAME: extern struct { + Low: ULONGLONG, + High: LONGLONG, + }, + D: [2]f64, + S: [4]f32, + H: [8]WORD, + B: [16]BYTE, + }; + + pub const ULONG = c_ulong; + pub const LONGLONG = c_longlong; + pub const ULONGLONG = c_ulonglong; + pub const BYTE = u8; + pub const WORD = c_ushort; + pub const DWORD = c_ulong; + pub const DWORD64 = c_ulonglong; + }, + else => struct { + pub const haveContext = false; + }, +}; + pub fn dumpStackPointerAddr(prefix: []const u8) void { const sp = asm ("" : [argc] "={rsp}" (-> usize) From 4d134a01f5a8baae346783f19d9b5db8c8256d32 Mon Sep 17 00:00:00 2001 From: Benjamin Feng Date: Wed, 29 Jan 2020 12:21:29 -0600 Subject: [PATCH 06/60] Move debug.global_allocator to testing.allocator --- doc/docgen.zig | 2 +- lib/std/array_list.zig | 14 +++---- lib/std/buffer.zig | 6 +-- lib/std/debug.zig | 7 ++-- lib/std/fifo.zig | 4 +- lib/std/fmt.zig | 10 ++--- lib/std/fs/path.zig | 16 ++++---- lib/std/heap.zig | 4 ++ lib/std/linked_list.zig | 6 +-- lib/std/os/test.zig | 2 +- lib/std/priority_queue.zig | 38 +++++++++---------- lib/std/process.zig | 8 ++-- lib/std/special/test_runner.zig | 1 + lib/std/testing.zig | 5 +++ lib/std/unicode.zig | 12 +++--- lib/std/zig/ast.zig | 2 +- test/compare_output.zig | 4 +- test/compile_errors.zig | 2 +- test/stage1/behavior/const_slice_child.zig | 2 +- test/standalone/brace_expansion/main.zig | 4 +- test/standalone/cat/main.zig | 2 +- test/standalone/empty_env/main.zig | 2 +- test/standalone/load_dynamic_library/main.zig | 4 +- 23 files changed, 84 insertions(+), 73 deletions(-) diff --git a/doc/docgen.zig b/doc/docgen.zig index 0218f5041..678eb2604 100644 --- a/doc/docgen.zig +++ b/doc/docgen.zig @@ -672,7 +672,7 @@ const TermState = enum { test "term color" { const input_bytes = "A\x1b[32;1mgreen\x1b[0mB"; - const result = try termColor(std.debug.global_allocator, input_bytes); + const result = try termColor(std.testing.allocator, input_bytes); testing.expectEqualSlices(u8, "AgreenB", result); } diff --git a/lib/std/array_list.zig b/lib/std/array_list.zig index 64f13eff9..be99a54e2 100644 --- a/lib/std/array_list.zig +++ b/lib/std/array_list.zig @@ -320,7 +320,7 @@ test "std.ArrayList.basic" { } test "std.ArrayList.orderedRemove" { - var list = ArrayList(i32).init(debug.global_allocator); + var list = ArrayList(i32).init(testing.allocator); defer list.deinit(); try list.append(1); @@ -347,7 +347,7 @@ test "std.ArrayList.orderedRemove" { } test "std.ArrayList.swapRemove" { - var list = ArrayList(i32).init(debug.global_allocator); + var list = ArrayList(i32).init(testing.allocator); defer list.deinit(); try list.append(1); @@ -374,7 +374,7 @@ test "std.ArrayList.swapRemove" { } test "std.ArrayList.swapRemoveOrError" { - var list = ArrayList(i32).init(debug.global_allocator); + var list = ArrayList(i32).init(testing.allocator); defer list.deinit(); // Test just after initialization @@ -402,7 +402,7 @@ test "std.ArrayList.swapRemoveOrError" { } test "std.ArrayList.insert" { - var list = ArrayList(i32).init(debug.global_allocator); + var list = ArrayList(i32).init(testing.allocator); defer list.deinit(); try list.append(1); @@ -416,7 +416,7 @@ test "std.ArrayList.insert" { } test "std.ArrayList.insertSlice" { - var list = ArrayList(i32).init(debug.global_allocator); + var list = ArrayList(i32).init(testing.allocator); defer list.deinit(); try list.append(1); @@ -443,7 +443,7 @@ const Item = struct { }; test "std.ArrayList: ArrayList(T) of struct T" { - var root = Item{ .integer = 1, .sub_items = ArrayList(Item).init(debug.global_allocator) }; - try root.sub_items.append(Item{ .integer = 42, .sub_items = ArrayList(Item).init(debug.global_allocator) }); + var root = Item{ .integer = 1, .sub_items = ArrayList(Item).init(testing.allocator) }; + try root.sub_items.append(Item{ .integer = 42, .sub_items = ArrayList(Item).init(testing.allocator) }); testing.expect(root.sub_items.items[0].integer == 42); } diff --git a/lib/std/buffer.zig b/lib/std/buffer.zig index 42bf8e814..ada359061 100644 --- a/lib/std/buffer.zig +++ b/lib/std/buffer.zig @@ -150,7 +150,7 @@ pub const Buffer = struct { }; test "simple Buffer" { - var buf = try Buffer.init(debug.global_allocator, ""); + var buf = try Buffer.init(testing.allocator, ""); testing.expect(buf.len() == 0); try buf.append("hello"); try buf.append(" "); @@ -169,14 +169,14 @@ test "simple Buffer" { } test "Buffer.initSize" { - var buf = try Buffer.initSize(debug.global_allocator, 3); + var buf = try Buffer.initSize(testing.allocator, 3); testing.expect(buf.len() == 3); try buf.append("hello"); testing.expect(mem.eql(u8, buf.toSliceConst()[3..], "hello")); } test "Buffer.initCapacity" { - var buf = try Buffer.initCapacity(debug.global_allocator, 10); + var buf = try Buffer.initCapacity(testing.allocator, 10); testing.expect(buf.len() == 0); testing.expect(buf.capacity() >= 10); const old_cap = buf.capacity(); diff --git a/lib/std/debug.zig b/lib/std/debug.zig index d035707a5..f2dcdd7e7 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -20,7 +20,7 @@ const windows = std.os.windows; pub const leb = @import("debug/leb128.zig"); pub const FailingAllocator = @import("debug/failing_allocator.zig").FailingAllocator; -pub const failing_allocator = &FailingAllocator.init(global_allocator, 0).allocator; +pub const failing_allocator = &FailingAllocator.init(&global_fixed_allocator.allocator, 0).allocator; pub const runtime_safety = switch (builtin.mode) { .Debug, .ReleaseSafe => true, @@ -2192,8 +2192,9 @@ fn readInitialLength(comptime E: type, in_stream: *io.InStream(E), is_64: *bool) } } -/// This should only be used in temporary test programs. -pub const global_allocator = &global_fixed_allocator.allocator; +pub const global_allocator = blk: { + @compileError("Please switch to std.testing.allocator."); +}; var global_fixed_allocator = std.heap.ThreadSafeFixedBufferAllocator.init(global_allocator_mem[0..]); var global_allocator_mem: [100 * 1024]u8 = undefined; diff --git a/lib/std/fifo.zig b/lib/std/fifo.zig index 7870979ab..ac8589f2c 100644 --- a/lib/std/fifo.zig +++ b/lib/std/fifo.zig @@ -347,7 +347,7 @@ pub fn LinearFifo( } test "LinearFifo(u8, .Dynamic)" { - var fifo = LinearFifo(u8, .Dynamic).init(debug.global_allocator); + var fifo = LinearFifo(u8, .Dynamic).init(testing.allocator); defer fifo.deinit(); try fifo.write("HELLO"); @@ -422,7 +422,7 @@ test "LinearFifo" { var fifo = switch (bt) { .Static => FifoType.init(), .Slice => FifoType.init(buf[0..]), - .Dynamic => FifoType.init(debug.global_allocator), + .Dynamic => FifoType.init(testing.allocator), }; defer fifo.deinit(); diff --git a/lib/std/fmt.zig b/lib/std/fmt.zig index cf3322a99..975765844 100644 --- a/lib/std/fmt.zig +++ b/lib/std/fmt.zig @@ -1598,7 +1598,7 @@ test "hexToBytes" { test "formatIntValue with comptime_int" { const value: comptime_int = 123456789123456789; - var buf = try std.Buffer.init(std.debug.global_allocator, ""); + var buf = try std.Buffer.init(std.testing.allocator, ""); try formatIntValue(value, "", FormatOptions{}, &buf, @TypeOf(std.Buffer.append).ReturnType.ErrorSet, std.Buffer.append); std.testing.expect(mem.eql(u8, buf.toSlice(), "123456789123456789")); } @@ -1652,19 +1652,19 @@ test "formatType max_depth" { inst.a = &inst; inst.tu.ptr = &inst.tu; - var buf0 = try std.Buffer.init(std.debug.global_allocator, ""); + var buf0 = try std.Buffer.init(std.testing.allocator, ""); try formatType(inst, "", FormatOptions{}, &buf0, @TypeOf(std.Buffer.append).ReturnType.ErrorSet, std.Buffer.append, 0); std.testing.expect(mem.eql(u8, buf0.toSlice(), "S{ ... }")); - var buf1 = try std.Buffer.init(std.debug.global_allocator, ""); + var buf1 = try std.Buffer.init(std.testing.allocator, ""); try formatType(inst, "", FormatOptions{}, &buf1, @TypeOf(std.Buffer.append).ReturnType.ErrorSet, std.Buffer.append, 1); std.testing.expect(mem.eql(u8, buf1.toSlice(), "S{ .a = S{ ... }, .tu = TU{ ... }, .e = E.Two, .vec = (10.200,2.220) }")); - var buf2 = try std.Buffer.init(std.debug.global_allocator, ""); + var buf2 = try std.Buffer.init(std.testing.allocator, ""); try formatType(inst, "", FormatOptions{}, &buf2, @TypeOf(std.Buffer.append).ReturnType.ErrorSet, std.Buffer.append, 2); std.testing.expect(mem.eql(u8, buf2.toSlice(), "S{ .a = S{ .a = S{ ... }, .tu = TU{ ... }, .e = E.Two, .vec = (10.200,2.220) }, .tu = TU{ .ptr = TU{ ... } }, .e = E.Two, .vec = (10.200,2.220) }")); - var buf3 = try std.Buffer.init(std.debug.global_allocator, ""); + var buf3 = try std.Buffer.init(std.testing.allocator, ""); try formatType(inst, "", FormatOptions{}, &buf3, @TypeOf(std.Buffer.append).ReturnType.ErrorSet, std.Buffer.append, 3); std.testing.expect(mem.eql(u8, buf3.toSlice(), "S{ .a = S{ .a = S{ .a = S{ ... }, .tu = TU{ ... }, .e = E.Two, .vec = (10.200,2.220) }, .tu = TU{ .ptr = TU{ ... } }, .e = E.Two, .vec = (10.200,2.220) }, .tu = TU{ .ptr = TU{ .ptr = TU{ ... } } }, .e = E.Two, .vec = (10.200,2.220) }")); } diff --git a/lib/std/fs/path.zig b/lib/std/fs/path.zig index b3ad3e9f7..6c29a3950 100644 --- a/lib/std/fs/path.zig +++ b/lib/std/fs/path.zig @@ -665,7 +665,7 @@ pub fn resolvePosix(allocator: *Allocator, paths: []const []const u8) ![]u8 { } test "resolve" { - const cwd = try process.getCwdAlloc(debug.global_allocator); + const cwd = try process.getCwdAlloc(testing.allocator); if (builtin.os == .windows) { if (windowsParsePath(cwd).kind == WindowsPath.Kind.Drive) { cwd[0] = asciiUpper(cwd[0]); @@ -683,11 +683,11 @@ test "resolveWindows" { return error.SkipZigTest; } if (builtin.os == .windows) { - const cwd = try process.getCwdAlloc(debug.global_allocator); + const cwd = try process.getCwdAlloc(testing.allocator); const parsed_cwd = windowsParsePath(cwd); { const result = testResolveWindows(&[_][]const u8{ "/usr/local", "lib\\zig\\std\\array_list.zig" }); - const expected = try join(debug.global_allocator, &[_][]const u8{ + const expected = try join(testing.allocator, &[_][]const u8{ parsed_cwd.disk_designator, "usr\\local\\lib\\zig\\std\\array_list.zig", }); @@ -698,7 +698,7 @@ test "resolveWindows" { } { const result = testResolveWindows(&[_][]const u8{ "usr/local", "lib\\zig" }); - const expected = try join(debug.global_allocator, &[_][]const u8{ + const expected = try join(testing.allocator, &[_][]const u8{ cwd, "usr\\local\\lib\\zig", }); @@ -738,11 +738,11 @@ test "resolvePosix" { } fn testResolveWindows(paths: []const []const u8) []u8 { - return resolveWindows(debug.global_allocator, paths) catch unreachable; + return resolveWindows(testing.allocator, paths) catch unreachable; } fn testResolvePosix(paths: []const []const u8) []u8 { - return resolvePosix(debug.global_allocator, paths) catch unreachable; + return resolvePosix(testing.allocator, paths) catch unreachable; } /// If the path is a file in the current directory (no directory component) @@ -1166,11 +1166,11 @@ test "relative" { } fn testRelativePosix(from: []const u8, to: []const u8, expected_output: []const u8) void { - const result = relativePosix(debug.global_allocator, from, to) catch unreachable; + const result = relativePosix(testing.allocator, from, to) catch unreachable; testing.expectEqualSlices(u8, expected_output, result); } fn testRelativeWindows(from: []const u8, to: []const u8, expected_output: []const u8) void { - const result = relativeWindows(debug.global_allocator, from, to) catch unreachable; + const result = relativeWindows(testing.allocator, from, to) catch unreachable; testing.expectEqualSlices(u8, expected_output, result); } diff --git a/lib/std/heap.zig b/lib/std/heap.zig index f25d2f017..e7196f82f 100644 --- a/lib/std/heap.zig +++ b/lib/std/heap.zig @@ -711,6 +711,10 @@ pub const ThreadSafeFixedBufferAllocator = blk: { fn shrink(allocator: *Allocator, old_mem: []u8, old_align: u29, new_size: usize, new_align: u29) []u8 { return old_mem[0..new_size]; } + + pub fn reset(self: *ThreadSafeFixedBufferAllocator) void { + self.end_index = 0; + } }; } }; diff --git a/lib/std/linked_list.zig b/lib/std/linked_list.zig index 649565315..a21c9a83e 100644 --- a/lib/std/linked_list.zig +++ b/lib/std/linked_list.zig @@ -143,7 +143,7 @@ pub fn SinglyLinkedList(comptime T: type) type { } test "basic SinglyLinkedList test" { - const allocator = debug.global_allocator; + const allocator = testing.allocator; var list = SinglyLinkedList(u32).init(); var one = try list.createNode(1, allocator); @@ -404,7 +404,7 @@ pub fn TailQueue(comptime T: type) type { } test "basic TailQueue test" { - const allocator = debug.global_allocator; + const allocator = testing.allocator; var list = TailQueue(u32).init(); var one = try list.createNode(1, allocator); @@ -456,7 +456,7 @@ test "basic TailQueue test" { } test "TailQueue concatenation" { - const allocator = debug.global_allocator; + const allocator = testing.allocator; var list1 = TailQueue(u32).init(); var list2 = TailQueue(u32).init(); diff --git a/lib/std/os/test.zig b/lib/std/os/test.zig index f71e80c7d..0d3be9e7e 100644 --- a/lib/std/os/test.zig +++ b/lib/std/os/test.zig @@ -9,7 +9,7 @@ const elf = std.elf; const File = std.fs.File; const Thread = std.Thread; -const a = std.debug.global_allocator; +const a = std.testing.allocator; const builtin = @import("builtin"); const AtomicRmwOp = builtin.AtomicRmwOp; diff --git a/lib/std/priority_queue.zig b/lib/std/priority_queue.zig index 6c56f469f..e726a07a8 100644 --- a/lib/std/priority_queue.zig +++ b/lib/std/priority_queue.zig @@ -1,10 +1,10 @@ const std = @import("std.zig"); const Allocator = std.mem.Allocator; -const debug = std.debug; -const assert = debug.assert; -const expect = std.testing.expect; -const expectEqual = std.testing.expectEqual; -const expectError = std.testing.expectError; +const assert = std.debug.assert; +const testing = std.testing; +const expect = testing.expect; +const expectEqual = testing.expectEqual; +const expectError = testing.expectError; /// Priority queue for storing generic data. Initialize with `init`. pub fn PriorityQueue(comptime T: type) type { @@ -239,7 +239,7 @@ fn greaterThan(a: u32, b: u32) bool { const PQ = PriorityQueue(u32); test "std.PriorityQueue: add and remove min heap" { - var queue = PQ.init(debug.global_allocator, lessThan); + var queue = PQ.init(testing.allocator, lessThan); defer queue.deinit(); try queue.add(54); @@ -257,7 +257,7 @@ test "std.PriorityQueue: add and remove min heap" { } test "std.PriorityQueue: add and remove same min heap" { - var queue = PQ.init(debug.global_allocator, lessThan); + var queue = PQ.init(testing.allocator, lessThan); defer queue.deinit(); try queue.add(1); @@ -275,14 +275,14 @@ test "std.PriorityQueue: add and remove same min heap" { } test "std.PriorityQueue: removeOrNull on empty" { - var queue = PQ.init(debug.global_allocator, lessThan); + var queue = PQ.init(testing.allocator, lessThan); defer queue.deinit(); expect(queue.removeOrNull() == null); } test "std.PriorityQueue: edge case 3 elements" { - var queue = PQ.init(debug.global_allocator, lessThan); + var queue = PQ.init(testing.allocator, lessThan); defer queue.deinit(); try queue.add(9); @@ -294,7 +294,7 @@ test "std.PriorityQueue: edge case 3 elements" { } test "std.PriorityQueue: peek" { - var queue = PQ.init(debug.global_allocator, lessThan); + var queue = PQ.init(testing.allocator, lessThan); defer queue.deinit(); expect(queue.peek() == null); @@ -306,7 +306,7 @@ test "std.PriorityQueue: peek" { } test "std.PriorityQueue: sift up with odd indices" { - var queue = PQ.init(debug.global_allocator, lessThan); + var queue = PQ.init(testing.allocator, lessThan); defer queue.deinit(); const items = [_]u32{ 15, 7, 21, 14, 13, 22, 12, 6, 7, 25, 5, 24, 11, 16, 15, 24, 2, 1 }; for (items) |e| { @@ -320,7 +320,7 @@ test "std.PriorityQueue: sift up with odd indices" { } test "std.PriorityQueue: addSlice" { - var queue = PQ.init(debug.global_allocator, lessThan); + var queue = PQ.init(testing.allocator, lessThan); defer queue.deinit(); const items = [_]u32{ 15, 7, 21, 14, 13, 22, 12, 6, 7, 25, 5, 24, 11, 16, 15, 24, 2, 1 }; try queue.addSlice(items[0..]); @@ -333,8 +333,8 @@ test "std.PriorityQueue: addSlice" { test "std.PriorityQueue: fromOwnedSlice" { const items = [_]u32{ 15, 7, 21, 14, 13, 22, 12, 6, 7, 25, 5, 24, 11, 16, 15, 24, 2, 1 }; - const heap_items = try std.mem.dupe(debug.global_allocator, u32, items[0..]); - var queue = PQ.fromOwnedSlice(debug.global_allocator, lessThan, heap_items[0..]); + const heap_items = try std.mem.dupe(testing.allocator, u32, items[0..]); + var queue = PQ.fromOwnedSlice(testing.allocator, lessThan, heap_items[0..]); defer queue.deinit(); const sorted_items = [_]u32{ 1, 2, 5, 6, 7, 7, 11, 12, 13, 14, 15, 15, 16, 21, 22, 24, 24, 25 }; @@ -344,7 +344,7 @@ test "std.PriorityQueue: fromOwnedSlice" { } test "std.PriorityQueue: add and remove max heap" { - var queue = PQ.init(debug.global_allocator, greaterThan); + var queue = PQ.init(testing.allocator, greaterThan); defer queue.deinit(); try queue.add(54); @@ -362,7 +362,7 @@ test "std.PriorityQueue: add and remove max heap" { } test "std.PriorityQueue: add and remove same max heap" { - var queue = PQ.init(debug.global_allocator, greaterThan); + var queue = PQ.init(testing.allocator, greaterThan); defer queue.deinit(); try queue.add(1); @@ -380,8 +380,8 @@ test "std.PriorityQueue: add and remove same max heap" { } test "std.PriorityQueue: iterator" { - var queue = PQ.init(debug.global_allocator, lessThan); - var map = std.AutoHashMap(u32, void).init(debug.global_allocator); + var queue = PQ.init(testing.allocator, lessThan); + var map = std.AutoHashMap(u32, void).init(testing.allocator); defer { queue.deinit(); map.deinit(); @@ -402,7 +402,7 @@ test "std.PriorityQueue: iterator" { } test "std.PriorityQueue: remove at index" { - var queue = PQ.init(debug.global_allocator, lessThan); + var queue = PQ.init(testing.allocator, lessThan); defer queue.deinit(); try queue.add(3); diff --git a/lib/std/process.zig b/lib/std/process.zig index 0ce3cabc1..2758e25ac 100644 --- a/lib/std/process.zig +++ b/lib/std/process.zig @@ -114,7 +114,7 @@ pub fn getEnvMap(allocator: *Allocator) !BufMap { } test "os.getEnvMap" { - var env = try getEnvMap(std.debug.global_allocator); + var env = try getEnvMap(std.testing.allocator); defer env.deinit(); } @@ -165,7 +165,7 @@ pub fn getEnvVarOwned(allocator: *mem.Allocator, key: []const u8) GetEnvVarOwned } test "os.getEnvVarOwned" { - var ga = std.debug.global_allocator; + var ga = std.testing.allocator; testing.expectError(error.EnvironmentVariableNotFound, getEnvVarOwned(ga, "BADENV")); } @@ -492,10 +492,10 @@ test "windows arg parsing" { fn testWindowsCmdLine(input_cmd_line: [*]const u8, expected_args: []const []const u8) void { var it = ArgIteratorWindows.initWithCmdLine(input_cmd_line); for (expected_args) |expected_arg| { - const arg = it.next(std.debug.global_allocator).? catch unreachable; + const arg = it.next(std.testing.allocator).? catch unreachable; testing.expectEqualSlices(u8, expected_arg, arg); } - testing.expect(it.next(std.debug.global_allocator) == null); + testing.expect(it.next(std.testing.allocator) == null); } pub const UserInfo = struct { diff --git a/lib/std/special/test_runner.zig b/lib/std/special/test_runner.zig index 0335c8562..286dfbed1 100644 --- a/lib/std/special/test_runner.zig +++ b/lib/std/special/test_runner.zig @@ -13,6 +13,7 @@ pub fn main() anyerror!void { }; for (test_fn_list) |test_fn, i| { + std.testing.allocator_instance.reset(); var test_node = root_node.start(test_fn.name, null); test_node.activate(); progress.refresh(); diff --git a/lib/std/testing.zig b/lib/std/testing.zig index 7a261e075..02d7cdb39 100644 --- a/lib/std/testing.zig +++ b/lib/std/testing.zig @@ -2,6 +2,11 @@ const builtin = @import("builtin"); const TypeId = builtin.TypeId; const std = @import("std.zig"); +/// This should only be used in temporary test programs. +pub const allocator = &allocator_instance.allocator; +pub var allocator_instance = std.heap.ThreadSafeFixedBufferAllocator.init(allocator_mem[0..]); +var allocator_mem: [100 * 1024]u8 = undefined; + /// This function is intended to be used only in tests. It prints diagnostics to stderr /// and then aborts when actual_error_union is not expected_error. pub fn expectError(expected_error: anyerror, actual_error_union: var) void { diff --git a/lib/std/unicode.zig b/lib/std/unicode.zig index 3d1674844..638b5f5e2 100644 --- a/lib/std/unicode.zig +++ b/lib/std/unicode.zig @@ -501,14 +501,14 @@ test "utf16leToUtf8" { { mem.writeIntSliceLittle(u16, utf16le_as_bytes[0..], 'A'); mem.writeIntSliceLittle(u16, utf16le_as_bytes[2..], 'a'); - const utf8 = try utf16leToUtf8Alloc(std.debug.global_allocator, &utf16le); + const utf8 = try utf16leToUtf8Alloc(std.testing.allocator, &utf16le); testing.expect(mem.eql(u8, utf8, "Aa")); } { mem.writeIntSliceLittle(u16, utf16le_as_bytes[0..], 0x80); mem.writeIntSliceLittle(u16, utf16le_as_bytes[2..], 0xffff); - const utf8 = try utf16leToUtf8Alloc(std.debug.global_allocator, &utf16le); + const utf8 = try utf16leToUtf8Alloc(std.testing.allocator, &utf16le); testing.expect(mem.eql(u8, utf8, "\xc2\x80" ++ "\xef\xbf\xbf")); } @@ -516,7 +516,7 @@ test "utf16leToUtf8" { // the values just outside the surrogate half range mem.writeIntSliceLittle(u16, utf16le_as_bytes[0..], 0xd7ff); mem.writeIntSliceLittle(u16, utf16le_as_bytes[2..], 0xe000); - const utf8 = try utf16leToUtf8Alloc(std.debug.global_allocator, &utf16le); + const utf8 = try utf16leToUtf8Alloc(std.testing.allocator, &utf16le); testing.expect(mem.eql(u8, utf8, "\xed\x9f\xbf" ++ "\xee\x80\x80")); } @@ -524,7 +524,7 @@ test "utf16leToUtf8" { // smallest surrogate pair mem.writeIntSliceLittle(u16, utf16le_as_bytes[0..], 0xd800); mem.writeIntSliceLittle(u16, utf16le_as_bytes[2..], 0xdc00); - const utf8 = try utf16leToUtf8Alloc(std.debug.global_allocator, &utf16le); + const utf8 = try utf16leToUtf8Alloc(std.testing.allocator, &utf16le); testing.expect(mem.eql(u8, utf8, "\xf0\x90\x80\x80")); } @@ -532,14 +532,14 @@ test "utf16leToUtf8" { // largest surrogate pair mem.writeIntSliceLittle(u16, utf16le_as_bytes[0..], 0xdbff); mem.writeIntSliceLittle(u16, utf16le_as_bytes[2..], 0xdfff); - const utf8 = try utf16leToUtf8Alloc(std.debug.global_allocator, &utf16le); + const utf8 = try utf16leToUtf8Alloc(std.testing.allocator, &utf16le); testing.expect(mem.eql(u8, utf8, "\xf4\x8f\xbf\xbf")); } { mem.writeIntSliceLittle(u16, utf16le_as_bytes[0..], 0xdbff); mem.writeIntSliceLittle(u16, utf16le_as_bytes[2..], 0xdc00); - const utf8 = try utf16leToUtf8Alloc(std.debug.global_allocator, &utf16le); + const utf8 = try utf16leToUtf8Alloc(std.testing.allocator, &utf16le); testing.expect(mem.eql(u8, utf8, "\xf4\x8f\xb0\x80")); } } diff --git a/lib/std/zig/ast.zig b/lib/std/zig/ast.zig index dc9a6bc7c..e33934382 100644 --- a/lib/std/zig/ast.zig +++ b/lib/std/zig/ast.zig @@ -2287,7 +2287,7 @@ pub const Node = struct { test "iterate" { var root = Node.Root{ .base = Node{ .id = Node.Id.Root }, - .decls = Node.Root.DeclList.init(std.debug.global_allocator), + .decls = Node.Root.DeclList.init(std.testing.allocator), .eof_token = 0, }; var base = &root.base; diff --git a/test/compare_output.zig b/test/compare_output.zig index db20709af..7a41d46f5 100644 --- a/test/compare_output.zig +++ b/test/compare_output.zig @@ -445,7 +445,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { \\const std = @import("std"); \\const io = std.io; \\const os = std.os; - \\const allocator = std.debug.global_allocator; + \\const allocator = std.testing.allocator; \\ \\pub fn main() !void { \\ var args_it = std.process.args(); @@ -486,7 +486,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { \\const std = @import("std"); \\const io = std.io; \\const os = std.os; - \\const allocator = std.debug.global_allocator; + \\const allocator = std.testing.allocator; \\ \\pub fn main() !void { \\ var args_it = std.process.args(); diff --git a/test/compile_errors.zig b/test/compile_errors.zig index 89e187aed..341062e16 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -5765,7 +5765,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { \\ \\export fn entry() void { \\ const a = MdNode.Header { - \\ .text = MdText.init(&std.debug.global_allocator), + \\ .text = MdText.init(&std.testing.allocator), \\ .weight = HeaderWeight.H1, \\ }; \\} diff --git a/test/stage1/behavior/const_slice_child.zig b/test/stage1/behavior/const_slice_child.zig index 672066718..cf650ae88 100644 --- a/test/stage1/behavior/const_slice_child.zig +++ b/test/stage1/behavior/const_slice_child.zig @@ -22,7 +22,7 @@ fn foo(args: [][]const u8) void { } fn bar(argc: usize) void { - const args = debug.global_allocator.alloc([]const u8, argc) catch unreachable; + const args = testing.allocator.alloc([]const u8, argc) catch unreachable; for (args) |_, i| { const ptr = argv[i]; args[i] = ptr[0..strlen(ptr)]; diff --git a/test/standalone/brace_expansion/main.zig b/test/standalone/brace_expansion/main.zig index cbb328541..c6bfd02e7 100644 --- a/test/standalone/brace_expansion/main.zig +++ b/test/standalone/brace_expansion/main.zig @@ -201,7 +201,7 @@ pub fn main() !void { } test "invalid inputs" { - global_allocator = std.debug.global_allocator; + global_allocator = std.testing.allocator; expectError("}ABC", error.InvalidInput); expectError("{ABC", error.InvalidInput); @@ -222,7 +222,7 @@ fn expectError(test_input: []const u8, expected_err: anyerror) void { } test "valid inputs" { - global_allocator = std.debug.global_allocator; + global_allocator = std.testing.allocator; expectExpansion("{x,y,z}", "x y z"); expectExpansion("{A,B}{x,y}", "Ax Ay Bx By"); diff --git a/test/standalone/cat/main.zig b/test/standalone/cat/main.zig index f0cd9728a..34439f9c2 100644 --- a/test/standalone/cat/main.zig +++ b/test/standalone/cat/main.zig @@ -4,7 +4,7 @@ const process = std.process; const fs = std.fs; const mem = std.mem; const warn = std.debug.warn; -const allocator = std.debug.global_allocator; +const allocator = std.testing.allocator; pub fn main() !void { var args_it = process.args(); diff --git a/test/standalone/empty_env/main.zig b/test/standalone/empty_env/main.zig index d6d5ecb5a..f4ebf5613 100644 --- a/test/standalone/empty_env/main.zig +++ b/test/standalone/empty_env/main.zig @@ -1,6 +1,6 @@ const std = @import("std"); pub fn main() void { - const env_map = std.process.getEnvMap(std.debug.global_allocator) catch @panic("unable to get env map"); + const env_map = std.process.getEnvMap(std.testing.allocator) catch @panic("unable to get env map"); std.testing.expect(env_map.count() == 0); } diff --git a/test/standalone/load_dynamic_library/main.zig b/test/standalone/load_dynamic_library/main.zig index 197e3ca47..70fc4986a 100644 --- a/test/standalone/load_dynamic_library/main.zig +++ b/test/standalone/load_dynamic_library/main.zig @@ -1,8 +1,8 @@ const std = @import("std"); pub fn main() !void { - const args = try std.process.argsAlloc(std.debug.global_allocator); - defer std.process.argsFree(std.debug.global_allocator, args); + const args = try std.process.argsAlloc(std.testing.allocator); + defer std.process.argsFree(std.testing.allocator, args); const dynlib_name = args[1]; From b7cd60a354731d61ee3a3184fd4be610382ca1d6 Mon Sep 17 00:00:00 2001 From: Rocknest <35231115+Rocknest@users.noreply.github.com> Date: Wed, 29 Jan 2020 21:09:00 +0200 Subject: [PATCH 07/60] Changing stuff and seeing what happens --- lib/std/debug.zig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/std/debug.zig b/lib/std/debug.zig index 561993fb9..acc3f3641 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -129,7 +129,7 @@ pub fn dumpStackTraceFromBase(bp: usize, ip: usize) void { return; }; const tty_config = detectTTYConfig(); - printSourceAtAddress(debug_info, stderr, ip, tty_config) catch return; + printSourceAtAddress(debug_info, stderr, if (builtin.os == .windows) (ip + 1) else ip, tty_config) catch return; const first_return_address = @intToPtr(*const usize, bp + @sizeOf(usize)).*; printSourceAtAddress(debug_info, stderr, first_return_address - 1, tty_config) catch return; var it = StackIterator{ @@ -325,6 +325,7 @@ pub const StackIterator = struct { } const return_address = @intToPtr(*const usize, self.fp - fp_adjust_factor + @sizeOf(usize)).*; + if (return_address == 0) return null; return return_address; } }; From aa9caf5064b3fc01579b7bd8c765ff33323a073a Mon Sep 17 00:00:00 2001 From: Benjamin Feng Date: Wed, 29 Jan 2020 13:18:04 -0600 Subject: [PATCH 08/60] Create leak_count_allocator --- doc/docgen.zig | 2 +- lib/std/array_list.zig | 15 +- lib/std/buffer.zig | 11 +- lib/std/debug.zig | 2 +- lib/std/fifo.zig | 4 +- lib/std/fmt.zig | 15 +- lib/std/fs/path.zig | 162 +++++++++--------- lib/std/linked_list.zig | 6 +- lib/std/os/test.zig | 2 +- lib/std/priority_queue.zig | 28 +-- lib/std/process.zig | 9 +- lib/std/special/test_runner.zig | 3 + lib/std/testing.zig | 42 +++++ lib/std/unicode.zig | 18 +- lib/std/zig/ast.zig | 2 +- test/compare_output.zig | 4 +- test/compile_errors.zig | 2 +- test/stage1/behavior/const_slice_child.zig | 2 +- test/standalone/brace_expansion/main.zig | 4 +- test/standalone/cat/main.zig | 2 +- test/standalone/empty_env/main.zig | 2 +- test/standalone/load_dynamic_library/main.zig | 4 +- 22 files changed, 206 insertions(+), 135 deletions(-) diff --git a/doc/docgen.zig b/doc/docgen.zig index 678eb2604..128314696 100644 --- a/doc/docgen.zig +++ b/doc/docgen.zig @@ -672,7 +672,7 @@ const TermState = enum { test "term color" { const input_bytes = "A\x1b[32;1mgreen\x1b[0mB"; - const result = try termColor(std.testing.allocator, input_bytes); + const result = try termColor(std.testing.leak_count_allocator, input_bytes); testing.expectEqualSlices(u8, "AgreenB", result); } diff --git a/lib/std/array_list.zig b/lib/std/array_list.zig index be99a54e2..57c0d706a 100644 --- a/lib/std/array_list.zig +++ b/lib/std/array_list.zig @@ -320,7 +320,7 @@ test "std.ArrayList.basic" { } test "std.ArrayList.orderedRemove" { - var list = ArrayList(i32).init(testing.allocator); + var list = ArrayList(i32).init(testing.leak_count_allocator); defer list.deinit(); try list.append(1); @@ -347,7 +347,7 @@ test "std.ArrayList.orderedRemove" { } test "std.ArrayList.swapRemove" { - var list = ArrayList(i32).init(testing.allocator); + var list = ArrayList(i32).init(testing.leak_count_allocator); defer list.deinit(); try list.append(1); @@ -374,7 +374,7 @@ test "std.ArrayList.swapRemove" { } test "std.ArrayList.swapRemoveOrError" { - var list = ArrayList(i32).init(testing.allocator); + var list = ArrayList(i32).init(testing.leak_count_allocator); defer list.deinit(); // Test just after initialization @@ -402,7 +402,7 @@ test "std.ArrayList.swapRemoveOrError" { } test "std.ArrayList.insert" { - var list = ArrayList(i32).init(testing.allocator); + var list = ArrayList(i32).init(testing.leak_count_allocator); defer list.deinit(); try list.append(1); @@ -416,7 +416,7 @@ test "std.ArrayList.insert" { } test "std.ArrayList.insertSlice" { - var list = ArrayList(i32).init(testing.allocator); + var list = ArrayList(i32).init(testing.leak_count_allocator); defer list.deinit(); try list.append(1); @@ -443,7 +443,8 @@ const Item = struct { }; test "std.ArrayList: ArrayList(T) of struct T" { - var root = Item{ .integer = 1, .sub_items = ArrayList(Item).init(testing.allocator) }; - try root.sub_items.append(Item{ .integer = 42, .sub_items = ArrayList(Item).init(testing.allocator) }); + var root = Item{ .integer = 1, .sub_items = ArrayList(Item).init(testing.leak_count_allocator) }; + defer root.sub_items.deinit(); + try root.sub_items.append(Item{ .integer = 42, .sub_items = ArrayList(Item).init(testing.leak_count_allocator) }); testing.expect(root.sub_items.items[0].integer == 42); } diff --git a/lib/std/buffer.zig b/lib/std/buffer.zig index ada359061..cc1166e0e 100644 --- a/lib/std/buffer.zig +++ b/lib/std/buffer.zig @@ -150,7 +150,9 @@ pub const Buffer = struct { }; test "simple Buffer" { - var buf = try Buffer.init(testing.allocator, ""); + var buf = try Buffer.init(testing.leak_count_allocator, ""); + defer buf.deinit(); + testing.expect(buf.len() == 0); try buf.append("hello"); try buf.append(" "); @@ -159,6 +161,7 @@ test "simple Buffer" { testing.expect(mem.eql(u8, mem.toSliceConst(u8, buf.toSliceConst().ptr), buf.toSliceConst())); var buf2 = try Buffer.initFromBuffer(buf); + defer buf2.deinit(); testing.expect(buf.eql(buf2.toSliceConst())); testing.expect(buf.startsWith("hell")); @@ -169,14 +172,16 @@ test "simple Buffer" { } test "Buffer.initSize" { - var buf = try Buffer.initSize(testing.allocator, 3); + var buf = try Buffer.initSize(testing.leak_count_allocator, 3); + defer buf.deinit(); testing.expect(buf.len() == 3); try buf.append("hello"); testing.expect(mem.eql(u8, buf.toSliceConst()[3..], "hello")); } test "Buffer.initCapacity" { - var buf = try Buffer.initCapacity(testing.allocator, 10); + var buf = try Buffer.initCapacity(testing.leak_count_allocator, 10); + defer buf.deinit(); testing.expect(buf.len() == 0); testing.expect(buf.capacity() >= 10); const old_cap = buf.capacity(); diff --git a/lib/std/debug.zig b/lib/std/debug.zig index f2dcdd7e7..7e1a99a39 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -2193,7 +2193,7 @@ fn readInitialLength(comptime E: type, in_stream: *io.InStream(E), is_64: *bool) } pub const global_allocator = blk: { - @compileError("Please switch to std.testing.allocator."); + @compileError("Please switch to std.testing.leak_count_allocator."); }; var global_fixed_allocator = std.heap.ThreadSafeFixedBufferAllocator.init(global_allocator_mem[0..]); var global_allocator_mem: [100 * 1024]u8 = undefined; diff --git a/lib/std/fifo.zig b/lib/std/fifo.zig index ac8589f2c..dd429289d 100644 --- a/lib/std/fifo.zig +++ b/lib/std/fifo.zig @@ -347,7 +347,7 @@ pub fn LinearFifo( } test "LinearFifo(u8, .Dynamic)" { - var fifo = LinearFifo(u8, .Dynamic).init(testing.allocator); + var fifo = LinearFifo(u8, .Dynamic).init(testing.leak_count_allocator); defer fifo.deinit(); try fifo.write("HELLO"); @@ -422,7 +422,7 @@ test "LinearFifo" { var fifo = switch (bt) { .Static => FifoType.init(), .Slice => FifoType.init(buf[0..]), - .Dynamic => FifoType.init(testing.allocator), + .Dynamic => FifoType.init(testing.leak_count_allocator), }; defer fifo.deinit(); diff --git a/lib/std/fmt.zig b/lib/std/fmt.zig index 975765844..529131065 100644 --- a/lib/std/fmt.zig +++ b/lib/std/fmt.zig @@ -1598,7 +1598,8 @@ test "hexToBytes" { test "formatIntValue with comptime_int" { const value: comptime_int = 123456789123456789; - var buf = try std.Buffer.init(std.testing.allocator, ""); + var buf = try std.Buffer.init(std.testing.leak_count_allocator, ""); + defer buf.deinit(); try formatIntValue(value, "", FormatOptions{}, &buf, @TypeOf(std.Buffer.append).ReturnType.ErrorSet, std.Buffer.append); std.testing.expect(mem.eql(u8, buf.toSlice(), "123456789123456789")); } @@ -1652,19 +1653,23 @@ test "formatType max_depth" { inst.a = &inst; inst.tu.ptr = &inst.tu; - var buf0 = try std.Buffer.init(std.testing.allocator, ""); + var buf0 = try std.Buffer.init(std.testing.leak_count_allocator, ""); + defer buf0.deinit(); try formatType(inst, "", FormatOptions{}, &buf0, @TypeOf(std.Buffer.append).ReturnType.ErrorSet, std.Buffer.append, 0); std.testing.expect(mem.eql(u8, buf0.toSlice(), "S{ ... }")); - var buf1 = try std.Buffer.init(std.testing.allocator, ""); + var buf1 = try std.Buffer.init(std.testing.leak_count_allocator, ""); + defer buf1.deinit(); try formatType(inst, "", FormatOptions{}, &buf1, @TypeOf(std.Buffer.append).ReturnType.ErrorSet, std.Buffer.append, 1); std.testing.expect(mem.eql(u8, buf1.toSlice(), "S{ .a = S{ ... }, .tu = TU{ ... }, .e = E.Two, .vec = (10.200,2.220) }")); - var buf2 = try std.Buffer.init(std.testing.allocator, ""); + var buf2 = try std.Buffer.init(std.testing.leak_count_allocator, ""); + defer buf2.deinit(); try formatType(inst, "", FormatOptions{}, &buf2, @TypeOf(std.Buffer.append).ReturnType.ErrorSet, std.Buffer.append, 2); std.testing.expect(mem.eql(u8, buf2.toSlice(), "S{ .a = S{ .a = S{ ... }, .tu = TU{ ... }, .e = E.Two, .vec = (10.200,2.220) }, .tu = TU{ .ptr = TU{ ... } }, .e = E.Two, .vec = (10.200,2.220) }")); - var buf3 = try std.Buffer.init(std.testing.allocator, ""); + var buf3 = try std.Buffer.init(std.testing.leak_count_allocator, ""); + defer buf3.deinit(); try formatType(inst, "", FormatOptions{}, &buf3, @TypeOf(std.Buffer.append).ReturnType.ErrorSet, std.Buffer.append, 3); std.testing.expect(mem.eql(u8, buf3.toSlice(), "S{ .a = S{ .a = S{ .a = S{ ... }, .tu = TU{ ... }, .e = E.Two, .vec = (10.200,2.220) }, .tu = TU{ .ptr = TU{ ... } }, .e = E.Two, .vec = (10.200,2.220) }, .tu = TU{ .ptr = TU{ .ptr = TU{ ... } } }, .e = E.Two, .vec = (10.200,2.220) }")); } diff --git a/lib/std/fs/path.zig b/lib/std/fs/path.zig index 6c29a3950..424e9f575 100644 --- a/lib/std/fs/path.zig +++ b/lib/std/fs/path.zig @@ -665,15 +665,16 @@ pub fn resolvePosix(allocator: *Allocator, paths: []const []const u8) ![]u8 { } test "resolve" { - const cwd = try process.getCwdAlloc(testing.allocator); + const cwd = try process.getCwdAlloc(testing.leak_count_allocator); + defer testing.leak_count_allocator.free(cwd); if (builtin.os == .windows) { if (windowsParsePath(cwd).kind == WindowsPath.Kind.Drive) { cwd[0] = asciiUpper(cwd[0]); } - testing.expect(mem.eql(u8, testResolveWindows(&[_][]const u8{"."}), cwd)); + try testResolveWindows(&[_][]const u8{"."}, cwd); } else { - testing.expect(mem.eql(u8, testResolvePosix(&[_][]const u8{ "a/b/c/", "../../.." }), cwd)); - testing.expect(mem.eql(u8, testResolvePosix(&[_][]const u8{"."}), cwd)); + try testResolvePosix(&[_][]const u8{ "a/b/c/", "../../.." }, cwd); + try testResolvePosix(&[_][]const u8{"."}, cwd); } } @@ -683,66 +684,71 @@ test "resolveWindows" { return error.SkipZigTest; } if (builtin.os == .windows) { - const cwd = try process.getCwdAlloc(testing.allocator); + const cwd = try process.getCwdAlloc(testing.leak_count_allocator); + defer testing.leak_count_allocator.free(cwd); const parsed_cwd = windowsParsePath(cwd); { - const result = testResolveWindows(&[_][]const u8{ "/usr/local", "lib\\zig\\std\\array_list.zig" }); - const expected = try join(testing.allocator, &[_][]const u8{ + const expected = try join(testing.leak_count_allocator, &[_][]const u8{ parsed_cwd.disk_designator, "usr\\local\\lib\\zig\\std\\array_list.zig", }); + defer testing.leak_count_allocator.free(expected); if (parsed_cwd.kind == WindowsPath.Kind.Drive) { expected[0] = asciiUpper(parsed_cwd.disk_designator[0]); } - testing.expect(mem.eql(u8, result, expected)); + try testResolveWindows(&[_][]const u8{ "/usr/local", "lib\\zig\\std\\array_list.zig" }, expected); } { - const result = testResolveWindows(&[_][]const u8{ "usr/local", "lib\\zig" }); - const expected = try join(testing.allocator, &[_][]const u8{ + const expected = try join(testing.leak_count_allocator, &[_][]const u8{ cwd, "usr\\local\\lib\\zig", }); + defer testing.leak_count_allocator.free(expected); if (parsed_cwd.kind == WindowsPath.Kind.Drive) { expected[0] = asciiUpper(parsed_cwd.disk_designator[0]); } - testing.expect(mem.eql(u8, result, expected)); + try testResolveWindows(&[_][]const u8{ "usr/local", "lib\\zig" }, expected); } } - testing.expect(mem.eql(u8, testResolveWindows(&[_][]const u8{ "c:\\a\\b\\c", "/hi", "ok" }), "C:\\hi\\ok")); - testing.expect(mem.eql(u8, testResolveWindows(&[_][]const u8{ "c:/blah\\blah", "d:/games", "c:../a" }), "C:\\blah\\a")); - testing.expect(mem.eql(u8, testResolveWindows(&[_][]const u8{ "c:/blah\\blah", "d:/games", "C:../a" }), "C:\\blah\\a")); - testing.expect(mem.eql(u8, testResolveWindows(&[_][]const u8{ "c:/ignore", "d:\\a/b\\c/d", "\\e.exe" }), "D:\\e.exe")); - testing.expect(mem.eql(u8, testResolveWindows(&[_][]const u8{ "c:/ignore", "c:/some/file" }), "C:\\some\\file")); - testing.expect(mem.eql(u8, testResolveWindows(&[_][]const u8{ "d:/ignore", "d:some/dir//" }), "D:\\ignore\\some\\dir")); - testing.expect(mem.eql(u8, testResolveWindows(&[_][]const u8{ "//server/share", "..", "relative\\" }), "\\\\server\\share\\relative")); - testing.expect(mem.eql(u8, testResolveWindows(&[_][]const u8{ "c:/", "//" }), "C:\\")); - testing.expect(mem.eql(u8, testResolveWindows(&[_][]const u8{ "c:/", "//dir" }), "C:\\dir")); - testing.expect(mem.eql(u8, testResolveWindows(&[_][]const u8{ "c:/", "//server/share" }), "\\\\server\\share\\")); - testing.expect(mem.eql(u8, testResolveWindows(&[_][]const u8{ "c:/", "//server//share" }), "\\\\server\\share\\")); - testing.expect(mem.eql(u8, testResolveWindows(&[_][]const u8{ "c:/", "///some//dir" }), "C:\\some\\dir")); - testing.expect(mem.eql(u8, testResolveWindows(&[_][]const u8{ "C:\\foo\\tmp.3\\", "..\\tmp.3\\cycles\\root.js" }), "C:\\foo\\tmp.3\\cycles\\root.js")); + try testResolveWindows(&[_][]const u8{ "c:\\a\\b\\c", "/hi", "ok" }, "C:\\hi\\ok"); + try testResolveWindows(&[_][]const u8{ "c:/blah\\blah", "d:/games", "c:../a" }, "C:\\blah\\a"); + try testResolveWindows(&[_][]const u8{ "c:/blah\\blah", "d:/games", "C:../a" }, "C:\\blah\\a"); + try testResolveWindows(&[_][]const u8{ "c:/ignore", "d:\\a/b\\c/d", "\\e.exe" }, "D:\\e.exe"); + try testResolveWindows(&[_][]const u8{ "c:/ignore", "c:/some/file" }, "C:\\some\\file"); + try testResolveWindows(&[_][]const u8{ "d:/ignore", "d:some/dir//" }, "D:\\ignore\\some\\dir"); + try testResolveWindows(&[_][]const u8{ "//server/share", "..", "relative\\" }, "\\\\server\\share\\relative"); + try testResolveWindows(&[_][]const u8{ "c:/", "//" }, "C:\\"); + try testResolveWindows(&[_][]const u8{ "c:/", "//dir" }, "C:\\dir"); + try testResolveWindows(&[_][]const u8{ "c:/", "//server/share" }, "\\\\server\\share\\"); + try testResolveWindows(&[_][]const u8{ "c:/", "//server//share" }, "\\\\server\\share\\"); + try testResolveWindows(&[_][]const u8{ "c:/", "///some//dir" }, "C:\\some\\dir"); + try testResolveWindows(&[_][]const u8{ "C:\\foo\\tmp.3\\", "..\\tmp.3\\cycles\\root.js" }, "C:\\foo\\tmp.3\\cycles\\root.js"); } test "resolvePosix" { - testing.expect(mem.eql(u8, testResolvePosix(&[_][]const u8{ "/a/b", "c" }), "/a/b/c")); - testing.expect(mem.eql(u8, testResolvePosix(&[_][]const u8{ "/a/b", "c", "//d", "e///" }), "/d/e")); - testing.expect(mem.eql(u8, testResolvePosix(&[_][]const u8{ "/a/b/c", "..", "../" }), "/a")); - testing.expect(mem.eql(u8, testResolvePosix(&[_][]const u8{ "/", "..", ".." }), "/")); - testing.expect(mem.eql(u8, testResolvePosix(&[_][]const u8{"/a/b/c/"}), "/a/b/c")); + try testResolvePosix(&[_][]const u8{ "/a/b", "c" }, "/a/b/c"); + try testResolvePosix(&[_][]const u8{ "/a/b", "c", "//d", "e///" }, "/d/e"); + try testResolvePosix(&[_][]const u8{ "/a/b/c", "..", "../" }, "/a"); + try testResolvePosix(&[_][]const u8{ "/", "..", ".." }, "/"); + try testResolvePosix(&[_][]const u8{"/a/b/c/"}, "/a/b/c"); - testing.expect(mem.eql(u8, testResolvePosix(&[_][]const u8{ "/var/lib", "../", "file/" }), "/var/file")); - testing.expect(mem.eql(u8, testResolvePosix(&[_][]const u8{ "/var/lib", "/../", "file/" }), "/file")); - testing.expect(mem.eql(u8, testResolvePosix(&[_][]const u8{ "/some/dir", ".", "/absolute/" }), "/absolute")); - testing.expect(mem.eql(u8, testResolvePosix(&[_][]const u8{ "/foo/tmp.3/", "../tmp.3/cycles/root.js" }), "/foo/tmp.3/cycles/root.js")); + try testResolvePosix(&[_][]const u8{ "/var/lib", "../", "file/" }, "/var/file"); + try testResolvePosix(&[_][]const u8{ "/var/lib", "/../", "file/" }, "/file"); + try testResolvePosix(&[_][]const u8{ "/some/dir", ".", "/absolute/" }, "/absolute"); + try testResolvePosix(&[_][]const u8{ "/foo/tmp.3/", "../tmp.3/cycles/root.js" }, "/foo/tmp.3/cycles/root.js"); } -fn testResolveWindows(paths: []const []const u8) []u8 { - return resolveWindows(testing.allocator, paths) catch unreachable; +fn testResolveWindows(paths: []const []const u8, expected: []const u8) !void { + const actual = try resolveWindows(testing.leak_count_allocator, paths); + defer testing.leak_count_allocator.free(actual); + return testing.expect(mem.eql(u8, actual, expected)); } -fn testResolvePosix(paths: []const []const u8) []u8 { - return resolvePosix(testing.allocator, paths) catch unreachable; +fn testResolvePosix(paths: []const []const u8, expected: []const u8) !void { + const actual = try resolvePosix(testing.leak_count_allocator, paths); + defer testing.leak_count_allocator.free(actual); + return testing.expect(mem.eql(u8, actual, expected)); } /// If the path is a file in the current directory (no directory component) @@ -1126,51 +1132,53 @@ test "relative" { // TODO https://github.com/ziglang/zig/issues/3288 return error.SkipZigTest; } - testRelativeWindows("c:/blah\\blah", "d:/games", "D:\\games"); - testRelativeWindows("c:/aaaa/bbbb", "c:/aaaa", ".."); - testRelativeWindows("c:/aaaa/bbbb", "c:/cccc", "..\\..\\cccc"); - testRelativeWindows("c:/aaaa/bbbb", "c:/aaaa/bbbb", ""); - testRelativeWindows("c:/aaaa/bbbb", "c:/aaaa/cccc", "..\\cccc"); - testRelativeWindows("c:/aaaa/", "c:/aaaa/cccc", "cccc"); - testRelativeWindows("c:/", "c:\\aaaa\\bbbb", "aaaa\\bbbb"); - testRelativeWindows("c:/aaaa/bbbb", "d:\\", "D:\\"); - testRelativeWindows("c:/AaAa/bbbb", "c:/aaaa/bbbb", ""); - testRelativeWindows("c:/aaaaa/", "c:/aaaa/cccc", "..\\aaaa\\cccc"); - testRelativeWindows("C:\\foo\\bar\\baz\\quux", "C:\\", "..\\..\\..\\.."); - testRelativeWindows("C:\\foo\\test", "C:\\foo\\test\\bar\\package.json", "bar\\package.json"); - testRelativeWindows("C:\\foo\\bar\\baz-quux", "C:\\foo\\bar\\baz", "..\\baz"); - testRelativeWindows("C:\\foo\\bar\\baz", "C:\\foo\\bar\\baz-quux", "..\\baz-quux"); - testRelativeWindows("\\\\foo\\bar", "\\\\foo\\bar\\baz", "baz"); - testRelativeWindows("\\\\foo\\bar\\baz", "\\\\foo\\bar", ".."); - testRelativeWindows("\\\\foo\\bar\\baz-quux", "\\\\foo\\bar\\baz", "..\\baz"); - testRelativeWindows("\\\\foo\\bar\\baz", "\\\\foo\\bar\\baz-quux", "..\\baz-quux"); - testRelativeWindows("C:\\baz-quux", "C:\\baz", "..\\baz"); - testRelativeWindows("C:\\baz", "C:\\baz-quux", "..\\baz-quux"); - testRelativeWindows("\\\\foo\\baz-quux", "\\\\foo\\baz", "..\\baz"); - testRelativeWindows("\\\\foo\\baz", "\\\\foo\\baz-quux", "..\\baz-quux"); - testRelativeWindows("C:\\baz", "\\\\foo\\bar\\baz", "\\\\foo\\bar\\baz"); - testRelativeWindows("\\\\foo\\bar\\baz", "C:\\baz", "C:\\baz"); + try testRelativeWindows("c:/blah\\blah", "d:/games", "D:\\games"); + try testRelativeWindows("c:/aaaa/bbbb", "c:/aaaa", ".."); + try testRelativeWindows("c:/aaaa/bbbb", "c:/cccc", "..\\..\\cccc"); + try testRelativeWindows("c:/aaaa/bbbb", "c:/aaaa/bbbb", ""); + try testRelativeWindows("c:/aaaa/bbbb", "c:/aaaa/cccc", "..\\cccc"); + try testRelativeWindows("c:/aaaa/", "c:/aaaa/cccc", "cccc"); + try testRelativeWindows("c:/", "c:\\aaaa\\bbbb", "aaaa\\bbbb"); + try testRelativeWindows("c:/aaaa/bbbb", "d:\\", "D:\\"); + try testRelativeWindows("c:/AaAa/bbbb", "c:/aaaa/bbbb", ""); + try testRelativeWindows("c:/aaaaa/", "c:/aaaa/cccc", "..\\aaaa\\cccc"); + try testRelativeWindows("C:\\foo\\bar\\baz\\quux", "C:\\", "..\\..\\..\\.."); + try testRelativeWindows("C:\\foo\\test", "C:\\foo\\test\\bar\\package.json", "bar\\package.json"); + try testRelativeWindows("C:\\foo\\bar\\baz-quux", "C:\\foo\\bar\\baz", "..\\baz"); + try testRelativeWindows("C:\\foo\\bar\\baz", "C:\\foo\\bar\\baz-quux", "..\\baz-quux"); + try testRelativeWindows("\\\\foo\\bar", "\\\\foo\\bar\\baz", "baz"); + try testRelativeWindows("\\\\foo\\bar\\baz", "\\\\foo\\bar", ".."); + try testRelativeWindows("\\\\foo\\bar\\baz-quux", "\\\\foo\\bar\\baz", "..\\baz"); + try testRelativeWindows("\\\\foo\\bar\\baz", "\\\\foo\\bar\\baz-quux", "..\\baz-quux"); + try testRelativeWindows("C:\\baz-quux", "C:\\baz", "..\\baz"); + try testRelativeWindows("C:\\baz", "C:\\baz-quux", "..\\baz-quux"); + try testRelativeWindows("\\\\foo\\baz-quux", "\\\\foo\\baz", "..\\baz"); + try testRelativeWindows("\\\\foo\\baz", "\\\\foo\\baz-quux", "..\\baz-quux"); + try testRelativeWindows("C:\\baz", "\\\\foo\\bar\\baz", "\\\\foo\\bar\\baz"); + try testRelativeWindows("\\\\foo\\bar\\baz", "C:\\baz", "C:\\baz"); - testRelativePosix("/var/lib", "/var", ".."); - testRelativePosix("/var/lib", "/bin", "../../bin"); - testRelativePosix("/var/lib", "/var/lib", ""); - testRelativePosix("/var/lib", "/var/apache", "../apache"); - testRelativePosix("/var/", "/var/lib", "lib"); - testRelativePosix("/", "/var/lib", "var/lib"); - testRelativePosix("/foo/test", "/foo/test/bar/package.json", "bar/package.json"); - testRelativePosix("/Users/a/web/b/test/mails", "/Users/a/web/b", "../.."); - testRelativePosix("/foo/bar/baz-quux", "/foo/bar/baz", "../baz"); - testRelativePosix("/foo/bar/baz", "/foo/bar/baz-quux", "../baz-quux"); - testRelativePosix("/baz-quux", "/baz", "../baz"); - testRelativePosix("/baz", "/baz-quux", "../baz-quux"); + try testRelativePosix("/var/lib", "/var", ".."); + try testRelativePosix("/var/lib", "/bin", "../../bin"); + try testRelativePosix("/var/lib", "/var/lib", ""); + try testRelativePosix("/var/lib", "/var/apache", "../apache"); + try testRelativePosix("/var/", "/var/lib", "lib"); + try testRelativePosix("/", "/var/lib", "var/lib"); + try testRelativePosix("/foo/test", "/foo/test/bar/package.json", "bar/package.json"); + try testRelativePosix("/Users/a/web/b/test/mails", "/Users/a/web/b", "../.."); + try testRelativePosix("/foo/bar/baz-quux", "/foo/bar/baz", "../baz"); + try testRelativePosix("/foo/bar/baz", "/foo/bar/baz-quux", "../baz-quux"); + try testRelativePosix("/baz-quux", "/baz", "../baz"); + try testRelativePosix("/baz", "/baz-quux", "../baz-quux"); } -fn testRelativePosix(from: []const u8, to: []const u8, expected_output: []const u8) void { - const result = relativePosix(testing.allocator, from, to) catch unreachable; +fn testRelativePosix(from: []const u8, to: []const u8, expected_output: []const u8) !void { + const result = try relativePosix(testing.leak_count_allocator, from, to); + defer testing.leak_count_allocator.free(result); testing.expectEqualSlices(u8, expected_output, result); } -fn testRelativeWindows(from: []const u8, to: []const u8, expected_output: []const u8) void { - const result = relativeWindows(testing.allocator, from, to) catch unreachable; +fn testRelativeWindows(from: []const u8, to: []const u8, expected_output: []const u8) !void { + const result = try relativeWindows(testing.leak_count_allocator, from, to); + defer testing.leak_count_allocator.free(result); testing.expectEqualSlices(u8, expected_output, result); } diff --git a/lib/std/linked_list.zig b/lib/std/linked_list.zig index a21c9a83e..d1652a804 100644 --- a/lib/std/linked_list.zig +++ b/lib/std/linked_list.zig @@ -143,7 +143,7 @@ pub fn SinglyLinkedList(comptime T: type) type { } test "basic SinglyLinkedList test" { - const allocator = testing.allocator; + const allocator = testing.leak_count_allocator; var list = SinglyLinkedList(u32).init(); var one = try list.createNode(1, allocator); @@ -404,7 +404,7 @@ pub fn TailQueue(comptime T: type) type { } test "basic TailQueue test" { - const allocator = testing.allocator; + const allocator = testing.leak_count_allocator; var list = TailQueue(u32).init(); var one = try list.createNode(1, allocator); @@ -456,7 +456,7 @@ test "basic TailQueue test" { } test "TailQueue concatenation" { - const allocator = testing.allocator; + const allocator = testing.leak_count_allocator; var list1 = TailQueue(u32).init(); var list2 = TailQueue(u32).init(); diff --git a/lib/std/os/test.zig b/lib/std/os/test.zig index 0d3be9e7e..2e60fe500 100644 --- a/lib/std/os/test.zig +++ b/lib/std/os/test.zig @@ -9,7 +9,7 @@ const elf = std.elf; const File = std.fs.File; const Thread = std.Thread; -const a = std.testing.allocator; +const a = std.testing.leak_count_allocator; const builtin = @import("builtin"); const AtomicRmwOp = builtin.AtomicRmwOp; diff --git a/lib/std/priority_queue.zig b/lib/std/priority_queue.zig index e726a07a8..9c07d2079 100644 --- a/lib/std/priority_queue.zig +++ b/lib/std/priority_queue.zig @@ -239,7 +239,7 @@ fn greaterThan(a: u32, b: u32) bool { const PQ = PriorityQueue(u32); test "std.PriorityQueue: add and remove min heap" { - var queue = PQ.init(testing.allocator, lessThan); + var queue = PQ.init(testing.leak_count_allocator, lessThan); defer queue.deinit(); try queue.add(54); @@ -257,7 +257,7 @@ test "std.PriorityQueue: add and remove min heap" { } test "std.PriorityQueue: add and remove same min heap" { - var queue = PQ.init(testing.allocator, lessThan); + var queue = PQ.init(testing.leak_count_allocator, lessThan); defer queue.deinit(); try queue.add(1); @@ -275,14 +275,14 @@ test "std.PriorityQueue: add and remove same min heap" { } test "std.PriorityQueue: removeOrNull on empty" { - var queue = PQ.init(testing.allocator, lessThan); + var queue = PQ.init(testing.leak_count_allocator, lessThan); defer queue.deinit(); expect(queue.removeOrNull() == null); } test "std.PriorityQueue: edge case 3 elements" { - var queue = PQ.init(testing.allocator, lessThan); + var queue = PQ.init(testing.leak_count_allocator, lessThan); defer queue.deinit(); try queue.add(9); @@ -294,7 +294,7 @@ test "std.PriorityQueue: edge case 3 elements" { } test "std.PriorityQueue: peek" { - var queue = PQ.init(testing.allocator, lessThan); + var queue = PQ.init(testing.leak_count_allocator, lessThan); defer queue.deinit(); expect(queue.peek() == null); @@ -306,7 +306,7 @@ test "std.PriorityQueue: peek" { } test "std.PriorityQueue: sift up with odd indices" { - var queue = PQ.init(testing.allocator, lessThan); + var queue = PQ.init(testing.leak_count_allocator, lessThan); defer queue.deinit(); const items = [_]u32{ 15, 7, 21, 14, 13, 22, 12, 6, 7, 25, 5, 24, 11, 16, 15, 24, 2, 1 }; for (items) |e| { @@ -320,7 +320,7 @@ test "std.PriorityQueue: sift up with odd indices" { } test "std.PriorityQueue: addSlice" { - var queue = PQ.init(testing.allocator, lessThan); + var queue = PQ.init(testing.leak_count_allocator, lessThan); defer queue.deinit(); const items = [_]u32{ 15, 7, 21, 14, 13, 22, 12, 6, 7, 25, 5, 24, 11, 16, 15, 24, 2, 1 }; try queue.addSlice(items[0..]); @@ -333,8 +333,8 @@ test "std.PriorityQueue: addSlice" { test "std.PriorityQueue: fromOwnedSlice" { const items = [_]u32{ 15, 7, 21, 14, 13, 22, 12, 6, 7, 25, 5, 24, 11, 16, 15, 24, 2, 1 }; - const heap_items = try std.mem.dupe(testing.allocator, u32, items[0..]); - var queue = PQ.fromOwnedSlice(testing.allocator, lessThan, heap_items[0..]); + const heap_items = try std.mem.dupe(testing.leak_count_allocator, u32, items[0..]); + var queue = PQ.fromOwnedSlice(testing.leak_count_allocator, lessThan, heap_items[0..]); defer queue.deinit(); const sorted_items = [_]u32{ 1, 2, 5, 6, 7, 7, 11, 12, 13, 14, 15, 15, 16, 21, 22, 24, 24, 25 }; @@ -344,7 +344,7 @@ test "std.PriorityQueue: fromOwnedSlice" { } test "std.PriorityQueue: add and remove max heap" { - var queue = PQ.init(testing.allocator, greaterThan); + var queue = PQ.init(testing.leak_count_allocator, greaterThan); defer queue.deinit(); try queue.add(54); @@ -362,7 +362,7 @@ test "std.PriorityQueue: add and remove max heap" { } test "std.PriorityQueue: add and remove same max heap" { - var queue = PQ.init(testing.allocator, greaterThan); + var queue = PQ.init(testing.leak_count_allocator, greaterThan); defer queue.deinit(); try queue.add(1); @@ -380,8 +380,8 @@ test "std.PriorityQueue: add and remove same max heap" { } test "std.PriorityQueue: iterator" { - var queue = PQ.init(testing.allocator, lessThan); - var map = std.AutoHashMap(u32, void).init(testing.allocator); + var queue = PQ.init(testing.leak_count_allocator, lessThan); + var map = std.AutoHashMap(u32, void).init(testing.leak_count_allocator); defer { queue.deinit(); map.deinit(); @@ -402,7 +402,7 @@ test "std.PriorityQueue: iterator" { } test "std.PriorityQueue: remove at index" { - var queue = PQ.init(testing.allocator, lessThan); + var queue = PQ.init(testing.leak_count_allocator, lessThan); defer queue.deinit(); try queue.add(3); diff --git a/lib/std/process.zig b/lib/std/process.zig index 2758e25ac..19f0eac23 100644 --- a/lib/std/process.zig +++ b/lib/std/process.zig @@ -114,7 +114,7 @@ pub fn getEnvMap(allocator: *Allocator) !BufMap { } test "os.getEnvMap" { - var env = try getEnvMap(std.testing.allocator); + var env = try getEnvMap(std.testing.leak_count_allocator); defer env.deinit(); } @@ -165,7 +165,7 @@ pub fn getEnvVarOwned(allocator: *mem.Allocator, key: []const u8) GetEnvVarOwned } test "os.getEnvVarOwned" { - var ga = std.testing.allocator; + var ga = std.testing.leak_count_allocator; testing.expectError(error.EnvironmentVariableNotFound, getEnvVarOwned(ga, "BADENV")); } @@ -492,10 +492,11 @@ test "windows arg parsing" { fn testWindowsCmdLine(input_cmd_line: [*]const u8, expected_args: []const []const u8) void { var it = ArgIteratorWindows.initWithCmdLine(input_cmd_line); for (expected_args) |expected_arg| { - const arg = it.next(std.testing.allocator).? catch unreachable; + const arg = it.next(std.testing.leak_count_allocator).? catch unreachable; + defer std.testing.leak_count_allocator.free(arg); testing.expectEqualSlices(u8, expected_arg, arg); } - testing.expect(it.next(std.testing.allocator) == null); + testing.expect(it.next(std.testing.leak_count_allocator) == null); } pub const UserInfo = struct { diff --git a/lib/std/special/test_runner.zig b/lib/std/special/test_runner.zig index 286dfbed1..e519f7f76 100644 --- a/lib/std/special/test_runner.zig +++ b/lib/std/special/test_runner.zig @@ -14,6 +14,7 @@ pub fn main() anyerror!void { for (test_fn_list) |test_fn, i| { std.testing.allocator_instance.reset(); + var test_node = root_node.start(test_fn.name, null); test_node.activate(); progress.refresh(); @@ -36,6 +37,8 @@ pub fn main() anyerror!void { return err; }, } + + try std.testing.leak_count_allocator_instance.validate(); } root_node.end(); if (ok_count == test_fn_list.len) { diff --git a/lib/std/testing.zig b/lib/std/testing.zig index 02d7cdb39..58298708c 100644 --- a/lib/std/testing.zig +++ b/lib/std/testing.zig @@ -7,6 +7,48 @@ pub const allocator = &allocator_instance.allocator; pub var allocator_instance = std.heap.ThreadSafeFixedBufferAllocator.init(allocator_mem[0..]); var allocator_mem: [100 * 1024]u8 = undefined; +pub const leak_count_allocator = &leak_count_allocator_instance.allocator; +pub var leak_count_allocator_instance = LeakCountAllocator.init(allocator); +const LeakCountAllocator = struct { + count: usize, + allocator: std.mem.Allocator, + internal_allocator: *std.mem.Allocator, + + fn init(allo: *std.mem.Allocator) LeakCountAllocator { + return .{ + .count = 0, + .allocator = .{ + .reallocFn = realloc, + .shrinkFn = shrink, + }, + .internal_allocator = allo, + }; + } + + fn realloc(allo: *std.mem.Allocator, old_mem: []u8, old_align: u29, new_size: usize, new_align: u29) ![]u8 { + const self = @fieldParentPtr(LeakCountAllocator, "allocator", allo); + if (old_mem.len == 0) { + self.count += 1; + } + return self.internal_allocator.reallocFn(self.internal_allocator, old_mem, old_align, new_size, new_align); + } + + fn shrink(allo: *std.mem.Allocator, old_mem: []u8, old_align: u29, new_size: usize, new_align: u29) []u8 { + const self = @fieldParentPtr(LeakCountAllocator, "allocator", allo); + if (new_size == 0) { + self.count -= 1; + } + return self.internal_allocator.shrinkFn(self.internal_allocator, old_mem, old_align, new_size, new_align); + } + + fn validate(self: LeakCountAllocator) !void { + if (self.count > 0) { + std.debug.warn("Detected leaked allocations without matching free: {}\n", .{self.count}); + return error.Leak; + } + } +}; + /// This function is intended to be used only in tests. It prints diagnostics to stderr /// and then aborts when actual_error_union is not expected_error. pub fn expectError(expected_error: anyerror, actual_error_union: var) void { diff --git a/lib/std/unicode.zig b/lib/std/unicode.zig index 638b5f5e2..188479683 100644 --- a/lib/std/unicode.zig +++ b/lib/std/unicode.zig @@ -501,14 +501,16 @@ test "utf16leToUtf8" { { mem.writeIntSliceLittle(u16, utf16le_as_bytes[0..], 'A'); mem.writeIntSliceLittle(u16, utf16le_as_bytes[2..], 'a'); - const utf8 = try utf16leToUtf8Alloc(std.testing.allocator, &utf16le); + const utf8 = try utf16leToUtf8Alloc(std.testing.leak_count_allocator, &utf16le); + defer std.testing.leak_count_allocator.free(utf8); testing.expect(mem.eql(u8, utf8, "Aa")); } { mem.writeIntSliceLittle(u16, utf16le_as_bytes[0..], 0x80); mem.writeIntSliceLittle(u16, utf16le_as_bytes[2..], 0xffff); - const utf8 = try utf16leToUtf8Alloc(std.testing.allocator, &utf16le); + const utf8 = try utf16leToUtf8Alloc(std.testing.leak_count_allocator, &utf16le); + defer std.testing.leak_count_allocator.free(utf8); testing.expect(mem.eql(u8, utf8, "\xc2\x80" ++ "\xef\xbf\xbf")); } @@ -516,7 +518,8 @@ test "utf16leToUtf8" { // the values just outside the surrogate half range mem.writeIntSliceLittle(u16, utf16le_as_bytes[0..], 0xd7ff); mem.writeIntSliceLittle(u16, utf16le_as_bytes[2..], 0xe000); - const utf8 = try utf16leToUtf8Alloc(std.testing.allocator, &utf16le); + const utf8 = try utf16leToUtf8Alloc(std.testing.leak_count_allocator, &utf16le); + defer std.testing.leak_count_allocator.free(utf8); testing.expect(mem.eql(u8, utf8, "\xed\x9f\xbf" ++ "\xee\x80\x80")); } @@ -524,7 +527,8 @@ test "utf16leToUtf8" { // smallest surrogate pair mem.writeIntSliceLittle(u16, utf16le_as_bytes[0..], 0xd800); mem.writeIntSliceLittle(u16, utf16le_as_bytes[2..], 0xdc00); - const utf8 = try utf16leToUtf8Alloc(std.testing.allocator, &utf16le); + const utf8 = try utf16leToUtf8Alloc(std.testing.leak_count_allocator, &utf16le); + defer std.testing.leak_count_allocator.free(utf8); testing.expect(mem.eql(u8, utf8, "\xf0\x90\x80\x80")); } @@ -532,14 +536,16 @@ test "utf16leToUtf8" { // largest surrogate pair mem.writeIntSliceLittle(u16, utf16le_as_bytes[0..], 0xdbff); mem.writeIntSliceLittle(u16, utf16le_as_bytes[2..], 0xdfff); - const utf8 = try utf16leToUtf8Alloc(std.testing.allocator, &utf16le); + const utf8 = try utf16leToUtf8Alloc(std.testing.leak_count_allocator, &utf16le); + defer std.testing.leak_count_allocator.free(utf8); testing.expect(mem.eql(u8, utf8, "\xf4\x8f\xbf\xbf")); } { mem.writeIntSliceLittle(u16, utf16le_as_bytes[0..], 0xdbff); mem.writeIntSliceLittle(u16, utf16le_as_bytes[2..], 0xdc00); - const utf8 = try utf16leToUtf8Alloc(std.testing.allocator, &utf16le); + const utf8 = try utf16leToUtf8Alloc(std.testing.leak_count_allocator, &utf16le); + defer std.testing.leak_count_allocator.free(utf8); testing.expect(mem.eql(u8, utf8, "\xf4\x8f\xb0\x80")); } } diff --git a/lib/std/zig/ast.zig b/lib/std/zig/ast.zig index e33934382..c967c7878 100644 --- a/lib/std/zig/ast.zig +++ b/lib/std/zig/ast.zig @@ -2287,7 +2287,7 @@ pub const Node = struct { test "iterate" { var root = Node.Root{ .base = Node{ .id = Node.Id.Root }, - .decls = Node.Root.DeclList.init(std.testing.allocator), + .decls = Node.Root.DeclList.init(std.testing.leak_count_allocator), .eof_token = 0, }; var base = &root.base; diff --git a/test/compare_output.zig b/test/compare_output.zig index 7a41d46f5..d743e0784 100644 --- a/test/compare_output.zig +++ b/test/compare_output.zig @@ -445,7 +445,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { \\const std = @import("std"); \\const io = std.io; \\const os = std.os; - \\const allocator = std.testing.allocator; + \\const allocator = std.testing.leak_count_allocator; \\ \\pub fn main() !void { \\ var args_it = std.process.args(); @@ -486,7 +486,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { \\const std = @import("std"); \\const io = std.io; \\const os = std.os; - \\const allocator = std.testing.allocator; + \\const allocator = std.testing.leak_count_allocator; \\ \\pub fn main() !void { \\ var args_it = std.process.args(); diff --git a/test/compile_errors.zig b/test/compile_errors.zig index 341062e16..2f3f0a9f1 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -5765,7 +5765,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { \\ \\export fn entry() void { \\ const a = MdNode.Header { - \\ .text = MdText.init(&std.testing.allocator), + \\ .text = MdText.init(&std.testing.leak_count_allocator), \\ .weight = HeaderWeight.H1, \\ }; \\} diff --git a/test/stage1/behavior/const_slice_child.zig b/test/stage1/behavior/const_slice_child.zig index cf650ae88..848a4780e 100644 --- a/test/stage1/behavior/const_slice_child.zig +++ b/test/stage1/behavior/const_slice_child.zig @@ -22,7 +22,7 @@ fn foo(args: [][]const u8) void { } fn bar(argc: usize) void { - const args = testing.allocator.alloc([]const u8, argc) catch unreachable; + const args = testing.leak_count_allocator.alloc([]const u8, argc) catch unreachable; for (args) |_, i| { const ptr = argv[i]; args[i] = ptr[0..strlen(ptr)]; diff --git a/test/standalone/brace_expansion/main.zig b/test/standalone/brace_expansion/main.zig index c6bfd02e7..33fe826d1 100644 --- a/test/standalone/brace_expansion/main.zig +++ b/test/standalone/brace_expansion/main.zig @@ -201,7 +201,7 @@ pub fn main() !void { } test "invalid inputs" { - global_allocator = std.testing.allocator; + global_allocator = std.testing.leak_count_allocator; expectError("}ABC", error.InvalidInput); expectError("{ABC", error.InvalidInput); @@ -222,7 +222,7 @@ fn expectError(test_input: []const u8, expected_err: anyerror) void { } test "valid inputs" { - global_allocator = std.testing.allocator; + global_allocator = std.testing.leak_count_allocator; expectExpansion("{x,y,z}", "x y z"); expectExpansion("{A,B}{x,y}", "Ax Ay Bx By"); diff --git a/test/standalone/cat/main.zig b/test/standalone/cat/main.zig index 34439f9c2..10ec00d6e 100644 --- a/test/standalone/cat/main.zig +++ b/test/standalone/cat/main.zig @@ -4,7 +4,7 @@ const process = std.process; const fs = std.fs; const mem = std.mem; const warn = std.debug.warn; -const allocator = std.testing.allocator; +const allocator = std.testing.leak_count_allocator; pub fn main() !void { var args_it = process.args(); diff --git a/test/standalone/empty_env/main.zig b/test/standalone/empty_env/main.zig index f4ebf5613..dc2ac7373 100644 --- a/test/standalone/empty_env/main.zig +++ b/test/standalone/empty_env/main.zig @@ -1,6 +1,6 @@ const std = @import("std"); pub fn main() void { - const env_map = std.process.getEnvMap(std.testing.allocator) catch @panic("unable to get env map"); + const env_map = std.process.getEnvMap(std.testing.leak_count_allocator) catch @panic("unable to get env map"); std.testing.expect(env_map.count() == 0); } diff --git a/test/standalone/load_dynamic_library/main.zig b/test/standalone/load_dynamic_library/main.zig index 70fc4986a..5a2e55e93 100644 --- a/test/standalone/load_dynamic_library/main.zig +++ b/test/standalone/load_dynamic_library/main.zig @@ -1,8 +1,8 @@ const std = @import("std"); pub fn main() !void { - const args = try std.process.argsAlloc(std.testing.allocator); - defer std.process.argsFree(std.testing.allocator, args); + const args = try std.process.argsAlloc(std.testing.leak_count_allocator); + defer std.process.argsFree(std.testing.leak_count_allocator, args); const dynlib_name = args[1]; From c4e6e5fad600f9277ce2cd76b7f2cf85922c6fd3 Mon Sep 17 00:00:00 2001 From: Benjamin Feng Date: Wed, 29 Jan 2020 14:47:17 -0600 Subject: [PATCH 09/60] Add explicit free to docs --- doc/docgen.zig | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/docgen.zig b/doc/docgen.zig index 128314696..cc4993d65 100644 --- a/doc/docgen.zig +++ b/doc/docgen.zig @@ -673,6 +673,7 @@ const TermState = enum { test "term color" { const input_bytes = "A\x1b[32;1mgreen\x1b[0mB"; const result = try termColor(std.testing.leak_count_allocator, input_bytes); + defer std.testing.leak_count_allocator.free(result); testing.expectEqualSlices(u8, "AgreenB", result); } From 4a4d6f2be911cae08db434f877a1be2340d262c8 Mon Sep 17 00:00:00 2001 From: Rocknest <35231115+Rocknest@users.noreply.github.com> Date: Wed, 29 Jan 2020 23:15:17 +0200 Subject: [PATCH 10/60] Reorganize definitions --- lib/std/debug.zig | 251 +----------------------------------- lib/std/os/windows/bits.zig | 229 +++++++++++++++++++++++++++++++- 2 files changed, 230 insertions(+), 250 deletions(-) diff --git a/lib/std/debug.zig b/lib/std/debug.zig index acc3f3641..9c1d21180 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -2317,11 +2317,11 @@ fn handleSegfaultWindows(info: *windows.EXCEPTION_POINTERS) callconv(.Stdcall) c } } -// zig won't let me use an anon enum here +// zig won't let me use an anon enum here https://github.com/ziglang/zig/issues/3707 fn handleSegfaultWindowsExtra(info: *windows.EXCEPTION_POINTERS, comptime msg: u8, comptime format: ?[]const u8) noreturn { const exception_address = @ptrToInt(info.ExceptionRecord.ExceptionAddress); - if (comptime windows_exception_context.haveContext) { - const regs = windows_exception_context.getRegs(info.ContextRecord); + if (@hasDecl(windows, "CONTEXT")) { + const regs = info.ContextRecord.getRegs(); switch (msg) { 0 => std.debug.warn("{}\n", .{format.?}), 1 => std.debug.warn("Segmentation fault at address 0x{x}\n", .{info.ExceptionRecord.ExceptionInformation[1]}), @@ -2341,251 +2341,6 @@ fn handleSegfaultWindowsExtra(info: *windows.EXCEPTION_POINTERS, comptime msg: u } } -pub const windows_exception_context = switch (builtin.arch) { - .i386 => struct { - pub const haveContext = true; - - pub fn getRegs(ptr: *c_void) struct {bp: usize, ip: usize} { - const ctx = @ptrCast(*const CONTEXT, @alignCast(@alignOf(CONTEXT), ptr)); - return .{.bp = @intCast(usize, ctx.Ebp), .ip = @intCast(usize, ctx.Eip)}; - } - - pub const CONTEXT = extern struct { - ContextFlags: DWORD, - Dr0: DWORD, - Dr1: DWORD, - Dr2: DWORD, - Dr3: DWORD, - Dr6: DWORD, - Dr7: DWORD, - FloatSave: FLOATING_SAVE_AREA, - SegGs: DWORD, - SegFs: DWORD, - SegEs: DWORD, - SegDs: DWORD, - Edi: DWORD, - Esi: DWORD, - Ebx: DWORD, - Edx: DWORD, - Ecx: DWORD, - Eax: DWORD, - Ebp: DWORD, - Eip: DWORD, - SegCs: DWORD, - EFlags: DWORD, - Esp: DWORD, - SegSs: DWORD, - ExtendedRegisters: [512]BYTE, - }; - - pub const FLOATING_SAVE_AREA = extern struct { - ControlWord: DWORD, - StatusWord: DWORD, - TagWord: DWORD, - ErrorOffset: DWORD, - ErrorSelector: DWORD, - DataOffset: DWORD, - DataSelector: DWORD, - RegisterArea: [80]BYTE, - Cr0NpxState: DWORD, - }; - - pub const BYTE = u8; - pub const DWORD = c_ulong; - }, - .x86_64 => struct { - pub const haveContext = true; - - pub fn getRegs(ptr: *c_void) struct {bp: usize, ip: usize} { - const ctx = @ptrCast(*const CONTEXT, @alignCast(@alignOf(CONTEXT), ptr)); - return .{.bp = @intCast(usize, ctx.Rbp), .ip = @intCast(usize, ctx.Rip)}; - } - - pub const CONTEXT = extern struct { - P1Home: DWORD64, - P2Home: DWORD64, - P3Home: DWORD64, - P4Home: DWORD64, - P5Home: DWORD64, - P6Home: DWORD64, - ContextFlags: DWORD, - MxCsr: DWORD, - SegCs: WORD, - SegDs: WORD, - SegEs: WORD, - SegFs: WORD, - SegGs: WORD, - SegSs: WORD, - EFlags: DWORD, - Dr0: DWORD64, - Dr1: DWORD64, - Dr2: DWORD64, - Dr3: DWORD64, - Dr6: DWORD64, - Dr7: DWORD64, - Rax: DWORD64, - Rcx: DWORD64, - Rdx: DWORD64, - Rbx: DWORD64, - Rsp: DWORD64, - Rbp: DWORD64, - Rsi: DWORD64, - Rdi: DWORD64, - R8: DWORD64, - R9: DWORD64, - R10: DWORD64, - R11: DWORD64, - R12: DWORD64, - R13: DWORD64, - R14: DWORD64, - R15: DWORD64, - Rip: DWORD64, - DUMMYUNIONNAME: extern union { - FltSave: XMM_SAVE_AREA32, - FloatSave: XMM_SAVE_AREA32, - DUMMYSTRUCTNAME: extern struct { - Header: [2]M128A, - Legacy: [8]M128A, - Xmm0: M128A, - Xmm1: M128A, - Xmm2: M128A, - Xmm3: M128A, - Xmm4: M128A, - Xmm5: M128A, - Xmm6: M128A, - Xmm7: M128A, - Xmm8: M128A, - Xmm9: M128A, - Xmm10: M128A, - Xmm11: M128A, - Xmm12: M128A, - Xmm13: M128A, - Xmm14: M128A, - Xmm15: M128A, - }, - }, - VectorRegister: [26]M128A, - VectorControl: DWORD64, - DebugControl: DWORD64, - LastBranchToRip: DWORD64, - LastBranchFromRip: DWORD64, - LastExceptionToRip: DWORD64, - LastExceptionFromRip: DWORD64, - }; - - pub const XMM_SAVE_AREA32 = extern struct { - ControlWord: WORD, - StatusWord: WORD, - TagWord: BYTE, - Reserved1: BYTE, - ErrorOpcode: WORD, - ErrorOffset: DWORD, - ErrorSelector: WORD, - Reserved2: WORD, - DataOffset: DWORD, - DataSelector: WORD, - Reserved3: WORD, - MxCsr: DWORD, - MxCsr_Mask: DWORD, - FloatRegisters: [8]M128A, - XmmRegisters: [16]M128A, - Reserved4: [96]BYTE, - }; - - pub const M128A = extern struct { - Low: ULONGLONG, - High: LONGLONG, - }; - - pub const BYTE = u8; - pub const WORD = u16; - pub const DWORD = u32; - pub const DWORD64 = u64; - pub const LONGLONG = c_longlong; - pub const ULONGLONG = c_ulonglong; - }, - .aarch64 => struct { - pub const haveContext = true; - - pub fn getRegs(ptr: *c_void) struct {bp: usize, ip: usize} { - const ctx = @ptrCast(*const CONTEXT, @alignCast(@alignOf(CONTEXT), ptr)); - return .{.bp = @intCast(usize, ctx.Fp), .ip = @intCast(usize, ctx.Pc)}; - } - - pub const CONTEXT = extern struct { - ContextFlags: ULONG, - Cpsr: ULONG, - DUMMYUNIONNAME: extern union { - DUMMYSTRUCTNAME: extern struct { - X0: DWORD64, - X1: DWORD64, - X2: DWORD64, - X3: DWORD64, - X4: DWORD64, - X5: DWORD64, - X6: DWORD64, - X7: DWORD64, - X8: DWORD64, - X9: DWORD64, - X10: DWORD64, - X11: DWORD64, - X12: DWORD64, - X13: DWORD64, - X14: DWORD64, - X15: DWORD64, - X16: DWORD64, - X17: DWORD64, - X18: DWORD64, - X19: DWORD64, - X20: DWORD64, - X21: DWORD64, - X22: DWORD64, - X23: DWORD64, - X24: DWORD64, - X25: DWORD64, - X26: DWORD64, - X27: DWORD64, - X28: DWORD64, - Fp: DWORD64, - Lr: DWORD64, - }, - X: [31]DWORD64, - }, - Sp: DWORD64, - Pc: DWORD64, - V: [32]NEON128, - Fpcr: DWORD, - Fpsr: DWORD, - Bcr: [8]DWORD, - Bvr: [8]DWORD64, - Wcr: [2]DWORD, - Wvr: [2]DWORD64, - }; - - pub const NEON128 = extern union { - DUMMYSTRUCTNAME: extern struct { - Low: ULONGLONG, - High: LONGLONG, - }, - D: [2]f64, - S: [4]f32, - H: [8]WORD, - B: [16]BYTE, - }; - - pub const ULONG = c_ulong; - pub const LONGLONG = c_longlong; - pub const ULONGLONG = c_ulonglong; - pub const BYTE = u8; - pub const WORD = c_ushort; - pub const DWORD = c_ulong; - pub const DWORD64 = c_ulonglong; - }, - else => struct { - pub const haveContext = false; - }, -}; - pub fn dumpStackPointerAddr(prefix: []const u8) void { const sp = asm ("" : [argc] "={rsp}" (-> usize) diff --git a/lib/std/os/windows/bits.zig b/lib/std/os/windows/bits.zig index 328732e0c..e4c685494 100644 --- a/lib/std/os/windows/bits.zig +++ b/lib/std/os/windows/bits.zig @@ -23,7 +23,6 @@ pub const BOOL = c_int; pub const BOOLEAN = BYTE; pub const BYTE = u8; pub const CHAR = u8; -pub const DWORD = u32; pub const FLOAT = f32; pub const HANDLE = *c_void; pub const HCRYPTPROV = ULONG_PTR; @@ -52,6 +51,8 @@ pub const DWORD_PTR = ULONG_PTR; pub const UNICODE = false; pub const WCHAR = u16; pub const WORD = u16; +pub const DWORD = u32; +pub const DWORD64 = u64; pub const LARGE_INTEGER = i64; pub const USHORT = u16; pub const SHORT = i16; @@ -887,9 +888,233 @@ pub const EXCEPTION_RECORD = extern struct { ExceptionInformation: [15]usize, }; +pub usingnamespace switch (builtin.arch) { + .i386 => struct { + pub const FLOATING_SAVE_AREA = extern struct { + ControlWord: DWORD, + StatusWord: DWORD, + TagWord: DWORD, + ErrorOffset: DWORD, + ErrorSelector: DWORD, + DataOffset: DWORD, + DataSelector: DWORD, + RegisterArea: [80]BYTE, + Cr0NpxState: DWORD, + }; + + pub const CONTEXT = extern struct { + ContextFlags: DWORD, + Dr0: DWORD, + Dr1: DWORD, + Dr2: DWORD, + Dr3: DWORD, + Dr6: DWORD, + Dr7: DWORD, + FloatSave: FLOATING_SAVE_AREA, + SegGs: DWORD, + SegFs: DWORD, + SegEs: DWORD, + SegDs: DWORD, + Edi: DWORD, + Esi: DWORD, + Ebx: DWORD, + Edx: DWORD, + Ecx: DWORD, + Eax: DWORD, + Ebp: DWORD, + Eip: DWORD, + SegCs: DWORD, + EFlags: DWORD, + Esp: DWORD, + SegSs: DWORD, + ExtendedRegisters: [512]BYTE, + + pub fn getRegs(ctx: *const CONTEXT) struct {bp: usize, ip: usize} { + return .{.bp = @intCast(usize, ctx.Ebp), .ip = @intCast(usize, ctx.Eip)}; + } + }; + + pub const PCONTEXT = *CONTEXT; + }, + .x86_64 => struct { + pub const M128A = extern struct { + Low: ULONGLONG, + High: LONGLONG, + }; + + pub const XMM_SAVE_AREA32 = extern struct { + ControlWord: WORD, + StatusWord: WORD, + TagWord: BYTE, + Reserved1: BYTE, + ErrorOpcode: WORD, + ErrorOffset: DWORD, + ErrorSelector: WORD, + Reserved2: WORD, + DataOffset: DWORD, + DataSelector: WORD, + Reserved3: WORD, + MxCsr: DWORD, + MxCsr_Mask: DWORD, + FloatRegisters: [8]M128A, + XmmRegisters: [16]M128A, + Reserved4: [96]BYTE, + }; + + pub const CONTEXT = extern struct { + P1Home: DWORD64, + P2Home: DWORD64, + P3Home: DWORD64, + P4Home: DWORD64, + P5Home: DWORD64, + P6Home: DWORD64, + ContextFlags: DWORD, + MxCsr: DWORD, + SegCs: WORD, + SegDs: WORD, + SegEs: WORD, + SegFs: WORD, + SegGs: WORD, + SegSs: WORD, + EFlags: DWORD, + Dr0: DWORD64, + Dr1: DWORD64, + Dr2: DWORD64, + Dr3: DWORD64, + Dr6: DWORD64, + Dr7: DWORD64, + Rax: DWORD64, + Rcx: DWORD64, + Rdx: DWORD64, + Rbx: DWORD64, + Rsp: DWORD64, + Rbp: DWORD64, + Rsi: DWORD64, + Rdi: DWORD64, + R8: DWORD64, + R9: DWORD64, + R10: DWORD64, + R11: DWORD64, + R12: DWORD64, + R13: DWORD64, + R14: DWORD64, + R15: DWORD64, + Rip: DWORD64, + DUMMYUNIONNAME: extern union { + FltSave: XMM_SAVE_AREA32, + FloatSave: XMM_SAVE_AREA32, + DUMMYSTRUCTNAME: extern struct { + Header: [2]M128A, + Legacy: [8]M128A, + Xmm0: M128A, + Xmm1: M128A, + Xmm2: M128A, + Xmm3: M128A, + Xmm4: M128A, + Xmm5: M128A, + Xmm6: M128A, + Xmm7: M128A, + Xmm8: M128A, + Xmm9: M128A, + Xmm10: M128A, + Xmm11: M128A, + Xmm12: M128A, + Xmm13: M128A, + Xmm14: M128A, + Xmm15: M128A, + }, + }, + VectorRegister: [26]M128A, + VectorControl: DWORD64, + DebugControl: DWORD64, + LastBranchToRip: DWORD64, + LastBranchFromRip: DWORD64, + LastExceptionToRip: DWORD64, + LastExceptionFromRip: DWORD64, + + pub fn getRegs(ctx: *const CONTEXT) struct {bp: usize, ip: usize} { + return .{.bp = @intCast(usize, ctx.Rbp), .ip = @intCast(usize, ctx.Rip)}; + } + }; + + pub const PCONTEXT = *CONTEXT; + }, + .aarch64 => struct { + pub const NEON128 = extern union { + DUMMYSTRUCTNAME: extern struct { + Low: ULONGLONG, + High: LONGLONG, + }, + D: [2]f64, + S: [4]f32, + H: [8]WORD, + B: [16]BYTE, + }; + + pub const CONTEXT = extern struct { + ContextFlags: ULONG, + Cpsr: ULONG, + DUMMYUNIONNAME: extern union { + DUMMYSTRUCTNAME: extern struct { + X0: DWORD64, + X1: DWORD64, + X2: DWORD64, + X3: DWORD64, + X4: DWORD64, + X5: DWORD64, + X6: DWORD64, + X7: DWORD64, + X8: DWORD64, + X9: DWORD64, + X10: DWORD64, + X11: DWORD64, + X12: DWORD64, + X13: DWORD64, + X14: DWORD64, + X15: DWORD64, + X16: DWORD64, + X17: DWORD64, + X18: DWORD64, + X19: DWORD64, + X20: DWORD64, + X21: DWORD64, + X22: DWORD64, + X23: DWORD64, + X24: DWORD64, + X25: DWORD64, + X26: DWORD64, + X27: DWORD64, + X28: DWORD64, + Fp: DWORD64, + Lr: DWORD64, + }, + X: [31]DWORD64, + }, + Sp: DWORD64, + Pc: DWORD64, + V: [32]NEON128, + Fpcr: DWORD, + Fpsr: DWORD, + Bcr: [8]DWORD, + Bvr: [8]DWORD64, + Wcr: [2]DWORD, + Wvr: [2]DWORD64, + + pub fn getRegs(ctx: *const CONTEXT) struct {bp: usize, ip: usize} { + return .{.bp = @intCast(usize, ctx.Fp), .ip = @intCast(usize, ctx.Pc)}; + } + }; + + pub const PCONTEXT = *CONTEXT; + }, + else => struct { + pub const PCONTEXT = *c_void; + }, +}; + pub const EXCEPTION_POINTERS = extern struct { ExceptionRecord: *EXCEPTION_RECORD, - ContextRecord: *c_void, + ContextRecord: PCONTEXT, }; pub const VECTORED_EXCEPTION_HANDLER = fn (ExceptionInfo: *EXCEPTION_POINTERS) callconv(.Stdcall) c_long; From ffd30dbe28efce0b971d69df06ab684ceef0f881 Mon Sep 17 00:00:00 2001 From: Benjamin Feng Date: Wed, 29 Jan 2020 15:30:13 -0600 Subject: [PATCH 11/60] Fix stage1 test --- test/stage1/behavior/const_slice_child.zig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/stage1/behavior/const_slice_child.zig b/test/stage1/behavior/const_slice_child.zig index 848a4780e..7d969ae46 100644 --- a/test/stage1/behavior/const_slice_child.zig +++ b/test/stage1/behavior/const_slice_child.zig @@ -1,6 +1,7 @@ const std = @import("std"); const debug = std.debug; -const expect = std.testing.expect; +const testing = std.testing; +const expect = testing.expect; var argv: [*]const [*]const u8 = undefined; @@ -23,6 +24,7 @@ fn foo(args: [][]const u8) void { fn bar(argc: usize) void { const args = testing.leak_count_allocator.alloc([]const u8, argc) catch unreachable; + defer testing.leak_count_allocator.free(args); for (args) |_, i| { const ptr = argv[i]; args[i] = ptr[0..strlen(ptr)]; From c0c9c601d492e9da3f391ec4d837f7ab02b559df Mon Sep 17 00:00:00 2001 From: Rocknest <35231115+Rocknest@users.noreply.github.com> Date: Wed, 29 Jan 2020 23:48:52 +0200 Subject: [PATCH 12/60] Fix off-by-one error --- lib/std/debug.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/std/debug.zig b/lib/std/debug.zig index 9c1d21180..2dd1da50c 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -129,7 +129,7 @@ pub fn dumpStackTraceFromBase(bp: usize, ip: usize) void { return; }; const tty_config = detectTTYConfig(); - printSourceAtAddress(debug_info, stderr, if (builtin.os == .windows) (ip + 1) else ip, tty_config) catch return; + printSourceAtAddress(debug_info, stderr, ip, tty_config) catch return; const first_return_address = @intToPtr(*const usize, bp + @sizeOf(usize)).*; printSourceAtAddress(debug_info, stderr, first_return_address - 1, tty_config) catch return; var it = StackIterator{ @@ -471,7 +471,7 @@ fn printSourceAtAddressWindows( line_index += @sizeOf(pdb.LineNumberEntry); const vaddr_start = frag_vaddr_start + line_num_entry.Offset; - if (relative_address <= vaddr_start) { + if (relative_address < vaddr_start) { break; } } From b1884b3a62e4b7d5c2bb1532f6ccc372ec3d909a Mon Sep 17 00:00:00 2001 From: Rocknest <35231115+Rocknest@users.noreply.github.com> Date: Thu, 30 Jan 2020 01:17:34 +0200 Subject: [PATCH 13/60] Fix aarch64 --- lib/std/os/windows/bits.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/std/os/windows/bits.zig b/lib/std/os/windows/bits.zig index e4c685494..d1c09c02e 100644 --- a/lib/std/os/windows/bits.zig +++ b/lib/std/os/windows/bits.zig @@ -1101,7 +1101,7 @@ pub usingnamespace switch (builtin.arch) { Wvr: [2]DWORD64, pub fn getRegs(ctx: *const CONTEXT) struct {bp: usize, ip: usize} { - return .{.bp = @intCast(usize, ctx.Fp), .ip = @intCast(usize, ctx.Pc)}; + return .{.bp = @intCast(usize, ctx.DUMMYUNIONNAME.DUMMYSTRUCTNAME.Fp), .ip = @intCast(usize, ctx.Pc)}; } }; From 0c137934cbd10528c2dced898b6c5485ab528e6d Mon Sep 17 00:00:00 2001 From: Benjamin Feng Date: Wed, 29 Jan 2020 17:26:10 -0600 Subject: [PATCH 14/60] Move FailingAllocator to testing --- lib/std/debug.zig | 10 +--- lib/std/io.zig | 2 +- lib/std/testing.zig | 45 ++---------------- .../{debug => testing}/failing_allocator.zig | 0 lib/std/testing/leak_count_allocator.zig | 46 +++++++++++++++++++ lib/std/zig/parser_test.zig | 4 +- 6 files changed, 56 insertions(+), 51 deletions(-) rename lib/std/{debug => testing}/failing_allocator.zig (100%) create mode 100644 lib/std/testing/leak_count_allocator.zig diff --git a/lib/std/debug.zig b/lib/std/debug.zig index 7e1a99a39..32aba0d9b 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -19,8 +19,8 @@ const windows = std.os.windows; pub const leb = @import("debug/leb128.zig"); -pub const FailingAllocator = @import("debug/failing_allocator.zig").FailingAllocator; -pub const failing_allocator = &FailingAllocator.init(&global_fixed_allocator.allocator, 0).allocator; +pub const global_allocator = @compileError("Please switch to std.testing.leak_count_allocator."); +pub const failing_allocator = @compileError("Please switch to std.testing.failing_allocator."); pub const runtime_safety = switch (builtin.mode) { .Debug, .ReleaseSafe => true, @@ -2192,12 +2192,6 @@ fn readInitialLength(comptime E: type, in_stream: *io.InStream(E), is_64: *bool) } } -pub const global_allocator = blk: { - @compileError("Please switch to std.testing.leak_count_allocator."); -}; -var global_fixed_allocator = std.heap.ThreadSafeFixedBufferAllocator.init(global_allocator_mem[0..]); -var global_allocator_mem: [100 * 1024]u8 = undefined; - /// TODO multithreaded awareness var debug_info_allocator: ?*mem.Allocator = null; var debug_info_arena_allocator: std.heap.ArenaAllocator = undefined; diff --git a/lib/std/io.zig b/lib/std/io.zig index 93f2ae768..a0e58c373 100644 --- a/lib/std/io.zig +++ b/lib/std/io.zig @@ -891,7 +891,7 @@ pub fn readLineSlice(slice: []u8) ![]u8 { pub fn readLineSliceFrom(stream: var, slice: []u8) ![]u8 { // We cannot use Buffer.fromOwnedSlice, as it wants to append a null byte // after taking ownership, which would always require an allocation. - var buf = std.Buffer{ .list = std.ArrayList(u8).fromOwnedSlice(debug.failing_allocator, slice) }; + var buf = std.Buffer{ .list = std.ArrayList(u8).fromOwnedSlice(testing.failing_allocator, slice) }; try buf.resize(0); return try readLineFrom(stream, &buf); } diff --git a/lib/std/testing.zig b/lib/std/testing.zig index 58298708c..07479a385 100644 --- a/lib/std/testing.zig +++ b/lib/std/testing.zig @@ -7,47 +7,12 @@ pub const allocator = &allocator_instance.allocator; pub var allocator_instance = std.heap.ThreadSafeFixedBufferAllocator.init(allocator_mem[0..]); var allocator_mem: [100 * 1024]u8 = undefined; -pub const leak_count_allocator = &leak_count_allocator_instance.allocator; +pub const FailingAllocator = @import("testing/failing_allocator.zig").FailingAllocator; +pub const failing_allocator = &FailingAllocator.init(allocator, 0).allocator; + +pub const LeakCountAllocator = @import("testing/leak_count_allocator.zig").LeakCountAllocator; pub var leak_count_allocator_instance = LeakCountAllocator.init(allocator); -const LeakCountAllocator = struct { - count: usize, - allocator: std.mem.Allocator, - internal_allocator: *std.mem.Allocator, - - fn init(allo: *std.mem.Allocator) LeakCountAllocator { - return .{ - .count = 0, - .allocator = .{ - .reallocFn = realloc, - .shrinkFn = shrink, - }, - .internal_allocator = allo, - }; - } - - fn realloc(allo: *std.mem.Allocator, old_mem: []u8, old_align: u29, new_size: usize, new_align: u29) ![]u8 { - const self = @fieldParentPtr(LeakCountAllocator, "allocator", allo); - if (old_mem.len == 0) { - self.count += 1; - } - return self.internal_allocator.reallocFn(self.internal_allocator, old_mem, old_align, new_size, new_align); - } - - fn shrink(allo: *std.mem.Allocator, old_mem: []u8, old_align: u29, new_size: usize, new_align: u29) []u8 { - const self = @fieldParentPtr(LeakCountAllocator, "allocator", allo); - if (new_size == 0) { - self.count -= 1; - } - return self.internal_allocator.shrinkFn(self.internal_allocator, old_mem, old_align, new_size, new_align); - } - - fn validate(self: LeakCountAllocator) !void { - if (self.count > 0) { - std.debug.warn("Detected leaked allocations without matching free: {}\n", .{self.count}); - return error.Leak; - } - } -}; +pub const leak_count_allocator = &leak_count_allocator_instance.allocator; /// This function is intended to be used only in tests. It prints diagnostics to stderr /// and then aborts when actual_error_union is not expected_error. diff --git a/lib/std/debug/failing_allocator.zig b/lib/std/testing/failing_allocator.zig similarity index 100% rename from lib/std/debug/failing_allocator.zig rename to lib/std/testing/failing_allocator.zig diff --git a/lib/std/testing/leak_count_allocator.zig b/lib/std/testing/leak_count_allocator.zig new file mode 100644 index 000000000..84c324817 --- /dev/null +++ b/lib/std/testing/leak_count_allocator.zig @@ -0,0 +1,46 @@ +const std = @import("../std.zig"); + +/// This allocator is used in front of another allocator and counts the numbers of allocs and frees. +/// The test runner asserts every alloc has a corresponding free at the end of each test. +/// +/// The detection algorithm is incredibly primitive and only accounts for number of calls. +/// This should be replaced by the general purpose debug allocator. +pub const LeakCountAllocator = struct { + count: usize, + allocator: std.mem.Allocator, + internal_allocator: *std.mem.Allocator, + + pub fn init(allocator: *std.mem.Allocator) LeakCountAllocator { + return .{ + .count = 0, + .allocator = .{ + .reallocFn = realloc, + .shrinkFn = shrink, + }, + .internal_allocator = allocator, + }; + } + + fn realloc(allocator: *std.mem.Allocator, old_mem: []u8, old_align: u29, new_size: usize, new_align: u29) ![]u8 { + const self = @fieldParentPtr(LeakCountAllocator, "allocator", allocator); + if (old_mem.len == 0) { + self.count += 1; + } + return self.internal_allocator.reallocFn(self.internal_allocator, old_mem, old_align, new_size, new_align); + } + + fn shrink(allocator: *std.mem.Allocator, old_mem: []u8, old_align: u29, new_size: usize, new_align: u29) []u8 { + const self = @fieldParentPtr(LeakCountAllocator, "allocator", allocator); + if (new_size == 0) { + self.count -= 1; + } + return self.internal_allocator.shrinkFn(self.internal_allocator, old_mem, old_align, new_size, new_align); + } + + pub fn validate(self: LeakCountAllocator) !void { + if (self.count > 0) { + std.debug.warn("Detected leaked allocations without matching free: {}\n", .{self.count}); + return error.Leak; + } + } +}; diff --git a/lib/std/zig/parser_test.zig b/lib/std/zig/parser_test.zig index c57540ade..1640d0999 100644 --- a/lib/std/zig/parser_test.zig +++ b/lib/std/zig/parser_test.zig @@ -2773,7 +2773,7 @@ fn testTransform(source: []const u8, expected_source: []const u8) !void { const needed_alloc_count = x: { // Try it once with unlimited memory, make sure it works var fixed_allocator = std.heap.FixedBufferAllocator.init(fixed_buffer_mem[0..]); - var failing_allocator = std.debug.FailingAllocator.init(&fixed_allocator.allocator, maxInt(usize)); + var failing_allocator = std.testing.FailingAllocator.init(&fixed_allocator.allocator, maxInt(usize)); var anything_changed: bool = undefined; const result_source = try testParse(source, &failing_allocator.allocator, &anything_changed); if (!mem.eql(u8, result_source, expected_source)) { @@ -2797,7 +2797,7 @@ fn testTransform(source: []const u8, expected_source: []const u8) !void { var fail_index: usize = 0; while (fail_index < needed_alloc_count) : (fail_index += 1) { var fixed_allocator = std.heap.FixedBufferAllocator.init(fixed_buffer_mem[0..]); - var failing_allocator = std.debug.FailingAllocator.init(&fixed_allocator.allocator, fail_index); + var failing_allocator = std.testing.FailingAllocator.init(&fixed_allocator.allocator, fail_index); var anything_changed: bool = undefined; if (testParse(source, &failing_allocator.allocator, &anything_changed)) |_| { return error.NondeterministicMemoryUsage; From 70ad84c8209ae7ab14472f77f9452820bc47c30e Mon Sep 17 00:00:00 2001 From: Benjamin Feng Date: Wed, 29 Jan 2020 17:38:52 -0600 Subject: [PATCH 15/60] Use defer/panic to better account for test failure --- lib/std/special/test_runner.zig | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/std/special/test_runner.zig b/lib/std/special/test_runner.zig index e519f7f76..a5bbfff6f 100644 --- a/lib/std/special/test_runner.zig +++ b/lib/std/special/test_runner.zig @@ -14,6 +14,11 @@ pub fn main() anyerror!void { for (test_fn_list) |test_fn, i| { std.testing.allocator_instance.reset(); + defer { + std.testing.leak_count_allocator_instance.validate() catch |err| { + @panic(@errorName(err)); + }; + } var test_node = root_node.start(test_fn.name, null); test_node.activate(); @@ -37,8 +42,6 @@ pub fn main() anyerror!void { return err; }, } - - try std.testing.leak_count_allocator_instance.validate(); } root_node.end(); if (ok_count == test_fn_list.len) { From b077f3ab7d55374d2770336db236ecd7b18238a8 Mon Sep 17 00:00:00 2001 From: Benjamin Feng Date: Wed, 29 Jan 2020 21:22:01 -0600 Subject: [PATCH 16/60] Promoted "leak_count_allocator" to the main testing.allocator --- doc/docgen.zig | 4 +-- lib/std/array_list.zig | 14 ++++---- lib/std/buffer.zig | 6 ++-- lib/std/debug.zig | 2 +- lib/std/fifo.zig | 4 +-- lib/std/fmt.zig | 10 +++--- lib/std/fs/path.zig | 32 +++++++++---------- lib/std/linked_list.zig | 6 ++-- lib/std/os/test.zig | 2 +- lib/std/priority_queue.zig | 28 ++++++++-------- lib/std/process.zig | 10 +++--- lib/std/special/test_runner.zig | 7 ++-- lib/std/testing.zig | 16 +++++----- lib/std/testing/leak_count_allocator.zig | 2 +- lib/std/unicode.zig | 24 +++++++------- lib/std/zig/ast.zig | 2 +- test/compare_output.zig | 4 +-- test/compile_errors.zig | 2 +- test/stage1/behavior/const_slice_child.zig | 4 +-- test/standalone/brace_expansion/main.zig | 4 +-- test/standalone/cat/main.zig | 2 +- test/standalone/empty_env/main.zig | 2 +- test/standalone/load_dynamic_library/main.zig | 4 +-- 23 files changed, 96 insertions(+), 95 deletions(-) diff --git a/doc/docgen.zig b/doc/docgen.zig index cc4993d65..e94f3500e 100644 --- a/doc/docgen.zig +++ b/doc/docgen.zig @@ -672,8 +672,8 @@ const TermState = enum { test "term color" { const input_bytes = "A\x1b[32;1mgreen\x1b[0mB"; - const result = try termColor(std.testing.leak_count_allocator, input_bytes); - defer std.testing.leak_count_allocator.free(result); + const result = try termColor(std.testing.allocator, input_bytes); + defer std.testing.allocator.free(result); testing.expectEqualSlices(u8, "AgreenB", result); } diff --git a/lib/std/array_list.zig b/lib/std/array_list.zig index 57c0d706a..b02839046 100644 --- a/lib/std/array_list.zig +++ b/lib/std/array_list.zig @@ -320,7 +320,7 @@ test "std.ArrayList.basic" { } test "std.ArrayList.orderedRemove" { - var list = ArrayList(i32).init(testing.leak_count_allocator); + var list = ArrayList(i32).init(testing.allocator); defer list.deinit(); try list.append(1); @@ -347,7 +347,7 @@ test "std.ArrayList.orderedRemove" { } test "std.ArrayList.swapRemove" { - var list = ArrayList(i32).init(testing.leak_count_allocator); + var list = ArrayList(i32).init(testing.allocator); defer list.deinit(); try list.append(1); @@ -374,7 +374,7 @@ test "std.ArrayList.swapRemove" { } test "std.ArrayList.swapRemoveOrError" { - var list = ArrayList(i32).init(testing.leak_count_allocator); + var list = ArrayList(i32).init(testing.allocator); defer list.deinit(); // Test just after initialization @@ -402,7 +402,7 @@ test "std.ArrayList.swapRemoveOrError" { } test "std.ArrayList.insert" { - var list = ArrayList(i32).init(testing.leak_count_allocator); + var list = ArrayList(i32).init(testing.allocator); defer list.deinit(); try list.append(1); @@ -416,7 +416,7 @@ test "std.ArrayList.insert" { } test "std.ArrayList.insertSlice" { - var list = ArrayList(i32).init(testing.leak_count_allocator); + var list = ArrayList(i32).init(testing.allocator); defer list.deinit(); try list.append(1); @@ -443,8 +443,8 @@ const Item = struct { }; test "std.ArrayList: ArrayList(T) of struct T" { - var root = Item{ .integer = 1, .sub_items = ArrayList(Item).init(testing.leak_count_allocator) }; + var root = Item{ .integer = 1, .sub_items = ArrayList(Item).init(testing.allocator) }; defer root.sub_items.deinit(); - try root.sub_items.append(Item{ .integer = 42, .sub_items = ArrayList(Item).init(testing.leak_count_allocator) }); + try root.sub_items.append(Item{ .integer = 42, .sub_items = ArrayList(Item).init(testing.allocator) }); testing.expect(root.sub_items.items[0].integer == 42); } diff --git a/lib/std/buffer.zig b/lib/std/buffer.zig index cc1166e0e..077b2b615 100644 --- a/lib/std/buffer.zig +++ b/lib/std/buffer.zig @@ -150,7 +150,7 @@ pub const Buffer = struct { }; test "simple Buffer" { - var buf = try Buffer.init(testing.leak_count_allocator, ""); + var buf = try Buffer.init(testing.allocator, ""); defer buf.deinit(); testing.expect(buf.len() == 0); @@ -172,7 +172,7 @@ test "simple Buffer" { } test "Buffer.initSize" { - var buf = try Buffer.initSize(testing.leak_count_allocator, 3); + var buf = try Buffer.initSize(testing.allocator, 3); defer buf.deinit(); testing.expect(buf.len() == 3); try buf.append("hello"); @@ -180,7 +180,7 @@ test "Buffer.initSize" { } test "Buffer.initCapacity" { - var buf = try Buffer.initCapacity(testing.leak_count_allocator, 10); + var buf = try Buffer.initCapacity(testing.allocator, 10); defer buf.deinit(); testing.expect(buf.len() == 0); testing.expect(buf.capacity() >= 10); diff --git a/lib/std/debug.zig b/lib/std/debug.zig index 32aba0d9b..8468c4eaa 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -19,7 +19,7 @@ const windows = std.os.windows; pub const leb = @import("debug/leb128.zig"); -pub const global_allocator = @compileError("Please switch to std.testing.leak_count_allocator."); +pub const global_allocator = @compileError("Please switch to std.testing.allocator."); pub const failing_allocator = @compileError("Please switch to std.testing.failing_allocator."); pub const runtime_safety = switch (builtin.mode) { diff --git a/lib/std/fifo.zig b/lib/std/fifo.zig index dd429289d..ac8589f2c 100644 --- a/lib/std/fifo.zig +++ b/lib/std/fifo.zig @@ -347,7 +347,7 @@ pub fn LinearFifo( } test "LinearFifo(u8, .Dynamic)" { - var fifo = LinearFifo(u8, .Dynamic).init(testing.leak_count_allocator); + var fifo = LinearFifo(u8, .Dynamic).init(testing.allocator); defer fifo.deinit(); try fifo.write("HELLO"); @@ -422,7 +422,7 @@ test "LinearFifo" { var fifo = switch (bt) { .Static => FifoType.init(), .Slice => FifoType.init(buf[0..]), - .Dynamic => FifoType.init(testing.leak_count_allocator), + .Dynamic => FifoType.init(testing.allocator), }; defer fifo.deinit(); diff --git a/lib/std/fmt.zig b/lib/std/fmt.zig index 529131065..627d8bc7a 100644 --- a/lib/std/fmt.zig +++ b/lib/std/fmt.zig @@ -1598,7 +1598,7 @@ test "hexToBytes" { test "formatIntValue with comptime_int" { const value: comptime_int = 123456789123456789; - var buf = try std.Buffer.init(std.testing.leak_count_allocator, ""); + var buf = try std.Buffer.init(std.testing.allocator, ""); defer buf.deinit(); try formatIntValue(value, "", FormatOptions{}, &buf, @TypeOf(std.Buffer.append).ReturnType.ErrorSet, std.Buffer.append); std.testing.expect(mem.eql(u8, buf.toSlice(), "123456789123456789")); @@ -1653,22 +1653,22 @@ test "formatType max_depth" { inst.a = &inst; inst.tu.ptr = &inst.tu; - var buf0 = try std.Buffer.init(std.testing.leak_count_allocator, ""); + var buf0 = try std.Buffer.init(std.testing.allocator, ""); defer buf0.deinit(); try formatType(inst, "", FormatOptions{}, &buf0, @TypeOf(std.Buffer.append).ReturnType.ErrorSet, std.Buffer.append, 0); std.testing.expect(mem.eql(u8, buf0.toSlice(), "S{ ... }")); - var buf1 = try std.Buffer.init(std.testing.leak_count_allocator, ""); + var buf1 = try std.Buffer.init(std.testing.allocator, ""); defer buf1.deinit(); try formatType(inst, "", FormatOptions{}, &buf1, @TypeOf(std.Buffer.append).ReturnType.ErrorSet, std.Buffer.append, 1); std.testing.expect(mem.eql(u8, buf1.toSlice(), "S{ .a = S{ ... }, .tu = TU{ ... }, .e = E.Two, .vec = (10.200,2.220) }")); - var buf2 = try std.Buffer.init(std.testing.leak_count_allocator, ""); + var buf2 = try std.Buffer.init(std.testing.allocator, ""); defer buf2.deinit(); try formatType(inst, "", FormatOptions{}, &buf2, @TypeOf(std.Buffer.append).ReturnType.ErrorSet, std.Buffer.append, 2); std.testing.expect(mem.eql(u8, buf2.toSlice(), "S{ .a = S{ .a = S{ ... }, .tu = TU{ ... }, .e = E.Two, .vec = (10.200,2.220) }, .tu = TU{ .ptr = TU{ ... } }, .e = E.Two, .vec = (10.200,2.220) }")); - var buf3 = try std.Buffer.init(std.testing.leak_count_allocator, ""); + var buf3 = try std.Buffer.init(std.testing.allocator, ""); defer buf3.deinit(); try formatType(inst, "", FormatOptions{}, &buf3, @TypeOf(std.Buffer.append).ReturnType.ErrorSet, std.Buffer.append, 3); std.testing.expect(mem.eql(u8, buf3.toSlice(), "S{ .a = S{ .a = S{ .a = S{ ... }, .tu = TU{ ... }, .e = E.Two, .vec = (10.200,2.220) }, .tu = TU{ .ptr = TU{ ... } }, .e = E.Two, .vec = (10.200,2.220) }, .tu = TU{ .ptr = TU{ .ptr = TU{ ... } } }, .e = E.Two, .vec = (10.200,2.220) }")); diff --git a/lib/std/fs/path.zig b/lib/std/fs/path.zig index 424e9f575..66e24a480 100644 --- a/lib/std/fs/path.zig +++ b/lib/std/fs/path.zig @@ -665,8 +665,8 @@ pub fn resolvePosix(allocator: *Allocator, paths: []const []const u8) ![]u8 { } test "resolve" { - const cwd = try process.getCwdAlloc(testing.leak_count_allocator); - defer testing.leak_count_allocator.free(cwd); + const cwd = try process.getCwdAlloc(testing.allocator); + defer testing.allocator.free(cwd); if (builtin.os == .windows) { if (windowsParsePath(cwd).kind == WindowsPath.Kind.Drive) { cwd[0] = asciiUpper(cwd[0]); @@ -684,26 +684,26 @@ test "resolveWindows" { return error.SkipZigTest; } if (builtin.os == .windows) { - const cwd = try process.getCwdAlloc(testing.leak_count_allocator); - defer testing.leak_count_allocator.free(cwd); + const cwd = try process.getCwdAlloc(testing.allocator); + defer testing.allocator.free(cwd); const parsed_cwd = windowsParsePath(cwd); { - const expected = try join(testing.leak_count_allocator, &[_][]const u8{ + const expected = try join(testing.allocator, &[_][]const u8{ parsed_cwd.disk_designator, "usr\\local\\lib\\zig\\std\\array_list.zig", }); - defer testing.leak_count_allocator.free(expected); + defer testing.allocator.free(expected); if (parsed_cwd.kind == WindowsPath.Kind.Drive) { expected[0] = asciiUpper(parsed_cwd.disk_designator[0]); } try testResolveWindows(&[_][]const u8{ "/usr/local", "lib\\zig\\std\\array_list.zig" }, expected); } { - const expected = try join(testing.leak_count_allocator, &[_][]const u8{ + const expected = try join(testing.allocator, &[_][]const u8{ cwd, "usr\\local\\lib\\zig", }); - defer testing.leak_count_allocator.free(expected); + defer testing.allocator.free(expected); if (parsed_cwd.kind == WindowsPath.Kind.Drive) { expected[0] = asciiUpper(parsed_cwd.disk_designator[0]); } @@ -740,14 +740,14 @@ test "resolvePosix" { } fn testResolveWindows(paths: []const []const u8, expected: []const u8) !void { - const actual = try resolveWindows(testing.leak_count_allocator, paths); - defer testing.leak_count_allocator.free(actual); + const actual = try resolveWindows(testing.allocator, paths); + defer testing.allocator.free(actual); return testing.expect(mem.eql(u8, actual, expected)); } fn testResolvePosix(paths: []const []const u8, expected: []const u8) !void { - const actual = try resolvePosix(testing.leak_count_allocator, paths); - defer testing.leak_count_allocator.free(actual); + const actual = try resolvePosix(testing.allocator, paths); + defer testing.allocator.free(actual); return testing.expect(mem.eql(u8, actual, expected)); } @@ -1172,13 +1172,13 @@ test "relative" { } fn testRelativePosix(from: []const u8, to: []const u8, expected_output: []const u8) !void { - const result = try relativePosix(testing.leak_count_allocator, from, to); - defer testing.leak_count_allocator.free(result); + const result = try relativePosix(testing.allocator, from, to); + defer testing.allocator.free(result); testing.expectEqualSlices(u8, expected_output, result); } fn testRelativeWindows(from: []const u8, to: []const u8, expected_output: []const u8) !void { - const result = try relativeWindows(testing.leak_count_allocator, from, to); - defer testing.leak_count_allocator.free(result); + const result = try relativeWindows(testing.allocator, from, to); + defer testing.allocator.free(result); testing.expectEqualSlices(u8, expected_output, result); } diff --git a/lib/std/linked_list.zig b/lib/std/linked_list.zig index d1652a804..a21c9a83e 100644 --- a/lib/std/linked_list.zig +++ b/lib/std/linked_list.zig @@ -143,7 +143,7 @@ pub fn SinglyLinkedList(comptime T: type) type { } test "basic SinglyLinkedList test" { - const allocator = testing.leak_count_allocator; + const allocator = testing.allocator; var list = SinglyLinkedList(u32).init(); var one = try list.createNode(1, allocator); @@ -404,7 +404,7 @@ pub fn TailQueue(comptime T: type) type { } test "basic TailQueue test" { - const allocator = testing.leak_count_allocator; + const allocator = testing.allocator; var list = TailQueue(u32).init(); var one = try list.createNode(1, allocator); @@ -456,7 +456,7 @@ test "basic TailQueue test" { } test "TailQueue concatenation" { - const allocator = testing.leak_count_allocator; + const allocator = testing.allocator; var list1 = TailQueue(u32).init(); var list2 = TailQueue(u32).init(); diff --git a/lib/std/os/test.zig b/lib/std/os/test.zig index 2e60fe500..0d3be9e7e 100644 --- a/lib/std/os/test.zig +++ b/lib/std/os/test.zig @@ -9,7 +9,7 @@ const elf = std.elf; const File = std.fs.File; const Thread = std.Thread; -const a = std.testing.leak_count_allocator; +const a = std.testing.allocator; const builtin = @import("builtin"); const AtomicRmwOp = builtin.AtomicRmwOp; diff --git a/lib/std/priority_queue.zig b/lib/std/priority_queue.zig index 9c07d2079..e726a07a8 100644 --- a/lib/std/priority_queue.zig +++ b/lib/std/priority_queue.zig @@ -239,7 +239,7 @@ fn greaterThan(a: u32, b: u32) bool { const PQ = PriorityQueue(u32); test "std.PriorityQueue: add and remove min heap" { - var queue = PQ.init(testing.leak_count_allocator, lessThan); + var queue = PQ.init(testing.allocator, lessThan); defer queue.deinit(); try queue.add(54); @@ -257,7 +257,7 @@ test "std.PriorityQueue: add and remove min heap" { } test "std.PriorityQueue: add and remove same min heap" { - var queue = PQ.init(testing.leak_count_allocator, lessThan); + var queue = PQ.init(testing.allocator, lessThan); defer queue.deinit(); try queue.add(1); @@ -275,14 +275,14 @@ test "std.PriorityQueue: add and remove same min heap" { } test "std.PriorityQueue: removeOrNull on empty" { - var queue = PQ.init(testing.leak_count_allocator, lessThan); + var queue = PQ.init(testing.allocator, lessThan); defer queue.deinit(); expect(queue.removeOrNull() == null); } test "std.PriorityQueue: edge case 3 elements" { - var queue = PQ.init(testing.leak_count_allocator, lessThan); + var queue = PQ.init(testing.allocator, lessThan); defer queue.deinit(); try queue.add(9); @@ -294,7 +294,7 @@ test "std.PriorityQueue: edge case 3 elements" { } test "std.PriorityQueue: peek" { - var queue = PQ.init(testing.leak_count_allocator, lessThan); + var queue = PQ.init(testing.allocator, lessThan); defer queue.deinit(); expect(queue.peek() == null); @@ -306,7 +306,7 @@ test "std.PriorityQueue: peek" { } test "std.PriorityQueue: sift up with odd indices" { - var queue = PQ.init(testing.leak_count_allocator, lessThan); + var queue = PQ.init(testing.allocator, lessThan); defer queue.deinit(); const items = [_]u32{ 15, 7, 21, 14, 13, 22, 12, 6, 7, 25, 5, 24, 11, 16, 15, 24, 2, 1 }; for (items) |e| { @@ -320,7 +320,7 @@ test "std.PriorityQueue: sift up with odd indices" { } test "std.PriorityQueue: addSlice" { - var queue = PQ.init(testing.leak_count_allocator, lessThan); + var queue = PQ.init(testing.allocator, lessThan); defer queue.deinit(); const items = [_]u32{ 15, 7, 21, 14, 13, 22, 12, 6, 7, 25, 5, 24, 11, 16, 15, 24, 2, 1 }; try queue.addSlice(items[0..]); @@ -333,8 +333,8 @@ test "std.PriorityQueue: addSlice" { test "std.PriorityQueue: fromOwnedSlice" { const items = [_]u32{ 15, 7, 21, 14, 13, 22, 12, 6, 7, 25, 5, 24, 11, 16, 15, 24, 2, 1 }; - const heap_items = try std.mem.dupe(testing.leak_count_allocator, u32, items[0..]); - var queue = PQ.fromOwnedSlice(testing.leak_count_allocator, lessThan, heap_items[0..]); + const heap_items = try std.mem.dupe(testing.allocator, u32, items[0..]); + var queue = PQ.fromOwnedSlice(testing.allocator, lessThan, heap_items[0..]); defer queue.deinit(); const sorted_items = [_]u32{ 1, 2, 5, 6, 7, 7, 11, 12, 13, 14, 15, 15, 16, 21, 22, 24, 24, 25 }; @@ -344,7 +344,7 @@ test "std.PriorityQueue: fromOwnedSlice" { } test "std.PriorityQueue: add and remove max heap" { - var queue = PQ.init(testing.leak_count_allocator, greaterThan); + var queue = PQ.init(testing.allocator, greaterThan); defer queue.deinit(); try queue.add(54); @@ -362,7 +362,7 @@ test "std.PriorityQueue: add and remove max heap" { } test "std.PriorityQueue: add and remove same max heap" { - var queue = PQ.init(testing.leak_count_allocator, greaterThan); + var queue = PQ.init(testing.allocator, greaterThan); defer queue.deinit(); try queue.add(1); @@ -380,8 +380,8 @@ test "std.PriorityQueue: add and remove same max heap" { } test "std.PriorityQueue: iterator" { - var queue = PQ.init(testing.leak_count_allocator, lessThan); - var map = std.AutoHashMap(u32, void).init(testing.leak_count_allocator); + var queue = PQ.init(testing.allocator, lessThan); + var map = std.AutoHashMap(u32, void).init(testing.allocator); defer { queue.deinit(); map.deinit(); @@ -402,7 +402,7 @@ test "std.PriorityQueue: iterator" { } test "std.PriorityQueue: remove at index" { - var queue = PQ.init(testing.leak_count_allocator, lessThan); + var queue = PQ.init(testing.allocator, lessThan); defer queue.deinit(); try queue.add(3); diff --git a/lib/std/process.zig b/lib/std/process.zig index 19f0eac23..dd5e12465 100644 --- a/lib/std/process.zig +++ b/lib/std/process.zig @@ -114,7 +114,7 @@ pub fn getEnvMap(allocator: *Allocator) !BufMap { } test "os.getEnvMap" { - var env = try getEnvMap(std.testing.leak_count_allocator); + var env = try getEnvMap(std.testing.allocator); defer env.deinit(); } @@ -165,7 +165,7 @@ pub fn getEnvVarOwned(allocator: *mem.Allocator, key: []const u8) GetEnvVarOwned } test "os.getEnvVarOwned" { - var ga = std.testing.leak_count_allocator; + var ga = std.testing.allocator; testing.expectError(error.EnvironmentVariableNotFound, getEnvVarOwned(ga, "BADENV")); } @@ -492,11 +492,11 @@ test "windows arg parsing" { fn testWindowsCmdLine(input_cmd_line: [*]const u8, expected_args: []const []const u8) void { var it = ArgIteratorWindows.initWithCmdLine(input_cmd_line); for (expected_args) |expected_arg| { - const arg = it.next(std.testing.leak_count_allocator).? catch unreachable; - defer std.testing.leak_count_allocator.free(arg); + const arg = it.next(std.testing.allocator).? catch unreachable; + defer std.testing.allocator.free(arg); testing.expectEqualSlices(u8, expected_arg, arg); } - testing.expect(it.next(std.testing.leak_count_allocator) == null); + testing.expect(it.next(std.testing.allocator) == null); } pub const UserInfo = struct { diff --git a/lib/std/special/test_runner.zig b/lib/std/special/test_runner.zig index a5bbfff6f..9a2d68a73 100644 --- a/lib/std/special/test_runner.zig +++ b/lib/std/special/test_runner.zig @@ -13,10 +13,11 @@ pub fn main() anyerror!void { }; for (test_fn_list) |test_fn, i| { - std.testing.allocator_instance.reset(); + std.testing.base_allocator_instance.reset(); defer { - std.testing.leak_count_allocator_instance.validate() catch |err| { - @panic(@errorName(err)); + std.testing.allocator_instance.validate() catch |err| switch (err) { + error.Leak => std.debug.panic("", .{}), + else => std.debug.panic("error.{}", .{@errorName(err)}), }; } diff --git a/lib/std/testing.zig b/lib/std/testing.zig index 07479a385..4850f2e9b 100644 --- a/lib/std/testing.zig +++ b/lib/std/testing.zig @@ -2,18 +2,18 @@ const builtin = @import("builtin"); const TypeId = builtin.TypeId; const std = @import("std.zig"); +pub const LeakCountAllocator = @import("testing/leak_count_allocator.zig").LeakCountAllocator; +pub const FailingAllocator = @import("testing/failing_allocator.zig").FailingAllocator; + /// This should only be used in temporary test programs. pub const allocator = &allocator_instance.allocator; -pub var allocator_instance = std.heap.ThreadSafeFixedBufferAllocator.init(allocator_mem[0..]); +pub var allocator_instance = LeakCountAllocator.init(&base_allocator_instance.allocator); + +pub const failing_allocator = &FailingAllocator.init(&base_allocator_instance.allocator, 0).allocator; + +pub var base_allocator_instance = std.heap.ThreadSafeFixedBufferAllocator.init(allocator_mem[0..]); var allocator_mem: [100 * 1024]u8 = undefined; -pub const FailingAllocator = @import("testing/failing_allocator.zig").FailingAllocator; -pub const failing_allocator = &FailingAllocator.init(allocator, 0).allocator; - -pub const LeakCountAllocator = @import("testing/leak_count_allocator.zig").LeakCountAllocator; -pub var leak_count_allocator_instance = LeakCountAllocator.init(allocator); -pub const leak_count_allocator = &leak_count_allocator_instance.allocator; - /// This function is intended to be used only in tests. It prints diagnostics to stderr /// and then aborts when actual_error_union is not expected_error. pub fn expectError(expected_error: anyerror, actual_error_union: var) void { diff --git a/lib/std/testing/leak_count_allocator.zig b/lib/std/testing/leak_count_allocator.zig index 84c324817..6cdcfa267 100644 --- a/lib/std/testing/leak_count_allocator.zig +++ b/lib/std/testing/leak_count_allocator.zig @@ -39,7 +39,7 @@ pub const LeakCountAllocator = struct { pub fn validate(self: LeakCountAllocator) !void { if (self.count > 0) { - std.debug.warn("Detected leaked allocations without matching free: {}\n", .{self.count}); + std.debug.warn("error - detected leaked allocations without matching free: {}\n", .{self.count}); return error.Leak; } } diff --git a/lib/std/unicode.zig b/lib/std/unicode.zig index 188479683..77783c3ed 100644 --- a/lib/std/unicode.zig +++ b/lib/std/unicode.zig @@ -501,16 +501,16 @@ test "utf16leToUtf8" { { mem.writeIntSliceLittle(u16, utf16le_as_bytes[0..], 'A'); mem.writeIntSliceLittle(u16, utf16le_as_bytes[2..], 'a'); - const utf8 = try utf16leToUtf8Alloc(std.testing.leak_count_allocator, &utf16le); - defer std.testing.leak_count_allocator.free(utf8); + const utf8 = try utf16leToUtf8Alloc(std.testing.allocator, &utf16le); + defer std.testing.allocator.free(utf8); testing.expect(mem.eql(u8, utf8, "Aa")); } { mem.writeIntSliceLittle(u16, utf16le_as_bytes[0..], 0x80); mem.writeIntSliceLittle(u16, utf16le_as_bytes[2..], 0xffff); - const utf8 = try utf16leToUtf8Alloc(std.testing.leak_count_allocator, &utf16le); - defer std.testing.leak_count_allocator.free(utf8); + const utf8 = try utf16leToUtf8Alloc(std.testing.allocator, &utf16le); + defer std.testing.allocator.free(utf8); testing.expect(mem.eql(u8, utf8, "\xc2\x80" ++ "\xef\xbf\xbf")); } @@ -518,8 +518,8 @@ test "utf16leToUtf8" { // the values just outside the surrogate half range mem.writeIntSliceLittle(u16, utf16le_as_bytes[0..], 0xd7ff); mem.writeIntSliceLittle(u16, utf16le_as_bytes[2..], 0xe000); - const utf8 = try utf16leToUtf8Alloc(std.testing.leak_count_allocator, &utf16le); - defer std.testing.leak_count_allocator.free(utf8); + const utf8 = try utf16leToUtf8Alloc(std.testing.allocator, &utf16le); + defer std.testing.allocator.free(utf8); testing.expect(mem.eql(u8, utf8, "\xed\x9f\xbf" ++ "\xee\x80\x80")); } @@ -527,8 +527,8 @@ test "utf16leToUtf8" { // smallest surrogate pair mem.writeIntSliceLittle(u16, utf16le_as_bytes[0..], 0xd800); mem.writeIntSliceLittle(u16, utf16le_as_bytes[2..], 0xdc00); - const utf8 = try utf16leToUtf8Alloc(std.testing.leak_count_allocator, &utf16le); - defer std.testing.leak_count_allocator.free(utf8); + const utf8 = try utf16leToUtf8Alloc(std.testing.allocator, &utf16le); + defer std.testing.allocator.free(utf8); testing.expect(mem.eql(u8, utf8, "\xf0\x90\x80\x80")); } @@ -536,16 +536,16 @@ test "utf16leToUtf8" { // largest surrogate pair mem.writeIntSliceLittle(u16, utf16le_as_bytes[0..], 0xdbff); mem.writeIntSliceLittle(u16, utf16le_as_bytes[2..], 0xdfff); - const utf8 = try utf16leToUtf8Alloc(std.testing.leak_count_allocator, &utf16le); - defer std.testing.leak_count_allocator.free(utf8); + const utf8 = try utf16leToUtf8Alloc(std.testing.allocator, &utf16le); + defer std.testing.allocator.free(utf8); testing.expect(mem.eql(u8, utf8, "\xf4\x8f\xbf\xbf")); } { mem.writeIntSliceLittle(u16, utf16le_as_bytes[0..], 0xdbff); mem.writeIntSliceLittle(u16, utf16le_as_bytes[2..], 0xdc00); - const utf8 = try utf16leToUtf8Alloc(std.testing.leak_count_allocator, &utf16le); - defer std.testing.leak_count_allocator.free(utf8); + const utf8 = try utf16leToUtf8Alloc(std.testing.allocator, &utf16le); + defer std.testing.allocator.free(utf8); testing.expect(mem.eql(u8, utf8, "\xf4\x8f\xb0\x80")); } } diff --git a/lib/std/zig/ast.zig b/lib/std/zig/ast.zig index c967c7878..e33934382 100644 --- a/lib/std/zig/ast.zig +++ b/lib/std/zig/ast.zig @@ -2287,7 +2287,7 @@ pub const Node = struct { test "iterate" { var root = Node.Root{ .base = Node{ .id = Node.Id.Root }, - .decls = Node.Root.DeclList.init(std.testing.leak_count_allocator), + .decls = Node.Root.DeclList.init(std.testing.allocator), .eof_token = 0, }; var base = &root.base; diff --git a/test/compare_output.zig b/test/compare_output.zig index d743e0784..7a41d46f5 100644 --- a/test/compare_output.zig +++ b/test/compare_output.zig @@ -445,7 +445,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { \\const std = @import("std"); \\const io = std.io; \\const os = std.os; - \\const allocator = std.testing.leak_count_allocator; + \\const allocator = std.testing.allocator; \\ \\pub fn main() !void { \\ var args_it = std.process.args(); @@ -486,7 +486,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { \\const std = @import("std"); \\const io = std.io; \\const os = std.os; - \\const allocator = std.testing.leak_count_allocator; + \\const allocator = std.testing.allocator; \\ \\pub fn main() !void { \\ var args_it = std.process.args(); diff --git a/test/compile_errors.zig b/test/compile_errors.zig index 2f3f0a9f1..341062e16 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -5765,7 +5765,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { \\ \\export fn entry() void { \\ const a = MdNode.Header { - \\ .text = MdText.init(&std.testing.leak_count_allocator), + \\ .text = MdText.init(&std.testing.allocator), \\ .weight = HeaderWeight.H1, \\ }; \\} diff --git a/test/stage1/behavior/const_slice_child.zig b/test/stage1/behavior/const_slice_child.zig index 7d969ae46..92e512102 100644 --- a/test/stage1/behavior/const_slice_child.zig +++ b/test/stage1/behavior/const_slice_child.zig @@ -23,8 +23,8 @@ fn foo(args: [][]const u8) void { } fn bar(argc: usize) void { - const args = testing.leak_count_allocator.alloc([]const u8, argc) catch unreachable; - defer testing.leak_count_allocator.free(args); + const args = testing.allocator.alloc([]const u8, argc) catch unreachable; + defer testing.allocator.free(args); for (args) |_, i| { const ptr = argv[i]; args[i] = ptr[0..strlen(ptr)]; diff --git a/test/standalone/brace_expansion/main.zig b/test/standalone/brace_expansion/main.zig index 33fe826d1..c6bfd02e7 100644 --- a/test/standalone/brace_expansion/main.zig +++ b/test/standalone/brace_expansion/main.zig @@ -201,7 +201,7 @@ pub fn main() !void { } test "invalid inputs" { - global_allocator = std.testing.leak_count_allocator; + global_allocator = std.testing.allocator; expectError("}ABC", error.InvalidInput); expectError("{ABC", error.InvalidInput); @@ -222,7 +222,7 @@ fn expectError(test_input: []const u8, expected_err: anyerror) void { } test "valid inputs" { - global_allocator = std.testing.leak_count_allocator; + global_allocator = std.testing.allocator; expectExpansion("{x,y,z}", "x y z"); expectExpansion("{A,B}{x,y}", "Ax Ay Bx By"); diff --git a/test/standalone/cat/main.zig b/test/standalone/cat/main.zig index 10ec00d6e..34439f9c2 100644 --- a/test/standalone/cat/main.zig +++ b/test/standalone/cat/main.zig @@ -4,7 +4,7 @@ const process = std.process; const fs = std.fs; const mem = std.mem; const warn = std.debug.warn; -const allocator = std.testing.leak_count_allocator; +const allocator = std.testing.allocator; pub fn main() !void { var args_it = process.args(); diff --git a/test/standalone/empty_env/main.zig b/test/standalone/empty_env/main.zig index dc2ac7373..f4ebf5613 100644 --- a/test/standalone/empty_env/main.zig +++ b/test/standalone/empty_env/main.zig @@ -1,6 +1,6 @@ const std = @import("std"); pub fn main() void { - const env_map = std.process.getEnvMap(std.testing.leak_count_allocator) catch @panic("unable to get env map"); + const env_map = std.process.getEnvMap(std.testing.allocator) catch @panic("unable to get env map"); std.testing.expect(env_map.count() == 0); } diff --git a/test/standalone/load_dynamic_library/main.zig b/test/standalone/load_dynamic_library/main.zig index 5a2e55e93..70fc4986a 100644 --- a/test/standalone/load_dynamic_library/main.zig +++ b/test/standalone/load_dynamic_library/main.zig @@ -1,8 +1,8 @@ const std = @import("std"); pub fn main() !void { - const args = try std.process.argsAlloc(std.testing.leak_count_allocator); - defer std.process.argsFree(std.testing.leak_count_allocator, args); + const args = try std.process.argsAlloc(std.testing.allocator); + defer std.process.argsFree(std.testing.allocator, args); const dynlib_name = args[1]; From 898ef82d65af9a00aadc7ed63e5e1c0bc6c52bde Mon Sep 17 00:00:00 2001 From: Benjamin Feng Date: Wed, 29 Jan 2020 21:35:08 -0600 Subject: [PATCH 17/60] Patch in arena to cleanup leaks --- test/standalone/brace_expansion/main.zig | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/standalone/brace_expansion/main.zig b/test/standalone/brace_expansion/main.zig index c6bfd02e7..e1d2ee667 100644 --- a/test/standalone/brace_expansion/main.zig +++ b/test/standalone/brace_expansion/main.zig @@ -201,7 +201,10 @@ pub fn main() !void { } test "invalid inputs" { - global_allocator = std.testing.allocator; + var arena = std.heap.ArenaAllocator.init(std.testing.allocator); + defer arena.deinit(); + + global_allocator = &arena.allocator; expectError("}ABC", error.InvalidInput); expectError("{ABC", error.InvalidInput); @@ -222,7 +225,10 @@ fn expectError(test_input: []const u8, expected_err: anyerror) void { } test "valid inputs" { - global_allocator = std.testing.allocator; + var arena = std.heap.ArenaAllocator.init(std.testing.allocator); + defer arena.deinit(); + + global_allocator = &arena.allocator; expectExpansion("{x,y,z}", "x y z"); expectExpansion("{A,B}{x,y}", "Ax Ay Bx By"); From 837877ea373d295cb30c4c1f4ebc2ff561d52a79 Mon Sep 17 00:00:00 2001 From: Benjamin Feng Date: Wed, 29 Jan 2020 21:39:08 -0600 Subject: [PATCH 18/60] Update docs to reflect new testing.allocator usage --- doc/langref.html.in | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/doc/langref.html.in b/doc/langref.html.in index 6789b25a6..47f13f9e0 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -5359,7 +5359,7 @@ const std = @import("std"); const assert = std.debug.assert; test "turn HashMap into a set with void" { - var map = std.HashMap(i32, void, hash_i32, eql_i32).init(std.debug.global_allocator); + var map = std.HashMap(i32, void, hash_i32, eql_i32).init(std.testing.allocator); defer map.deinit(); _ = try map.put(1, {}); @@ -9281,9 +9281,8 @@ fn concat(allocator: *Allocator, a: []const u8, b: []const u8) ![]u8 { In the above example, 100 bytes of stack memory are used to initialize a {#syntax#}FixedBufferAllocator{#endsyntax#}, which is then passed to a function. As a convenience there is a global {#syntax#}FixedBufferAllocator{#endsyntax#} - available for quick tests at {#syntax#}std.debug.global_allocator{#endsyntax#}, - however it is deprecated and should be avoided in favor of directly using a - {#syntax#}FixedBufferAllocator{#endsyntax#} as in the example above. + available for quick tests at {#syntax#}std.testing.allocator{#endsyntax#}, + which will also do perform basic leak detection.

Currently Zig has no general purpose allocator, but there is @@ -9341,7 +9340,7 @@ pub fn main() !void {

  • Are you writing a test, and you want to make sure {#syntax#}error.OutOfMemory{#endsyntax#} - is handled correctly? In this case, use {#syntax#}std.debug.FailingAllocator{#endsyntax#}. + is handled correctly? In this case, use {#syntax#}std.testing.FailingAllocator{#endsyntax#}.
  • Finally, if none of the above apply, you need a general purpose allocator. Zig does not From ad93ad3e6077cdaa7111c7aefbfb1305ae3edfb5 Mon Sep 17 00:00:00 2001 From: Benjamin Feng Date: Wed, 29 Jan 2020 21:46:06 -0600 Subject: [PATCH 19/60] Fix errant reference to page_allocator --- lib/std/process.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/std/process.zig b/lib/std/process.zig index dd5e12465..ca5ca3a3b 100644 --- a/lib/std/process.zig +++ b/lib/std/process.zig @@ -79,7 +79,7 @@ pub fn getEnvMap(allocator: *Allocator) !BufMap { // https://github.com/WebAssembly/WASI/issues/27 var environ = try allocator.alloc(?[*:0]u8, environ_count + 1); defer allocator.free(environ); - var environ_buf = try std.heap.page_allocator.alloc(u8, environ_buf_size); + var environ_buf = try allocator.alloc(u8, environ_buf_size); defer allocator.free(environ_buf); const environ_get_ret = os.wasi.environ_get(environ.ptr, environ_buf.ptr); From b7a236d68e042ffcf2b0642e951ecca33ed842a4 Mon Sep 17 00:00:00 2001 From: Benjamin Feng Date: Wed, 29 Jan 2020 22:06:26 -0600 Subject: [PATCH 20/60] Convert a bunch of page_allocator to testing.allocator --- lib/std/buf_map.zig | 1 + lib/std/buf_set.zig | 2 +- lib/std/build.zig | 3 +++ lib/std/hash/auto_hash.zig | 10 +++++----- lib/std/hash_map.zig | 6 +++--- lib/std/os/test.zig | 4 ++-- lib/std/packed_int_array.zig | 4 ++-- lib/std/segmented_list.zig | 2 +- src-self-hosted/c_tokenizer.zig | 4 ++-- test/stage1/behavior/async_fn.zig | 6 +++--- 10 files changed, 23 insertions(+), 19 deletions(-) diff --git a/lib/std/buf_map.zig b/lib/std/buf_map.zig index 06f00608b..df90025ba 100644 --- a/lib/std/buf_map.zig +++ b/lib/std/buf_map.zig @@ -83,6 +83,7 @@ pub const BufMap = struct { }; test "BufMap" { + // TODO: uncomment and fix the leak var bufmap = BufMap.init(std.heap.page_allocator); defer bufmap.deinit(); diff --git a/lib/std/buf_set.zig b/lib/std/buf_set.zig index 7ac8136e7..89df0478f 100644 --- a/lib/std/buf_set.zig +++ b/lib/std/buf_set.zig @@ -65,7 +65,7 @@ pub const BufSet = struct { }; test "BufSet" { - var bufset = BufSet.init(std.heap.page_allocator); + var bufset = BufSet.init(std.testing.allocator); defer bufset.deinit(); try bufset.put("x"); diff --git a/lib/std/build.zig b/lib/std/build.zig index d310f53c0..40dd4a348 100644 --- a/lib/std/build.zig +++ b/lib/std/build.zig @@ -1059,7 +1059,10 @@ pub const Builder = struct { }; test "builder.findProgram compiles" { + // TODO: uncomment and fix the leak + // const builder = try Builder.create(std.testing.allocator, "zig", "zig-cache", "zig-cache"); const builder = try Builder.create(std.heap.page_allocator, "zig", "zig-cache", "zig-cache"); + defer builder.destroy(); _ = builder.findProgram(&[_][]const u8{}, &[_][]const u8{}) catch null; } diff --git a/lib/std/hash/auto_hash.zig b/lib/std/hash/auto_hash.zig index e60a1c105..adde71875 100644 --- a/lib/std/hash/auto_hash.zig +++ b/lib/std/hash/auto_hash.zig @@ -234,8 +234,8 @@ test "hash pointer" { test "hash slice shallow" { // Allocate one array dynamically so that we're assured it is not merged // with the other by the optimization passes. - const array1 = try std.heap.page_allocator.create([6]u32); - defer std.heap.page_allocator.destroy(array1); + const array1 = try std.testing.allocator.create([6]u32); + defer std.testing.allocator.destroy(array1); array1.* = [_]u32{ 1, 2, 3, 4, 5, 6 }; const array2 = [_]u32{ 1, 2, 3, 4, 5, 6 }; const a = array1[0..]; @@ -250,8 +250,8 @@ test "hash slice shallow" { test "hash slice deep" { // Allocate one array dynamically so that we're assured it is not merged // with the other by the optimization passes. - const array1 = try std.heap.page_allocator.create([6]u32); - defer std.heap.page_allocator.destroy(array1); + const array1 = try std.testing.allocator.create([6]u32); + defer std.testing.allocator.destroy(array1); array1.* = [_]u32{ 1, 2, 3, 4, 5, 6 }; const array2 = [_]u32{ 1, 2, 3, 4, 5, 6 }; const a = array1[0..]; @@ -278,7 +278,7 @@ test "hash struct deep" { } }; - const allocator = std.heap.page_allocator; + const allocator = std.testing.allocator; const foo = try Foo.init(allocator, 123, 1.0, true); const bar = try Foo.init(allocator, 123, 1.0, true); const baz = try Foo.init(allocator, 123, 1.0, false); diff --git a/lib/std/hash_map.zig b/lib/std/hash_map.zig index 57a2f58b9..80ca218df 100644 --- a/lib/std/hash_map.zig +++ b/lib/std/hash_map.zig @@ -419,7 +419,7 @@ pub fn HashMap(comptime K: type, comptime V: type, comptime hash: fn (key: K) u3 } test "basic hash map usage" { - var map = AutoHashMap(i32, i32).init(std.heap.page_allocator); + var map = AutoHashMap(i32, i32).init(std.testing.allocator); defer map.deinit(); testing.expect((try map.put(1, 11)) == null); @@ -463,7 +463,7 @@ test "basic hash map usage" { } test "iterator hash map" { - var reset_map = AutoHashMap(i32, i32).init(std.heap.page_allocator); + var reset_map = AutoHashMap(i32, i32).init(std.testing.allocator); defer reset_map.deinit(); try reset_map.putNoClobber(1, 11); @@ -509,7 +509,7 @@ test "iterator hash map" { } test "ensure capacity" { - var map = AutoHashMap(i32, i32).init(std.heap.page_allocator); + var map = AutoHashMap(i32, i32).init(std.testing.allocator); defer map.deinit(); try map.ensureCapacity(20); diff --git a/lib/std/os/test.zig b/lib/std/os/test.zig index 0d3be9e7e..a872c03fd 100644 --- a/lib/std/os/test.zig +++ b/lib/std/os/test.zig @@ -235,8 +235,8 @@ test "pipe" { } test "argsAlloc" { - var args = try std.process.argsAlloc(std.heap.page_allocator); - std.process.argsFree(std.heap.page_allocator, args); + var args = try std.process.argsAlloc(std.testing.allocator); + std.process.argsFree(std.testing.allocator, args); } test "memfd_create" { diff --git a/lib/std/packed_int_array.zig b/lib/std/packed_int_array.zig index bc29e985b..3dfa55e74 100644 --- a/lib/std/packed_int_array.zig +++ b/lib/std/packed_int_array.zig @@ -604,7 +604,7 @@ test "PackedIntArray at end of available memory" { p: PackedArray, }; - const allocator = std.heap.page_allocator; + const allocator = std.testing.allocator; var pad = try allocator.create(Padded); defer allocator.destroy(pad); @@ -618,7 +618,7 @@ test "PackedIntSlice at end of available memory" { } const PackedSlice = PackedIntSlice(u11); - const allocator = std.heap.page_allocator; + const allocator = std.testing.allocator; var page = try allocator.alloc(u8, std.mem.page_size); defer allocator.free(page); diff --git a/lib/std/segmented_list.zig b/lib/std/segmented_list.zig index 80e4666b6..d7d137175 100644 --- a/lib/std/segmented_list.zig +++ b/lib/std/segmented_list.zig @@ -339,7 +339,7 @@ pub fn SegmentedList(comptime T: type, comptime prealloc_item_count: usize) type } test "std.SegmentedList" { - var a = std.heap.page_allocator; + var a = std.testing.allocator; try testSegmentedList(0, a); try testSegmentedList(1, a); diff --git a/src-self-hosted/c_tokenizer.zig b/src-self-hosted/c_tokenizer.zig index 7cff969c3..7e085bcf7 100644 --- a/src-self-hosted/c_tokenizer.zig +++ b/src-self-hosted/c_tokenizer.zig @@ -866,7 +866,7 @@ fn expectTokens(tl: *TokenList, src: [*:0]const u8, expected: []CToken) void { } test "tokenize macro" { - var tl = TokenList.init(std.heap.page_allocator); + var tl = TokenList.init(std.testing.allocator); defer tl.deinit(); expectTokens(&tl, "TEST(0\n", &[_]CToken{ @@ -904,7 +904,7 @@ test "tokenize macro" { } test "tokenize macro ops" { - var tl = TokenList.init(std.heap.page_allocator); + var tl = TokenList.init(std.testing.allocator); defer tl.deinit(); expectTokens(&tl, "ADD A + B", &[_]CToken{ diff --git a/test/stage1/behavior/async_fn.zig b/test/stage1/behavior/async_fn.zig index 1b21ba7ef..c7ea183b6 100644 --- a/test/stage1/behavior/async_fn.zig +++ b/test/stage1/behavior/async_fn.zig @@ -410,8 +410,8 @@ test "heap allocated async function frame" { var x: i32 = 42; fn doTheTest() !void { - const frame = try std.heap.page_allocator.create(@Frame(someFunc)); - defer std.heap.page_allocator.destroy(frame); + const frame = try std.testing.allocator.create(@Frame(someFunc)); + defer std.testing.allocator.destroy(frame); expect(x == 42); frame.* = async someFunc(); @@ -671,7 +671,7 @@ fn testAsyncAwaitTypicalUsage( } fn amain() !void { - const allocator = std.heap.page_allocator; // TODO once we have the debug allocator, use that, so that this can detect leaks + const allocator = std.testing.allocator; var download_frame = async fetchUrl(allocator, "https://example.com/"); var download_awaited = false; errdefer if (!download_awaited) { From 5c8e85f3884c581b17c8df1f19852189fe7c9412 Mon Sep 17 00:00:00 2001 From: Benjamin Feng Date: Wed, 29 Jan 2020 22:17:15 -0600 Subject: [PATCH 21/60] Fix BufMap value leak --- lib/std/buf_map.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/std/buf_map.zig b/lib/std/buf_map.zig index df90025ba..e8bc735b5 100644 --- a/lib/std/buf_map.zig +++ b/lib/std/buf_map.zig @@ -43,9 +43,10 @@ pub const BufMap = struct { pub fn set(self: *BufMap, key: []const u8, value: []const u8) !void { const value_copy = try self.copy(value); errdefer self.free(value_copy); - // Avoid copying key if it already exists const get_or_put = try self.hash_map.getOrPut(key); - if (!get_or_put.found_existing) { + if (get_or_put.found_existing) { + self.free(get_or_put.kv.value); + } else { get_or_put.kv.key = self.copy(key) catch |err| { _ = self.hash_map.remove(key); return err; @@ -83,8 +84,7 @@ pub const BufMap = struct { }; test "BufMap" { - // TODO: uncomment and fix the leak - var bufmap = BufMap.init(std.heap.page_allocator); + var bufmap = BufMap.init(std.testing.allocator); defer bufmap.deinit(); try bufmap.set("x", "1"); From 184128fd9e5bfcf9b9a1c1021cf1d8db03147c28 Mon Sep 17 00:00:00 2001 From: Benjamin Feng Date: Thu, 30 Jan 2020 00:14:17 -0600 Subject: [PATCH 22/60] Fix testing.allocator wiring --- lib/std/special/test_runner.zig | 10 ++++------ lib/std/testing/leak_count_allocator.zig | 3 ++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/std/special/test_runner.zig b/lib/std/special/test_runner.zig index 9a2d68a73..07c46ee43 100644 --- a/lib/std/special/test_runner.zig +++ b/lib/std/special/test_runner.zig @@ -14,12 +14,6 @@ pub fn main() anyerror!void { for (test_fn_list) |test_fn, i| { std.testing.base_allocator_instance.reset(); - defer { - std.testing.allocator_instance.validate() catch |err| switch (err) { - error.Leak => std.debug.panic("", .{}), - else => std.debug.panic("error.{}", .{@errorName(err)}), - }; - } var test_node = root_node.start(test_fn.name, null); test_node.activate(); @@ -30,6 +24,10 @@ pub fn main() anyerror!void { if (test_fn.func()) |_| { ok_count += 1; test_node.end(); + std.testing.allocator_instance.validate() catch |err| switch (err) { + error.Leak => std.debug.panic("", .{}), + else => std.debug.panic("error.{}", .{@errorName(err)}), + }; if (progress.terminal == null) std.debug.warn("OK\n", .{}); } else |err| switch (err) { error.SkipZigTest => { diff --git a/lib/std/testing/leak_count_allocator.zig b/lib/std/testing/leak_count_allocator.zig index 6cdcfa267..1d65b8c56 100644 --- a/lib/std/testing/leak_count_allocator.zig +++ b/lib/std/testing/leak_count_allocator.zig @@ -23,10 +23,11 @@ pub const LeakCountAllocator = struct { fn realloc(allocator: *std.mem.Allocator, old_mem: []u8, old_align: u29, new_size: usize, new_align: u29) ![]u8 { const self = @fieldParentPtr(LeakCountAllocator, "allocator", allocator); + var data = try self.internal_allocator.reallocFn(self.internal_allocator, old_mem, old_align, new_size, new_align); if (old_mem.len == 0) { self.count += 1; } - return self.internal_allocator.reallocFn(self.internal_allocator, old_mem, old_align, new_size, new_align); + return data; } fn shrink(allocator: *std.mem.Allocator, old_mem: []u8, old_align: u29, new_size: usize, new_align: u29) []u8 { From c1fb97aef6d0f7343e9226b2f19fbe9d315afa94 Mon Sep 17 00:00:00 2001 From: Benjamin Feng Date: Thu, 30 Jan 2020 00:20:11 -0600 Subject: [PATCH 23/60] Remove unnecessary allocator from mutex --- lib/std/mutex.zig | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib/std/mutex.zig b/lib/std/mutex.zig index 7fbe4fde1..30ac835f9 100644 --- a/lib/std/mutex.zig +++ b/lib/std/mutex.zig @@ -306,12 +306,6 @@ const TestContext = struct { }; test "std.Mutex" { - var plenty_of_memory = try std.heap.page_allocator.alloc(u8, 300 * 1024); - defer std.heap.page_allocator.free(plenty_of_memory); - - var fixed_buffer_allocator = std.heap.ThreadSafeFixedBufferAllocator.init(plenty_of_memory); - var a = &fixed_buffer_allocator.allocator; - var mutex = Mutex.init(); defer mutex.deinit(); From 46d84a1b639eb8e2c11b1936e6897a6352802325 Mon Sep 17 00:00:00 2001 From: Benjamin Feng Date: Thu, 30 Jan 2020 00:26:54 -0600 Subject: [PATCH 24/60] Convert a few more page_allocator --- lib/std/heap/logging_allocator.zig | 2 +- lib/std/testing.zig | 2 +- test/cli.zig | 2 +- test/stage1/behavior/async_fn.zig | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/std/heap/logging_allocator.zig b/lib/std/heap/logging_allocator.zig index d1b7f4776..7dce7bc20 100644 --- a/lib/std/heap/logging_allocator.zig +++ b/lib/std/heap/logging_allocator.zig @@ -57,7 +57,7 @@ test "LoggingAllocator" { var slice_stream = std.io.SliceOutStream.init(buf[0..]); const stream = &slice_stream.stream; - const allocator = &LoggingAllocator.init(std.heap.page_allocator, @ptrCast(*AnyErrorOutStream, stream)).allocator; + const allocator = &LoggingAllocator.init(std.testing.allocator, @ptrCast(*AnyErrorOutStream, stream)).allocator; const ptr = try allocator.alloc(u8, 10); allocator.free(ptr); diff --git a/lib/std/testing.zig b/lib/std/testing.zig index 4850f2e9b..f8247b5a9 100644 --- a/lib/std/testing.zig +++ b/lib/std/testing.zig @@ -12,7 +12,7 @@ pub var allocator_instance = LeakCountAllocator.init(&base_allocator_instance.al pub const failing_allocator = &FailingAllocator.init(&base_allocator_instance.allocator, 0).allocator; pub var base_allocator_instance = std.heap.ThreadSafeFixedBufferAllocator.init(allocator_mem[0..]); -var allocator_mem: [100 * 1024]u8 = undefined; +var allocator_mem: [512 * 1024]u8 = undefined; /// This function is intended to be used only in tests. It prints diagnostics to stderr /// and then aborts when actual_error_union is not expected_error. diff --git a/test/cli.zig b/test/cli.zig index 0527b5c92..b7d03d9e2 100644 --- a/test/cli.zig +++ b/test/cli.zig @@ -8,7 +8,7 @@ const ChildProcess = std.ChildProcess; var a: *std.mem.Allocator = undefined; pub fn main() !void { - var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); + var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); var arg_it = process.args(); diff --git a/test/stage1/behavior/async_fn.zig b/test/stage1/behavior/async_fn.zig index c7ea183b6..fb740ead4 100644 --- a/test/stage1/behavior/async_fn.zig +++ b/test/stage1/behavior/async_fn.zig @@ -935,12 +935,12 @@ fn recursiveAsyncFunctionTest(comptime suspending_implementation: bool) type { _ = async amain(&result); return result; } else { - return fib(std.heap.page_allocator, 10) catch unreachable; + return fib(std.testing.allocator, 10) catch unreachable; } } fn amain(result: *u32) void { - var x = async fib(std.heap.page_allocator, 10); + var x = async fib(std.testing.allocator, 10); result.* = (await x) catch unreachable; } }; From 94f29ae11736bd5abb0383610b42cb7ea19f1f0c Mon Sep 17 00:00:00 2001 From: Rocknest <35231115+Rocknest@users.noreply.github.com> Date: Thu, 30 Jan 2020 08:53:38 +0200 Subject: [PATCH 25/60] Remove intCast's --- lib/std/os/windows/bits.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/std/os/windows/bits.zig b/lib/std/os/windows/bits.zig index d1c09c02e..b184e68f6 100644 --- a/lib/std/os/windows/bits.zig +++ b/lib/std/os/windows/bits.zig @@ -930,7 +930,7 @@ pub usingnamespace switch (builtin.arch) { ExtendedRegisters: [512]BYTE, pub fn getRegs(ctx: *const CONTEXT) struct {bp: usize, ip: usize} { - return .{.bp = @intCast(usize, ctx.Ebp), .ip = @intCast(usize, ctx.Eip)}; + return .{.bp = ctx.Ebp, .ip = ctx.Eip}; } }; @@ -1033,7 +1033,7 @@ pub usingnamespace switch (builtin.arch) { LastExceptionFromRip: DWORD64, pub fn getRegs(ctx: *const CONTEXT) struct {bp: usize, ip: usize} { - return .{.bp = @intCast(usize, ctx.Rbp), .ip = @intCast(usize, ctx.Rip)}; + return .{.bp = ctx.Rbp, .ip = ctx.Rip}; } }; @@ -1101,7 +1101,7 @@ pub usingnamespace switch (builtin.arch) { Wvr: [2]DWORD64, pub fn getRegs(ctx: *const CONTEXT) struct {bp: usize, ip: usize} { - return .{.bp = @intCast(usize, ctx.DUMMYUNIONNAME.DUMMYSTRUCTNAME.Fp), .ip = @intCast(usize, ctx.Pc)}; + return .{.bp = ctx.DUMMYUNIONNAME.DUMMYSTRUCTNAME.Fp, .ip = ctx.Pc}; } }; From 9c196efa2afe0e337ac0b16bd1138e89393f6106 Mon Sep 17 00:00:00 2001 From: Benjamin Feng Date: Thu, 30 Jan 2020 01:12:21 -0600 Subject: [PATCH 26/60] Add explicit error message for too many frees --- lib/std/testing/leak_count_allocator.zig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/std/testing/leak_count_allocator.zig b/lib/std/testing/leak_count_allocator.zig index 1d65b8c56..65244e529 100644 --- a/lib/std/testing/leak_count_allocator.zig +++ b/lib/std/testing/leak_count_allocator.zig @@ -33,6 +33,9 @@ pub const LeakCountAllocator = struct { fn shrink(allocator: *std.mem.Allocator, old_mem: []u8, old_align: u29, new_size: usize, new_align: u29) []u8 { const self = @fieldParentPtr(LeakCountAllocator, "allocator", allocator); if (new_size == 0) { + if (self.count == 0) { + std.debug.panic("error - too many calls to free, most likely double free", .{}); + } self.count -= 1; } return self.internal_allocator.shrinkFn(self.internal_allocator, old_mem, old_align, new_size, new_align); From a5f18c2b2ae86126e0fd0cba67676ae68ba0f1df Mon Sep 17 00:00:00 2001 From: Rocknest <35231115+Rocknest@users.noreply.github.com> Date: Thu, 30 Jan 2020 10:00:28 +0200 Subject: [PATCH 27/60] Fix one more edge case --- lib/std/debug.zig | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/std/debug.zig b/lib/std/debug.zig index 2dd1da50c..9cd76cb30 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -131,6 +131,7 @@ pub fn dumpStackTraceFromBase(bp: usize, ip: usize) void { const tty_config = detectTTYConfig(); printSourceAtAddress(debug_info, stderr, ip, tty_config) catch return; const first_return_address = @intToPtr(*const usize, bp + @sizeOf(usize)).*; + if (first_return_address == 0) return; // The whole call stack may be optimized out printSourceAtAddress(debug_info, stderr, first_return_address - 1, tty_config) catch return; var it = StackIterator{ .first_addr = null, From e77a102e24c351a56cdda5bad5a46dcd58101c23 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Wed, 29 Jan 2020 18:40:52 +0100 Subject: [PATCH 28/60] Small DWARF fixups * Clang doesn't seem to emit a DW_AT_low_pc together with DW_AT_ranges for asm files. * Keep reading the other CUs if the lookup fails. --- lib/std/debug.zig | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/std/debug.zig b/lib/std/debug.zig index d035707a5..a5fd1a471 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -1390,8 +1390,12 @@ pub const DwarfInfo = struct { // All the addresses in the list are relative to the value // specified by DW_AT_low_pc or to some other value encoded - // in the list itself - var base_address = try compile_unit.die.getAttrAddr(DW.AT_low_pc); + // in the list itself. + // If no starting value is specified use zero. + var base_address = compile_unit.die.getAttrAddr(DW.AT_low_pc) catch |err| switch (err) { + error.MissingDebugInfo => 0, + else => return err, + }; try s.seekable_stream.seekTo(ranges_offset); @@ -1410,8 +1414,6 @@ pub const DwarfInfo = struct { return compile_unit; } } - - return error.InvalidDebugInfo; } else |err| { if (err != error.MissingDebugInfo) return err; continue; From 14d9582e9a76d0c52ed7efe44eb767b55da12e57 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 30 Jan 2020 10:23:00 -0500 Subject: [PATCH 29/60] ci: don't rely on sourcehut's pkg system --- .builds/freebsd.yml | 6 ------ ci/srht/freebsd_script | 3 +++ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.builds/freebsd.yml b/.builds/freebsd.yml index 95712e499..9b936657f 100644 --- a/.builds/freebsd.yml +++ b/.builds/freebsd.yml @@ -1,10 +1,4 @@ image: freebsd/latest -packages: - - cmake - - py27-s3cmd - - wget - - curl - - jq secrets: - 6c60aaee-92e7-4e7d-812c-114817689b4d - dd0bd962-7664-4d3e-b0f3-41c9ee96b8b8 diff --git a/ci/srht/freebsd_script b/ci/srht/freebsd_script index a2f4431d7..5e9c6fa26 100755 --- a/ci/srht/freebsd_script +++ b/ci/srht/freebsd_script @@ -3,6 +3,9 @@ set -x set -e +sudo pkg update -f +yes | sudo pkg install cmake py27-s3cmd wget curl jq + ZIGDIR="$(pwd)" CACHE_BASENAME="llvm+clang-9.0.0-freebsd-x86_64-release" PREFIX="$HOME/$CACHE_BASENAME" From cbd42e44d6321e59c7e89019e28bcf5299210795 Mon Sep 17 00:00:00 2001 From: Shawn Landden Date: Thu, 30 Jan 2020 21:01:51 +0400 Subject: [PATCH 30/60] rb: fix rb.Node.getLast() that never worked --- lib/std/rb.zig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/std/rb.zig b/lib/std/rb.zig index d7840b75b..a39b815e7 100644 --- a/lib/std/rb.zig +++ b/lib/std/rb.zig @@ -123,7 +123,8 @@ pub const Node = struct { return node; } - fn getLast(node: *Node) *Node { + fn getLast(nodeconst: *Node) *Node { + var node = nodeconst; while (node.right) |right| { node = right; } From c944865fc7e66603bdb605c31ac70da323ecdbdc Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Wed, 29 Jan 2020 23:38:00 +0100 Subject: [PATCH 31/60] Generate compilable code for array inits The compiler still doesn't like too much the newfangled anonymous arrays so let's use the old-style declarations. Closes #4181 --- src-self-hosted/translate_c.zig | 40 ++++++++++++++++++++++++++++----- test/run_translated_c.zig | 16 +++++++++++++ 2 files changed, 50 insertions(+), 6 deletions(-) diff --git a/src-self-hosted/translate_c.zig b/src-self-hosted/translate_c.zig index d4df99877..0c186b40f 100644 --- a/src-self-hosted/translate_c.zig +++ b/src-self-hosted/translate_c.zig @@ -1991,6 +1991,29 @@ fn transInitListExprRecord( return &init_node.base; } +fn transCreateNodeArrayType( + rp: RestorePoint, + source_loc: ZigClangSourceLocation, + ty: *const ZigClangType, + len: var, +) TransError!*ast.Node { + var node = try transCreateNodePrefixOp( + rp.c, + .{ + .ArrayType = .{ + .len_expr = undefined, + .sentinel = null, + }, + }, + .LBracket, + "[", + ); + node.op.ArrayType.len_expr = try transCreateNodeInt(rp.c, len); + _ = try appendToken(rp.c, .RBracket, "]"); + node.rhs = try transType(rp, ty, source_loc); + return &node.base; +} + fn transInitListExprArray( rp: RestorePoint, scope: *Scope, @@ -2011,8 +2034,13 @@ fn transInitListExprArray( var init_node: *ast.Node.SuffixOp = undefined; var cat_tok: ast.TokenIndex = undefined; if (init_count != 0) { - const dot_tok = try appendToken(rp.c, .Period, "."); - init_node = try transCreateNodeContainerInitializer(rp.c, dot_tok); + const ty_node = try transCreateNodeArrayType( + rp, + loc, + ZigClangQualType_getTypePtr(child_qt), + init_count, + ); + init_node = try transCreateNodeArrayInitializer(rp.c, ty_node); var i: c_uint = 0; while (i < init_count) : (i += 1) { const elem_expr = ZigClangInitListExpr_getInit(expr, i); @@ -2026,8 +2054,8 @@ fn transInitListExprArray( cat_tok = try appendToken(rp.c, .PlusPlus, "++"); } - const dot_tok = try appendToken(rp.c, .Period, "."); - var filler_init_node = try transCreateNodeContainerInitializer(rp.c, dot_tok); + const ty_node = try transCreateNodeArrayType(rp, loc, ZigClangQualType_getTypePtr(child_qt), 1); + var filler_init_node = try transCreateNodeArrayInitializer(rp.c, ty_node); const filler_val_expr = ZigClangInitListExpr_getArrayFiller(expr); try filler_init_node.op.ArrayInitializer.push(try transExpr(rp, scope, filler_val_expr, .used, .r_value)); filler_init_node.rtoken = try appendToken(rp.c, .RBrace, "}"); @@ -3878,11 +3906,11 @@ fn transCreateNodeBoolLiteral(c: *Context, value: bool) !*ast.Node { return &node.base; } -fn transCreateNodeContainerInitializer(c: *Context, dot_tok: ast.TokenIndex) !*ast.Node.SuffixOp { +fn transCreateNodeArrayInitializer(c: *Context, ty: *ast.Node) !*ast.Node.SuffixOp { _ = try appendToken(c, .LBrace, "{"); const node = try c.a().create(ast.Node.SuffixOp); node.* = ast.Node.SuffixOp{ - .lhs = .{ .dot = dot_tok }, + .lhs = .{ .node = ty }, .op = .{ .ArrayInitializer = ast.Node.SuffixOp.Op.InitList.init(c.a()), }, diff --git a/test/run_translated_c.zig b/test/run_translated_c.zig index d48c3dc5c..629a85083 100644 --- a/test/run_translated_c.zig +++ b/test/run_translated_c.zig @@ -3,6 +3,22 @@ const tests = @import("tests.zig"); const nl = std.cstr.line_sep; pub fn addCases(cases: *tests.RunTranslatedCContext) void { + cases.add("array initializer", + \\#include + \\int main(int argc, char **argv) { + \\ int a0[4] = {1}; + \\ int a1[4] = {1,2,3,4}; + \\ int s0 = 0, s1 = 0; + \\ for (int i = 0; i < 4; i++) { + \\ s0 += a0[i]; + \\ s1 += a1[i]; + \\ } + \\ if (s0 != 1) abort(); + \\ if (s1 != 10) abort(); + \\ return 0; + \\} + , ""); + cases.add("forward declarations", \\#include \\int foo(int); From 979c69d6b27a38e89ac85eb7db4f0c03c19433d5 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Thu, 30 Jan 2020 19:53:35 +0100 Subject: [PATCH 32/60] Amend some failing test cases --- test/translate_c.zig | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/translate_c.zig b/test/translate_c.zig index af79fe2ff..be4ea8083 100644 --- a/test/translate_c.zig +++ b/test/translate_c.zig @@ -18,7 +18,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { \\static const uuid_t UUID_NULL __attribute__ ((unused)) = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; , &[_][]const u8{ \\pub const uuid_t = [16]u8; - \\pub const UUID_NULL: uuid_t = .{ + \\pub const UUID_NULL: uuid_t = [16]u8{ \\ @bitCast(u8, @truncate(i8, @as(c_int, 0))), \\ @bitCast(u8, @truncate(i8, @as(c_int, 0))), \\ @bitCast(u8, @truncate(i8, @as(c_int, 0))), @@ -87,7 +87,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { \\ .x = @as(c_int, 1), \\}; \\pub export var ub: union_unnamed_1 = union_unnamed_1{ - \\ .c = .{ + \\ .c = [4]u8{ \\ @bitCast(u8, @truncate(i8, @as(c_int, 'a'))), \\ @bitCast(u8, @truncate(i8, @as(c_int, 'b'))), \\ @bitCast(u8, @truncate(i8, @as(c_int, 'b'))), @@ -1118,12 +1118,12 @@ pub fn addCases(cases: *tests.TranslateCContext) void { \\} , &[_][]const u8{ \\pub fn foo() callconv(.C) void { - \\ var arr: [10]u8 = .{ + \\ var arr: [10]u8 = [1]u8{ \\ @bitCast(u8, @truncate(i8, @as(c_int, 1))), - \\ } ++ .{0} ** 9; - \\ var arr1: [10][*c]u8 = .{ + \\ } ++ [1]u8{0} ** 9; + \\ var arr1: [10][*c]u8 = [1][*c]u8{ \\ null, - \\ } ++ .{null} ** 9; + \\ } ++ [1][*c]u8{null} ** 9; \\} }); @@ -1570,7 +1570,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { cases.add("undefined array global", \\int array[100] = {}; , &[_][]const u8{ - \\pub export var array: [100]c_int = .{0} ** 100; + \\pub export var array: [100]c_int = [1]c_int{0} ** 100; }); cases.add("restrict -> noalias", @@ -1904,7 +1904,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { \\ return array[index]; \\} , &[_][]const u8{ - \\pub export var array: [100]c_int = .{0} ** 100; + \\pub export var array: [100]c_int = [1]c_int{0} ** 100; \\pub export fn foo(arg_index: c_int) c_int { \\ var index = arg_index; \\ return array[@intCast(c_uint, index)]; From 58c97b3561c39036c2db1875d5a1b5125dd580ef Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 30 Jan 2020 15:30:03 -0500 Subject: [PATCH 33/60] fix llvm assertion with debug info for vectors --- src/analyze.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/analyze.cpp b/src/analyze.cpp index 2210a17da..8be23ad82 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -9205,7 +9205,7 @@ static void resolve_llvm_types(CodeGen *g, ZigType *type, ResolveStatus wanted_r if (type->llvm_di_type != nullptr) return; type->llvm_type = LLVMVectorType(get_llvm_type(g, type->data.vector.elem_type), type->data.vector.len); - type->llvm_di_type = ZigLLVMDIBuilderCreateVectorType(g->dbuilder, type->size_in_bits, + type->llvm_di_type = ZigLLVMDIBuilderCreateVectorType(g->dbuilder, 8 * type->abi_size, type->abi_align, get_llvm_di_type(g, type->data.vector.elem_type), type->data.vector.len); return; } From d27678fe83f8c7d61cc41c7300d68fe502dd4999 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Thu, 30 Jan 2020 22:25:33 +0100 Subject: [PATCH 34/60] fmt: Refactor the arg fetching code * Error out if the requested index is out-of-bound * Tidy-up all the arg-related variables in a struct --- lib/std/fmt.zig | 59 ++++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/lib/std/fmt.zig b/lib/std/fmt.zig index 627d8bc7a..64c9006fe 100644 --- a/lib/std/fmt.zig +++ b/lib/std/fmt.zig @@ -21,17 +21,6 @@ pub const FormatOptions = struct { fill: u8 = ' ', }; -fn nextArg(comptime used_pos_args: *u32, comptime maybe_pos_arg: ?comptime_int, comptime next_arg: *comptime_int) comptime_int { - if (maybe_pos_arg) |pos_arg| { - used_pos_args.* |= 1 << pos_arg; - return pos_arg; - } else { - const arg = next_arg.*; - next_arg.* += 1; - return arg; - } -} - fn peekIsAlign(comptime fmt: []const u8) bool { // Should only be called during a state transition to the format segment. comptime assert(fmt[0] == ':'); @@ -113,12 +102,36 @@ pub fn format( comptime var start_index = 0; comptime var state = State.Start; - comptime var next_arg = 0; comptime var maybe_pos_arg: ?comptime_int = null; - comptime var used_pos_args: ArgSetType = 0; comptime var specifier_start = 0; comptime var specifier_end = 0; comptime var options = FormatOptions{}; + comptime var arg_state: struct { + next_arg: usize = 0, + used_args: ArgSetType = 0, + args_len: usize = args.len, + + fn hasUnusedArgs(comptime self: *@This()) bool { + return (@popCount(ArgSetType, self.used_args) != self.args_len); + } + + fn nextArg(comptime self: *@This(), comptime pos_arg: ?comptime_int) comptime_int { + const next_idx = pos_arg orelse blk: { + const arg = self.next_arg; + self.next_arg += 1; + break :blk arg; + }; + + if (next_idx >= self.args_len) { + @compileError("Too few arguments"); + } + + // Mark this argument as used + self.used_args |= 1 << next_idx; + + return next_idx; + } + } = .{}; inline for (fmt) |c, i| { switch (state) { @@ -166,11 +179,7 @@ pub fn format( } }, '}' => { - const arg_to_print = comptime nextArg(&used_pos_args, maybe_pos_arg, &next_arg); - - if (arg_to_print >= args.len) { - @compileError("Too few arguments"); - } + const arg_to_print = comptime arg_state.nextArg(maybe_pos_arg); try formatType( args[arg_to_print], @@ -203,7 +212,7 @@ pub fn format( state = if (comptime peekIsAlign(fmt[i..])) State.FormatFillAndAlign else State.FormatWidth; }, '}' => { - const arg_to_print = comptime nextArg(&used_pos_args, maybe_pos_arg, &next_arg); + const arg_to_print = comptime arg_state.nextArg(maybe_pos_arg); try formatType( args[arg_to_print], @@ -250,7 +259,7 @@ pub fn format( state = .FormatPrecision; }, '}' => { - const arg_to_print = comptime nextArg(&used_pos_args, maybe_pos_arg, &next_arg); + const arg_to_print = comptime arg_state.nextArg(maybe_pos_arg); try formatType( args[arg_to_print], @@ -278,7 +287,7 @@ pub fn format( options.precision.? += c - '0'; }, '}' => { - const arg_to_print = comptime nextArg(&used_pos_args, maybe_pos_arg, &next_arg); + const arg_to_print = comptime arg_state.nextArg(maybe_pos_arg); try formatType( args[arg_to_print], @@ -299,13 +308,7 @@ pub fn format( } } comptime { - // All arguments must have been printed but we allow mixing positional and fixed to achieve this. - var i: usize = 0; - inline while (i < next_arg) : (i += 1) { - used_pos_args |= 1 << i; - } - - if (@popCount(ArgSetType, used_pos_args) != args.len) { + if (comptime arg_state.hasUnusedArgs()) { @compileError("Unused arguments"); } if (state != State.Start) { From fd8d8afb243d5a6ceadaf38ad08b72be915fce2e Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Fri, 31 Jan 2020 00:40:43 +0100 Subject: [PATCH 35/60] stdlib: Add binary search function --- lib/std/sort.zig | 61 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/lib/std/sort.zig b/lib/std/sort.zig index 98bac0678..c65158568 100644 --- a/lib/std/sort.zig +++ b/lib/std/sort.zig @@ -5,6 +5,67 @@ const mem = std.mem; const math = std.math; const builtin = @import("builtin"); +pub fn binarySearch(comptime T: type, items: []T, comptime compareFn: fn (val: T) math.Order) ?usize { + if (items.len < 1) + return null; + + var left: usize = 0; + var right: usize = items.len - 1; + + while (left <= right) { + // Avoid overflowing in the midpoint calculation + const mid = left + (right - left) / 2; + // Compare the midpoint element with the key + switch (compareFn(items[mid])) { + .eq => return mid, + .lt => left = mid + 1, + .gt => right = mid - 1, + } + } + + return null; +} + +test "std.sort.binarySearch" { + const S = struct { + fn makeComparisonPred(comptime T: type, value: T) type { + return struct { + fn pred(v: T) math.Order { + return math.order(v, value); + } + }; + } + }; + testing.expectEqual( + @as(?usize, null), + binarySearch(u32, &[_]u32{}, S.makeComparisonPred(u32, 1).pred), + ); + testing.expectEqual( + @as(?usize, 0), + binarySearch(u32, &[_]u32{1}, S.makeComparisonPred(u32, 1).pred), + ); + testing.expectEqual( + @as(?usize, null), + binarySearch(u32, &[_]u32{0}, S.makeComparisonPred(u32, 1).pred), + ); + testing.expectEqual( + @as(?usize, 4), + binarySearch(u32, &[_]u32{ 1, 2, 3, 4, 5 }, S.makeComparisonPred(u32, 5).pred), + ); + testing.expectEqual( + @as(?usize, 0), + binarySearch(u32, &[_]u32{ 2, 4, 8, 16, 32, 64 }, S.makeComparisonPred(u32, 2).pred), + ); + testing.expectEqual( + @as(?usize, 1), + binarySearch(i32, &[_]i32{ -7, -4, 0, 9, 10 }, S.makeComparisonPred(i32, -4).pred), + ); + testing.expectEqual( + @as(?usize, 3), + binarySearch(i32, &[_]i32{ -100, -25, 2, 98, 99, 100 }, S.makeComparisonPred(i32, 98).pred), + ); +} + /// Stable in-place sort. O(n) best case, O(pow(n, 2)) worst case. O(1) memory (no allocator required). pub fn insertionSort(comptime T: type, items: []T, lessThan: fn (lhs: T, rhs: T) bool) void { var i: usize = 1; From 1e78070a40bac709bfd25beb24c1721d4977a69d Mon Sep 17 00:00:00 2001 From: meme Date: Thu, 30 Jan 2020 20:00:05 -0500 Subject: [PATCH 36/60] build: Fix missing `dupe` - Strange memory corruption issues occur when allocated memory is passed to the builder and it is `defer`'d and freed - Instead, `dupe` the string as is done in other handlers, this fixes the issue --- lib/std/build.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/std/build.zig b/lib/std/build.zig index 2b9a8ddcd..4537d5dd0 100644 --- a/lib/std/build.zig +++ b/lib/std/build.zig @@ -1735,17 +1735,17 @@ pub const LibExeObjStep = struct { } pub fn addLibPath(self: *LibExeObjStep, path: []const u8) void { - self.lib_paths.append(path) catch unreachable; + self.lib_paths.append(self.builder.dupe(path)) catch unreachable; } pub fn addFrameworkDir(self: *LibExeObjStep, dir_path: []const u8) void { - self.framework_dirs.append(dir_path) catch unreachable; + self.framework_dirs.append(self.builder.dupe(dir_path)) catch unreachable; } pub fn addPackagePath(self: *LibExeObjStep, name: []const u8, pkg_index_path: []const u8) void { self.packages.append(Pkg{ - .name = name, - .path = pkg_index_path, + .name = self.builder.dupe(name), + .path = self.builder.dupe(pkg_index_path), }) catch unreachable; } From 176bc53858053866e2a751e8d1e2a6a52871cff0 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Thu, 30 Jan 2020 23:16:52 +0100 Subject: [PATCH 37/60] translate-c: Fix translation of fn pointers Closes #4332 --- src-self-hosted/translate_c.zig | 23 +---------------------- test/translate_c.zig | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src-self-hosted/translate_c.zig b/src-self-hosted/translate_c.zig index 0c186b40f..ec89072ca 100644 --- a/src-self-hosted/translate_c.zig +++ b/src-self-hosted/translate_c.zig @@ -3446,31 +3446,10 @@ fn qualTypeToLog2IntRef(rp: RestorePoint, qt: ZigClangQualType, source_loc: ZigC } fn qualTypeChildIsFnProto(qt: ZigClangQualType) bool { - const ty = ZigClangQualType_getTypePtr(qt); + const ty = qualTypeCanon(qt); switch (ZigClangType_getTypeClass(ty)) { .FunctionProto, .FunctionNoProto => return true, - .Elaborated => { - const elaborated_ty = @ptrCast(*const ZigClangElaboratedType, ty); - return qualTypeChildIsFnProto(ZigClangElaboratedType_getNamedType(elaborated_ty)); - }, - .Typedef => { - const typedef_ty = @ptrCast(*const ZigClangTypedefType, ty); - const typedef_decl = ZigClangTypedefType_getDecl(typedef_ty); - return qualTypeChildIsFnProto(ZigClangTypedefNameDecl_getUnderlyingType(typedef_decl)); - }, - .Paren => { - const paren_type = @ptrCast(*const ZigClangParenType, ty); - const inner_type = ZigClangParenType_getInnerType(paren_type); - switch (ZigClangQualType_getTypeClass(inner_type)) { - .FunctionProto, .FunctionNoProto => return true, - else => return false, - } - }, - .Attributed => { - const attr_type = @ptrCast(*const ZigClangAttributedType, ty); - return qualTypeChildIsFnProto(ZigClangAttributedType_getEquivalentType(attr_type)); - }, else => return false, } } diff --git a/test/translate_c.zig b/test/translate_c.zig index be4ea8083..22467b1e6 100644 --- a/test/translate_c.zig +++ b/test/translate_c.zig @@ -3,6 +3,26 @@ const builtin = @import("builtin"); const Target = @import("std").Target; pub fn addCases(cases: *tests.TranslateCContext) void { + cases.add("function prototype translated as optional", + \\typedef void (*fnptr_ty)(void); + \\typedef __attribute__((cdecl)) void (*fnptr_attr_ty)(void); + \\struct foo { + \\ __attribute__((cdecl)) void (*foo)(void); + \\ void (*bar)(void); + \\ fnptr_ty baz; + \\ fnptr_attr_ty qux; + \\}; + , &[_][]const u8{ + \\pub const fnptr_ty = ?fn () callconv(.C) void; + \\pub const fnptr_attr_ty = ?fn () callconv(.C) void; + \\pub const struct_foo = extern struct { + \\ foo: ?fn () callconv(.C) void, + \\ bar: ?fn () callconv(.C) void, + \\ baz: fnptr_ty, + \\ qux: fnptr_attr_ty, + \\}; + }); + cases.add("function prototype with parenthesis", \\void (f0) (void *L); \\void ((f1)) (void *L); From 7cf0b02ab44481c7961393cb095993adb29d85f3 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Fri, 31 Jan 2020 19:47:00 +1100 Subject: [PATCH 38/60] NTSTATUS is a non-exhaustive enum --- lib/std/fs.zig | 34 +- lib/std/fs/file.zig | 8 +- lib/std/mutex.zig | 4 +- lib/std/os.zig | 12 +- lib/std/os/windows.zig | 2 +- lib/std/os/windows/bits.zig | 26 +- lib/std/os/windows/ntstatus.zig | 5600 +++++++++++++++++++++++++++++++ lib/std/os/windows/status.zig | 1670 --------- lib/std/reset_event.zig | 10 +- 9 files changed, 5652 insertions(+), 1714 deletions(-) create mode 100644 lib/std/os/windows/ntstatus.zig delete mode 100644 lib/std/os/windows/status.zig diff --git a/lib/std/fs.zig b/lib/std/fs.zig index 540d5f1a1..fe59b6ee2 100644 --- a/lib/std/fs.zig +++ b/lib/std/fs.zig @@ -598,8 +598,8 @@ pub const Dir = struct { self.index = 0; self.end_index = io.Information; switch (rc) { - w.STATUS.SUCCESS => {}, - w.STATUS.ACCESS_DENIED => return error.AccessDenied, + .SUCCESS => {}, + .ACCESS_DENIED => return error.AccessDenied, else => return w.unexpectedStatus(rc), } } @@ -837,16 +837,16 @@ pub const Dir = struct { 0, ); switch (rc) { - w.STATUS.SUCCESS => return result, - w.STATUS.OBJECT_NAME_INVALID => unreachable, - w.STATUS.OBJECT_NAME_NOT_FOUND => return error.FileNotFound, - w.STATUS.OBJECT_PATH_NOT_FOUND => return error.FileNotFound, - w.STATUS.INVALID_PARAMETER => unreachable, - w.STATUS.SHARING_VIOLATION => return error.SharingViolation, - w.STATUS.ACCESS_DENIED => return error.AccessDenied, - w.STATUS.PIPE_BUSY => return error.PipeBusy, - w.STATUS.OBJECT_PATH_SYNTAX_BAD => unreachable, - w.STATUS.OBJECT_NAME_COLLISION => return error.PathAlreadyExists, + .SUCCESS => return result, + .OBJECT_NAME_INVALID => unreachable, + .OBJECT_NAME_NOT_FOUND => return error.FileNotFound, + .OBJECT_PATH_NOT_FOUND => return error.FileNotFound, + .INVALID_PARAMETER => unreachable, + .SHARING_VIOLATION => return error.SharingViolation, + .ACCESS_DENIED => return error.AccessDenied, + .PIPE_BUSY => return error.PipeBusy, + .OBJECT_PATH_SYNTAX_BAD => unreachable, + .OBJECT_NAME_COLLISION => return error.PathAlreadyExists, else => return w.unexpectedStatus(rc), } } @@ -990,11 +990,11 @@ pub const Dir = struct { 0, ); switch (rc) { - w.STATUS.SUCCESS => return result, - w.STATUS.OBJECT_NAME_INVALID => unreachable, - w.STATUS.OBJECT_NAME_NOT_FOUND => return error.FileNotFound, - w.STATUS.OBJECT_PATH_NOT_FOUND => return error.FileNotFound, - w.STATUS.INVALID_PARAMETER => unreachable, + .SUCCESS => return result, + .OBJECT_NAME_INVALID => unreachable, + .OBJECT_NAME_NOT_FOUND => return error.FileNotFound, + .OBJECT_PATH_NOT_FOUND => return error.FileNotFound, + .INVALID_PARAMETER => unreachable, else => return w.unexpectedStatus(rc), } } diff --git a/lib/std/fs/file.zig b/lib/std/fs/file.zig index c7265a892..924f10401 100644 --- a/lib/std/fs/file.zig +++ b/lib/std/fs/file.zig @@ -225,10 +225,10 @@ pub const File = struct { var info: windows.FILE_ALL_INFORMATION = undefined; const rc = windows.ntdll.NtQueryInformationFile(self.handle, &io_status_block, &info, @sizeOf(windows.FILE_ALL_INFORMATION), .FileAllInformation); switch (rc) { - windows.STATUS.SUCCESS => {}, - windows.STATUS.BUFFER_OVERFLOW => {}, - windows.STATUS.INVALID_PARAMETER => unreachable, - windows.STATUS.ACCESS_DENIED => return error.AccessDenied, + .SUCCESS => {}, + .BUFFER_OVERFLOW => {}, + .INVALID_PARAMETER => unreachable, + .ACCESS_DENIED => return error.AccessDenied, else => return windows.unexpectedStatus(rc), } return Stat{ diff --git a/lib/std/mutex.zig b/lib/std/mutex.zig index 30ac835f9..6954b2fb1 100644 --- a/lib/std/mutex.zig +++ b/lib/std/mutex.zig @@ -126,7 +126,7 @@ else if (builtin.os == .windows) // then unset the WAKE bit so that another unlocker can wake up a thread. } else if (@cmpxchgWeak(u32, &self.waiters, waiters, (waiters + WAIT) | 1, .Monotonic, .Monotonic) == null) { const rc = windows.ntdll.NtWaitForKeyedEvent(handle, key, windows.FALSE, null); - assert(rc == 0); + assert(rc == .SUCCESS); _ = @atomicRmw(u32, &self.waiters, .Sub, WAKE, .Monotonic); } } @@ -154,7 +154,7 @@ else if (builtin.os == .windows) // try to decrease the waiter count & set the WAKE bit meaning a thread is waking up if (@cmpxchgWeak(u32, &self.mutex.waiters, waiters, waiters - WAIT + WAKE, .Release, .Monotonic) == null) { const rc = windows.ntdll.NtReleaseKeyedEvent(handle, key, windows.FALSE, null); - assert(rc == 0); + assert(rc == .SUCCESS); return; } } diff --git a/lib/std/os.zig b/lib/std/os.zig index f881d7483..47b863250 100644 --- a/lib/std/os.zig +++ b/lib/std/os.zig @@ -1176,15 +1176,15 @@ pub fn unlinkatW(dirfd: fd_t, sub_path_w: [*:0]const u16, flags: u32) UnlinkatEr null, 0, ); - if (rc == w.STATUS.SUCCESS) { + if (rc == .SUCCESS) { rc = w.ntdll.NtClose(tmp_handle); } switch (rc) { - w.STATUS.SUCCESS => return, - w.STATUS.OBJECT_NAME_INVALID => unreachable, - w.STATUS.OBJECT_NAME_NOT_FOUND => return error.FileNotFound, - w.STATUS.INVALID_PARAMETER => unreachable, - w.STATUS.FILE_IS_A_DIRECTORY => return error.IsDir, + .SUCCESS => return, + .OBJECT_NAME_INVALID => unreachable, + .OBJECT_NAME_NOT_FOUND => return error.FileNotFound, + .INVALID_PARAMETER => unreachable, + .FILE_IS_A_DIRECTORY => return error.IsDir, else => return w.unexpectedStatus(rc), } } diff --git a/lib/std/os/windows.zig b/lib/std/os/windows.zig index 9254cb1f6..c389538ed 100644 --- a/lib/std/os/windows.zig +++ b/lib/std/os/windows.zig @@ -1057,7 +1057,7 @@ pub fn unexpectedWSAError(err: c_int) std.os.UnexpectedError { /// and you get an unexpected status. pub fn unexpectedStatus(status: NTSTATUS) std.os.UnexpectedError { if (std.os.unexpected_error_tracing) { - std.debug.warn("error.Unexpected NTSTATUS=0x{x}\n", .{status}); + std.debug.warn("error.Unexpected NTSTATUS=0x{x}\n", .{@enumToInt(status)}); std.debug.dumpCurrentStackTrace(null); } return error.Unexpected; diff --git a/lib/std/os/windows/bits.zig b/lib/std/os/windows/bits.zig index b184e68f6..ffd3bb4f1 100644 --- a/lib/std/os/windows/bits.zig +++ b/lib/std/os/windows/bits.zig @@ -6,7 +6,7 @@ const assert = std.debug.assert; const maxInt = std.math.maxInt; pub const ERROR = @import("error.zig"); -pub const STATUS = @import("status.zig"); +pub usingnamespace @import("ntstatus.zig"); pub const LANG = @import("lang.zig"); pub const SUBLANG = @import("sublang.zig"); @@ -62,7 +62,6 @@ pub const ULONGLONG = u64; pub const LONGLONG = i64; pub const HLOCAL = HANDLE; pub const LANGID = c_ushort; -pub const NTSTATUS = ULONG; pub const va_list = *@OpaqueType(); @@ -929,9 +928,12 @@ pub usingnamespace switch (builtin.arch) { SegSs: DWORD, ExtendedRegisters: [512]BYTE, - pub fn getRegs(ctx: *const CONTEXT) struct {bp: usize, ip: usize} { - return .{.bp = ctx.Ebp, .ip = ctx.Eip}; - } + pub fn getRegs(ctx: *const CONTEXT) struct { + bp: usize, + ip: usize, + } { + return .{ .bp = ctx.Ebp, .ip = ctx.Eip }; + } }; pub const PCONTEXT = *CONTEXT; @@ -1032,8 +1034,11 @@ pub usingnamespace switch (builtin.arch) { LastExceptionToRip: DWORD64, LastExceptionFromRip: DWORD64, - pub fn getRegs(ctx: *const CONTEXT) struct {bp: usize, ip: usize} { - return .{.bp = ctx.Rbp, .ip = ctx.Rip}; + pub fn getRegs(ctx: *const CONTEXT) struct { + bp: usize, + ip: usize, + } { + return .{ .bp = ctx.Rbp, .ip = ctx.Rip }; } }; @@ -1100,8 +1105,11 @@ pub usingnamespace switch (builtin.arch) { Wcr: [2]DWORD, Wvr: [2]DWORD64, - pub fn getRegs(ctx: *const CONTEXT) struct {bp: usize, ip: usize} { - return .{.bp = ctx.DUMMYUNIONNAME.DUMMYSTRUCTNAME.Fp, .ip = ctx.Pc}; + pub fn getRegs(ctx: *const CONTEXT) struct { + bp: usize, + ip: usize, + } { + return .{ .bp = ctx.DUMMYUNIONNAME.DUMMYSTRUCTNAME.Fp, .ip = ctx.Pc }; } }; diff --git a/lib/std/os/windows/ntstatus.zig b/lib/std/os/windows/ntstatus.zig new file mode 100644 index 000000000..5c9344d63 --- /dev/null +++ b/lib/std/os/windows/ntstatus.zig @@ -0,0 +1,5600 @@ +// NTSTATUS codes from https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/596a1078-e883-4972-9bbc-49e60bebca55? +pub const NTSTATUS = extern enum(u32) { + /// The operation completed successfully. + SUCCESS = 0x00000000, + + /// The caller specified WaitAny for WaitType and one of the dispatcher objects in the Object array has been set to the signaled state. + WAIT_0 = 0x00000000, + + /// The caller specified WaitAny for WaitType and one of the dispatcher objects in the Object array has been set to the signaled state. + WAIT_1 = 0x00000001, + + /// The caller specified WaitAny for WaitType and one of the dispatcher objects in the Object array has been set to the signaled state. + WAIT_2 = 0x00000002, + + /// The caller specified WaitAny for WaitType and one of the dispatcher objects in the Object array has been set to the signaled state. + WAIT_3 = 0x00000003, + + /// The caller specified WaitAny for WaitType and one of the dispatcher objects in the Object array has been set to the signaled state. + WAIT_63 = 0x0000003F, + + /// The caller attempted to wait for a mutex that has been abandoned. + ABANDONED = 0x00000080, + + /// The caller attempted to wait for a mutex that has been abandoned. + ABANDONED_WAIT_0 = 0x00000080, + + /// The caller attempted to wait for a mutex that has been abandoned. + ABANDONED_WAIT_63 = 0x000000BF, + + /// A user-mode APC was delivered before the given Interval expired. + USER_APC = 0x000000C0, + + /// The delay completed because the thread was alerted. + ALERTED = 0x00000101, + + /// The given Timeout interval expired. + TIMEOUT = 0x00000102, + + /// The operation that was requested is pending completion. + PENDING = 0x00000103, + + /// A reparse should be performed by the Object Manager because the name of the file resulted in a symbolic link. + REPARSE = 0x00000104, + + /// Returned by enumeration APIs to indicate more information is available to successive calls. + MORE_ENTRIES = 0x00000105, + + /// Indicates not all privileges or groups that are referenced are assigned to the caller. + /// This allows, for example, all privileges to be disabled without having to know exactly which privileges are assigned. + NOT_ALL_ASSIGNED = 0x00000106, + + /// Some of the information to be translated has not been translated. + SOME_NOT_MAPPED = 0x00000107, + + /// An open/create operation completed while an opportunistic lock (oplock) break is underway. + OPLOCK_BREAK_IN_PROGRESS = 0x00000108, + + /// A new volume has been mounted by a file system. + VOLUME_MOUNTED = 0x00000109, + + /// This success level status indicates that the transaction state already exists for the registry subtree but that a transaction commit was previously aborted. The commit has now been completed. + RXACT_COMMITTED = 0x0000010A, + + /// Indicates that a notify change request has been completed due to closing the handle that made the notify change request. + NOTIFY_CLEANUP = 0x0000010B, + + /// Indicates that a notify change request is being completed and that the information is not being returned in the caller's buffer. + /// The caller now needs to enumerate the files to find the changes. + NOTIFY_ENUM_DIR = 0x0000010C, + + /// {No Quotas} No system quota limits are specifically set for this account. + NO_QUOTAS_FOR_ACCOUNT = 0x0000010D, + + /// {Connect Failure on Primary Transport} An attempt was made to connect to the remote server %hs on the primary transport, but the connection failed. + /// The computer WAS able to connect on a secondary transport. + PRIMARY_TRANSPORT_CONNECT_FAILED = 0x0000010E, + + /// The page fault was a transition fault. + PAGE_FAULT_TRANSITION = 0x00000110, + + /// The page fault was a demand zero fault. + PAGE_FAULT_DEMAND_ZERO = 0x00000111, + + /// The page fault was a demand zero fault. + PAGE_FAULT_COPY_ON_WRITE = 0x00000112, + + /// The page fault was a demand zero fault. + PAGE_FAULT_GUARD_PAGE = 0x00000113, + + /// The page fault was satisfied by reading from a secondary storage device. + PAGE_FAULT_PAGING_FILE = 0x00000114, + + /// The cached page was locked during operation. + CACHE_PAGE_LOCKED = 0x00000115, + + /// The crash dump exists in a paging file. + CRASH_DUMP = 0x00000116, + + /// The specified buffer contains all zeros. + BUFFER_ALL_ZEROS = 0x00000117, + + /// A reparse should be performed by the Object Manager because the name of the file resulted in a symbolic link. + REPARSE_OBJECT = 0x00000118, + + /// The device has succeeded a query-stop and its resource requirements have changed. + RESOURCE_REQUIREMENTS_CHANGED = 0x00000119, + + /// The translator has translated these resources into the global space and no additional translations should be performed. + TRANSLATION_COMPLETE = 0x00000120, + + /// The directory service evaluated group memberships locally, because it was unable to contact a global catalog server. + DS_MEMBERSHIP_EVALUATED_LOCALLY = 0x00000121, + + /// A process being terminated has no threads to terminate. + NOTHING_TO_TERMINATE = 0x00000122, + + /// The specified process is not part of a job. + PROCESS_NOT_IN_JOB = 0x00000123, + + /// The specified process is part of a job. + PROCESS_IN_JOB = 0x00000124, + + /// {Volume Shadow Copy Service} The system is now ready for hibernation. + VOLSNAP_HIBERNATE_READY = 0x00000125, + + /// A file system or file system filter driver has successfully completed an FsFilter operation. + FSFILTER_OP_COMPLETED_SUCCESSFULLY = 0x00000126, + + /// The specified interrupt vector was already connected. + INTERRUPT_VECTOR_ALREADY_CONNECTED = 0x00000127, + + /// The specified interrupt vector is still connected. + INTERRUPT_STILL_CONNECTED = 0x00000128, + + /// The current process is a cloned process. + PROCESS_CLONED = 0x00000129, + + /// The file was locked and all users of the file can only read. + FILE_LOCKED_WITH_ONLY_READERS = 0x0000012A, + + /// The file was locked and at least one user of the file can write. + FILE_LOCKED_WITH_WRITERS = 0x0000012B, + + /// The specified ResourceManager made no changes or updates to the resource under this transaction. + RESOURCEMANAGER_READ_ONLY = 0x00000202, + + /// An operation is blocked and waiting for an oplock. + WAIT_FOR_OPLOCK = 0x00000367, + + /// Debugger handled the exception. + DBG_EXCEPTION_HANDLED = 0x00010001, + + /// The debugger continued. + DBG_CONTINUE = 0x00010002, + + /// The IO was completed by a filter. + FLT_IO_COMPLETE = 0x001C0001, + + /// The file is temporarily unavailable. + FILE_NOT_AVAILABLE = 0xC0000467, + + /// The share is temporarily unavailable. + SHARE_UNAVAILABLE = 0xC0000480, + + /// A threadpool worker thread entered a callback at thread affinity %p and exited at affinity %p. + /// This is unexpected, indicating that the callback missed restoring the priority. + CALLBACK_RETURNED_THREAD_AFFINITY = 0xC0000721, + + /// {Object Exists} An attempt was made to create an object but the object name already exists. + OBJECT_NAME_EXISTS = 0x40000000, + + /// {Thread Suspended} A thread termination occurred while the thread was suspended. The thread resumed, and termination proceeded. + THREAD_WAS_SUSPENDED = 0x40000001, + + /// {Working Set Range Error} An attempt was made to set the working set minimum or maximum to values that are outside the allowable range. + WORKING_SET_LIMIT_RANGE = 0x40000002, + + /// {Image Relocated} An image file could not be mapped at the address that is specified in the image file. Local fixes must be performed on this image. + IMAGE_NOT_AT_BASE = 0x40000003, + + /// This informational level status indicates that a specified registry subtree transaction state did not yet exist and had to be created. + RXACT_STATE_CREATED = 0x40000004, + + /// {Segment Load} A virtual DOS machine (VDM) is loading, unloading, or moving an MS-DOS or Win16 program segment image. + /// An exception is raised so that a debugger can load, unload, or track symbols and breakpoints within these 16-bit segments. + SEGMENT_NOTIFICATION = 0x40000005, + + /// {Local Session Key} A user session key was requested for a local remote procedure call (RPC) connection. + /// The session key that is returned is a constant value and not unique to this connection. + LOCAL_USER_SESSION_KEY = 0x40000006, + + /// {Invalid Current Directory} The process cannot switch to the startup current directory %hs. + /// Select OK to set the current directory to %hs, or select CANCEL to exit. + BAD_CURRENT_DIRECTORY = 0x40000007, + + /// {Serial IOCTL Complete} A serial I/O operation was completed by another write to a serial port. (The IOCTL_SERIAL_XOFF_COUNTER reached zero.) + SERIAL_MORE_WRITES = 0x40000008, + + /// {Registry Recovery} One of the files that contains the system registry data had to be recovered by using a log or alternate copy. The recovery was successful. + REGISTRY_RECOVERED = 0x40000009, + + /// {Redundant Read} To satisfy a read request, the Windows NT operating system fault-tolerant file system successfully read the requested data from a redundant copy. + /// This was done because the file system encountered a failure on a member of the fault-tolerant volume but was unable to reassign the failing area of the device. + FT_READ_RECOVERY_FROM_BACKUP = 0x4000000A, + + /// {Redundant Write} To satisfy a write request, the Windows NT fault-tolerant file system successfully wrote a redundant copy of the information. + /// This was done because the file system encountered a failure on a member of the fault-tolerant volume but was unable to reassign the failing area of the device. + FT_WRITE_RECOVERY = 0x4000000B, + + /// {Serial IOCTL Timeout} A serial I/O operation completed because the time-out period expired. + /// (The IOCTL_SERIAL_XOFF_COUNTER had not reached zero.) + SERIAL_COUNTER_TIMEOUT = 0x4000000C, + + /// {Password Too Complex} The Windows password is too complex to be converted to a LAN Manager password. + /// The LAN Manager password that returned is a NULL string. + NULL_LM_PASSWORD = 0x4000000D, + + /// {Machine Type Mismatch} The image file %hs is valid but is for a machine type other than the current machine. + /// Select OK to continue, or CANCEL to fail the DLL load. + IMAGE_MACHINE_TYPE_MISMATCH = 0x4000000E, + + /// {Partial Data Received} The network transport returned partial data to its client. The remaining data will be sent later. + RECEIVE_PARTIAL = 0x4000000F, + + /// {Expedited Data Received} The network transport returned data to its client that was marked as expedited by the remote system. + RECEIVE_EXPEDITED = 0x40000010, + + /// {Partial Expedited Data Received} The network transport returned partial data to its client and this data was marked as expedited by the remote system. The remaining data will be sent later. + RECEIVE_PARTIAL_EXPEDITED = 0x40000011, + + /// {TDI Event Done} The TDI indication has completed successfully. + EVENT_DONE = 0x40000012, + + /// {TDI Event Pending} The TDI indication has entered the pending state. + EVENT_PENDING = 0x40000013, + + /// Checking file system on %wZ. + CHECKING_FILE_SYSTEM = 0x40000014, + + /// {Fatal Application Exit} %hs + FATAL_APP_EXIT = 0x40000015, + + /// The specified registry key is referenced by a predefined handle. + PREDEFINED_HANDLE = 0x40000016, + + /// {Page Unlocked} The page protection of a locked page was changed to 'No Access' and the page was unlocked from memory and from the process. + WAS_UNLOCKED = 0x40000017, + + /// %hs + SERVICE_NOTIFICATION = 0x40000018, + + /// {Page Locked} One of the pages to lock was already locked. + WAS_LOCKED = 0x40000019, + + /// Application popup: %1 : %2 + LOG_HARD_ERROR = 0x4000001A, + + /// A Win32 process already exists. + ALREADY_WIN32 = 0x4000001B, + + /// An exception status code that is used by the Win32 x86 emulation subsystem. + WX86_UNSIMULATE = 0x4000001C, + + /// An exception status code that is used by the Win32 x86 emulation subsystem. + WX86_CONTINUE = 0x4000001D, + + /// An exception status code that is used by the Win32 x86 emulation subsystem. + WX86_SINGLE_STEP = 0x4000001E, + + /// An exception status code that is used by the Win32 x86 emulation subsystem. + WX86_BREAKPOINT = 0x4000001F, + + /// An exception status code that is used by the Win32 x86 emulation subsystem. + WX86_EXCEPTION_CONTINUE = 0x40000020, + + /// An exception status code that is used by the Win32 x86 emulation subsystem. + WX86_EXCEPTION_LASTCHANCE = 0x40000021, + + /// An exception status code that is used by the Win32 x86 emulation subsystem. + WX86_EXCEPTION_CHAIN = 0x40000022, + + /// {Machine Type Mismatch} The image file %hs is valid but is for a machine type other than the current machine. + IMAGE_MACHINE_TYPE_MISMATCH_EXE = 0x40000023, + + /// A yield execution was performed and no thread was available to run. + NO_YIELD_PERFORMED = 0x40000024, + + /// The resume flag to a timer API was ignored. + TIMER_RESUME_IGNORED = 0x40000025, + + /// The arbiter has deferred arbitration of these resources to its parent. + ARBITRATION_UNHANDLED = 0x40000026, + + /// The device has detected a CardBus card in its slot. + CARDBUS_NOT_SUPPORTED = 0x40000027, + + /// An exception status code that is used by the Win32 x86 emulation subsystem. + WX86_CREATEWX86TIB = 0x40000028, + + /// The CPUs in this multiprocessor system are not all the same revision level. + /// To use all processors, the operating system restricts itself to the features of the least capable processor in the system. + /// If problems occur with this system, contact the CPU manufacturer to see if this mix of processors is supported. + MP_PROCESSOR_MISMATCH = 0x40000029, + + /// The system was put into hibernation. + HIBERNATED = 0x4000002A, + + /// The system was resumed from hibernation. + RESUME_HIBERNATION = 0x4000002B, + + /// Windows has detected that the system firmware (BIOS) was updated [previous firmware date = %2, current firmware date %3]. + FIRMWARE_UPDATED = 0x4000002C, + + /// A device driver is leaking locked I/O pages and is causing system degradation. + /// The system has automatically enabled the tracking code to try and catch the culprit. + DRIVERS_LEAKING_LOCKED_PAGES = 0x4000002D, + + /// The ALPC message being canceled has already been retrieved from the queue on the other side. + MESSAGE_RETRIEVED = 0x4000002E, + + /// The system power state is transitioning from %2 to %3. + SYSTEM_POWERSTATE_TRANSITION = 0x4000002F, + + /// The receive operation was successful. + /// Check the ALPC completion list for the received message. + ALPC_CHECK_COMPLETION_LIST = 0x40000030, + + /// The system power state is transitioning from %2 to %3 but could enter %4. + SYSTEM_POWERSTATE_COMPLEX_TRANSITION = 0x40000031, + + /// Access to %1 is monitored by policy rule %2. + ACCESS_AUDIT_BY_POLICY = 0x40000032, + + /// A valid hibernation file has been invalidated and should be abandoned. + ABANDON_HIBERFILE = 0x40000033, + + /// Business rule scripts are disabled for the calling application. + BIZRULES_NOT_ENABLED = 0x40000034, + + /// The system has awoken. + WAKE_SYSTEM = 0x40000294, + + /// The directory service is shutting down. + DS_SHUTTING_DOWN = 0x40000370, + + /// Debugger will reply later. + DBG_REPLY_LATER = 0x40010001, + + /// Debugger cannot provide a handle. + DBG_UNABLE_TO_PROVIDE_HANDLE = 0x40010002, + + /// Debugger terminated the thread. + DBG_TERMINATE_THREAD = 0x40010003, + + /// Debugger terminated the process. + DBG_TERMINATE_PROCESS = 0x40010004, + + /// Debugger obtained control of C. + DBG_CONTROL_C = 0x40010005, + + /// Debugger printed an exception on control C. + DBG_PRINTEXCEPTION_C = 0x40010006, + + /// Debugger received a RIP exception. + DBG_RIPEXCEPTION = 0x40010007, + + /// Debugger received a control break. + DBG_CONTROL_BREAK = 0x40010008, + + /// Debugger command communication exception. + DBG_COMMAND_EXCEPTION = 0x40010009, + + /// A UUID that is valid only on this computer has been allocated. + RPC_NT_UUID_LOCAL_ONLY = 0x40020056, + + /// Some data remains to be sent in the request buffer. + RPC_NT_SEND_INCOMPLETE = 0x400200AF, + + /// The Client Drive Mapping Service has connected on Terminal Connection. + CTX_CDM_CONNECT = 0x400A0004, + + /// The Client Drive Mapping Service has disconnected on Terminal Connection. + CTX_CDM_DISCONNECT = 0x400A0005, + + /// A kernel mode component is releasing a reference on an activation context. + SXS_RELEASE_ACTIVATION_CONTEXT = 0x4015000D, + + /// The transactional resource manager is already consistent. Recovery is not needed. + RECOVERY_NOT_NEEDED = 0x40190034, + + /// The transactional resource manager has already been started. + RM_ALREADY_STARTED = 0x40190035, + + /// The log service encountered a log stream with no restart area. + LOG_NO_RESTART = 0x401A000C, + + /// {Display Driver Recovered From Failure} The %hs display driver has detected a failure and recovered from it. Some graphical operations might have failed. + /// The next time you restart the machine, a dialog box appears, giving you an opportunity to upload data about this failure to Microsoft. + VIDEO_DRIVER_DEBUG_REPORT_REQUEST = 0x401B00EC, + + /// The specified buffer is not big enough to contain the entire requested dataset. + /// Partial data is populated up to the size of the buffer. + /// The caller needs to provide a buffer of the size as specified in the partially populated buffer's content (interface specific). + GRAPHICS_PARTIAL_DATA_POPULATED = 0x401E000A, + + /// The kernel driver detected a version mismatch between it and the user mode driver. + GRAPHICS_DRIVER_MISMATCH = 0x401E0117, + + /// No mode is pinned on the specified VidPN source/target. + GRAPHICS_MODE_NOT_PINNED = 0x401E0307, + + /// The specified mode set does not specify a preference for one of its modes. + GRAPHICS_NO_PREFERRED_MODE = 0x401E031E, + + /// The specified dataset (for example, mode set, frequency range set, descriptor set, or topology) is empty. + GRAPHICS_DATASET_IS_EMPTY = 0x401E034B, + + /// The specified dataset (for example, mode set, frequency range set, descriptor set, or topology) does not contain any more elements. + GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET = 0x401E034C, + + /// The specified content transformation is not pinned on the specified VidPN present path. + GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_PINNED = 0x401E0351, + + /// The child device presence was not reliably detected. + GRAPHICS_UNKNOWN_CHILD_STATUS = 0x401E042F, + + /// Starting the lead adapter in a linked configuration has been temporarily deferred. + GRAPHICS_LEADLINK_START_DEFERRED = 0x401E0437, + + /// The display adapter is being polled for children too frequently at the same polling level. + GRAPHICS_POLLING_TOO_FREQUENTLY = 0x401E0439, + + /// Starting the adapter has been temporarily deferred. + GRAPHICS_START_DEFERRED = 0x401E043A, + + /// The request will be completed later by an NDIS status indication. + NDIS_INDICATION_REQUIRED = 0x40230001, + + /// {EXCEPTION} Guard Page Exception A page of memory that marks the end of a data structure, such as a stack or an array, has been accessed. + GUARD_PAGE_VIOLATION = 0x80000001, + + /// {EXCEPTION} Alignment Fault A data type misalignment was detected in a load or store instruction. + DATATYPE_MISALIGNMENT = 0x80000002, + + /// {EXCEPTION} Breakpoint A breakpoint has been reached. + BREAKPOINT = 0x80000003, + + /// {EXCEPTION} Single Step A single step or trace operation has just been completed. + SINGLE_STEP = 0x80000004, + + /// {Buffer Overflow} The data was too large to fit into the specified buffer. + BUFFER_OVERFLOW = 0x80000005, + + /// {No More Files} No more files were found which match the file specification. + NO_MORE_FILES = 0x80000006, + + /// {Kernel Debugger Awakened} The system debugger was awakened by an interrupt. + WAKE_SYSTEM_DEBUGGER = 0x80000007, + + /// {Handles Closed} Handles to objects have been automatically closed because of the requested operation. + HANDLES_CLOSED = 0x8000000A, + + /// {Non-Inheritable ACL} An access control list (ACL) contains no components that can be inherited. + NO_INHERITANCE = 0x8000000B, + + /// {GUID Substitution} During the translation of a globally unique identifier (GUID) to a Windows security ID (SID), no administratively defined GUID prefix was found. + /// A substitute prefix was used, which will not compromise system security. + /// However, this might provide a more restrictive access than intended. + GUID_SUBSTITUTION_MADE = 0x8000000C, + + /// Because of protection conflicts, not all the requested bytes could be copied. + PARTIAL_COPY = 0x8000000D, + + /// {Out of Paper} The printer is out of paper. + DEVICE_PAPER_EMPTY = 0x8000000E, + + /// {Device Power Is Off} The printer power has been turned off. + DEVICE_POWERED_OFF = 0x8000000F, + + /// {Device Offline} The printer has been taken offline. + DEVICE_OFF_LINE = 0x80000010, + + /// {Device Busy} The device is currently busy. + DEVICE_BUSY = 0x80000011, + + /// {No More EAs} No more extended attributes (EAs) were found for the file. + NO_MORE_EAS = 0x80000012, + + /// {Illegal EA} The specified extended attribute (EA) name contains at least one illegal character. + INVALID_EA_NAME = 0x80000013, + + /// {Inconsistent EA List} The extended attribute (EA) list is inconsistent. + EA_LIST_INCONSISTENT = 0x80000014, + + /// {Invalid EA Flag} An invalid extended attribute (EA) flag was set. + INVALID_EA_FLAG = 0x80000015, + + /// {Verifying Disk} The media has changed and a verify operation is in progress; therefore, no reads or writes can be performed to the device, except those that are used in the verify operation. + VERIFY_REQUIRED = 0x80000016, + + /// {Too Much Information} The specified access control list (ACL) contained more information than was expected. + EXTRANEOUS_INFORMATION = 0x80000017, + + /// This warning level status indicates that the transaction state already exists for the registry subtree, but that a transaction commit was previously aborted. + /// The commit has NOT been completed but has not been rolled back either; therefore, it can still be committed, if needed. + RXACT_COMMIT_NECESSARY = 0x80000018, + + /// {No More Entries} No more entries are available from an enumeration operation. + NO_MORE_ENTRIES = 0x8000001A, + + /// {Filemark Found} A filemark was detected. + FILEMARK_DETECTED = 0x8000001B, + + /// {Media Changed} The media has changed. + MEDIA_CHANGED = 0x8000001C, + + /// {I/O Bus Reset} An I/O bus reset was detected. + BUS_RESET = 0x8000001D, + + /// {End of Media} The end of the media was encountered. + END_OF_MEDIA = 0x8000001E, + + /// The beginning of a tape or partition has been detected. + BEGINNING_OF_MEDIA = 0x8000001F, + + /// {Media Changed} The media might have changed. + MEDIA_CHECK = 0x80000020, + + /// A tape access reached a set mark. + SETMARK_DETECTED = 0x80000021, + + /// During a tape access, the end of the data written is reached. + NO_DATA_DETECTED = 0x80000022, + + /// The redirector is in use and cannot be unloaded. + REDIRECTOR_HAS_OPEN_HANDLES = 0x80000023, + + /// The server is in use and cannot be unloaded. + SERVER_HAS_OPEN_HANDLES = 0x80000024, + + /// The specified connection has already been disconnected. + ALREADY_DISCONNECTED = 0x80000025, + + /// A long jump has been executed. + LONGJUMP = 0x80000026, + + /// A cleaner cartridge is present in the tape library. + CLEANER_CARTRIDGE_INSTALLED = 0x80000027, + + /// The Plug and Play query operation was not successful. + PLUGPLAY_QUERY_VETOED = 0x80000028, + + /// A frame consolidation has been executed. + UNWIND_CONSOLIDATE = 0x80000029, + + /// {Registry Hive Recovered} The registry hive (file): %hs was corrupted and it has been recovered. Some data might have been lost. + REGISTRY_HIVE_RECOVERED = 0x8000002A, + + /// The application is attempting to run executable code from the module %hs. This might be insecure. + /// An alternative, %hs, is available. Should the application use the secure module %hs? + DLL_MIGHT_BE_INSECURE = 0x8000002B, + + /// The application is loading executable code from the module %hs. + /// This is secure but might be incompatible with previous releases of the operating system. + /// An alternative, %hs, is available. Should the application use the secure module %hs? + DLL_MIGHT_BE_INCOMPATIBLE = 0x8000002C, + + /// The create operation stopped after reaching a symbolic link. + STOPPED_ON_SYMLINK = 0x8000002D, + + /// The device has indicated that cleaning is necessary. + DEVICE_REQUIRES_CLEANING = 0x80000288, + + /// The device has indicated that its door is open. Further operations require it closed and secured. + DEVICE_DOOR_OPEN = 0x80000289, + + /// Windows discovered a corruption in the file %hs. This file has now been repaired. + /// Check if any data in the file was lost because of the corruption. + DATA_LOST_REPAIR = 0x80000803, + + /// Debugger did not handle the exception. + DBG_EXCEPTION_NOT_HANDLED = 0x80010001, + + /// The cluster node is already up. + CLUSTER_NODE_ALREADY_UP = 0x80130001, + + /// The cluster node is already down. + CLUSTER_NODE_ALREADY_DOWN = 0x80130002, + + /// The cluster network is already online. + CLUSTER_NETWORK_ALREADY_ONLINE = 0x80130003, + + /// The cluster network is already offline. + CLUSTER_NETWORK_ALREADY_OFFLINE = 0x80130004, + + /// The cluster node is already a member of the cluster. + CLUSTER_NODE_ALREADY_MEMBER = 0x80130005, + + /// The log could not be set to the requested size. + COULD_NOT_RESIZE_LOG = 0x80190009, + + /// There is no transaction metadata on the file. + NO_TXF_METADATA = 0x80190029, + + /// The file cannot be recovered because there is a handle still open on it. + CANT_RECOVER_WITH_HANDLE_OPEN = 0x80190031, + + /// Transaction metadata is already present on this file and cannot be superseded. + TXF_METADATA_ALREADY_PRESENT = 0x80190041, + + /// A transaction scope could not be entered because the scope handler has not been initialized. + TRANSACTION_SCOPE_CALLBACKS_NOT_SET = 0x80190042, + + /// {Display Driver Stopped Responding and recovered} The %hs display driver has stopped working normally. The recovery had been performed. + VIDEO_HUNG_DISPLAY_DRIVER_THREAD_RECOVERED = 0x801B00EB, + + /// {Buffer too small} The buffer is too small to contain the entry. No information has been written to the buffer. + FLT_BUFFER_TOO_SMALL = 0x801C0001, + + /// Volume metadata read or write is incomplete. + FVE_PARTIAL_METADATA = 0x80210001, + + /// BitLocker encryption keys were ignored because the volume was in a transient state. + FVE_TRANSIENT_STATE = 0x80210002, + + /// {Operation Failed} The requested operation was unsuccessful. + UNSUCCESSFUL = 0xC0000001, + + /// {Not Implemented} The requested operation is not implemented. + NOT_IMPLEMENTED = 0xC0000002, + + /// {Invalid Parameter} The specified information class is not a valid information class for the specified object. + INVALID_INFO_CLASS = 0xC0000003, + + /// The specified information record length does not match the length that is required for the specified information class. + INFO_LENGTH_MISMATCH = 0xC0000004, + + /// The instruction at 0x%08lx referenced memory at 0x%08lx. The memory could not be %s. + ACCESS_VIOLATION = 0xC0000005, + + /// The instruction at 0x%08lx referenced memory at 0x%08lx. + /// The required data was not placed into memory because of an I/O error status of 0x%08lx. + IN_PAGE_ERROR = 0xC0000006, + + /// The page file quota for the process has been exhausted. + PAGEFILE_QUOTA = 0xC0000007, + + /// An invalid HANDLE was specified. + INVALID_HANDLE = 0xC0000008, + + /// An invalid initial stack was specified in a call to NtCreateThread. + BAD_INITIAL_STACK = 0xC0000009, + + /// An invalid initial start address was specified in a call to NtCreateThread. + BAD_INITIAL_PC = 0xC000000A, + + /// An invalid client ID was specified. + INVALID_CID = 0xC000000B, + + /// An attempt was made to cancel or set a timer that has an associated APC and the specified thread is not the thread that originally set the timer with an associated APC routine. + TIMER_NOT_CANCELED = 0xC000000C, + + /// An invalid parameter was passed to a service or function. + INVALID_PARAMETER = 0xC000000D, + + /// A device that does not exist was specified. + NO_SUCH_DEVICE = 0xC000000E, + + /// {File Not Found} The file %hs does not exist. + NO_SUCH_FILE = 0xC000000F, + + /// The specified request is not a valid operation for the target device. + INVALID_DEVICE_REQUEST = 0xC0000010, + + /// The end-of-file marker has been reached. + /// There is no valid data in the file beyond this marker. + END_OF_FILE = 0xC0000011, + + /// {Wrong Volume} The wrong volume is in the drive. Insert volume %hs into drive %hs. + WRONG_VOLUME = 0xC0000012, + + /// {No Disk} There is no disk in the drive. Insert a disk into drive %hs. + NO_MEDIA_IN_DEVICE = 0xC0000013, + + /// {Unknown Disk Format} The disk in drive %hs is not formatted properly. + /// Check the disk, and reformat it, if needed. + UNRECOGNIZED_MEDIA = 0xC0000014, + + /// {Sector Not Found} The specified sector does not exist. + NONEXISTENT_SECTOR = 0xC0000015, + + /// {Still Busy} The specified I/O request packet (IRP) cannot be disposed of because the I/O operation is not complete. + MORE_PROCESSING_REQUIRED = 0xC0000016, + + /// {Not Enough Quota} Not enough virtual memory or paging file quota is available to complete the specified operation. + NO_MEMORY = 0xC0000017, + + /// {Conflicting Address Range} The specified address range conflicts with the address space. + CONFLICTING_ADDRESSES = 0xC0000018, + + /// The address range to unmap is not a mapped view. + NOT_MAPPED_VIEW = 0xC0000019, + + /// The virtual memory cannot be freed. + UNABLE_TO_FREE_VM = 0xC000001A, + + /// The specified section cannot be deleted. + UNABLE_TO_DELETE_SECTION = 0xC000001B, + + /// An invalid system service was specified in a system service call. + INVALID_SYSTEM_SERVICE = 0xC000001C, + + /// {EXCEPTION} Illegal Instruction An attempt was made to execute an illegal instruction. + ILLEGAL_INSTRUCTION = 0xC000001D, + + /// {Invalid Lock Sequence} An attempt was made to execute an invalid lock sequence. + INVALID_LOCK_SEQUENCE = 0xC000001E, + + /// {Invalid Mapping} An attempt was made to create a view for a section that is bigger than the section. + INVALID_VIEW_SIZE = 0xC000001F, + + /// {Bad File} The attributes of the specified mapping file for a section of memory cannot be read. + INVALID_FILE_FOR_SECTION = 0xC0000020, + + /// {Already Committed} The specified address range is already committed. + ALREADY_COMMITTED = 0xC0000021, + + /// {Access Denied} A process has requested access to an object but has not been granted those access rights. + ACCESS_DENIED = 0xC0000022, + + /// {Buffer Too Small} The buffer is too small to contain the entry. No information has been written to the buffer. + BUFFER_TOO_SMALL = 0xC0000023, + + /// {Wrong Type} There is a mismatch between the type of object that is required by the requested operation and the type of object that is specified in the request. + OBJECT_TYPE_MISMATCH = 0xC0000024, + + /// {EXCEPTION} Cannot Continue Windows cannot continue from this exception. + NONCONTINUABLE_EXCEPTION = 0xC0000025, + + /// An invalid exception disposition was returned by an exception handler. + INVALID_DISPOSITION = 0xC0000026, + + /// Unwind exception code. + UNWIND = 0xC0000027, + + /// An invalid or unaligned stack was encountered during an unwind operation. + BAD_STACK = 0xC0000028, + + /// An invalid unwind target was encountered during an unwind operation. + INVALID_UNWIND_TARGET = 0xC0000029, + + /// An attempt was made to unlock a page of memory that was not locked. + NOT_LOCKED = 0xC000002A, + + /// A device parity error on an I/O operation. + PARITY_ERROR = 0xC000002B, + + /// An attempt was made to decommit uncommitted virtual memory. + UNABLE_TO_DECOMMIT_VM = 0xC000002C, + + /// An attempt was made to change the attributes on memory that has not been committed. + NOT_COMMITTED = 0xC000002D, + + /// Invalid object attributes specified to NtCreatePort or invalid port attributes specified to NtConnectPort. + INVALID_PORT_ATTRIBUTES = 0xC000002E, + + /// The length of the message that was passed to NtRequestPort or NtRequestWaitReplyPort is longer than the maximum message that is allowed by the port. + PORT_MESSAGE_TOO_LONG = 0xC000002F, + + /// An invalid combination of parameters was specified. + INVALID_PARAMETER_MIX = 0xC0000030, + + /// An attempt was made to lower a quota limit below the current usage. + INVALID_QUOTA_LOWER = 0xC0000031, + + /// {Corrupt Disk} The file system structure on the disk is corrupt and unusable. Run the Chkdsk utility on the volume %hs. + DISK_CORRUPT_ERROR = 0xC0000032, + + /// The object name is invalid. + OBJECT_NAME_INVALID = 0xC0000033, + + /// The object name is not found. + OBJECT_NAME_NOT_FOUND = 0xC0000034, + + /// The object name already exists. + OBJECT_NAME_COLLISION = 0xC0000035, + + /// An attempt was made to send a message to a disconnected communication port. + PORT_DISCONNECTED = 0xC0000037, + + /// An attempt was made to attach to a device that was already attached to another device. + DEVICE_ALREADY_ATTACHED = 0xC0000038, + + /// The object path component was not a directory object. + OBJECT_PATH_INVALID = 0xC0000039, + + /// {Path Not Found} The path %hs does not exist. + OBJECT_PATH_NOT_FOUND = 0xC000003A, + + /// The object path component was not a directory object. + OBJECT_PATH_SYNTAX_BAD = 0xC000003B, + + /// {Data Overrun} A data overrun error occurred. + DATA_OVERRUN = 0xC000003C, + + /// {Data Late} A data late error occurred. + DATA_LATE_ERROR = 0xC000003D, + + /// {Data Error} An error occurred in reading or writing data. + DATA_ERROR = 0xC000003E, + + /// {Bad CRC} A cyclic redundancy check (CRC) checksum error occurred. + CRC_ERROR = 0xC000003F, + + /// {Section Too Large} The specified section is too big to map the file. + SECTION_TOO_BIG = 0xC0000040, + + /// The NtConnectPort request is refused. + PORT_CONNECTION_REFUSED = 0xC0000041, + + /// The type of port handle is invalid for the operation that is requested. + INVALID_PORT_HANDLE = 0xC0000042, + + /// A file cannot be opened because the share access flags are incompatible. + SHARING_VIOLATION = 0xC0000043, + + /// Insufficient quota exists to complete the operation. + QUOTA_EXCEEDED = 0xC0000044, + + /// The specified page protection was not valid. + INVALID_PAGE_PROTECTION = 0xC0000045, + + /// An attempt to release a mutant object was made by a thread that was not the owner of the mutant object. + MUTANT_NOT_OWNED = 0xC0000046, + + /// An attempt was made to release a semaphore such that its maximum count would have been exceeded. + SEMAPHORE_LIMIT_EXCEEDED = 0xC0000047, + + /// An attempt was made to set the DebugPort or ExceptionPort of a process, but a port already exists in the process, or an attempt was made to set the CompletionPort of a file but a port was already set in the file, or an attempt was made to set the associated completion port of an ALPC port but it is already set. + PORT_ALREADY_SET = 0xC0000048, + + /// An attempt was made to query image information on a section that does not map an image. + SECTION_NOT_IMAGE = 0xC0000049, + + /// An attempt was made to suspend a thread whose suspend count was at its maximum. + SUSPEND_COUNT_EXCEEDED = 0xC000004A, + + /// An attempt was made to suspend a thread that has begun termination. + THREAD_IS_TERMINATING = 0xC000004B, + + /// An attempt was made to set the working set limit to an invalid value (for example, the minimum greater than maximum). + BAD_WORKING_SET_LIMIT = 0xC000004C, + + /// A section was created to map a file that is not compatible with an already existing section that maps the same file. + INCOMPATIBLE_FILE_MAP = 0xC000004D, + + /// A view to a section specifies a protection that is incompatible with the protection of the initial view. + SECTION_PROTECTION = 0xC000004E, + + /// An operation involving EAs failed because the file system does not support EAs. + EAS_NOT_SUPPORTED = 0xC000004F, + + /// An EA operation failed because the EA set is too large. + EA_TOO_LARGE = 0xC0000050, + + /// An EA operation failed because the name or EA index is invalid. + NONEXISTENT_EA_ENTRY = 0xC0000051, + + /// The file for which EAs were requested has no EAs. + NO_EAS_ON_FILE = 0xC0000052, + + /// The EA is corrupt and cannot be read. + EA_CORRUPT_ERROR = 0xC0000053, + + /// A requested read/write cannot be granted due to a conflicting file lock. + FILE_LOCK_CONFLICT = 0xC0000054, + + /// A requested file lock cannot be granted due to other existing locks. + LOCK_NOT_GRANTED = 0xC0000055, + + /// A non-close operation has been requested of a file object that has a delete pending. + DELETE_PENDING = 0xC0000056, + + /// An attempt was made to set the control attribute on a file. + /// This attribute is not supported in the destination file system. + CTL_FILE_NOT_SUPPORTED = 0xC0000057, + + /// Indicates a revision number that was encountered or specified is not one that is known by the service. + /// It might be a more recent revision than the service is aware of. + UNKNOWN_REVISION = 0xC0000058, + + /// Indicates that two revision levels are incompatible. + REVISION_MISMATCH = 0xC0000059, + + /// Indicates a particular security ID cannot be assigned as the owner of an object. + INVALID_OWNER = 0xC000005A, + + /// Indicates a particular security ID cannot be assigned as the primary group of an object. + INVALID_PRIMARY_GROUP = 0xC000005B, + + /// An attempt has been made to operate on an impersonation token by a thread that is not currently impersonating a client. + NO_IMPERSONATION_TOKEN = 0xC000005C, + + /// A mandatory group cannot be disabled. + CANT_DISABLE_MANDATORY = 0xC000005D, + + /// No logon servers are currently available to service the logon request. + NO_LOGON_SERVERS = 0xC000005E, + + /// A specified logon session does not exist. It might already have been terminated. + NO_SUCH_LOGON_SESSION = 0xC000005F, + + /// A specified privilege does not exist. + NO_SUCH_PRIVILEGE = 0xC0000060, + + /// A required privilege is not held by the client. + PRIVILEGE_NOT_HELD = 0xC0000061, + + /// The name provided is not a properly formed account name. + INVALID_ACCOUNT_NAME = 0xC0000062, + + /// The specified account already exists. + USER_EXISTS = 0xC0000063, + + /// The specified account does not exist. + NO_SUCH_USER = 0xC0000064, + + /// The specified group already exists. + GROUP_EXISTS = 0xC0000065, + + /// The specified group does not exist. + NO_SUCH_GROUP = 0xC0000066, + + /// The specified user account is already in the specified group account. + /// Also used to indicate a group cannot be deleted because it contains a member. + MEMBER_IN_GROUP = 0xC0000067, + + /// The specified user account is not a member of the specified group account. + MEMBER_NOT_IN_GROUP = 0xC0000068, + + /// Indicates the requested operation would disable or delete the last remaining administration account. + /// This is not allowed to prevent creating a situation in which the system cannot be administrated. + LAST_ADMIN = 0xC0000069, + + /// When trying to update a password, this return status indicates that the value provided as the current password is not correct. + WRONG_PASSWORD = 0xC000006A, + + /// When trying to update a password, this return status indicates that the value provided for the new password contains values that are not allowed in passwords. + ILL_FORMED_PASSWORD = 0xC000006B, + + /// When trying to update a password, this status indicates that some password update rule has been violated. + /// For example, the password might not meet length criteria. + PASSWORD_RESTRICTION = 0xC000006C, + + /// The attempted logon is invalid. + /// This is either due to a bad username or authentication information. + LOGON_FAILURE = 0xC000006D, + + /// Indicates a referenced user name and authentication information are valid, but some user account restriction has prevented successful authentication (such as time-of-day restrictions). + ACCOUNT_RESTRICTION = 0xC000006E, + + /// The user account has time restrictions and cannot be logged onto at this time. + INVALID_LOGON_HOURS = 0xC000006F, + + /// The user account is restricted so that it cannot be used to log on from the source workstation. + INVALID_WORKSTATION = 0xC0000070, + + /// The user account password has expired. + PASSWORD_EXPIRED = 0xC0000071, + + /// The referenced account is currently disabled and cannot be logged on to. + ACCOUNT_DISABLED = 0xC0000072, + + /// None of the information to be translated has been translated. + NONE_MAPPED = 0xC0000073, + + /// The number of LUIDs requested cannot be allocated with a single allocation. + TOO_MANY_LUIDS_REQUESTED = 0xC0000074, + + /// Indicates there are no more LUIDs to allocate. + LUIDS_EXHAUSTED = 0xC0000075, + + /// Indicates the sub-authority value is invalid for the particular use. + INVALID_SUB_AUTHORITY = 0xC0000076, + + /// Indicates the ACL structure is not valid. + INVALID_ACL = 0xC0000077, + + /// Indicates the SID structure is not valid. + INVALID_SID = 0xC0000078, + + /// Indicates the SECURITY_DESCRIPTOR structure is not valid. + INVALID_SECURITY_DESCR = 0xC0000079, + + /// Indicates the specified procedure address cannot be found in the DLL. + PROCEDURE_NOT_FOUND = 0xC000007A, + + /// {Bad Image} %hs is either not designed to run on Windows or it contains an error. + /// Try installing the program again using the original installation media or contact your system administrator or the software vendor for support. + INVALID_IMAGE_FORMAT = 0xC000007B, + + /// An attempt was made to reference a token that does not exist. + /// This is typically done by referencing the token that is associated with a thread when the thread is not impersonating a client. + NO_TOKEN = 0xC000007C, + + /// Indicates that an attempt to build either an inherited ACL or ACE was not successful. This can be caused by a number of things. + /// One of the more probable causes is the replacement of a CreatorId with a SID that did not fit into the ACE or ACL. + BAD_INHERITANCE_ACL = 0xC000007D, + + /// The range specified in NtUnlockFile was not locked. + RANGE_NOT_LOCKED = 0xC000007E, + + /// An operation failed because the disk was full. + DISK_FULL = 0xC000007F, + + /// The GUID allocation server is disabled at the moment. + SERVER_DISABLED = 0xC0000080, + + /// The GUID allocation server is enabled at the moment. + SERVER_NOT_DISABLED = 0xC0000081, + + /// Too many GUIDs were requested from the allocation server at once. + TOO_MANY_GUIDS_REQUESTED = 0xC0000082, + + /// The GUIDs could not be allocated because the Authority Agent was exhausted. + GUIDS_EXHAUSTED = 0xC0000083, + + /// The value provided was an invalid value for an identifier authority. + INVALID_ID_AUTHORITY = 0xC0000084, + + /// No more authority agent values are available for the particular identifier authority value. + AGENTS_EXHAUSTED = 0xC0000085, + + /// An invalid volume label has been specified. + INVALID_VOLUME_LABEL = 0xC0000086, + + /// A mapped section could not be extended. + SECTION_NOT_EXTENDED = 0xC0000087, + + /// Specified section to flush does not map a data file. + NOT_MAPPED_DATA = 0xC0000088, + + /// Indicates the specified image file did not contain a resource section. + RESOURCE_DATA_NOT_FOUND = 0xC0000089, + + /// Indicates the specified resource type cannot be found in the image file. + RESOURCE_TYPE_NOT_FOUND = 0xC000008A, + + /// Indicates the specified resource name cannot be found in the image file. + RESOURCE_NAME_NOT_FOUND = 0xC000008B, + + /// {EXCEPTION} Array bounds exceeded. + ARRAY_BOUNDS_EXCEEDED = 0xC000008C, + + /// {EXCEPTION} Floating-point denormal operand. + FLOAT_DENORMAL_OPERAND = 0xC000008D, + + /// {EXCEPTION} Floating-point division by zero. + FLOAT_DIVIDE_BY_ZERO = 0xC000008E, + + /// {EXCEPTION} Floating-point inexact result. + FLOAT_INEXACT_RESULT = 0xC000008F, + + /// {EXCEPTION} Floating-point invalid operation. + FLOAT_INVALID_OPERATION = 0xC0000090, + + /// {EXCEPTION} Floating-point overflow. + FLOAT_OVERFLOW = 0xC0000091, + + /// {EXCEPTION} Floating-point stack check. + FLOAT_STACK_CHECK = 0xC0000092, + + /// {EXCEPTION} Floating-point underflow. + FLOAT_UNDERFLOW = 0xC0000093, + + /// {EXCEPTION} Integer division by zero. + INTEGER_DIVIDE_BY_ZERO = 0xC0000094, + + /// {EXCEPTION} Integer overflow. + INTEGER_OVERFLOW = 0xC0000095, + + /// {EXCEPTION} Privileged instruction. + PRIVILEGED_INSTRUCTION = 0xC0000096, + + /// An attempt was made to install more paging files than the system supports. + TOO_MANY_PAGING_FILES = 0xC0000097, + + /// The volume for a file has been externally altered such that the opened file is no longer valid. + FILE_INVALID = 0xC0000098, + + /// When a block of memory is allotted for future updates, such as the memory allocated to hold discretionary access control and primary group information, successive updates might exceed the amount of memory originally allotted. + /// Because a quota might already have been charged to several processes that have handles to the object, it is not reasonable to alter the size of the allocated memory. + /// Instead, a request that requires more memory than has been allotted must fail and the STATUS_ALLOTTED_SPACE_EXCEEDED error returned. + ALLOTTED_SPACE_EXCEEDED = 0xC0000099, + + /// Insufficient system resources exist to complete the API. + INSUFFICIENT_RESOURCES = 0xC000009A, + + /// An attempt has been made to open a DFS exit path control file. + DFS_EXIT_PATH_FOUND = 0xC000009B, + + /// There are bad blocks (sectors) on the hard disk. + DEVICE_DATA_ERROR = 0xC000009C, + + /// There is bad cabling, non-termination, or the controller is not able to obtain access to the hard disk. + DEVICE_NOT_CONNECTED = 0xC000009D, + + /// Virtual memory cannot be freed because the base address is not the base of the region and a region size of zero was specified. + FREE_VM_NOT_AT_BASE = 0xC000009F, + + /// An attempt was made to free virtual memory that is not allocated. + MEMORY_NOT_ALLOCATED = 0xC00000A0, + + /// The working set is not big enough to allow the requested pages to be locked. + WORKING_SET_QUOTA = 0xC00000A1, + + /// {Write Protect Error} The disk cannot be written to because it is write-protected. + /// Remove the write protection from the volume %hs in drive %hs. + MEDIA_WRITE_PROTECTED = 0xC00000A2, + + /// {Drive Not Ready} The drive is not ready for use; its door might be open. + /// Check drive %hs and make sure that a disk is inserted and that the drive door is closed. + DEVICE_NOT_READY = 0xC00000A3, + + /// The specified attributes are invalid or are incompatible with the attributes for the group as a whole. + INVALID_GROUP_ATTRIBUTES = 0xC00000A4, + + /// A specified impersonation level is invalid. + /// Also used to indicate that a required impersonation level was not provided. + BAD_IMPERSONATION_LEVEL = 0xC00000A5, + + /// An attempt was made to open an anonymous-level token. Anonymous tokens cannot be opened. + CANT_OPEN_ANONYMOUS = 0xC00000A6, + + /// The validation information class requested was invalid. + BAD_VALIDATION_CLASS = 0xC00000A7, + + /// The type of a token object is inappropriate for its attempted use. + BAD_TOKEN_TYPE = 0xC00000A8, + + /// The type of a token object is inappropriate for its attempted use. + BAD_MASTER_BOOT_RECORD = 0xC00000A9, + + /// An attempt was made to execute an instruction at an unaligned address and the host system does not support unaligned instruction references. + INSTRUCTION_MISALIGNMENT = 0xC00000AA, + + /// The maximum named pipe instance count has been reached. + INSTANCE_NOT_AVAILABLE = 0xC00000AB, + + /// An instance of a named pipe cannot be found in the listening state. + PIPE_NOT_AVAILABLE = 0xC00000AC, + + /// The named pipe is not in the connected or closing state. + INVALID_PIPE_STATE = 0xC00000AD, + + /// The specified pipe is set to complete operations and there are current I/O operations queued so that it cannot be changed to queue operations. + PIPE_BUSY = 0xC00000AE, + + /// The specified handle is not open to the server end of the named pipe. + ILLEGAL_FUNCTION = 0xC00000AF, + + /// The specified named pipe is in the disconnected state. + PIPE_DISCONNECTED = 0xC00000B0, + + /// The specified named pipe is in the closing state. + PIPE_CLOSING = 0xC00000B1, + + /// The specified named pipe is in the connected state. + PIPE_CONNECTED = 0xC00000B2, + + /// The specified named pipe is in the listening state. + PIPE_LISTENING = 0xC00000B3, + + /// The specified named pipe is not in message mode. + INVALID_READ_MODE = 0xC00000B4, + + /// {Device Timeout} The specified I/O operation on %hs was not completed before the time-out period expired. + IO_TIMEOUT = 0xC00000B5, + + /// The specified file has been closed by another process. + FILE_FORCED_CLOSED = 0xC00000B6, + + /// Profiling is not started. + PROFILING_NOT_STARTED = 0xC00000B7, + + /// Profiling is not stopped. + PROFILING_NOT_STOPPED = 0xC00000B8, + + /// The passed ACL did not contain the minimum required information. + COULD_NOT_INTERPRET = 0xC00000B9, + + /// The file that was specified as a target is a directory, and the caller specified that it could be anything but a directory. + FILE_IS_A_DIRECTORY = 0xC00000BA, + + /// The request is not supported. + NOT_SUPPORTED = 0xC00000BB, + + /// This remote computer is not listening. + REMOTE_NOT_LISTENING = 0xC00000BC, + + /// A duplicate name exists on the network. + DUPLICATE_NAME = 0xC00000BD, + + /// The network path cannot be located. + BAD_NETWORK_PATH = 0xC00000BE, + + /// The network is busy. + NETWORK_BUSY = 0xC00000BF, + + /// This device does not exist. + DEVICE_DOES_NOT_EXIST = 0xC00000C0, + + /// The network BIOS command limit has been reached. + TOO_MANY_COMMANDS = 0xC00000C1, + + /// An I/O adapter hardware error has occurred. + ADAPTER_HARDWARE_ERROR = 0xC00000C2, + + /// The network responded incorrectly. + INVALID_NETWORK_RESPONSE = 0xC00000C3, + + /// An unexpected network error occurred. + UNEXPECTED_NETWORK_ERROR = 0xC00000C4, + + /// The remote adapter is not compatible. + BAD_REMOTE_ADAPTER = 0xC00000C5, + + /// The print queue is full. + PRINT_QUEUE_FULL = 0xC00000C6, + + /// Space to store the file that is waiting to be printed is not available on the server. + NO_SPOOL_SPACE = 0xC00000C7, + + /// The requested print file has been canceled. + PRINT_CANCELLED = 0xC00000C8, + + /// The network name was deleted. + NETWORK_NAME_DELETED = 0xC00000C9, + + /// Network access is denied. + NETWORK_ACCESS_DENIED = 0xC00000CA, + + /// {Incorrect Network Resource Type} The specified device type (LPT, for example) conflicts with the actual device type on the remote resource. + BAD_DEVICE_TYPE = 0xC00000CB, + + /// {Network Name Not Found} The specified share name cannot be found on the remote server. + BAD_NETWORK_NAME = 0xC00000CC, + + /// The name limit for the network adapter card of the local computer was exceeded. + TOO_MANY_NAMES = 0xC00000CD, + + /// The network BIOS session limit was exceeded. + TOO_MANY_SESSIONS = 0xC00000CE, + + /// File sharing has been temporarily paused. + SHARING_PAUSED = 0xC00000CF, + + /// No more connections can be made to this remote computer at this time because the computer has already accepted the maximum number of connections. + REQUEST_NOT_ACCEPTED = 0xC00000D0, + + /// Print or disk redirection is temporarily paused. + REDIRECTOR_PAUSED = 0xC00000D1, + + /// A network data fault occurred. + NET_WRITE_FAULT = 0xC00000D2, + + /// The number of active profiling objects is at the maximum and no more can be started. + PROFILING_AT_LIMIT = 0xC00000D3, + + /// {Incorrect Volume} The destination file of a rename request is located on a different device than the source of the rename request. + NOT_SAME_DEVICE = 0xC00000D4, + + /// The specified file has been renamed and thus cannot be modified. + FILE_RENAMED = 0xC00000D5, + + /// {Network Request Timeout} The session with a remote server has been disconnected because the time-out interval for a request has expired. + VIRTUAL_CIRCUIT_CLOSED = 0xC00000D6, + + /// Indicates an attempt was made to operate on the security of an object that does not have security associated with it. + NO_SECURITY_ON_OBJECT = 0xC00000D7, + + /// Used to indicate that an operation cannot continue without blocking for I/O. + CANT_WAIT = 0xC00000D8, + + /// Used to indicate that a read operation was done on an empty pipe. + PIPE_EMPTY = 0xC00000D9, + + /// Configuration information could not be read from the domain controller, either because the machine is unavailable or access has been denied. + CANT_ACCESS_DOMAIN_INFO = 0xC00000DA, + + /// Indicates that a thread attempted to terminate itself by default (called NtTerminateThread with NULL) and it was the last thread in the current process. + CANT_TERMINATE_SELF = 0xC00000DB, + + /// Indicates the Sam Server was in the wrong state to perform the desired operation. + INVALID_SERVER_STATE = 0xC00000DC, + + /// Indicates the domain was in the wrong state to perform the desired operation. + INVALID_DOMAIN_STATE = 0xC00000DD, + + /// This operation is only allowed for the primary domain controller of the domain. + INVALID_DOMAIN_ROLE = 0xC00000DE, + + /// The specified domain did not exist. + NO_SUCH_DOMAIN = 0xC00000DF, + + /// The specified domain already exists. + DOMAIN_EXISTS = 0xC00000E0, + + /// An attempt was made to exceed the limit on the number of domains per server for this release. + DOMAIN_LIMIT_EXCEEDED = 0xC00000E1, + + /// An error status returned when the opportunistic lock (oplock) request is denied. + OPLOCK_NOT_GRANTED = 0xC00000E2, + + /// An error status returned when an invalid opportunistic lock (oplock) acknowledgment is received by a file system. + INVALID_OPLOCK_PROTOCOL = 0xC00000E3, + + /// This error indicates that the requested operation cannot be completed due to a catastrophic media failure or an on-disk data structure corruption. + INTERNAL_DB_CORRUPTION = 0xC00000E4, + + /// An internal error occurred. + INTERNAL_ERROR = 0xC00000E5, + + /// Indicates generic access types were contained in an access mask which should already be mapped to non-generic access types. + GENERIC_NOT_MAPPED = 0xC00000E6, + + /// Indicates a security descriptor is not in the necessary format (absolute or self-relative). + BAD_DESCRIPTOR_FORMAT = 0xC00000E7, + + /// An access to a user buffer failed at an expected point in time. + /// This code is defined because the caller does not want to accept STATUS_ACCESS_VIOLATION in its filter. + INVALID_USER_BUFFER = 0xC00000E8, + + /// If an I/O error that is not defined in the standard FsRtl filter is returned, it is converted to the following error, which is guaranteed to be in the filter. + /// In this case, information is lost; however, the filter correctly handles the exception. + UNEXPECTED_IO_ERROR = 0xC00000E9, + + /// If an MM error that is not defined in the standard FsRtl filter is returned, it is converted to one of the following errors, which are guaranteed to be in the filter. + /// In this case, information is lost; however, the filter correctly handles the exception. + UNEXPECTED_MM_CREATE_ERR = 0xC00000EA, + + /// If an MM error that is not defined in the standard FsRtl filter is returned, it is converted to one of the following errors, which are guaranteed to be in the filter. + /// In this case, information is lost; however, the filter correctly handles the exception. + UNEXPECTED_MM_MAP_ERROR = 0xC00000EB, + + /// If an MM error that is not defined in the standard FsRtl filter is returned, it is converted to one of the following errors, which are guaranteed to be in the filter. + /// In this case, information is lost; however, the filter correctly handles the exception. + UNEXPECTED_MM_EXTEND_ERR = 0xC00000EC, + + /// The requested action is restricted for use by logon processes only. + /// The calling process has not registered as a logon process. + NOT_LOGON_PROCESS = 0xC00000ED, + + /// An attempt has been made to start a new session manager or LSA logon session by using an ID that is already in use. + LOGON_SESSION_EXISTS = 0xC00000EE, + + /// An invalid parameter was passed to a service or function as the first argument. + INVALID_PARAMETER_1 = 0xC00000EF, + + /// An invalid parameter was passed to a service or function as the second argument. + INVALID_PARAMETER_2 = 0xC00000F0, + + /// An invalid parameter was passed to a service or function as the third argument. + INVALID_PARAMETER_3 = 0xC00000F1, + + /// An invalid parameter was passed to a service or function as the fourth argument. + INVALID_PARAMETER_4 = 0xC00000F2, + + /// An invalid parameter was passed to a service or function as the fifth argument. + INVALID_PARAMETER_5 = 0xC00000F3, + + /// An invalid parameter was passed to a service or function as the sixth argument. + INVALID_PARAMETER_6 = 0xC00000F4, + + /// An invalid parameter was passed to a service or function as the seventh argument. + INVALID_PARAMETER_7 = 0xC00000F5, + + /// An invalid parameter was passed to a service or function as the eighth argument. + INVALID_PARAMETER_8 = 0xC00000F6, + + /// An invalid parameter was passed to a service or function as the ninth argument. + INVALID_PARAMETER_9 = 0xC00000F7, + + /// An invalid parameter was passed to a service or function as the tenth argument. + INVALID_PARAMETER_10 = 0xC00000F8, + + /// An invalid parameter was passed to a service or function as the eleventh argument. + INVALID_PARAMETER_11 = 0xC00000F9, + + /// An invalid parameter was passed to a service or function as the twelfth argument. + INVALID_PARAMETER_12 = 0xC00000FA, + + /// An attempt was made to access a network file, but the network software was not yet started. + REDIRECTOR_NOT_STARTED = 0xC00000FB, + + /// An attempt was made to start the redirector, but the redirector has already been started. + REDIRECTOR_STARTED = 0xC00000FC, + + /// A new guard page for the stack cannot be created. + STACK_OVERFLOW = 0xC00000FD, + + /// A specified authentication package is unknown. + NO_SUCH_PACKAGE = 0xC00000FE, + + /// A malformed function table was encountered during an unwind operation. + BAD_FUNCTION_TABLE = 0xC00000FF, + + /// Indicates the specified environment variable name was not found in the specified environment block. + VARIABLE_NOT_FOUND = 0xC0000100, + + /// Indicates that the directory trying to be deleted is not empty. + DIRECTORY_NOT_EMPTY = 0xC0000101, + + /// {Corrupt File} The file or directory %hs is corrupt and unreadable. Run the Chkdsk utility. + FILE_CORRUPT_ERROR = 0xC0000102, + + /// A requested opened file is not a directory. + NOT_A_DIRECTORY = 0xC0000103, + + /// The logon session is not in a state that is consistent with the requested operation. + BAD_LOGON_SESSION_STATE = 0xC0000104, + + /// An internal LSA error has occurred. + /// An authentication package has requested the creation of a logon session but the ID of an already existing logon session has been specified. + LOGON_SESSION_COLLISION = 0xC0000105, + + /// A specified name string is too long for its intended use. + NAME_TOO_LONG = 0xC0000106, + + /// The user attempted to force close the files on a redirected drive, but there were opened files on the drive, and the user did not specify a sufficient level of force. + FILES_OPEN = 0xC0000107, + + /// The user attempted to force close the files on a redirected drive, but there were opened directories on the drive, and the user did not specify a sufficient level of force. + CONNECTION_IN_USE = 0xC0000108, + + /// RtlFindMessage could not locate the requested message ID in the message table resource. + MESSAGE_NOT_FOUND = 0xC0000109, + + /// An attempt was made to duplicate an object handle into or out of an exiting process. + PROCESS_IS_TERMINATING = 0xC000010A, + + /// Indicates an invalid value has been provided for the LogonType requested. + INVALID_LOGON_TYPE = 0xC000010B, + + /// Indicates that an attempt was made to assign protection to a file system file or directory and one of the SIDs in the security descriptor could not be translated into a GUID that could be stored by the file system. + /// This causes the protection attempt to fail, which might cause a file creation attempt to fail. + NO_GUID_TRANSLATION = 0xC000010C, + + /// Indicates that an attempt has been made to impersonate via a named pipe that has not yet been read from. + CANNOT_IMPERSONATE = 0xC000010D, + + /// Indicates that the specified image is already loaded. + IMAGE_ALREADY_LOADED = 0xC000010E, + + /// Indicates that an attempt was made to change the size of the LDT for a process that has no LDT. + NO_LDT = 0xC0000117, + + /// Indicates that an attempt was made to grow an LDT by setting its size, or that the size was not an even number of selectors. + INVALID_LDT_SIZE = 0xC0000118, + + /// Indicates that the starting value for the LDT information was not an integral multiple of the selector size. + INVALID_LDT_OFFSET = 0xC0000119, + + /// Indicates that the user supplied an invalid descriptor when trying to set up LDT descriptors. + INVALID_LDT_DESCRIPTOR = 0xC000011A, + + /// The specified image file did not have the correct format. It appears to be NE format. + INVALID_IMAGE_NE_FORMAT = 0xC000011B, + + /// Indicates that the transaction state of a registry subtree is incompatible with the requested operation. + /// For example, a request has been made to start a new transaction with one already in progress, or a request has been made to apply a transaction when one is not currently in progress. + RXACT_INVALID_STATE = 0xC000011C, + + /// Indicates an error has occurred during a registry transaction commit. + /// The database has been left in an unknown, but probably inconsistent, state. + /// The state of the registry transaction is left as COMMITTING. + RXACT_COMMIT_FAILURE = 0xC000011D, + + /// An attempt was made to map a file of size zero with the maximum size specified as zero. + MAPPED_FILE_SIZE_ZERO = 0xC000011E, + + /// Too many files are opened on a remote server. + /// This error should only be returned by the Windows redirector on a remote drive. + TOO_MANY_OPENED_FILES = 0xC000011F, + + /// The I/O request was canceled. + CANCELLED = 0xC0000120, + + /// An attempt has been made to remove a file or directory that cannot be deleted. + CANNOT_DELETE = 0xC0000121, + + /// Indicates a name that was specified as a remote computer name is syntactically invalid. + INVALID_COMPUTER_NAME = 0xC0000122, + + /// An I/O request other than close was performed on a file after it was deleted, which can only happen to a request that did not complete before the last handle was closed via NtClose. + FILE_DELETED = 0xC0000123, + + /// Indicates an operation that is incompatible with built-in accounts has been attempted on a built-in (special) SAM account. For example, built-in accounts cannot be deleted. + SPECIAL_ACCOUNT = 0xC0000124, + + /// The operation requested cannot be performed on the specified group because it is a built-in special group. + SPECIAL_GROUP = 0xC0000125, + + /// The operation requested cannot be performed on the specified user because it is a built-in special user. + SPECIAL_USER = 0xC0000126, + + /// Indicates a member cannot be removed from a group because the group is currently the member's primary group. + MEMBERS_PRIMARY_GROUP = 0xC0000127, + + /// An I/O request other than close and several other special case operations was attempted using a file object that had already been closed. + FILE_CLOSED = 0xC0000128, + + /// Indicates a process has too many threads to perform the requested action. + /// For example, assignment of a primary token can be performed only when a process has zero or one threads. + TOO_MANY_THREADS = 0xC0000129, + + /// An attempt was made to operate on a thread within a specific process, but the specified thread is not in the specified process. + THREAD_NOT_IN_PROCESS = 0xC000012A, + + /// An attempt was made to establish a token for use as a primary token but the token is already in use. + /// A token can only be the primary token of one process at a time. + TOKEN_ALREADY_IN_USE = 0xC000012B, + + /// The page file quota was exceeded. + PAGEFILE_QUOTA_EXCEEDED = 0xC000012C, + + /// {Out of Virtual Memory} Your system is low on virtual memory. + /// To ensure that Windows runs correctly, increase the size of your virtual memory paging file. For more information, see Help. + COMMITMENT_LIMIT = 0xC000012D, + + /// The specified image file did not have the correct format: it appears to be LE format. + INVALID_IMAGE_LE_FORMAT = 0xC000012E, + + /// The specified image file did not have the correct format: it did not have an initial MZ. + INVALID_IMAGE_NOT_MZ = 0xC000012F, + + /// The specified image file did not have the correct format: it did not have a proper e_lfarlc in the MZ header. + INVALID_IMAGE_PROTECT = 0xC0000130, + + /// The specified image file did not have the correct format: it appears to be a 16-bit Windows image. + INVALID_IMAGE_WIN_16 = 0xC0000131, + + /// The Netlogon service cannot start because another Netlogon service running in the domain conflicts with the specified role. + LOGON_SERVER_CONFLICT = 0xC0000132, + + /// The time at the primary domain controller is different from the time at the backup domain controller or member server by too large an amount. + TIME_DIFFERENCE_AT_DC = 0xC0000133, + + /// On applicable Windows Server releases, the SAM database is significantly out of synchronization with the copy on the domain controller. A complete synchronization is required. + SYNCHRONIZATION_REQUIRED = 0xC0000134, + + /// {Unable To Locate Component} This application has failed to start because %hs was not found. + /// Reinstalling the application might fix this problem. + DLL_NOT_FOUND = 0xC0000135, + + /// The NtCreateFile API failed. This error should never be returned to an application; it is a place holder for the Windows LAN Manager Redirector to use in its internal error-mapping routines. + OPEN_FAILED = 0xC0000136, + + /// {Privilege Failed} The I/O permissions for the process could not be changed. + IO_PRIVILEGE_FAILED = 0xC0000137, + + /// {Ordinal Not Found} The ordinal %ld could not be located in the dynamic link library %hs. + ORDINAL_NOT_FOUND = 0xC0000138, + + /// {Entry Point Not Found} The procedure entry point %hs could not be located in the dynamic link library %hs. + ENTRYPOINT_NOT_FOUND = 0xC0000139, + + /// {Application Exit by CTRL+C} The application terminated as a result of a CTRL+C. + CONTROL_C_EXIT = 0xC000013A, + + /// {Virtual Circuit Closed} The network transport on your computer has closed a network connection. + /// There might or might not be I/O requests outstanding. + LOCAL_DISCONNECT = 0xC000013B, + + /// {Virtual Circuit Closed} The network transport on a remote computer has closed a network connection. + /// There might or might not be I/O requests outstanding. + REMOTE_DISCONNECT = 0xC000013C, + + /// {Insufficient Resources on Remote Computer} The remote computer has insufficient resources to complete the network request. + /// For example, the remote computer might not have enough available memory to carry out the request at this time. + REMOTE_RESOURCES = 0xC000013D, + + /// {Virtual Circuit Closed} An existing connection (virtual circuit) has been broken at the remote computer. + /// There is probably something wrong with the network software protocol or the network hardware on the remote computer. + LINK_FAILED = 0xC000013E, + + /// {Virtual Circuit Closed} The network transport on your computer has closed a network connection because it had to wait too long for a response from the remote computer. + LINK_TIMEOUT = 0xC000013F, + + /// The connection handle that was given to the transport was invalid. + INVALID_CONNECTION = 0xC0000140, + + /// The address handle that was given to the transport was invalid. + INVALID_ADDRESS = 0xC0000141, + + /// {DLL Initialization Failed} Initialization of the dynamic link library %hs failed. The process is terminating abnormally. + DLL_INIT_FAILED = 0xC0000142, + + /// {Missing System File} The required system file %hs is bad or missing. + MISSING_SYSTEMFILE = 0xC0000143, + + /// {Application Error} The exception %s (0x%08lx) occurred in the application at location 0x%08lx. + UNHANDLED_EXCEPTION = 0xC0000144, + + /// {Application Error} The application failed to initialize properly (0x%lx). Click OK to terminate the application. + APP_INIT_FAILURE = 0xC0000145, + + /// {Unable to Create Paging File} The creation of the paging file %hs failed (%lx). The requested size was %ld. + PAGEFILE_CREATE_FAILED = 0xC0000146, + + /// {No Paging File Specified} No paging file was specified in the system configuration. + NO_PAGEFILE = 0xC0000147, + + /// {Incorrect System Call Level} An invalid level was passed into the specified system call. + INVALID_LEVEL = 0xC0000148, + + /// {Incorrect Password to LAN Manager Server} You specified an incorrect password to a LAN Manager 2.x or MS-NET server. + WRONG_PASSWORD_CORE = 0xC0000149, + + /// {EXCEPTION} A real-mode application issued a floating-point instruction and floating-point hardware is not present. + ILLEGAL_FLOAT_CONTEXT = 0xC000014A, + + /// The pipe operation has failed because the other end of the pipe has been closed. + PIPE_BROKEN = 0xC000014B, + + /// {The Registry Is Corrupt} The structure of one of the files that contains registry data is corrupt; the image of the file in memory is corrupt; or the file could not be recovered because the alternate copy or log was absent or corrupt. + REGISTRY_CORRUPT = 0xC000014C, + + /// An I/O operation initiated by the Registry failed and cannot be recovered. + /// The registry could not read in, write out, or flush one of the files that contain the system's image of the registry. + REGISTRY_IO_FAILED = 0xC000014D, + + /// An event pair synchronization operation was performed using the thread-specific client/server event pair object, but no event pair object was associated with the thread. + NO_EVENT_PAIR = 0xC000014E, + + /// The volume does not contain a recognized file system. + /// Be sure that all required file system drivers are loaded and that the volume is not corrupt. + UNRECOGNIZED_VOLUME = 0xC000014F, + + /// No serial device was successfully initialized. The serial driver will unload. + SERIAL_NO_DEVICE_INITED = 0xC0000150, + + /// The specified local group does not exist. + NO_SUCH_ALIAS = 0xC0000151, + + /// The specified account name is not a member of the group. + MEMBER_NOT_IN_ALIAS = 0xC0000152, + + /// The specified account name is already a member of the group. + MEMBER_IN_ALIAS = 0xC0000153, + + /// The specified local group already exists. + ALIAS_EXISTS = 0xC0000154, + + /// A requested type of logon (for example, interactive, network, and service) is not granted by the local security policy of the target system. + /// Ask the system administrator to grant the necessary form of logon. + LOGON_NOT_GRANTED = 0xC0000155, + + /// The maximum number of secrets that can be stored in a single system was exceeded. + /// The length and number of secrets is limited to satisfy U.S. State Department export restrictions. + TOO_MANY_SECRETS = 0xC0000156, + + /// The length of a secret exceeds the maximum allowable length. + /// The length and number of secrets is limited to satisfy U.S. State Department export restrictions. + SECRET_TOO_LONG = 0xC0000157, + + /// The local security authority (LSA) database contains an internal inconsistency. + INTERNAL_DB_ERROR = 0xC0000158, + + /// The requested operation cannot be performed in full-screen mode. + FULLSCREEN_MODE = 0xC0000159, + + /// During a logon attempt, the user's security context accumulated too many security IDs. This is a very unusual situation. + /// Remove the user from some global or local groups to reduce the number of security IDs to incorporate into the security context. + TOO_MANY_CONTEXT_IDS = 0xC000015A, + + /// A user has requested a type of logon (for example, interactive or network) that has not been granted. + /// An administrator has control over who can logon interactively and through the network. + LOGON_TYPE_NOT_GRANTED = 0xC000015B, + + /// The system has attempted to load or restore a file into the registry, and the specified file is not in the format of a registry file. + NOT_REGISTRY_FILE = 0xC000015C, + + /// An attempt was made to change a user password in the security account manager without providing the necessary Windows cross-encrypted password. + NT_CROSS_ENCRYPTION_REQUIRED = 0xC000015D, + + /// A domain server has an incorrect configuration. + DOMAIN_CTRLR_CONFIG_ERROR = 0xC000015E, + + /// An attempt was made to explicitly access the secondary copy of information via a device control to the fault tolerance driver and the secondary copy is not present in the system. + FT_MISSING_MEMBER = 0xC000015F, + + /// A configuration registry node that represents a driver service entry was ill-formed and did not contain the required value entries. + ILL_FORMED_SERVICE_ENTRY = 0xC0000160, + + /// An illegal character was encountered. + /// For a multibyte character set, this includes a lead byte without a succeeding trail byte. + /// For the Unicode character set this includes the characters 0xFFFF and 0xFFFE. + ILLEGAL_CHARACTER = 0xC0000161, + + /// No mapping for the Unicode character exists in the target multibyte code page. + UNMAPPABLE_CHARACTER = 0xC0000162, + + /// The Unicode character is not defined in the Unicode character set that is installed on the system. + UNDEFINED_CHARACTER = 0xC0000163, + + /// The paging file cannot be created on a floppy disk. + FLOPPY_VOLUME = 0xC0000164, + + /// {Floppy Disk Error} While accessing a floppy disk, an ID address mark was not found. + FLOPPY_ID_MARK_NOT_FOUND = 0xC0000165, + + /// {Floppy Disk Error} While accessing a floppy disk, the track address from the sector ID field was found to be different from the track address that is maintained by the controller. + FLOPPY_WRONG_CYLINDER = 0xC0000166, + + /// {Floppy Disk Error} The floppy disk controller reported an error that is not recognized by the floppy disk driver. + FLOPPY_UNKNOWN_ERROR = 0xC0000167, + + /// {Floppy Disk Error} While accessing a floppy-disk, the controller returned inconsistent results via its registers. + FLOPPY_BAD_REGISTERS = 0xC0000168, + + /// {Hard Disk Error} While accessing the hard disk, a recalibrate operation failed, even after retries. + DISK_RECALIBRATE_FAILED = 0xC0000169, + + /// {Hard Disk Error} While accessing the hard disk, a disk operation failed even after retries. + DISK_OPERATION_FAILED = 0xC000016A, + + /// {Hard Disk Error} While accessing the hard disk, a disk controller reset was needed, but even that failed. + DISK_RESET_FAILED = 0xC000016B, + + /// An attempt was made to open a device that was sharing an interrupt request (IRQ) with other devices. + /// At least one other device that uses that IRQ was already opened. + /// Two concurrent opens of devices that share an IRQ and only work via interrupts is not supported for the particular bus type that the devices use. + SHARED_IRQ_BUSY = 0xC000016C, + + /// {FT Orphaning} A disk that is part of a fault-tolerant volume can no longer be accessed. + FT_ORPHANING = 0xC000016D, + + /// The basic input/output system (BIOS) failed to connect a system interrupt to the device or bus for which the device is connected. + BIOS_FAILED_TO_CONNECT_INTERRUPT = 0xC000016E, + + /// The tape could not be partitioned. + PARTITION_FAILURE = 0xC0000172, + + /// When accessing a new tape of a multi-volume partition, the current blocksize is incorrect. + INVALID_BLOCK_LENGTH = 0xC0000173, + + /// The tape partition information could not be found when loading a tape. + DEVICE_NOT_PARTITIONED = 0xC0000174, + + /// An attempt to lock the eject media mechanism failed. + UNABLE_TO_LOCK_MEDIA = 0xC0000175, + + /// An attempt to unload media failed. + UNABLE_TO_UNLOAD_MEDIA = 0xC0000176, + + /// The physical end of tape was detected. + EOM_OVERFLOW = 0xC0000177, + + /// {No Media} There is no media in the drive. Insert media into drive %hs. + NO_MEDIA = 0xC0000178, + + /// A member could not be added to or removed from the local group because the member does not exist. + NO_SUCH_MEMBER = 0xC000017A, + + /// A new member could not be added to a local group because the member has the wrong account type. + INVALID_MEMBER = 0xC000017B, + + /// An illegal operation was attempted on a registry key that has been marked for deletion. + KEY_DELETED = 0xC000017C, + + /// The system could not allocate the required space in a registry log. + NO_LOG_SPACE = 0xC000017D, + + /// Too many SIDs have been specified. + TOO_MANY_SIDS = 0xC000017E, + + /// An attempt was made to change a user password in the security account manager without providing the necessary LM cross-encrypted password. + LM_CROSS_ENCRYPTION_REQUIRED = 0xC000017F, + + /// An attempt was made to create a symbolic link in a registry key that already has subkeys or values. + KEY_HAS_CHILDREN = 0xC0000180, + + /// An attempt was made to create a stable subkey under a volatile parent key. + CHILD_MUST_BE_VOLATILE = 0xC0000181, + + /// The I/O device is configured incorrectly or the configuration parameters to the driver are incorrect. + DEVICE_CONFIGURATION_ERROR = 0xC0000182, + + /// An error was detected between two drivers or within an I/O driver. + DRIVER_INTERNAL_ERROR = 0xC0000183, + + /// The device is not in a valid state to perform this request. + INVALID_DEVICE_STATE = 0xC0000184, + + /// The I/O device reported an I/O error. + IO_DEVICE_ERROR = 0xC0000185, + + /// A protocol error was detected between the driver and the device. + DEVICE_PROTOCOL_ERROR = 0xC0000186, + + /// This operation is only allowed for the primary domain controller of the domain. + BACKUP_CONTROLLER = 0xC0000187, + + /// The log file space is insufficient to support this operation. + LOG_FILE_FULL = 0xC0000188, + + /// A write operation was attempted to a volume after it was dismounted. + TOO_LATE = 0xC0000189, + + /// The workstation does not have a trust secret for the primary domain in the local LSA database. + NO_TRUST_LSA_SECRET = 0xC000018A, + + /// On applicable Windows Server releases, the SAM database does not have a computer account for this workstation trust relationship. + NO_TRUST_SAM_ACCOUNT = 0xC000018B, + + /// The logon request failed because the trust relationship between the primary domain and the trusted domain failed. + TRUSTED_DOMAIN_FAILURE = 0xC000018C, + + /// The logon request failed because the trust relationship between this workstation and the primary domain failed. + TRUSTED_RELATIONSHIP_FAILURE = 0xC000018D, + + /// The Eventlog log file is corrupt. + EVENTLOG_FILE_CORRUPT = 0xC000018E, + + /// No Eventlog log file could be opened. The Eventlog service did not start. + EVENTLOG_CANT_START = 0xC000018F, + + /// The network logon failed. This might be because the validation authority cannot be reached. + TRUST_FAILURE = 0xC0000190, + + /// An attempt was made to acquire a mutant such that its maximum count would have been exceeded. + MUTANT_LIMIT_EXCEEDED = 0xC0000191, + + /// An attempt was made to logon, but the NetLogon service was not started. + NETLOGON_NOT_STARTED = 0xC0000192, + + /// The user account has expired. + ACCOUNT_EXPIRED = 0xC0000193, + + /// {EXCEPTION} Possible deadlock condition. + POSSIBLE_DEADLOCK = 0xC0000194, + + /// Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed. + /// Disconnect all previous connections to the server or shared resource and try again. + NETWORK_CREDENTIAL_CONFLICT = 0xC0000195, + + /// An attempt was made to establish a session to a network server, but there are already too many sessions established to that server. + REMOTE_SESSION_LIMIT = 0xC0000196, + + /// The log file has changed between reads. + EVENTLOG_FILE_CHANGED = 0xC0000197, + + /// The account used is an interdomain trust account. + /// Use your global user account or local user account to access this server. + NOLOGON_INTERDOMAIN_TRUST_ACCOUNT = 0xC0000198, + + /// The account used is a computer account. + /// Use your global user account or local user account to access this server. + NOLOGON_WORKSTATION_TRUST_ACCOUNT = 0xC0000199, + + /// The account used is a server trust account. + /// Use your global user account or local user account to access this server. + NOLOGON_SERVER_TRUST_ACCOUNT = 0xC000019A, + + /// The name or SID of the specified domain is inconsistent with the trust information for that domain. + DOMAIN_TRUST_INCONSISTENT = 0xC000019B, + + /// A volume has been accessed for which a file system driver is required that has not yet been loaded. + FS_DRIVER_REQUIRED = 0xC000019C, + + /// Indicates that the specified image is already loaded as a DLL. + IMAGE_ALREADY_LOADED_AS_DLL = 0xC000019D, + + /// Short name settings cannot be changed on this volume due to the global registry setting. + INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING = 0xC000019E, + + /// Short names are not enabled on this volume. + SHORT_NAMES_NOT_ENABLED_ON_VOLUME = 0xC000019F, + + /// The security stream for the given volume is in an inconsistent state. Please run CHKDSK on the volume. + SECURITY_STREAM_IS_INCONSISTENT = 0xC00001A0, + + /// A requested file lock operation cannot be processed due to an invalid byte range. + INVALID_LOCK_RANGE = 0xC00001A1, + + /// The specified access control entry (ACE) contains an invalid condition. + INVALID_ACE_CONDITION = 0xC00001A2, + + /// The subsystem needed to support the image type is not present. + IMAGE_SUBSYSTEM_NOT_PRESENT = 0xC00001A3, + + /// The specified file already has a notification GUID associated with it. + NOTIFICATION_GUID_ALREADY_DEFINED = 0xC00001A4, + + /// A remote open failed because the network open restrictions were not satisfied. + NETWORK_OPEN_RESTRICTION = 0xC0000201, + + /// There is no user session key for the specified logon session. + NO_USER_SESSION_KEY = 0xC0000202, + + /// The remote user session has been deleted. + USER_SESSION_DELETED = 0xC0000203, + + /// Indicates the specified resource language ID cannot be found in the image file. + RESOURCE_LANG_NOT_FOUND = 0xC0000204, + + /// Insufficient server resources exist to complete the request. + INSUFF_SERVER_RESOURCES = 0xC0000205, + + /// The size of the buffer is invalid for the specified operation. + INVALID_BUFFER_SIZE = 0xC0000206, + + /// The transport rejected the specified network address as invalid. + INVALID_ADDRESS_COMPONENT = 0xC0000207, + + /// The transport rejected the specified network address due to invalid use of a wildcard. + INVALID_ADDRESS_WILDCARD = 0xC0000208, + + /// The transport address could not be opened because all the available addresses are in use. + TOO_MANY_ADDRESSES = 0xC0000209, + + /// The transport address could not be opened because it already exists. + ADDRESS_ALREADY_EXISTS = 0xC000020A, + + /// The transport address is now closed. + ADDRESS_CLOSED = 0xC000020B, + + /// The transport connection is now disconnected. + CONNECTION_DISCONNECTED = 0xC000020C, + + /// The transport connection has been reset. + CONNECTION_RESET = 0xC000020D, + + /// The transport cannot dynamically acquire any more nodes. + TOO_MANY_NODES = 0xC000020E, + + /// The transport aborted a pending transaction. + TRANSACTION_ABORTED = 0xC000020F, + + /// The transport timed out a request that is waiting for a response. + TRANSACTION_TIMED_OUT = 0xC0000210, + + /// The transport did not receive a release for a pending response. + TRANSACTION_NO_RELEASE = 0xC0000211, + + /// The transport did not find a transaction that matches the specific token. + TRANSACTION_NO_MATCH = 0xC0000212, + + /// The transport had previously responded to a transaction request. + TRANSACTION_RESPONDED = 0xC0000213, + + /// The transport does not recognize the specified transaction request ID. + TRANSACTION_INVALID_ID = 0xC0000214, + + /// The transport does not recognize the specified transaction request type. + TRANSACTION_INVALID_TYPE = 0xC0000215, + + /// The transport can only process the specified request on the server side of a session. + NOT_SERVER_SESSION = 0xC0000216, + + /// The transport can only process the specified request on the client side of a session. + NOT_CLIENT_SESSION = 0xC0000217, + + /// {Registry File Failure} The registry cannot load the hive (file): %hs or its log or alternate. It is corrupt, absent, or not writable. + CANNOT_LOAD_REGISTRY_FILE = 0xC0000218, + + /// {Unexpected Failure in DebugActiveProcess} An unexpected failure occurred while processing a DebugActiveProcess API request. + /// Choosing OK will terminate the process, and choosing Cancel will ignore the error. + DEBUG_ATTACH_FAILED = 0xC0000219, + + /// {Fatal System Error} The %hs system process terminated unexpectedly with a status of 0x%08x (0x%08x 0x%08x). The system has been shut down. + SYSTEM_PROCESS_TERMINATED = 0xC000021A, + + /// {Data Not Accepted} The TDI client could not handle the data received during an indication. + DATA_NOT_ACCEPTED = 0xC000021B, + + /// {Unable to Retrieve Browser Server List} The list of servers for this workgroup is not currently available. + NO_BROWSER_SERVERS_FOUND = 0xC000021C, + + /// NTVDM encountered a hard error. + VDM_HARD_ERROR = 0xC000021D, + + /// {Cancel Timeout} The driver %hs failed to complete a canceled I/O request in the allotted time. + DRIVER_CANCEL_TIMEOUT = 0xC000021E, + + /// {Reply Message Mismatch} An attempt was made to reply to an LPC message, but the thread specified by the client ID in the message was not waiting on that message. + REPLY_MESSAGE_MISMATCH = 0xC000021F, + + /// {Mapped View Alignment Incorrect} An attempt was made to map a view of a file, but either the specified base address or the offset into the file were not aligned on the proper allocation granularity. + MAPPED_ALIGNMENT = 0xC0000220, + + /// {Bad Image Checksum} The image %hs is possibly corrupt. + /// The header checksum does not match the computed checksum. + IMAGE_CHECKSUM_MISMATCH = 0xC0000221, + + /// {Delayed Write Failed} Windows was unable to save all the data for the file %hs. The data has been lost. + /// This error might be caused by a failure of your computer hardware or network connection. Try to save this file elsewhere. + LOST_WRITEBEHIND_DATA = 0xC0000222, + + /// The parameters passed to the server in the client/server shared memory window were invalid. + /// Too much data might have been put in the shared memory window. + CLIENT_SERVER_PARAMETERS_INVALID = 0xC0000223, + + /// The user password must be changed before logging on the first time. + PASSWORD_MUST_CHANGE = 0xC0000224, + + /// The object was not found. + NOT_FOUND = 0xC0000225, + + /// The stream is not a tiny stream. + NOT_TINY_STREAM = 0xC0000226, + + /// A transaction recovery failed. + RECOVERY_FAILURE = 0xC0000227, + + /// The request must be handled by the stack overflow code. + STACK_OVERFLOW_READ = 0xC0000228, + + /// A consistency check failed. + FAIL_CHECK = 0xC0000229, + + /// The attempt to insert the ID in the index failed because the ID is already in the index. + DUPLICATE_OBJECTID = 0xC000022A, + + /// The attempt to set the object ID failed because the object already has an ID. + OBJECTID_EXISTS = 0xC000022B, + + /// Internal OFS status codes indicating how an allocation operation is handled. + /// Either it is retried after the containing oNode is moved or the extent stream is converted to a large stream. + CONVERT_TO_LARGE = 0xC000022C, + + /// The request needs to be retried. + RETRY = 0xC000022D, + + /// The attempt to find the object found an object on the volume that matches by ID; however, it is out of the scope of the handle that is used for the operation. + FOUND_OUT_OF_SCOPE = 0xC000022E, + + /// The bucket array must be grown. Retry the transaction after doing so. + ALLOCATE_BUCKET = 0xC000022F, + + /// The specified property set does not exist on the object. + PROPSET_NOT_FOUND = 0xC0000230, + + /// The user/kernel marshaling buffer has overflowed. + MARSHALL_OVERFLOW = 0xC0000231, + + /// The supplied variant structure contains invalid data. + INVALID_VARIANT = 0xC0000232, + + /// A domain controller for this domain was not found. + DOMAIN_CONTROLLER_NOT_FOUND = 0xC0000233, + + /// The user account has been automatically locked because too many invalid logon attempts or password change attempts have been requested. + ACCOUNT_LOCKED_OUT = 0xC0000234, + + /// NtClose was called on a handle that was protected from close via NtSetInformationObject. + HANDLE_NOT_CLOSABLE = 0xC0000235, + + /// The transport-connection attempt was refused by the remote system. + CONNECTION_REFUSED = 0xC0000236, + + /// The transport connection was gracefully closed. + GRACEFUL_DISCONNECT = 0xC0000237, + + /// The transport endpoint already has an address associated with it. + ADDRESS_ALREADY_ASSOCIATED = 0xC0000238, + + /// An address has not yet been associated with the transport endpoint. + ADDRESS_NOT_ASSOCIATED = 0xC0000239, + + /// An operation was attempted on a nonexistent transport connection. + CONNECTION_INVALID = 0xC000023A, + + /// An invalid operation was attempted on an active transport connection. + CONNECTION_ACTIVE = 0xC000023B, + + /// The remote network is not reachable by the transport. + NETWORK_UNREACHABLE = 0xC000023C, + + /// The remote system is not reachable by the transport. + HOST_UNREACHABLE = 0xC000023D, + + /// The remote system does not support the transport protocol. + PROTOCOL_UNREACHABLE = 0xC000023E, + + /// No service is operating at the destination port of the transport on the remote system. + PORT_UNREACHABLE = 0xC000023F, + + /// The request was aborted. + REQUEST_ABORTED = 0xC0000240, + + /// The transport connection was aborted by the local system. + CONNECTION_ABORTED = 0xC0000241, + + /// The specified buffer contains ill-formed data. + BAD_COMPRESSION_BUFFER = 0xC0000242, + + /// The requested operation cannot be performed on a file with a user mapped section open. + USER_MAPPED_FILE = 0xC0000243, + + /// {Audit Failed} An attempt to generate a security audit failed. + AUDIT_FAILED = 0xC0000244, + + /// The timer resolution was not previously set by the current process. + TIMER_RESOLUTION_NOT_SET = 0xC0000245, + + /// A connection to the server could not be made because the limit on the number of concurrent connections for this account has been reached. + CONNECTION_COUNT_LIMIT = 0xC0000246, + + /// Attempting to log on during an unauthorized time of day for this account. + LOGIN_TIME_RESTRICTION = 0xC0000247, + + /// The account is not authorized to log on from this station. + LOGIN_WKSTA_RESTRICTION = 0xC0000248, + + /// {UP/MP Image Mismatch} The image %hs has been modified for use on a uniprocessor system, but you are running it on a multiprocessor machine. Reinstall the image file. + IMAGE_MP_UP_MISMATCH = 0xC0000249, + + /// There is insufficient account information to log you on. + INSUFFICIENT_LOGON_INFO = 0xC0000250, + + /// {Invalid DLL Entrypoint} The dynamic link library %hs is not written correctly. + /// The stack pointer has been left in an inconsistent state. + /// The entry point should be declared as WINAPI or STDCALL. + /// Select YES to fail the DLL load. Select NO to continue execution. + /// Selecting NO might cause the application to operate incorrectly. + BAD_DLL_ENTRYPOINT = 0xC0000251, + + /// {Invalid Service Callback Entrypoint} The %hs service is not written correctly. + /// The stack pointer has been left in an inconsistent state. + /// The callback entry point should be declared as WINAPI or STDCALL. + /// Selecting OK will cause the service to continue operation. + /// However, the service process might operate incorrectly. + BAD_SERVICE_ENTRYPOINT = 0xC0000252, + + /// The server received the messages but did not send a reply. + LPC_REPLY_LOST = 0xC0000253, + + /// There is an IP address conflict with another system on the network. + IP_ADDRESS_CONFLICT1 = 0xC0000254, + + /// There is an IP address conflict with another system on the network. + IP_ADDRESS_CONFLICT2 = 0xC0000255, + + /// {Low On Registry Space} The system has reached the maximum size that is allowed for the system part of the registry. Additional storage requests will be ignored. + REGISTRY_QUOTA_LIMIT = 0xC0000256, + + /// The contacted server does not support the indicated part of the DFS namespace. + PATH_NOT_COVERED = 0xC0000257, + + /// A callback return system service cannot be executed when no callback is active. + NO_CALLBACK_ACTIVE = 0xC0000258, + + /// The service being accessed is licensed for a particular number of connections. + /// No more connections can be made to the service at this time because the service has already accepted the maximum number of connections. + LICENSE_QUOTA_EXCEEDED = 0xC0000259, + + /// The password provided is too short to meet the policy of your user account. Choose a longer password. + PWD_TOO_SHORT = 0xC000025A, + + /// The policy of your user account does not allow you to change passwords too frequently. + /// This is done to prevent users from changing back to a familiar, but potentially discovered, password. + /// If you feel your password has been compromised, contact your administrator immediately to have a new one assigned. + PWD_TOO_RECENT = 0xC000025B, + + /// You have attempted to change your password to one that you have used in the past. + /// The policy of your user account does not allow this. + /// Select a password that you have not previously used. + PWD_HISTORY_CONFLICT = 0xC000025C, + + /// You have attempted to load a legacy device driver while its device instance had been disabled. + PLUGPLAY_NO_DEVICE = 0xC000025E, + + /// The specified compression format is unsupported. + UNSUPPORTED_COMPRESSION = 0xC000025F, + + /// The specified hardware profile configuration is invalid. + INVALID_HW_PROFILE = 0xC0000260, + + /// The specified Plug and Play registry device path is invalid. + INVALID_PLUGPLAY_DEVICE_PATH = 0xC0000261, + + /// {Driver Entry Point Not Found} The %hs device driver could not locate the ordinal %ld in driver %hs. + DRIVER_ORDINAL_NOT_FOUND = 0xC0000262, + + /// {Driver Entry Point Not Found} The %hs device driver could not locate the entry point %hs in driver %hs. + DRIVER_ENTRYPOINT_NOT_FOUND = 0xC0000263, + + /// {Application Error} The application attempted to release a resource it did not own. Click OK to terminate the application. + RESOURCE_NOT_OWNED = 0xC0000264, + + /// An attempt was made to create more links on a file than the file system supports. + TOO_MANY_LINKS = 0xC0000265, + + /// The specified quota list is internally inconsistent with its descriptor. + QUOTA_LIST_INCONSISTENT = 0xC0000266, + + /// The specified file has been relocated to offline storage. + FILE_IS_OFFLINE = 0xC0000267, + + /// {Windows Evaluation Notification} The evaluation period for this installation of Windows has expired. This system will shutdown in 1 hour. + /// To restore access to this installation of Windows, upgrade this installation by using a licensed distribution of this product. + EVALUATION_EXPIRATION = 0xC0000268, + + /// {Illegal System DLL Relocation} The system DLL %hs was relocated in memory. The application will not run properly. + /// The relocation occurred because the DLL %hs occupied an address range that is reserved for Windows system DLLs. + /// The vendor supplying the DLL should be contacted for a new DLL. + ILLEGAL_DLL_RELOCATION = 0xC0000269, + + /// {License Violation} The system has detected tampering with your registered product type. + /// This is a violation of your software license. Tampering with the product type is not permitted. + LICENSE_VIOLATION = 0xC000026A, + + /// {DLL Initialization Failed} The application failed to initialize because the window station is shutting down. + DLL_INIT_FAILED_LOGOFF = 0xC000026B, + + /// {Unable to Load Device Driver} %hs device driver could not be loaded. Error Status was 0x%x. + DRIVER_UNABLE_TO_LOAD = 0xC000026C, + + /// DFS is unavailable on the contacted server. + DFS_UNAVAILABLE = 0xC000026D, + + /// An operation was attempted to a volume after it was dismounted. + VOLUME_DISMOUNTED = 0xC000026E, + + /// An internal error occurred in the Win32 x86 emulation subsystem. + WX86_INTERNAL_ERROR = 0xC000026F, + + /// Win32 x86 emulation subsystem floating-point stack check. + WX86_FLOAT_STACK_CHECK = 0xC0000270, + + /// The validation process needs to continue on to the next step. + VALIDATE_CONTINUE = 0xC0000271, + + /// There was no match for the specified key in the index. + NO_MATCH = 0xC0000272, + + /// There are no more matches for the current index enumeration. + NO_MORE_MATCHES = 0xC0000273, + + /// The NTFS file or directory is not a reparse point. + NOT_A_REPARSE_POINT = 0xC0000275, + + /// The Windows I/O reparse tag passed for the NTFS reparse point is invalid. + IO_REPARSE_TAG_INVALID = 0xC0000276, + + /// The Windows I/O reparse tag does not match the one that is in the NTFS reparse point. + IO_REPARSE_TAG_MISMATCH = 0xC0000277, + + /// The user data passed for the NTFS reparse point is invalid. + IO_REPARSE_DATA_INVALID = 0xC0000278, + + /// The layered file system driver for this I/O tag did not handle it when needed. + IO_REPARSE_TAG_NOT_HANDLED = 0xC0000279, + + /// The NTFS symbolic link could not be resolved even though the initial file name is valid. + REPARSE_POINT_NOT_RESOLVED = 0xC0000280, + + /// The NTFS directory is a reparse point. + DIRECTORY_IS_A_REPARSE_POINT = 0xC0000281, + + /// The range could not be added to the range list because of a conflict. + RANGE_LIST_CONFLICT = 0xC0000282, + + /// The specified medium changer source element contains no media. + SOURCE_ELEMENT_EMPTY = 0xC0000283, + + /// The specified medium changer destination element already contains media. + DESTINATION_ELEMENT_FULL = 0xC0000284, + + /// The specified medium changer element does not exist. + ILLEGAL_ELEMENT_ADDRESS = 0xC0000285, + + /// The specified element is contained in a magazine that is no longer present. + MAGAZINE_NOT_PRESENT = 0xC0000286, + + /// The device requires re-initialization due to hardware errors. + REINITIALIZATION_NEEDED = 0xC0000287, + + /// The file encryption attempt failed. + ENCRYPTION_FAILED = 0xC000028A, + + /// The file decryption attempt failed. + DECRYPTION_FAILED = 0xC000028B, + + /// The specified range could not be found in the range list. + RANGE_NOT_FOUND = 0xC000028C, + + /// There is no encryption recovery policy configured for this system. + NO_RECOVERY_POLICY = 0xC000028D, + + /// The required encryption driver is not loaded for this system. + NO_EFS = 0xC000028E, + + /// The file was encrypted with a different encryption driver than is currently loaded. + WRONG_EFS = 0xC000028F, + + /// There are no EFS keys defined for the user. + NO_USER_KEYS = 0xC0000290, + + /// The specified file is not encrypted. + FILE_NOT_ENCRYPTED = 0xC0000291, + + /// The specified file is not in the defined EFS export format. + NOT_EXPORT_FORMAT = 0xC0000292, + + /// The specified file is encrypted and the user does not have the ability to decrypt it. + FILE_ENCRYPTED = 0xC0000293, + + /// The GUID passed was not recognized as valid by a WMI data provider. + WMI_GUID_NOT_FOUND = 0xC0000295, + + /// The instance name passed was not recognized as valid by a WMI data provider. + WMI_INSTANCE_NOT_FOUND = 0xC0000296, + + /// The data item ID passed was not recognized as valid by a WMI data provider. + WMI_ITEMID_NOT_FOUND = 0xC0000297, + + /// The WMI request could not be completed and should be retried. + WMI_TRY_AGAIN = 0xC0000298, + + /// The policy object is shared and can only be modified at the root. + SHARED_POLICY = 0xC0000299, + + /// The policy object does not exist when it should. + POLICY_OBJECT_NOT_FOUND = 0xC000029A, + + /// The requested policy information only lives in the Ds. + POLICY_ONLY_IN_DS = 0xC000029B, + + /// The volume must be upgraded to enable this feature. + VOLUME_NOT_UPGRADED = 0xC000029C, + + /// The remote storage service is not operational at this time. + REMOTE_STORAGE_NOT_ACTIVE = 0xC000029D, + + /// The remote storage service encountered a media error. + REMOTE_STORAGE_MEDIA_ERROR = 0xC000029E, + + /// The tracking (workstation) service is not running. + NO_TRACKING_SERVICE = 0xC000029F, + + /// The server process is running under a SID that is different from the SID that is required by client. + SERVER_SID_MISMATCH = 0xC00002A0, + + /// The specified directory service attribute or value does not exist. + DS_NO_ATTRIBUTE_OR_VALUE = 0xC00002A1, + + /// The attribute syntax specified to the directory service is invalid. + DS_INVALID_ATTRIBUTE_SYNTAX = 0xC00002A2, + + /// The attribute type specified to the directory service is not defined. + DS_ATTRIBUTE_TYPE_UNDEFINED = 0xC00002A3, + + /// The specified directory service attribute or value already exists. + DS_ATTRIBUTE_OR_VALUE_EXISTS = 0xC00002A4, + + /// The directory service is busy. + DS_BUSY = 0xC00002A5, + + /// The directory service is unavailable. + DS_UNAVAILABLE = 0xC00002A6, + + /// The directory service was unable to allocate a relative identifier. + DS_NO_RIDS_ALLOCATED = 0xC00002A7, + + /// The directory service has exhausted the pool of relative identifiers. + DS_NO_MORE_RIDS = 0xC00002A8, + + /// The requested operation could not be performed because the directory service is not the master for that type of operation. + DS_INCORRECT_ROLE_OWNER = 0xC00002A9, + + /// The directory service was unable to initialize the subsystem that allocates relative identifiers. + DS_RIDMGR_INIT_ERROR = 0xC00002AA, + + /// The requested operation did not satisfy one or more constraints that are associated with the class of the object. + DS_OBJ_CLASS_VIOLATION = 0xC00002AB, + + /// The directory service can perform the requested operation only on a leaf object. + DS_CANT_ON_NON_LEAF = 0xC00002AC, + + /// The directory service cannot perform the requested operation on the Relatively Defined Name (RDN) attribute of an object. + DS_CANT_ON_RDN = 0xC00002AD, + + /// The directory service detected an attempt to modify the object class of an object. + DS_CANT_MOD_OBJ_CLASS = 0xC00002AE, + + /// An error occurred while performing a cross domain move operation. + DS_CROSS_DOM_MOVE_FAILED = 0xC00002AF, + + /// Unable to contact the global catalog server. + DS_GC_NOT_AVAILABLE = 0xC00002B0, + + /// The requested operation requires a directory service, and none was available. + DIRECTORY_SERVICE_REQUIRED = 0xC00002B1, + + /// The reparse attribute cannot be set because it is incompatible with an existing attribute. + REPARSE_ATTRIBUTE_CONFLICT = 0xC00002B2, + + /// A group marked "use for deny only" cannot be enabled. + CANT_ENABLE_DENY_ONLY = 0xC00002B3, + + /// {EXCEPTION} Multiple floating-point faults. + FLOAT_MULTIPLE_FAULTS = 0xC00002B4, + + /// {EXCEPTION} Multiple floating-point traps. + FLOAT_MULTIPLE_TRAPS = 0xC00002B5, + + /// The device has been removed. + DEVICE_REMOVED = 0xC00002B6, + + /// The volume change journal is being deleted. + JOURNAL_DELETE_IN_PROGRESS = 0xC00002B7, + + /// The volume change journal is not active. + JOURNAL_NOT_ACTIVE = 0xC00002B8, + + /// The requested interface is not supported. + NOINTERFACE = 0xC00002B9, + + /// A directory service resource limit has been exceeded. + DS_ADMIN_LIMIT_EXCEEDED = 0xC00002C1, + + /// {System Standby Failed} The driver %hs does not support standby mode. + /// Updating this driver allows the system to go to standby mode. + DRIVER_FAILED_SLEEP = 0xC00002C2, + + /// Mutual Authentication failed. The server password is out of date at the domain controller. + MUTUAL_AUTHENTICATION_FAILED = 0xC00002C3, + + /// The system file %1 has become corrupt and has been replaced. + CORRUPT_SYSTEM_FILE = 0xC00002C4, + + /// {EXCEPTION} Alignment Error A data type misalignment error was detected in a load or store instruction. + DATATYPE_MISALIGNMENT_ERROR = 0xC00002C5, + + /// The WMI data item or data block is read-only. + WMI_READ_ONLY = 0xC00002C6, + + /// The WMI data item or data block could not be changed. + WMI_SET_FAILURE = 0xC00002C7, + + /// {Virtual Memory Minimum Too Low} Your system is low on virtual memory. + /// Windows is increasing the size of your virtual memory paging file. + /// During this process, memory requests for some applications might be denied. For more information, see Help. + COMMITMENT_MINIMUM = 0xC00002C8, + + /// {EXCEPTION} Register NaT consumption faults. + /// A NaT value is consumed on a non-speculative instruction. + REG_NAT_CONSUMPTION = 0xC00002C9, + + /// The transport element of the medium changer contains media, which is causing the operation to fail. + TRANSPORT_FULL = 0xC00002CA, + + /// Security Accounts Manager initialization failed because of the following error: %hs Error Status: 0x%x. + /// Click OK to shut down this system and restart in Directory Services Restore Mode. + /// Check the event log for more detailed information. + DS_SAM_INIT_FAILURE = 0xC00002CB, + + /// This operation is supported only when you are connected to the server. + ONLY_IF_CONNECTED = 0xC00002CC, + + /// Only an administrator can modify the membership list of an administrative group. + DS_SENSITIVE_GROUP_VIOLATION = 0xC00002CD, + + /// A device was removed so enumeration must be restarted. + PNP_RESTART_ENUMERATION = 0xC00002CE, + + /// The journal entry has been deleted from the journal. + JOURNAL_ENTRY_DELETED = 0xC00002CF, + + /// Cannot change the primary group ID of a domain controller account. + DS_CANT_MOD_PRIMARYGROUPID = 0xC00002D0, + + /// {Fatal System Error} The system image %s is not properly signed. + /// The file has been replaced with the signed file. The system has been shut down. + SYSTEM_IMAGE_BAD_SIGNATURE = 0xC00002D1, + + /// The device will not start without a reboot. + PNP_REBOOT_REQUIRED = 0xC00002D2, + + /// The power state of the current device cannot support this request. + POWER_STATE_INVALID = 0xC00002D3, + + /// The specified group type is invalid. + DS_INVALID_GROUP_TYPE = 0xC00002D4, + + /// In a mixed domain, no nesting of a global group if the group is security enabled. + DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN = 0xC00002D5, + + /// In a mixed domain, cannot nest local groups with other local groups, if the group is security enabled. + DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN = 0xC00002D6, + + /// A global group cannot have a local group as a member. + DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER = 0xC00002D7, + + /// A global group cannot have a universal group as a member. + DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER = 0xC00002D8, + + /// A universal group cannot have a local group as a member. + DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER = 0xC00002D9, + + /// A global group cannot have a cross-domain member. + DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER = 0xC00002DA, + + /// A local group cannot have another cross-domain local group as a member. + DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER = 0xC00002DB, + + /// Cannot change to a security-disabled group because primary members are in this group. + DS_HAVE_PRIMARY_MEMBERS = 0xC00002DC, + + /// The WMI operation is not supported by the data block or method. + WMI_NOT_SUPPORTED = 0xC00002DD, + + /// There is not enough power to complete the requested operation. + INSUFFICIENT_POWER = 0xC00002DE, + + /// The Security Accounts Manager needs to get the boot password. + SAM_NEED_BOOTKEY_PASSWORD = 0xC00002DF, + + /// The Security Accounts Manager needs to get the boot key from the floppy disk. + SAM_NEED_BOOTKEY_FLOPPY = 0xC00002E0, + + /// The directory service cannot start. + DS_CANT_START = 0xC00002E1, + + /// The directory service could not start because of the following error: %hs Error Status: 0x%x. + /// Click OK to shut down this system and restart in Directory Services Restore Mode. + /// Check the event log for more detailed information. + DS_INIT_FAILURE = 0xC00002E2, + + /// The Security Accounts Manager initialization failed because of the following error: %hs Error Status: 0x%x. + /// Click OK to shut down this system and restart in Safe Mode. + /// Check the event log for more detailed information. + SAM_INIT_FAILURE = 0xC00002E3, + + /// The requested operation can be performed only on a global catalog server. + DS_GC_REQUIRED = 0xC00002E4, + + /// A local group can only be a member of other local groups in the same domain. + DS_LOCAL_MEMBER_OF_LOCAL_ONLY = 0xC00002E5, + + /// Foreign security principals cannot be members of universal groups. + DS_NO_FPO_IN_UNIVERSAL_GROUPS = 0xC00002E6, + + /// Your computer could not be joined to the domain. + /// You have exceeded the maximum number of computer accounts you are allowed to create in this domain. + /// Contact your system administrator to have this limit reset or increased. + DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED = 0xC00002E7, + + /// This operation cannot be performed on the current domain. + CURRENT_DOMAIN_NOT_ALLOWED = 0xC00002E9, + + /// The directory or file cannot be created. + CANNOT_MAKE = 0xC00002EA, + + /// The system is in the process of shutting down. + SYSTEM_SHUTDOWN = 0xC00002EB, + + /// Directory Services could not start because of the following error: %hs Error Status: 0x%x. Click OK to shut down the system. + /// You can use the recovery console to diagnose the system further. + DS_INIT_FAILURE_CONSOLE = 0xC00002EC, + + /// Security Accounts Manager initialization failed because of the following error: %hs Error Status: 0x%x. Click OK to shut down the system. + /// You can use the recovery console to diagnose the system further. + DS_SAM_INIT_FAILURE_CONSOLE = 0xC00002ED, + + /// A security context was deleted before the context was completed. This is considered a logon failure. + UNFINISHED_CONTEXT_DELETED = 0xC00002EE, + + /// The client is trying to negotiate a context and the server requires user-to-user but did not send a TGT reply. + NO_TGT_REPLY = 0xC00002EF, + + /// An object ID was not found in the file. + OBJECTID_NOT_FOUND = 0xC00002F0, + + /// Unable to accomplish the requested task because the local machine does not have any IP addresses. + NO_IP_ADDRESSES = 0xC00002F1, + + /// The supplied credential handle does not match the credential that is associated with the security context. + WRONG_CREDENTIAL_HANDLE = 0xC00002F2, + + /// The crypto system or checksum function is invalid because a required function is unavailable. + CRYPTO_SYSTEM_INVALID = 0xC00002F3, + + /// The number of maximum ticket referrals has been exceeded. + MAX_REFERRALS_EXCEEDED = 0xC00002F4, + + /// The local machine must be a Kerberos KDC (domain controller) and it is not. + MUST_BE_KDC = 0xC00002F5, + + /// The other end of the security negotiation requires strong crypto but it is not supported on the local machine. + STRONG_CRYPTO_NOT_SUPPORTED = 0xC00002F6, + + /// The KDC reply contained more than one principal name. + TOO_MANY_PRINCIPALS = 0xC00002F7, + + /// Expected to find PA data for a hint of what etype to use, but it was not found. + NO_PA_DATA = 0xC00002F8, + + /// The client certificate does not contain a valid UPN, or does not match the client name in the logon request. Contact your administrator. + PKINIT_NAME_MISMATCH = 0xC00002F9, + + /// Smart card logon is required and was not used. + SMARTCARD_LOGON_REQUIRED = 0xC00002FA, + + /// An invalid request was sent to the KDC. + KDC_INVALID_REQUEST = 0xC00002FB, + + /// The KDC was unable to generate a referral for the service requested. + KDC_UNABLE_TO_REFER = 0xC00002FC, + + /// The encryption type requested is not supported by the KDC. + KDC_UNKNOWN_ETYPE = 0xC00002FD, + + /// A system shutdown is in progress. + SHUTDOWN_IN_PROGRESS = 0xC00002FE, + + /// The server machine is shutting down. + SERVER_SHUTDOWN_IN_PROGRESS = 0xC00002FF, + + /// This operation is not supported on a computer running Windows Server 2003 operating system for Small Business Server. + NOT_SUPPORTED_ON_SBS = 0xC0000300, + + /// The WMI GUID is no longer available. + WMI_GUID_DISCONNECTED = 0xC0000301, + + /// Collection or events for the WMI GUID is already disabled. + WMI_ALREADY_DISABLED = 0xC0000302, + + /// Collection or events for the WMI GUID is already enabled. + WMI_ALREADY_ENABLED = 0xC0000303, + + /// The master file table on the volume is too fragmented to complete this operation. + MFT_TOO_FRAGMENTED = 0xC0000304, + + /// Copy protection failure. + COPY_PROTECTION_FAILURE = 0xC0000305, + + /// Copy protection error—DVD CSS Authentication failed. + CSS_AUTHENTICATION_FAILURE = 0xC0000306, + + /// Copy protection error—The specified sector does not contain a valid key. + CSS_KEY_NOT_PRESENT = 0xC0000307, + + /// Copy protection error—DVD session key not established. + CSS_KEY_NOT_ESTABLISHED = 0xC0000308, + + /// Copy protection error—The read failed because the sector is encrypted. + CSS_SCRAMBLED_SECTOR = 0xC0000309, + + /// Copy protection error—The region of the specified DVD does not correspond to the region setting of the drive. + CSS_REGION_MISMATCH = 0xC000030A, + + /// Copy protection error—The region setting of the drive might be permanent. + CSS_RESETS_EXHAUSTED = 0xC000030B, + + /// The Kerberos protocol encountered an error while validating the KDC certificate during smart card logon. + /// There is more information in the system event log. + PKINIT_FAILURE = 0xC0000320, + + /// The Kerberos protocol encountered an error while attempting to use the smart card subsystem. + SMARTCARD_SUBSYSTEM_FAILURE = 0xC0000321, + + /// The target server does not have acceptable Kerberos credentials. + NO_KERB_KEY = 0xC0000322, + + /// The transport determined that the remote system is down. + HOST_DOWN = 0xC0000350, + + /// An unsupported pre-authentication mechanism was presented to the Kerberos package. + UNSUPPORTED_PREAUTH = 0xC0000351, + + /// The encryption algorithm that is used on the source file needs a bigger key buffer than the one that is used on the destination file. + EFS_ALG_BLOB_TOO_BIG = 0xC0000352, + + /// An attempt to remove a processes DebugPort was made, but a port was not already associated with the process. + PORT_NOT_SET = 0xC0000353, + + /// An attempt to do an operation on a debug port failed because the port is in the process of being deleted. + DEBUGGER_INACTIVE = 0xC0000354, + + /// This version of Windows is not compatible with the behavior version of the directory forest, domain, or domain controller. + DS_VERSION_CHECK_FAILURE = 0xC0000355, + + /// The specified event is currently not being audited. + AUDITING_DISABLED = 0xC0000356, + + /// The machine account was created prior to Windows NT 4.0 operating system. The account needs to be recreated. + PRENT4_MACHINE_ACCOUNT = 0xC0000357, + + /// An account group cannot have a universal group as a member. + DS_AG_CANT_HAVE_UNIVERSAL_MEMBER = 0xC0000358, + + /// The specified image file did not have the correct format; it appears to be a 32-bit Windows image. + INVALID_IMAGE_WIN_32 = 0xC0000359, + + /// The specified image file did not have the correct format; it appears to be a 64-bit Windows image. + INVALID_IMAGE_WIN_64 = 0xC000035A, + + /// The client's supplied SSPI channel bindings were incorrect. + BAD_BINDINGS = 0xC000035B, + + /// The client session has expired; so the client must re-authenticate to continue accessing the remote resources. + NETWORK_SESSION_EXPIRED = 0xC000035C, + + /// The AppHelp dialog box canceled; thus preventing the application from starting. + APPHELP_BLOCK = 0xC000035D, + + /// The SID filtering operation removed all SIDs. + ALL_SIDS_FILTERED = 0xC000035E, + + /// The driver was not loaded because the system is starting in safe mode. + NOT_SAFE_MODE_DRIVER = 0xC000035F, + + /// Access to %1 has been restricted by your Administrator by the default software restriction policy level. + ACCESS_DISABLED_BY_POLICY_DEFAULT = 0xC0000361, + + /// Access to %1 has been restricted by your Administrator by location with policy rule %2 placed on path %3. + ACCESS_DISABLED_BY_POLICY_PATH = 0xC0000362, + + /// Access to %1 has been restricted by your Administrator by software publisher policy. + ACCESS_DISABLED_BY_POLICY_PUBLISHER = 0xC0000363, + + /// Access to %1 has been restricted by your Administrator by policy rule %2. + ACCESS_DISABLED_BY_POLICY_OTHER = 0xC0000364, + + /// The driver was not loaded because it failed its initialization call. + FAILED_DRIVER_ENTRY = 0xC0000365, + + /// The device encountered an error while applying power or reading the device configuration. + /// This might be caused by a failure of your hardware or by a poor connection. + DEVICE_ENUMERATION_ERROR = 0xC0000366, + + /// The create operation failed because the name contained at least one mount point that resolves to a volume to which the specified device object is not attached. + MOUNT_POINT_NOT_RESOLVED = 0xC0000368, + + /// The device object parameter is either not a valid device object or is not attached to the volume that is specified by the file name. + INVALID_DEVICE_OBJECT_PARAMETER = 0xC0000369, + + /// A machine check error has occurred. + /// Check the system event log for additional information. + MCA_OCCURED = 0xC000036A, + + /// Driver %2 has been blocked from loading. + DRIVER_BLOCKED_CRITICAL = 0xC000036B, + + /// Driver %2 has been blocked from loading. + DRIVER_BLOCKED = 0xC000036C, + + /// There was error [%2] processing the driver database. + DRIVER_DATABASE_ERROR = 0xC000036D, + + /// System hive size has exceeded its limit. + SYSTEM_HIVE_TOO_LARGE = 0xC000036E, + + /// A dynamic link library (DLL) referenced a module that was neither a DLL nor the process's executable image. + INVALID_IMPORT_OF_NON_DLL = 0xC000036F, + + /// The local account store does not contain secret material for the specified account. + NO_SECRETS = 0xC0000371, + + /// Access to %1 has been restricted by your Administrator by policy rule %2. + ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY = 0xC0000372, + + /// The system was not able to allocate enough memory to perform a stack switch. + FAILED_STACK_SWITCH = 0xC0000373, + + /// A heap has been corrupted. + HEAP_CORRUPTION = 0xC0000374, + + /// An incorrect PIN was presented to the smart card. + SMARTCARD_WRONG_PIN = 0xC0000380, + + /// The smart card is blocked. + SMARTCARD_CARD_BLOCKED = 0xC0000381, + + /// No PIN was presented to the smart card. + SMARTCARD_CARD_NOT_AUTHENTICATED = 0xC0000382, + + /// No smart card is available. + SMARTCARD_NO_CARD = 0xC0000383, + + /// The requested key container does not exist on the smart card. + SMARTCARD_NO_KEY_CONTAINER = 0xC0000384, + + /// The requested certificate does not exist on the smart card. + SMARTCARD_NO_CERTIFICATE = 0xC0000385, + + /// The requested keyset does not exist. + SMARTCARD_NO_KEYSET = 0xC0000386, + + /// A communication error with the smart card has been detected. + SMARTCARD_IO_ERROR = 0xC0000387, + + /// The system detected a possible attempt to compromise security. + /// Ensure that you can contact the server that authenticated you. + DOWNGRADE_DETECTED = 0xC0000388, + + /// The smart card certificate used for authentication has been revoked. Contact your system administrator. + /// There might be additional information in the event log. + SMARTCARD_CERT_REVOKED = 0xC0000389, + + /// An untrusted certificate authority was detected while processing the smart card certificate that is used for authentication. Contact your system administrator. + ISSUING_CA_UNTRUSTED = 0xC000038A, + + /// The revocation status of the smart card certificate that is used for authentication could not be determined. Contact your system administrator. + REVOCATION_OFFLINE_C = 0xC000038B, + + /// The smart card certificate used for authentication was not trusted. Contact your system administrator. + PKINIT_CLIENT_FAILURE = 0xC000038C, + + /// The smart card certificate used for authentication has expired. Contact your system administrator. + SMARTCARD_CERT_EXPIRED = 0xC000038D, + + /// The driver could not be loaded because a previous version of the driver is still in memory. + DRIVER_FAILED_PRIOR_UNLOAD = 0xC000038E, + + /// The smart card provider could not perform the action because the context was acquired as silent. + SMARTCARD_SILENT_CONTEXT = 0xC000038F, + + /// The delegated trust creation quota of the current user has been exceeded. + PER_USER_TRUST_QUOTA_EXCEEDED = 0xC0000401, + + /// The total delegated trust creation quota has been exceeded. + ALL_USER_TRUST_QUOTA_EXCEEDED = 0xC0000402, + + /// The delegated trust deletion quota of the current user has been exceeded. + USER_DELETE_TRUST_QUOTA_EXCEEDED = 0xC0000403, + + /// The requested name already exists as a unique identifier. + DS_NAME_NOT_UNIQUE = 0xC0000404, + + /// The requested object has a non-unique identifier and cannot be retrieved. + DS_DUPLICATE_ID_FOUND = 0xC0000405, + + /// The group cannot be converted due to attribute restrictions on the requested group type. + DS_GROUP_CONVERSION_ERROR = 0xC0000406, + + /// {Volume Shadow Copy Service} Wait while the Volume Shadow Copy Service prepares volume %hs for hibernation. + VOLSNAP_PREPARE_HIBERNATE = 0xC0000407, + + /// Kerberos sub-protocol User2User is required. + USER2USER_REQUIRED = 0xC0000408, + + /// The system detected an overrun of a stack-based buffer in this application. + /// This overrun could potentially allow a malicious user to gain control of this application. + STACK_BUFFER_OVERRUN = 0xC0000409, + + /// The Kerberos subsystem encountered an error. + /// A service for user protocol request was made against a domain controller which does not support service for user. + NO_S4U_PROT_SUPPORT = 0xC000040A, + + /// An attempt was made by this server to make a Kerberos constrained delegation request for a target that is outside the server realm. + /// This action is not supported and the resulting error indicates a misconfiguration on the allowed-to-delegate-to list for this server. Contact your administrator. + CROSSREALM_DELEGATION_FAILURE = 0xC000040B, + + /// The revocation status of the domain controller certificate used for smart card authentication could not be determined. + /// There is additional information in the system event log. Contact your system administrator. + REVOCATION_OFFLINE_KDC = 0xC000040C, + + /// An untrusted certificate authority was detected while processing the domain controller certificate used for authentication. + /// There is additional information in the system event log. Contact your system administrator. + ISSUING_CA_UNTRUSTED_KDC = 0xC000040D, + + /// The domain controller certificate used for smart card logon has expired. + /// Contact your system administrator with the contents of your system event log. + KDC_CERT_EXPIRED = 0xC000040E, + + /// The domain controller certificate used for smart card logon has been revoked. + /// Contact your system administrator with the contents of your system event log. + KDC_CERT_REVOKED = 0xC000040F, + + /// Data present in one of the parameters is more than the function can operate on. + PARAMETER_QUOTA_EXCEEDED = 0xC0000410, + + /// The system has failed to hibernate (The error code is %hs). + /// Hibernation will be disabled until the system is restarted. + HIBERNATION_FAILURE = 0xC0000411, + + /// An attempt to delay-load a .dll or get a function address in a delay-loaded .dll failed. + DELAY_LOAD_FAILED = 0xC0000412, + + /// Logon Failure: The machine you are logging onto is protected by an authentication firewall. + /// The specified account is not allowed to authenticate to the machine. + AUTHENTICATION_FIREWALL_FAILED = 0xC0000413, + + /// %hs is a 16-bit application. You do not have permissions to execute 16-bit applications. + /// Check your permissions with your system administrator. + VDM_DISALLOWED = 0xC0000414, + + /// {Display Driver Stopped Responding} The %hs display driver has stopped working normally. + /// Save your work and reboot the system to restore full display functionality. + /// The next time you reboot the machine a dialog will be displayed giving you a chance to report this failure to Microsoft. + HUNG_DISPLAY_DRIVER_THREAD = 0xC0000415, + + /// The Desktop heap encountered an error while allocating session memory. + /// There is more information in the system event log. + INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE = 0xC0000416, + + /// An invalid parameter was passed to a C runtime function. + INVALID_CRUNTIME_PARAMETER = 0xC0000417, + + /// The authentication failed because NTLM was blocked. + NTLM_BLOCKED = 0xC0000418, + + /// The source object's SID already exists in destination forest. + DS_SRC_SID_EXISTS_IN_FOREST = 0xC0000419, + + /// The domain name of the trusted domain already exists in the forest. + DS_DOMAIN_NAME_EXISTS_IN_FOREST = 0xC000041A, + + /// The flat name of the trusted domain already exists in the forest. + DS_FLAT_NAME_EXISTS_IN_FOREST = 0xC000041B, + + /// The User Principal Name (UPN) is invalid. + INVALID_USER_PRINCIPAL_NAME = 0xC000041C, + + /// There has been an assertion failure. + ASSERTION_FAILURE = 0xC0000420, + + /// Application verifier has found an error in the current process. + VERIFIER_STOP = 0xC0000421, + + /// A user mode unwind is in progress. + CALLBACK_POP_STACK = 0xC0000423, + + /// %2 has been blocked from loading due to incompatibility with this system. + /// Contact your software vendor for a compatible version of the driver. + INCOMPATIBLE_DRIVER_BLOCKED = 0xC0000424, + + /// Illegal operation attempted on a registry key which has already been unloaded. + HIVE_UNLOADED = 0xC0000425, + + /// Compression is disabled for this volume. + COMPRESSION_DISABLED = 0xC0000426, + + /// The requested operation could not be completed due to a file system limitation. + FILE_SYSTEM_LIMITATION = 0xC0000427, + + /// The hash for image %hs cannot be found in the system catalogs. + /// The image is likely corrupt or the victim of tampering. + INVALID_IMAGE_HASH = 0xC0000428, + + /// The implementation is not capable of performing the request. + NOT_CAPABLE = 0xC0000429, + + /// The requested operation is out of order with respect to other operations. + REQUEST_OUT_OF_SEQUENCE = 0xC000042A, + + /// An operation attempted to exceed an implementation-defined limit. + IMPLEMENTATION_LIMIT = 0xC000042B, + + /// The requested operation requires elevation. + ELEVATION_REQUIRED = 0xC000042C, + + /// The required security context does not exist. + NO_SECURITY_CONTEXT = 0xC000042D, + + /// The PKU2U protocol encountered an error while attempting to utilize the associated certificates. + PKU2U_CERT_FAILURE = 0xC000042E, + + /// The operation was attempted beyond the valid data length of the file. + BEYOND_VDL = 0xC0000432, + + /// The attempted write operation encountered a write already in progress for some portion of the range. + ENCOUNTERED_WRITE_IN_PROGRESS = 0xC0000433, + + /// The page fault mappings changed in the middle of processing a fault so the operation must be retried. + PTE_CHANGED = 0xC0000434, + + /// The attempt to purge this file from memory failed to purge some or all the data from memory. + PURGE_FAILED = 0xC0000435, + + /// The requested credential requires confirmation. + CRED_REQUIRES_CONFIRMATION = 0xC0000440, + + /// The remote server sent an invalid response for a file being opened with Client Side Encryption. + CS_ENCRYPTION_INVALID_SERVER_RESPONSE = 0xC0000441, + + /// Client Side Encryption is not supported by the remote server even though it claims to support it. + CS_ENCRYPTION_UNSUPPORTED_SERVER = 0xC0000442, + + /// File is encrypted and should be opened in Client Side Encryption mode. + CS_ENCRYPTION_EXISTING_ENCRYPTED_FILE = 0xC0000443, + + /// A new encrypted file is being created and a $EFS needs to be provided. + CS_ENCRYPTION_NEW_ENCRYPTED_FILE = 0xC0000444, + + /// The SMB client requested a CSE FSCTL on a non-CSE file. + CS_ENCRYPTION_FILE_NOT_CSE = 0xC0000445, + + /// Indicates a particular Security ID cannot be assigned as the label of an object. + INVALID_LABEL = 0xC0000446, + + /// The process hosting the driver for this device has terminated. + DRIVER_PROCESS_TERMINATED = 0xC0000450, + + /// The requested system device cannot be identified due to multiple indistinguishable devices potentially matching the identification criteria. + AMBIGUOUS_SYSTEM_DEVICE = 0xC0000451, + + /// The requested system device cannot be found. + SYSTEM_DEVICE_NOT_FOUND = 0xC0000452, + + /// This boot application must be restarted. + RESTART_BOOT_APPLICATION = 0xC0000453, + + /// Insufficient NVRAM resources exist to complete the API. A reboot might be required. + INSUFFICIENT_NVRAM_RESOURCES = 0xC0000454, + + /// No ranges for the specified operation were able to be processed. + NO_RANGES_PROCESSED = 0xC0000460, + + /// The storage device does not support Offload Write. + DEVICE_FEATURE_NOT_SUPPORTED = 0xC0000463, + + /// Data cannot be moved because the source device cannot communicate with the destination device. + DEVICE_UNREACHABLE = 0xC0000464, + + /// The token representing the data is invalid or expired. + INVALID_TOKEN = 0xC0000465, + + /// The file server is temporarily unavailable. + SERVER_UNAVAILABLE = 0xC0000466, + + /// The specified task name is invalid. + INVALID_TASK_NAME = 0xC0000500, + + /// The specified task index is invalid. + INVALID_TASK_INDEX = 0xC0000501, + + /// The specified thread is already joining a task. + THREAD_ALREADY_IN_TASK = 0xC0000502, + + /// A callback has requested to bypass native code. + CALLBACK_BYPASS = 0xC0000503, + + /// A fail fast exception occurred. + /// Exception handlers will not be invoked and the process will be terminated immediately. + FAIL_FAST_EXCEPTION = 0xC0000602, + + /// Windows cannot verify the digital signature for this file. + /// The signing certificate for this file has been revoked. + IMAGE_CERT_REVOKED = 0xC0000603, + + /// The ALPC port is closed. + PORT_CLOSED = 0xC0000700, + + /// The ALPC message requested is no longer available. + MESSAGE_LOST = 0xC0000701, + + /// The ALPC message supplied is invalid. + INVALID_MESSAGE = 0xC0000702, + + /// The ALPC message has been canceled. + REQUEST_CANCELED = 0xC0000703, + + /// Invalid recursive dispatch attempt. + RECURSIVE_DISPATCH = 0xC0000704, + + /// No receive buffer has been supplied in a synchronous request. + LPC_RECEIVE_BUFFER_EXPECTED = 0xC0000705, + + /// The connection port is used in an invalid context. + LPC_INVALID_CONNECTION_USAGE = 0xC0000706, + + /// The ALPC port does not accept new request messages. + LPC_REQUESTS_NOT_ALLOWED = 0xC0000707, + + /// The resource requested is already in use. + RESOURCE_IN_USE = 0xC0000708, + + /// The hardware has reported an uncorrectable memory error. + HARDWARE_MEMORY_ERROR = 0xC0000709, + + /// Status 0x%08x was returned, waiting on handle 0x%x for wait 0x%p, in waiter 0x%p. + THREADPOOL_HANDLE_EXCEPTION = 0xC000070A, + + /// After a callback to 0x%p(0x%p), a completion call to Set event(0x%p) failed with status 0x%08x. + THREADPOOL_SET_EVENT_ON_COMPLETION_FAILED = 0xC000070B, + + /// After a callback to 0x%p(0x%p), a completion call to ReleaseSemaphore(0x%p, %d) failed with status 0x%08x. + THREADPOOL_RELEASE_SEMAPHORE_ON_COMPLETION_FAILED = 0xC000070C, + + /// After a callback to 0x%p(0x%p), a completion call to ReleaseMutex(%p) failed with status 0x%08x. + THREADPOOL_RELEASE_MUTEX_ON_COMPLETION_FAILED = 0xC000070D, + + /// After a callback to 0x%p(0x%p), a completion call to FreeLibrary(%p) failed with status 0x%08x. + THREADPOOL_FREE_LIBRARY_ON_COMPLETION_FAILED = 0xC000070E, + + /// The thread pool 0x%p was released while a thread was posting a callback to 0x%p(0x%p) to it. + THREADPOOL_RELEASED_DURING_OPERATION = 0xC000070F, + + /// A thread pool worker thread is impersonating a client, after a callback to 0x%p(0x%p). + /// This is unexpected, indicating that the callback is missing a call to revert the impersonation. + CALLBACK_RETURNED_WHILE_IMPERSONATING = 0xC0000710, + + /// A thread pool worker thread is impersonating a client, after executing an APC. + /// This is unexpected, indicating that the APC is missing a call to revert the impersonation. + APC_RETURNED_WHILE_IMPERSONATING = 0xC0000711, + + /// Either the target process, or the target thread's containing process, is a protected process. + PROCESS_IS_PROTECTED = 0xC0000712, + + /// A thread is getting dispatched with MCA EXCEPTION because of MCA. + MCA_EXCEPTION = 0xC0000713, + + /// The client certificate account mapping is not unique. + CERTIFICATE_MAPPING_NOT_UNIQUE = 0xC0000714, + + /// The symbolic link cannot be followed because its type is disabled. + SYMLINK_CLASS_DISABLED = 0xC0000715, + + /// Indicates that the specified string is not valid for IDN normalization. + INVALID_IDN_NORMALIZATION = 0xC0000716, + + /// No mapping for the Unicode character exists in the target multi-byte code page. + NO_UNICODE_TRANSLATION = 0xC0000717, + + /// The provided callback is already registered. + ALREADY_REGISTERED = 0xC0000718, + + /// The provided context did not match the target. + CONTEXT_MISMATCH = 0xC0000719, + + /// The specified port already has a completion list. + PORT_ALREADY_HAS_COMPLETION_LIST = 0xC000071A, + + /// A threadpool worker thread entered a callback at thread base priority 0x%x and exited at priority 0x%x. + /// This is unexpected, indicating that the callback missed restoring the priority. + CALLBACK_RETURNED_THREAD_PRIORITY = 0xC000071B, + + /// An invalid thread, handle %p, is specified for this operation. + /// Possibly, a threadpool worker thread was specified. + INVALID_THREAD = 0xC000071C, + + /// A threadpool worker thread entered a callback, which left transaction state. + /// This is unexpected, indicating that the callback missed clearing the transaction. + CALLBACK_RETURNED_TRANSACTION = 0xC000071D, + + /// A threadpool worker thread entered a callback, which left the loader lock held. + /// This is unexpected, indicating that the callback missed releasing the lock. + CALLBACK_RETURNED_LDR_LOCK = 0xC000071E, + + /// A threadpool worker thread entered a callback, which left with preferred languages set. + /// This is unexpected, indicating that the callback missed clearing them. + CALLBACK_RETURNED_LANG = 0xC000071F, + + /// A threadpool worker thread entered a callback, which left with background priorities set. + /// This is unexpected, indicating that the callback missed restoring the original priorities. + CALLBACK_RETURNED_PRI_BACK = 0xC0000720, + + /// The attempted operation required self healing to be enabled. + DISK_REPAIR_DISABLED = 0xC0000800, + + /// The directory service cannot perform the requested operation because a domain rename operation is in progress. + DS_DOMAIN_RENAME_IN_PROGRESS = 0xC0000801, + + /// An operation failed because the storage quota was exceeded. + DISK_QUOTA_EXCEEDED = 0xC0000802, + + /// An operation failed because the content was blocked. + CONTENT_BLOCKED = 0xC0000804, + + /// The operation could not be completed due to bad clusters on disk. + BAD_CLUSTERS = 0xC0000805, + + /// The operation could not be completed because the volume is dirty. Please run the Chkdsk utility and try again. + VOLUME_DIRTY = 0xC0000806, + + /// This file is checked out or locked for editing by another user. + FILE_CHECKED_OUT = 0xC0000901, + + /// The file must be checked out before saving changes. + CHECKOUT_REQUIRED = 0xC0000902, + + /// The file type being saved or retrieved has been blocked. + BAD_FILE_TYPE = 0xC0000903, + + /// The file size exceeds the limit allowed and cannot be saved. + FILE_TOO_LARGE = 0xC0000904, + + /// Access Denied. Before opening files in this location, you must first browse to the e.g. + /// site and select the option to log on automatically. + FORMS_AUTH_REQUIRED = 0xC0000905, + + /// The operation did not complete successfully because the file contains a virus. + VIRUS_INFECTED = 0xC0000906, + + /// This file contains a virus and cannot be opened. + /// Due to the nature of this virus, the file has been removed from this location. + VIRUS_DELETED = 0xC0000907, + + /// The resources required for this device conflict with the MCFG table. + BAD_MCFG_TABLE = 0xC0000908, + + /// The operation did not complete successfully because it would cause an oplock to be broken. + /// The caller has requested that existing oplocks not be broken. + CANNOT_BREAK_OPLOCK = 0xC0000909, + + /// WOW Assertion Error. + WOW_ASSERTION = 0xC0009898, + + /// The cryptographic signature is invalid. + INVALID_SIGNATURE = 0xC000A000, + + /// The cryptographic provider does not support HMAC. + HMAC_NOT_SUPPORTED = 0xC000A001, + + /// The IPsec queue overflowed. + IPSEC_QUEUE_OVERFLOW = 0xC000A010, + + /// The neighbor discovery queue overflowed. + ND_QUEUE_OVERFLOW = 0xC000A011, + + /// An Internet Control Message Protocol (ICMP) hop limit exceeded error was received. + HOPLIMIT_EXCEEDED = 0xC000A012, + + /// The protocol is not installed on the local machine. + PROTOCOL_NOT_SUPPORTED = 0xC000A013, + + /// {Delayed Write Failed} Windows was unable to save all the data for the file %hs; the data has been lost. + /// This error might be caused by network connectivity issues. Try to save this file elsewhere. + LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED = 0xC000A080, + + /// {Delayed Write Failed} Windows was unable to save all the data for the file %hs; the data has been lost. + /// This error was returned by the server on which the file exists. Try to save this file elsewhere. + LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR = 0xC000A081, + + /// {Delayed Write Failed} Windows was unable to save all the data for the file %hs; the data has been lost. + /// This error might be caused if the device has been removed or the media is write-protected. + LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR = 0xC000A082, + + /// Windows was unable to parse the requested XML data. + XML_PARSE_ERROR = 0xC000A083, + + /// An error was encountered while processing an XML digital signature. + XMLDSIG_ERROR = 0xC000A084, + + /// This indicates that the caller made the connection request in the wrong routing compartment. + WRONG_COMPARTMENT = 0xC000A085, + + /// This indicates that there was an AuthIP failure when attempting to connect to the remote host. + AUTHIP_FAILURE = 0xC000A086, + + /// OID mapped groups cannot have members. + DS_OID_MAPPED_GROUP_CANT_HAVE_MEMBERS = 0xC000A087, + + /// The specified OID cannot be found. + DS_OID_NOT_FOUND = 0xC000A088, + + /// Hash generation for the specified version and hash type is not enabled on server. + HASH_NOT_SUPPORTED = 0xC000A100, + + /// The hash requests is not present or not up to date with the current file contents. + HASH_NOT_PRESENT = 0xC000A101, + + /// A file system filter on the server has not opted in for Offload Read support. + OFFLOAD_READ_FLT_NOT_SUPPORTED = 0xC000A2A1, + + /// A file system filter on the server has not opted in for Offload Write support. + OFFLOAD_WRITE_FLT_NOT_SUPPORTED = 0xC000A2A2, + + /// Offload read operations cannot be performed on: + /// - Compressed files + /// - Sparse files + /// - Encrypted files + /// - File system metadata files + OFFLOAD_READ_FILE_NOT_SUPPORTED = 0xC000A2A3, + + /// Offload write operations cannot be performed on: + /// - Compressed files + /// - Sparse files + /// - Encrypted files + /// - File system metadata files + OFFLOAD_WRITE_FILE_NOT_SUPPORTED = 0xC000A2A4, + + /// The debugger did not perform a state change. + DBG_NO_STATE_CHANGE = 0xC0010001, + + /// The debugger found that the application is not idle. + DBG_APP_NOT_IDLE = 0xC0010002, + + /// The string binding is invalid. + RPC_NT_INVALID_STRING_BINDING = 0xC0020001, + + /// The binding handle is not the correct type. + RPC_NT_WRONG_KIND_OF_BINDING = 0xC0020002, + + /// The binding handle is invalid. + RPC_NT_INVALID_BINDING = 0xC0020003, + + /// The RPC protocol sequence is not supported. + RPC_NT_PROTSEQ_NOT_SUPPORTED = 0xC0020004, + + /// The RPC protocol sequence is invalid. + RPC_NT_INVALID_RPC_PROTSEQ = 0xC0020005, + + /// The string UUID is invalid. + RPC_NT_INVALID_STRING_UUID = 0xC0020006, + + /// The endpoint format is invalid. + RPC_NT_INVALID_ENDPOINT_FORMAT = 0xC0020007, + + /// The network address is invalid. + RPC_NT_INVALID_NET_ADDR = 0xC0020008, + + /// No endpoint was found. + RPC_NT_NO_ENDPOINT_FOUND = 0xC0020009, + + /// The time-out value is invalid. + RPC_NT_INVALID_TIMEOUT = 0xC002000A, + + /// The object UUID was not found. + RPC_NT_OBJECT_NOT_FOUND = 0xC002000B, + + /// The object UUID has already been registered. + RPC_NT_ALREADY_REGISTERED = 0xC002000C, + + /// The type UUID has already been registered. + RPC_NT_TYPE_ALREADY_REGISTERED = 0xC002000D, + + /// The RPC server is already listening. + RPC_NT_ALREADY_LISTENING = 0xC002000E, + + /// No protocol sequences have been registered. + RPC_NT_NO_PROTSEQS_REGISTERED = 0xC002000F, + + /// The RPC server is not listening. + RPC_NT_NOT_LISTENING = 0xC0020010, + + /// The manager type is unknown. + RPC_NT_UNKNOWN_MGR_TYPE = 0xC0020011, + + /// The interface is unknown. + RPC_NT_UNKNOWN_IF = 0xC0020012, + + /// There are no bindings. + RPC_NT_NO_BINDINGS = 0xC0020013, + + /// There are no protocol sequences. + RPC_NT_NO_PROTSEQS = 0xC0020014, + + /// The endpoint cannot be created. + RPC_NT_CANT_CREATE_ENDPOINT = 0xC0020015, + + /// Insufficient resources are available to complete this operation. + RPC_NT_OUT_OF_RESOURCES = 0xC0020016, + + /// The RPC server is unavailable. + RPC_NT_SERVER_UNAVAILABLE = 0xC0020017, + + /// The RPC server is too busy to complete this operation. + RPC_NT_SERVER_TOO_BUSY = 0xC0020018, + + /// The network options are invalid. + RPC_NT_INVALID_NETWORK_OPTIONS = 0xC0020019, + + /// No RPCs are active on this thread. + RPC_NT_NO_CALL_ACTIVE = 0xC002001A, + + /// The RPC failed. + RPC_NT_CALL_FAILED = 0xC002001B, + + /// The RPC failed and did not execute. + RPC_NT_CALL_FAILED_DNE = 0xC002001C, + + /// An RPC protocol error occurred. + RPC_NT_PROTOCOL_ERROR = 0xC002001D, + + /// The RPC server does not support the transfer syntax. + RPC_NT_UNSUPPORTED_TRANS_SYN = 0xC002001F, + + /// The type UUID is not supported. + RPC_NT_UNSUPPORTED_TYPE = 0xC0020021, + + /// The tag is invalid. + RPC_NT_INVALID_TAG = 0xC0020022, + + /// The array bounds are invalid. + RPC_NT_INVALID_BOUND = 0xC0020023, + + /// The binding does not contain an entry name. + RPC_NT_NO_ENTRY_NAME = 0xC0020024, + + /// The name syntax is invalid. + RPC_NT_INVALID_NAME_SYNTAX = 0xC0020025, + + /// The name syntax is not supported. + RPC_NT_UNSUPPORTED_NAME_SYNTAX = 0xC0020026, + + /// No network address is available to construct a UUID. + RPC_NT_UUID_NO_ADDRESS = 0xC0020028, + + /// The endpoint is a duplicate. + RPC_NT_DUPLICATE_ENDPOINT = 0xC0020029, + + /// The authentication type is unknown. + RPC_NT_UNKNOWN_AUTHN_TYPE = 0xC002002A, + + /// The maximum number of calls is too small. + RPC_NT_MAX_CALLS_TOO_SMALL = 0xC002002B, + + /// The string is too long. + RPC_NT_STRING_TOO_LONG = 0xC002002C, + + /// The RPC protocol sequence was not found. + RPC_NT_PROTSEQ_NOT_FOUND = 0xC002002D, + + /// The procedure number is out of range. + RPC_NT_PROCNUM_OUT_OF_RANGE = 0xC002002E, + + /// The binding does not contain any authentication information. + RPC_NT_BINDING_HAS_NO_AUTH = 0xC002002F, + + /// The authentication service is unknown. + RPC_NT_UNKNOWN_AUTHN_SERVICE = 0xC0020030, + + /// The authentication level is unknown. + RPC_NT_UNKNOWN_AUTHN_LEVEL = 0xC0020031, + + /// The security context is invalid. + RPC_NT_INVALID_AUTH_IDENTITY = 0xC0020032, + + /// The authorization service is unknown. + RPC_NT_UNKNOWN_AUTHZ_SERVICE = 0xC0020033, + + /// The entry is invalid. + EPT_NT_INVALID_ENTRY = 0xC0020034, + + /// The operation cannot be performed. + EPT_NT_CANT_PERFORM_OP = 0xC0020035, + + /// No more endpoints are available from the endpoint mapper. + EPT_NT_NOT_REGISTERED = 0xC0020036, + + /// No interfaces have been exported. + RPC_NT_NOTHING_TO_EXPORT = 0xC0020037, + + /// The entry name is incomplete. + RPC_NT_INCOMPLETE_NAME = 0xC0020038, + + /// The version option is invalid. + RPC_NT_INVALID_VERS_OPTION = 0xC0020039, + + /// There are no more members. + RPC_NT_NO_MORE_MEMBERS = 0xC002003A, + + /// There is nothing to unexport. + RPC_NT_NOT_ALL_OBJS_UNEXPORTED = 0xC002003B, + + /// The interface was not found. + RPC_NT_INTERFACE_NOT_FOUND = 0xC002003C, + + /// The entry already exists. + RPC_NT_ENTRY_ALREADY_EXISTS = 0xC002003D, + + /// The entry was not found. + RPC_NT_ENTRY_NOT_FOUND = 0xC002003E, + + /// The name service is unavailable. + RPC_NT_NAME_SERVICE_UNAVAILABLE = 0xC002003F, + + /// The network address family is invalid. + RPC_NT_INVALID_NAF_ID = 0xC0020040, + + /// The requested operation is not supported. + RPC_NT_CANNOT_SUPPORT = 0xC0020041, + + /// No security context is available to allow impersonation. + RPC_NT_NO_CONTEXT_AVAILABLE = 0xC0020042, + + /// An internal error occurred in the RPC. + RPC_NT_INTERNAL_ERROR = 0xC0020043, + + /// The RPC server attempted to divide an integer by zero. + RPC_NT_ZERO_DIVIDE = 0xC0020044, + + /// An addressing error occurred in the RPC server. + RPC_NT_ADDRESS_ERROR = 0xC0020045, + + /// A floating point operation at the RPC server caused a divide by zero. + RPC_NT_FP_DIV_ZERO = 0xC0020046, + + /// A floating point underflow occurred at the RPC server. + RPC_NT_FP_UNDERFLOW = 0xC0020047, + + /// A floating point overflow occurred at the RPC server. + RPC_NT_FP_OVERFLOW = 0xC0020048, + + /// An RPC is already in progress for this thread. + RPC_NT_CALL_IN_PROGRESS = 0xC0020049, + + /// There are no more bindings. + RPC_NT_NO_MORE_BINDINGS = 0xC002004A, + + /// The group member was not found. + RPC_NT_GROUP_MEMBER_NOT_FOUND = 0xC002004B, + + /// The endpoint mapper database entry could not be created. + EPT_NT_CANT_CREATE = 0xC002004C, + + /// The object UUID is the nil UUID. + RPC_NT_INVALID_OBJECT = 0xC002004D, + + /// No interfaces have been registered. + RPC_NT_NO_INTERFACES = 0xC002004F, + + /// The RPC was canceled. + RPC_NT_CALL_CANCELLED = 0xC0020050, + + /// The binding handle does not contain all the required information. + RPC_NT_BINDING_INCOMPLETE = 0xC0020051, + + /// A communications failure occurred during an RPC. + RPC_NT_COMM_FAILURE = 0xC0020052, + + /// The requested authentication level is not supported. + RPC_NT_UNSUPPORTED_AUTHN_LEVEL = 0xC0020053, + + /// No principal name was registered. + RPC_NT_NO_PRINC_NAME = 0xC0020054, + + /// The error specified is not a valid Windows RPC error code. + RPC_NT_NOT_RPC_ERROR = 0xC0020055, + + /// A security package-specific error occurred. + RPC_NT_SEC_PKG_ERROR = 0xC0020057, + + /// The thread was not canceled. + RPC_NT_NOT_CANCELLED = 0xC0020058, + + /// Invalid asynchronous RPC handle. + RPC_NT_INVALID_ASYNC_HANDLE = 0xC0020062, + + /// Invalid asynchronous RPC call handle for this operation. + RPC_NT_INVALID_ASYNC_CALL = 0xC0020063, + + /// Access to the HTTP proxy is denied. + RPC_NT_PROXY_ACCESS_DENIED = 0xC0020064, + + /// The list of RPC servers available for auto-handle binding has been exhausted. + RPC_NT_NO_MORE_ENTRIES = 0xC0030001, + + /// The file designated by DCERPCCHARTRANS cannot be opened. + RPC_NT_SS_CHAR_TRANS_OPEN_FAIL = 0xC0030002, + + /// The file containing the character translation table has fewer than 512 bytes. + RPC_NT_SS_CHAR_TRANS_SHORT_FILE = 0xC0030003, + + /// A null context handle is passed as an [in] parameter. + RPC_NT_SS_IN_NULL_CONTEXT = 0xC0030004, + + /// The context handle does not match any known context handles. + RPC_NT_SS_CONTEXT_MISMATCH = 0xC0030005, + + /// The context handle changed during a call. + RPC_NT_SS_CONTEXT_DAMAGED = 0xC0030006, + + /// The binding handles passed to an RPC do not match. + RPC_NT_SS_HANDLES_MISMATCH = 0xC0030007, + + /// The stub is unable to get the call handle. + RPC_NT_SS_CANNOT_GET_CALL_HANDLE = 0xC0030008, + + /// A null reference pointer was passed to the stub. + RPC_NT_NULL_REF_POINTER = 0xC0030009, + + /// The enumeration value is out of range. + RPC_NT_ENUM_VALUE_OUT_OF_RANGE = 0xC003000A, + + /// The byte count is too small. + RPC_NT_BYTE_COUNT_TOO_SMALL = 0xC003000B, + + /// The stub received bad data. + RPC_NT_BAD_STUB_DATA = 0xC003000C, + + /// Invalid operation on the encoding/decoding handle. + RPC_NT_INVALID_ES_ACTION = 0xC0030059, + + /// Incompatible version of the serializing package. + RPC_NT_WRONG_ES_VERSION = 0xC003005A, + + /// Incompatible version of the RPC stub. + RPC_NT_WRONG_STUB_VERSION = 0xC003005B, + + /// The RPC pipe object is invalid or corrupt. + RPC_NT_INVALID_PIPE_OBJECT = 0xC003005C, + + /// An invalid operation was attempted on an RPC pipe object. + RPC_NT_INVALID_PIPE_OPERATION = 0xC003005D, + + /// Unsupported RPC pipe version. + RPC_NT_WRONG_PIPE_VERSION = 0xC003005E, + + /// The RPC pipe object has already been closed. + RPC_NT_PIPE_CLOSED = 0xC003005F, + + /// The RPC call completed before all pipes were processed. + RPC_NT_PIPE_DISCIPLINE_ERROR = 0xC0030060, + + /// No more data is available from the RPC pipe. + RPC_NT_PIPE_EMPTY = 0xC0030061, + + /// A device is missing in the system BIOS MPS table. This device will not be used. + /// Contact your system vendor for a system BIOS update. + PNP_BAD_MPS_TABLE = 0xC0040035, + + /// A translator failed to translate resources. + PNP_TRANSLATION_FAILED = 0xC0040036, + + /// An IRQ translator failed to translate resources. + PNP_IRQ_TRANSLATION_FAILED = 0xC0040037, + + /// Driver %2 returned an invalid ID for a child device (%3). + PNP_INVALID_ID = 0xC0040038, + + /// Reissue the given operation as a cached I/O operation + IO_REISSUE_AS_CACHED = 0xC0040039, + + /// Session name %1 is invalid. + CTX_WINSTATION_NAME_INVALID = 0xC00A0001, + + /// The protocol driver %1 is invalid. + CTX_INVALID_PD = 0xC00A0002, + + /// The protocol driver %1 was not found in the system path. + CTX_PD_NOT_FOUND = 0xC00A0003, + + /// A close operation is pending on the terminal connection. + CTX_CLOSE_PENDING = 0xC00A0006, + + /// No free output buffers are available. + CTX_NO_OUTBUF = 0xC00A0007, + + /// The MODEM.INF file was not found. + CTX_MODEM_INF_NOT_FOUND = 0xC00A0008, + + /// The modem (%1) was not found in the MODEM.INF file. + CTX_INVALID_MODEMNAME = 0xC00A0009, + + /// The modem did not accept the command sent to it. + /// Verify that the configured modem name matches the attached modem. + CTX_RESPONSE_ERROR = 0xC00A000A, + + /// The modem did not respond to the command sent to it. + /// Verify that the modem cable is properly attached and the modem is turned on. + CTX_MODEM_RESPONSE_TIMEOUT = 0xC00A000B, + + /// Carrier detection has failed or the carrier has been dropped due to disconnection. + CTX_MODEM_RESPONSE_NO_CARRIER = 0xC00A000C, + + /// A dial tone was not detected within the required time. + /// Verify that the phone cable is properly attached and functional. + CTX_MODEM_RESPONSE_NO_DIALTONE = 0xC00A000D, + + /// A busy signal was detected at a remote site on callback. + CTX_MODEM_RESPONSE_BUSY = 0xC00A000E, + + /// A voice was detected at a remote site on callback. + CTX_MODEM_RESPONSE_VOICE = 0xC00A000F, + + /// Transport driver error. + CTX_TD_ERROR = 0xC00A0010, + + /// The client you are using is not licensed to use this system. Your logon request is denied. + CTX_LICENSE_CLIENT_INVALID = 0xC00A0012, + + /// The system has reached its licensed logon limit. Try again later. + CTX_LICENSE_NOT_AVAILABLE = 0xC00A0013, + + /// The system license has expired. Your logon request is denied. + CTX_LICENSE_EXPIRED = 0xC00A0014, + + /// The specified session cannot be found. + CTX_WINSTATION_NOT_FOUND = 0xC00A0015, + + /// The specified session name is already in use. + CTX_WINSTATION_NAME_COLLISION = 0xC00A0016, + + /// The requested operation cannot be completed because the terminal connection is currently processing a connect, disconnect, reset, or delete operation. + CTX_WINSTATION_BUSY = 0xC00A0017, + + /// An attempt has been made to connect to a session whose video mode is not supported by the current client. + CTX_BAD_VIDEO_MODE = 0xC00A0018, + + /// The application attempted to enable DOS graphics mode. DOS graphics mode is not supported. + CTX_GRAPHICS_INVALID = 0xC00A0022, + + /// The requested operation can be performed only on the system console. + /// This is most often the result of a driver or system DLL requiring direct console access. + CTX_NOT_CONSOLE = 0xC00A0024, + + /// The client failed to respond to the server connect message. + CTX_CLIENT_QUERY_TIMEOUT = 0xC00A0026, + + /// Disconnecting the console session is not supported. + CTX_CONSOLE_DISCONNECT = 0xC00A0027, + + /// Reconnecting a disconnected session to the console is not supported. + CTX_CONSOLE_CONNECT = 0xC00A0028, + + /// The request to control another session remotely was denied. + CTX_SHADOW_DENIED = 0xC00A002A, + + /// A process has requested access to a session, but has not been granted those access rights. + CTX_WINSTATION_ACCESS_DENIED = 0xC00A002B, + + /// The terminal connection driver %1 is invalid. + CTX_INVALID_WD = 0xC00A002E, + + /// The terminal connection driver %1 was not found in the system path. + CTX_WD_NOT_FOUND = 0xC00A002F, + + /// The requested session cannot be controlled remotely. + /// You cannot control your own session, a session that is trying to control your session, a session that has no user logged on, or other sessions from the console. + CTX_SHADOW_INVALID = 0xC00A0030, + + /// The requested session is not configured to allow remote control. + CTX_SHADOW_DISABLED = 0xC00A0031, + + /// The RDP protocol component %2 detected an error in the protocol stream and has disconnected the client. + RDP_PROTOCOL_ERROR = 0xC00A0032, + + /// Your request to connect to this terminal server has been rejected. + /// Your terminal server client license number has not been entered for this copy of the terminal client. + /// Contact your system administrator for help in entering a valid, unique license number for this terminal server client. Click OK to continue. + CTX_CLIENT_LICENSE_NOT_SET = 0xC00A0033, + + /// Your request to connect to this terminal server has been rejected. + /// Your terminal server client license number is currently being used by another user. + /// Contact your system administrator to obtain a new copy of the terminal server client with a valid, unique license number. Click OK to continue. + CTX_CLIENT_LICENSE_IN_USE = 0xC00A0034, + + /// The remote control of the console was terminated because the display mode was changed. + /// Changing the display mode in a remote control session is not supported. + CTX_SHADOW_ENDED_BY_MODE_CHANGE = 0xC00A0035, + + /// Remote control could not be terminated because the specified session is not currently being remotely controlled. + CTX_SHADOW_NOT_RUNNING = 0xC00A0036, + + /// Your interactive logon privilege has been disabled. Contact your system administrator. + CTX_LOGON_DISABLED = 0xC00A0037, + + /// The terminal server security layer detected an error in the protocol stream and has disconnected the client. + CTX_SECURITY_LAYER_ERROR = 0xC00A0038, + + /// The target session is incompatible with the current session. + TS_INCOMPATIBLE_SESSIONS = 0xC00A0039, + + /// The resource loader failed to find an MUI file. + MUI_FILE_NOT_FOUND = 0xC00B0001, + + /// The resource loader failed to load an MUI file because the file failed to pass validation. + MUI_INVALID_FILE = 0xC00B0002, + + /// The RC manifest is corrupted with garbage data, is an unsupported version, or is missing a required item. + MUI_INVALID_RC_CONFIG = 0xC00B0003, + + /// The RC manifest has an invalid culture name. + MUI_INVALID_LOCALE_NAME = 0xC00B0004, + + /// The RC manifest has and invalid ultimate fallback name. + MUI_INVALID_ULTIMATEFALLBACK_NAME = 0xC00B0005, + + /// The resource loader cache does not have a loaded MUI entry. + MUI_FILE_NOT_LOADED = 0xC00B0006, + + /// The user stopped resource enumeration. + RESOURCE_ENUM_USER_STOP = 0xC00B0007, + + /// The cluster node is not valid. + CLUSTER_INVALID_NODE = 0xC0130001, + + /// The cluster node already exists. + CLUSTER_NODE_EXISTS = 0xC0130002, + + /// A node is in the process of joining the cluster. + CLUSTER_JOIN_IN_PROGRESS = 0xC0130003, + + /// The cluster node was not found. + CLUSTER_NODE_NOT_FOUND = 0xC0130004, + + /// The cluster local node information was not found. + CLUSTER_LOCAL_NODE_NOT_FOUND = 0xC0130005, + + /// The cluster network already exists. + CLUSTER_NETWORK_EXISTS = 0xC0130006, + + /// The cluster network was not found. + CLUSTER_NETWORK_NOT_FOUND = 0xC0130007, + + /// The cluster network interface already exists. + CLUSTER_NETINTERFACE_EXISTS = 0xC0130008, + + /// The cluster network interface was not found. + CLUSTER_NETINTERFACE_NOT_FOUND = 0xC0130009, + + /// The cluster request is not valid for this object. + CLUSTER_INVALID_REQUEST = 0xC013000A, + + /// The cluster network provider is not valid. + CLUSTER_INVALID_NETWORK_PROVIDER = 0xC013000B, + + /// The cluster node is down. + CLUSTER_NODE_DOWN = 0xC013000C, + + /// The cluster node is not reachable. + CLUSTER_NODE_UNREACHABLE = 0xC013000D, + + /// The cluster node is not a member of the cluster. + CLUSTER_NODE_NOT_MEMBER = 0xC013000E, + + /// A cluster join operation is not in progress. + CLUSTER_JOIN_NOT_IN_PROGRESS = 0xC013000F, + + /// The cluster network is not valid. + CLUSTER_INVALID_NETWORK = 0xC0130010, + + /// No network adapters are available. + CLUSTER_NO_NET_ADAPTERS = 0xC0130011, + + /// The cluster node is up. + CLUSTER_NODE_UP = 0xC0130012, + + /// The cluster node is paused. + CLUSTER_NODE_PAUSED = 0xC0130013, + + /// The cluster node is not paused. + CLUSTER_NODE_NOT_PAUSED = 0xC0130014, + + /// No cluster security context is available. + CLUSTER_NO_SECURITY_CONTEXT = 0xC0130015, + + /// The cluster network is not configured for internal cluster communication. + CLUSTER_NETWORK_NOT_INTERNAL = 0xC0130016, + + /// The cluster node has been poisoned. + CLUSTER_POISONED = 0xC0130017, + + /// An attempt was made to run an invalid AML opcode. + ACPI_INVALID_OPCODE = 0xC0140001, + + /// The AML interpreter stack has overflowed. + ACPI_STACK_OVERFLOW = 0xC0140002, + + /// An inconsistent state has occurred. + ACPI_ASSERT_FAILED = 0xC0140003, + + /// An attempt was made to access an array outside its bounds. + ACPI_INVALID_INDEX = 0xC0140004, + + /// A required argument was not specified. + ACPI_INVALID_ARGUMENT = 0xC0140005, + + /// A fatal error has occurred. + ACPI_FATAL = 0xC0140006, + + /// An invalid SuperName was specified. + ACPI_INVALID_SUPERNAME = 0xC0140007, + + /// An argument with an incorrect type was specified. + ACPI_INVALID_ARGTYPE = 0xC0140008, + + /// An object with an incorrect type was specified. + ACPI_INVALID_OBJTYPE = 0xC0140009, + + /// A target with an incorrect type was specified. + ACPI_INVALID_TARGETTYPE = 0xC014000A, + + /// An incorrect number of arguments was specified. + ACPI_INCORRECT_ARGUMENT_COUNT = 0xC014000B, + + /// An address failed to translate. + ACPI_ADDRESS_NOT_MAPPED = 0xC014000C, + + /// An incorrect event type was specified. + ACPI_INVALID_EVENTTYPE = 0xC014000D, + + /// A handler for the target already exists. + ACPI_HANDLER_COLLISION = 0xC014000E, + + /// Invalid data for the target was specified. + ACPI_INVALID_DATA = 0xC014000F, + + /// An invalid region for the target was specified. + ACPI_INVALID_REGION = 0xC0140010, + + /// An attempt was made to access a field outside the defined range. + ACPI_INVALID_ACCESS_SIZE = 0xC0140011, + + /// The global system lock could not be acquired. + ACPI_ACQUIRE_GLOBAL_LOCK = 0xC0140012, + + /// An attempt was made to reinitialize the ACPI subsystem. + ACPI_ALREADY_INITIALIZED = 0xC0140013, + + /// The ACPI subsystem has not been initialized. + ACPI_NOT_INITIALIZED = 0xC0140014, + + /// An incorrect mutex was specified. + ACPI_INVALID_MUTEX_LEVEL = 0xC0140015, + + /// The mutex is not currently owned. + ACPI_MUTEX_NOT_OWNED = 0xC0140016, + + /// An attempt was made to access the mutex by a process that was not the owner. + ACPI_MUTEX_NOT_OWNER = 0xC0140017, + + /// An error occurred during an access to region space. + ACPI_RS_ACCESS = 0xC0140018, + + /// An attempt was made to use an incorrect table. + ACPI_INVALID_TABLE = 0xC0140019, + + /// The registration of an ACPI event failed. + ACPI_REG_HANDLER_FAILED = 0xC0140020, + + /// An ACPI power object failed to transition state. + ACPI_POWER_REQUEST_FAILED = 0xC0140021, + + /// The requested section is not present in the activation context. + SXS_SECTION_NOT_FOUND = 0xC0150001, + + /// Windows was unble to process the application binding information. + /// Refer to the system event log for further information. + SXS_CANT_GEN_ACTCTX = 0xC0150002, + + /// The application binding data format is invalid. + SXS_INVALID_ACTCTXDATA_FORMAT = 0xC0150003, + + /// The referenced assembly is not installed on the system. + SXS_ASSEMBLY_NOT_FOUND = 0xC0150004, + + /// The manifest file does not begin with the required tag and format information. + SXS_MANIFEST_FORMAT_ERROR = 0xC0150005, + + /// The manifest file contains one or more syntax errors. + SXS_MANIFEST_PARSE_ERROR = 0xC0150006, + + /// The application attempted to activate a disabled activation context. + SXS_ACTIVATION_CONTEXT_DISABLED = 0xC0150007, + + /// The requested lookup key was not found in any active activation context. + SXS_KEY_NOT_FOUND = 0xC0150008, + + /// A component version required by the application conflicts with another component version that is already active. + SXS_VERSION_CONFLICT = 0xC0150009, + + /// The type requested activation context section does not match the query API used. + SXS_WRONG_SECTION_TYPE = 0xC015000A, + + /// Lack of system resources has required isolated activation to be disabled for the current thread of execution. + SXS_THREAD_QUERIES_DISABLED = 0xC015000B, + + /// The referenced assembly could not be found. + SXS_ASSEMBLY_MISSING = 0xC015000C, + + /// An attempt to set the process default activation context failed because the process default activation context was already set. + SXS_PROCESS_DEFAULT_ALREADY_SET = 0xC015000E, + + /// The activation context being deactivated is not the most recently activated one. + SXS_EARLY_DEACTIVATION = 0xC015000F, + + /// The activation context being deactivated is not active for the current thread of execution. + SXS_INVALID_DEACTIVATION = 0xC0150010, + + /// The activation context being deactivated has already been deactivated. + SXS_MULTIPLE_DEACTIVATION = 0xC0150011, + + /// The activation context of the system default assembly could not be generated. + SXS_SYSTEM_DEFAULT_ACTIVATION_CONTEXT_EMPTY = 0xC0150012, + + /// A component used by the isolation facility has requested that the process be terminated. + SXS_PROCESS_TERMINATION_REQUESTED = 0xC0150013, + + /// The activation context activation stack for the running thread of execution is corrupt. + SXS_CORRUPT_ACTIVATION_STACK = 0xC0150014, + + /// The application isolation metadata for this process or thread has become corrupt. + SXS_CORRUPTION = 0xC0150015, + + /// The value of an attribute in an identity is not within the legal range. + SXS_INVALID_IDENTITY_ATTRIBUTE_VALUE = 0xC0150016, + + /// The name of an attribute in an identity is not within the legal range. + SXS_INVALID_IDENTITY_ATTRIBUTE_NAME = 0xC0150017, + + /// An identity contains two definitions for the same attribute. + SXS_IDENTITY_DUPLICATE_ATTRIBUTE = 0xC0150018, + + /// The identity string is malformed. + /// This might be due to a trailing comma, more than two unnamed attributes, a missing attribute name, or a missing attribute value. + SXS_IDENTITY_PARSE_ERROR = 0xC0150019, + + /// The component store has become corrupted. + SXS_COMPONENT_STORE_CORRUPT = 0xC015001A, + + /// A component's file does not match the verification information present in the component manifest. + SXS_FILE_HASH_MISMATCH = 0xC015001B, + + /// The identities of the manifests are identical, but their contents are different. + SXS_MANIFEST_IDENTITY_SAME_BUT_CONTENTS_DIFFERENT = 0xC015001C, + + /// The component identities are different. + SXS_IDENTITIES_DIFFERENT = 0xC015001D, + + /// The assembly is not a deployment. + SXS_ASSEMBLY_IS_NOT_A_DEPLOYMENT = 0xC015001E, + + /// The file is not a part of the assembly. + SXS_FILE_NOT_PART_OF_ASSEMBLY = 0xC015001F, + + /// An advanced installer failed during setup or servicing. + ADVANCED_INSTALLER_FAILED = 0xC0150020, + + /// The character encoding in the XML declaration did not match the encoding used in the document. + XML_ENCODING_MISMATCH = 0xC0150021, + + /// The size of the manifest exceeds the maximum allowed. + SXS_MANIFEST_TOO_BIG = 0xC0150022, + + /// The setting is not registered. + SXS_SETTING_NOT_REGISTERED = 0xC0150023, + + /// One or more required transaction members are not present. + SXS_TRANSACTION_CLOSURE_INCOMPLETE = 0xC0150024, + + /// The SMI primitive installer failed during setup or servicing. + SMI_PRIMITIVE_INSTALLER_FAILED = 0xC0150025, + + /// A generic command executable returned a result that indicates failure. + GENERIC_COMMAND_FAILED = 0xC0150026, + + /// A component is missing file verification information in its manifest. + SXS_FILE_HASH_MISSING = 0xC0150027, + + /// The function attempted to use a name that is reserved for use by another transaction. + TRANSACTIONAL_CONFLICT = 0xC0190001, + + /// The transaction handle associated with this operation is invalid. + INVALID_TRANSACTION = 0xC0190002, + + /// The requested operation was made in the context of a transaction that is no longer active. + TRANSACTION_NOT_ACTIVE = 0xC0190003, + + /// The transaction manager was unable to be successfully initialized. Transacted operations are not supported. + TM_INITIALIZATION_FAILED = 0xC0190004, + + /// Transaction support within the specified file system resource manager was not started or was shut down due to an error. + RM_NOT_ACTIVE = 0xC0190005, + + /// The metadata of the resource manager has been corrupted. The resource manager will not function. + RM_METADATA_CORRUPT = 0xC0190006, + + /// The resource manager attempted to prepare a transaction that it has not successfully joined. + TRANSACTION_NOT_JOINED = 0xC0190007, + + /// The specified directory does not contain a file system resource manager. + DIRECTORY_NOT_RM = 0xC0190008, + + /// The remote server or share does not support transacted file operations. + TRANSACTIONS_UNSUPPORTED_REMOTE = 0xC019000A, + + /// The requested log size for the file system resource manager is invalid. + LOG_RESIZE_INVALID_SIZE = 0xC019000B, + + /// The remote server sent mismatching version number or Fid for a file opened with transactions. + REMOTE_FILE_VERSION_MISMATCH = 0xC019000C, + + /// The resource manager tried to register a protocol that already exists. + CRM_PROTOCOL_ALREADY_EXISTS = 0xC019000F, + + /// The attempt to propagate the transaction failed. + TRANSACTION_PROPAGATION_FAILED = 0xC0190010, + + /// The requested propagation protocol was not registered as a CRM. + CRM_PROTOCOL_NOT_FOUND = 0xC0190011, + + /// The transaction object already has a superior enlistment, and the caller attempted an operation that would have created a new superior. Only a single superior enlistment is allowed. + TRANSACTION_SUPERIOR_EXISTS = 0xC0190012, + + /// The requested operation is not valid on the transaction object in its current state. + TRANSACTION_REQUEST_NOT_VALID = 0xC0190013, + + /// The caller has called a response API, but the response is not expected because the transaction manager did not issue the corresponding request to the caller. + TRANSACTION_NOT_REQUESTED = 0xC0190014, + + /// It is too late to perform the requested operation, because the transaction has already been aborted. + TRANSACTION_ALREADY_ABORTED = 0xC0190015, + + /// It is too late to perform the requested operation, because the transaction has already been committed. + TRANSACTION_ALREADY_COMMITTED = 0xC0190016, + + /// The buffer passed in to NtPushTransaction or NtPullTransaction is not in a valid format. + TRANSACTION_INVALID_MARSHALL_BUFFER = 0xC0190017, + + /// The current transaction context associated with the thread is not a valid handle to a transaction object. + CURRENT_TRANSACTION_NOT_VALID = 0xC0190018, + + /// An attempt to create space in the transactional resource manager's log failed. + /// The failure status has been recorded in the event log. + LOG_GROWTH_FAILED = 0xC0190019, + + /// The object (file, stream, or link) that corresponds to the handle has been deleted by a transaction savepoint rollback. + OBJECT_NO_LONGER_EXISTS = 0xC0190021, + + /// The specified file miniversion was not found for this transacted file open. + STREAM_MINIVERSION_NOT_FOUND = 0xC0190022, + + /// The specified file miniversion was found but has been invalidated. + /// The most likely cause is a transaction savepoint rollback. + STREAM_MINIVERSION_NOT_VALID = 0xC0190023, + + /// A miniversion can be opened only in the context of the transaction that created it. + MINIVERSION_INACCESSIBLE_FROM_SPECIFIED_TRANSACTION = 0xC0190024, + + /// It is not possible to open a miniversion with modify access. + CANT_OPEN_MINIVERSION_WITH_MODIFY_INTENT = 0xC0190025, + + /// It is not possible to create any more miniversions for this stream. + CANT_CREATE_MORE_STREAM_MINIVERSIONS = 0xC0190026, + + /// The handle has been invalidated by a transaction. + /// The most likely cause is the presence of memory mapping on a file or an open handle when the transaction ended or rolled back to savepoint. + HANDLE_NO_LONGER_VALID = 0xC0190028, + + /// The log data is corrupt. + LOG_CORRUPTION_DETECTED = 0xC0190030, + + /// The transaction outcome is unavailable because the resource manager responsible for it is disconnected. + RM_DISCONNECTED = 0xC0190032, + + /// The request was rejected because the enlistment in question is not a superior enlistment. + ENLISTMENT_NOT_SUPERIOR = 0xC0190033, + + /// The file cannot be opened in a transaction because its identity depends on the outcome of an unresolved transaction. + FILE_IDENTITY_NOT_PERSISTENT = 0xC0190036, + + /// The operation cannot be performed because another transaction is depending on this property not changing. + CANT_BREAK_TRANSACTIONAL_DEPENDENCY = 0xC0190037, + + /// The operation would involve a single file with two transactional resource managers and is, therefore, not allowed. + CANT_CROSS_RM_BOUNDARY = 0xC0190038, + + /// The $Txf directory must be empty for this operation to succeed. + TXF_DIR_NOT_EMPTY = 0xC0190039, + + /// The operation would leave a transactional resource manager in an inconsistent state and is therefore not allowed. + INDOUBT_TRANSACTIONS_EXIST = 0xC019003A, + + /// The operation could not be completed because the transaction manager does not have a log. + TM_VOLATILE = 0xC019003B, + + /// A rollback could not be scheduled because a previously scheduled rollback has already executed or been queued for execution. + ROLLBACK_TIMER_EXPIRED = 0xC019003C, + + /// The transactional metadata attribute on the file or directory %hs is corrupt and unreadable. + TXF_ATTRIBUTE_CORRUPT = 0xC019003D, + + /// The encryption operation could not be completed because a transaction is active. + EFS_NOT_ALLOWED_IN_TRANSACTION = 0xC019003E, + + /// This object is not allowed to be opened in a transaction. + TRANSACTIONAL_OPEN_NOT_ALLOWED = 0xC019003F, + + /// Memory mapping (creating a mapped section) a remote file under a transaction is not supported. + TRANSACTED_MAPPING_UNSUPPORTED_REMOTE = 0xC0190040, + + /// Promotion was required to allow the resource manager to enlist, but the transaction was set to disallow it. + TRANSACTION_REQUIRED_PROMOTION = 0xC0190043, + + /// This file is open for modification in an unresolved transaction and can be opened for execute only by a transacted reader. + CANNOT_EXECUTE_FILE_IN_TRANSACTION = 0xC0190044, + + /// The request to thaw frozen transactions was ignored because transactions were not previously frozen. + TRANSACTIONS_NOT_FROZEN = 0xC0190045, + + /// Transactions cannot be frozen because a freeze is already in progress. + TRANSACTION_FREEZE_IN_PROGRESS = 0xC0190046, + + /// The target volume is not a snapshot volume. + /// This operation is valid only on a volume mounted as a snapshot. + NOT_SNAPSHOT_VOLUME = 0xC0190047, + + /// The savepoint operation failed because files are open on the transaction, which is not permitted. + NO_SAVEPOINT_WITH_OPEN_FILES = 0xC0190048, + + /// The sparse operation could not be completed because a transaction is active on the file. + SPARSE_NOT_ALLOWED_IN_TRANSACTION = 0xC0190049, + + /// The call to create a transaction manager object failed because the Tm Identity that is stored in the log file does not match the Tm Identity that was passed in as an argument. + TM_IDENTITY_MISMATCH = 0xC019004A, + + /// I/O was attempted on a section object that has been floated as a result of a transaction ending. There is no valid data. + FLOATED_SECTION = 0xC019004B, + + /// The transactional resource manager cannot currently accept transacted work due to a transient condition, such as low resources. + CANNOT_ACCEPT_TRANSACTED_WORK = 0xC019004C, + + /// The transactional resource manager had too many transactions outstanding that could not be aborted. + /// The transactional resource manager has been shut down. + CANNOT_ABORT_TRANSACTIONS = 0xC019004D, + + /// The specified transaction was unable to be opened because it was not found. + TRANSACTION_NOT_FOUND = 0xC019004E, + + /// The specified resource manager was unable to be opened because it was not found. + RESOURCEMANAGER_NOT_FOUND = 0xC019004F, + + /// The specified enlistment was unable to be opened because it was not found. + ENLISTMENT_NOT_FOUND = 0xC0190050, + + /// The specified transaction manager was unable to be opened because it was not found. + TRANSACTIONMANAGER_NOT_FOUND = 0xC0190051, + + /// The specified resource manager was unable to create an enlistment because its associated transaction manager is not online. + TRANSACTIONMANAGER_NOT_ONLINE = 0xC0190052, + + /// The specified transaction manager was unable to create the objects contained in its log file in the Ob namespace. + /// Therefore, the transaction manager was unable to recover. + TRANSACTIONMANAGER_RECOVERY_NAME_COLLISION = 0xC0190053, + + /// The call to create a superior enlistment on this transaction object could not be completed because the transaction object specified for the enlistment is a subordinate branch of the transaction. + /// Only the root of the transaction can be enlisted as a superior. + TRANSACTION_NOT_ROOT = 0xC0190054, + + /// Because the associated transaction manager or resource manager has been closed, the handle is no longer valid. + TRANSACTION_OBJECT_EXPIRED = 0xC0190055, + + /// The compression operation could not be completed because a transaction is active on the file. + COMPRESSION_NOT_ALLOWED_IN_TRANSACTION = 0xC0190056, + + /// The specified operation could not be performed on this superior enlistment because the enlistment was not created with the corresponding completion response in the NotificationMask. + TRANSACTION_RESPONSE_NOT_ENLISTED = 0xC0190057, + + /// The specified operation could not be performed because the record to be logged was too long. + /// This can occur because either there are too many enlistments on this transaction or the combined RecoveryInformation being logged on behalf of those enlistments is too long. + TRANSACTION_RECORD_TOO_LONG = 0xC0190058, + + /// The link-tracking operation could not be completed because a transaction is active. + NO_LINK_TRACKING_IN_TRANSACTION = 0xC0190059, + + /// This operation cannot be performed in a transaction. + OPERATION_NOT_SUPPORTED_IN_TRANSACTION = 0xC019005A, + + /// The kernel transaction manager had to abort or forget the transaction because it blocked forward progress. + TRANSACTION_INTEGRITY_VIOLATED = 0xC019005B, + + /// The handle is no longer properly associated with its transaction. + /// It might have been opened in a transactional resource manager that was subsequently forced to restart. Please close the handle and open a new one. + EXPIRED_HANDLE = 0xC0190060, + + /// The specified operation could not be performed because the resource manager is not enlisted in the transaction. + TRANSACTION_NOT_ENLISTED = 0xC0190061, + + /// The log service found an invalid log sector. + LOG_SECTOR_INVALID = 0xC01A0001, + + /// The log service encountered a log sector with invalid block parity. + LOG_SECTOR_PARITY_INVALID = 0xC01A0002, + + /// The log service encountered a remapped log sector. + LOG_SECTOR_REMAPPED = 0xC01A0003, + + /// The log service encountered a partial or incomplete log block. + LOG_BLOCK_INCOMPLETE = 0xC01A0004, + + /// The log service encountered an attempt to access data outside the active log range. + LOG_INVALID_RANGE = 0xC01A0005, + + /// The log service user-log marshaling buffers are exhausted. + LOG_BLOCKS_EXHAUSTED = 0xC01A0006, + + /// The log service encountered an attempt to read from a marshaling area with an invalid read context. + LOG_READ_CONTEXT_INVALID = 0xC01A0007, + + /// The log service encountered an invalid log restart area. + LOG_RESTART_INVALID = 0xC01A0008, + + /// The log service encountered an invalid log block version. + LOG_BLOCK_VERSION = 0xC01A0009, + + /// The log service encountered an invalid log block. + LOG_BLOCK_INVALID = 0xC01A000A, + + /// The log service encountered an attempt to read the log with an invalid read mode. + LOG_READ_MODE_INVALID = 0xC01A000B, + + /// The log service encountered a corrupted metadata file. + LOG_METADATA_CORRUPT = 0xC01A000D, + + /// The log service encountered a metadata file that could not be created by the log file system. + LOG_METADATA_INVALID = 0xC01A000E, + + /// The log service encountered a metadata file with inconsistent data. + LOG_METADATA_INCONSISTENT = 0xC01A000F, + + /// The log service encountered an attempt to erroneously allocate or dispose reservation space. + LOG_RESERVATION_INVALID = 0xC01A0010, + + /// The log service cannot delete the log file or the file system container. + LOG_CANT_DELETE = 0xC01A0011, + + /// The log service has reached the maximum allowable containers allocated to a log file. + LOG_CONTAINER_LIMIT_EXCEEDED = 0xC01A0012, + + /// The log service has attempted to read or write backward past the start of the log. + LOG_START_OF_LOG = 0xC01A0013, + + /// The log policy could not be installed because a policy of the same type is already present. + LOG_POLICY_ALREADY_INSTALLED = 0xC01A0014, + + /// The log policy in question was not installed at the time of the request. + LOG_POLICY_NOT_INSTALLED = 0xC01A0015, + + /// The installed set of policies on the log is invalid. + LOG_POLICY_INVALID = 0xC01A0016, + + /// A policy on the log in question prevented the operation from completing. + LOG_POLICY_CONFLICT = 0xC01A0017, + + /// The log space cannot be reclaimed because the log is pinned by the archive tail. + LOG_PINNED_ARCHIVE_TAIL = 0xC01A0018, + + /// The log record is not a record in the log file. + LOG_RECORD_NONEXISTENT = 0xC01A0019, + + /// The number of reserved log records or the adjustment of the number of reserved log records is invalid. + LOG_RECORDS_RESERVED_INVALID = 0xC01A001A, + + /// The reserved log space or the adjustment of the log space is invalid. + LOG_SPACE_RESERVED_INVALID = 0xC01A001B, + + /// A new or existing archive tail or the base of the active log is invalid. + LOG_TAIL_INVALID = 0xC01A001C, + + /// The log space is exhausted. + LOG_FULL = 0xC01A001D, + + /// The log is multiplexed; no direct writes to the physical log are allowed. + LOG_MULTIPLEXED = 0xC01A001E, + + /// The operation failed because the log is dedicated. + LOG_DEDICATED = 0xC01A001F, + + /// The operation requires an archive context. + LOG_ARCHIVE_NOT_IN_PROGRESS = 0xC01A0020, + + /// Log archival is in progress. + LOG_ARCHIVE_IN_PROGRESS = 0xC01A0021, + + /// The operation requires a nonephemeral log, but the log is ephemeral. + LOG_EPHEMERAL = 0xC01A0022, + + /// The log must have at least two containers before it can be read from or written to. + LOG_NOT_ENOUGH_CONTAINERS = 0xC01A0023, + + /// A log client has already registered on the stream. + LOG_CLIENT_ALREADY_REGISTERED = 0xC01A0024, + + /// A log client has not been registered on the stream. + LOG_CLIENT_NOT_REGISTERED = 0xC01A0025, + + /// A request has already been made to handle the log full condition. + LOG_FULL_HANDLER_IN_PROGRESS = 0xC01A0026, + + /// The log service encountered an error when attempting to read from a log container. + LOG_CONTAINER_READ_FAILED = 0xC01A0027, + + /// The log service encountered an error when attempting to write to a log container. + LOG_CONTAINER_WRITE_FAILED = 0xC01A0028, + + /// The log service encountered an error when attempting to open a log container. + LOG_CONTAINER_OPEN_FAILED = 0xC01A0029, + + /// The log service encountered an invalid container state when attempting a requested action. + LOG_CONTAINER_STATE_INVALID = 0xC01A002A, + + /// The log service is not in the correct state to perform a requested action. + LOG_STATE_INVALID = 0xC01A002B, + + /// The log space cannot be reclaimed because the log is pinned. + LOG_PINNED = 0xC01A002C, + + /// The log metadata flush failed. + LOG_METADATA_FLUSH_FAILED = 0xC01A002D, + + /// Security on the log and its containers is inconsistent. + LOG_INCONSISTENT_SECURITY = 0xC01A002E, + + /// Records were appended to the log or reservation changes were made, but the log could not be flushed. + LOG_APPENDED_FLUSH_FAILED = 0xC01A002F, + + /// The log is pinned due to reservation consuming most of the log space. + /// Free some reserved records to make space available. + LOG_PINNED_RESERVATION = 0xC01A0030, + + /// {Display Driver Stopped Responding} The %hs display driver has stopped working normally. + /// Save your work and reboot the system to restore full display functionality. + /// The next time you reboot the computer, a dialog box will allow you to upload data about this failure to Microsoft. + VIDEO_HUNG_DISPLAY_DRIVER_THREAD = 0xC01B00EA, + + /// A handler was not defined by the filter for this operation. + FLT_NO_HANDLER_DEFINED = 0xC01C0001, + + /// A context is already defined for this object. + FLT_CONTEXT_ALREADY_DEFINED = 0xC01C0002, + + /// Asynchronous requests are not valid for this operation. + FLT_INVALID_ASYNCHRONOUS_REQUEST = 0xC01C0003, + + /// This is an internal error code used by the filter manager to determine if a fast I/O operation should be forced down the input/output request packet (IRP) path. Minifilters should never return this value. + FLT_DISALLOW_FAST_IO = 0xC01C0004, + + /// An invalid name request was made. + /// The name requested cannot be retrieved at this time. + FLT_INVALID_NAME_REQUEST = 0xC01C0005, + + /// Posting this operation to a worker thread for further processing is not safe at this time because it could lead to a system deadlock. + FLT_NOT_SAFE_TO_POST_OPERATION = 0xC01C0006, + + /// The Filter Manager was not initialized when a filter tried to register. + /// Make sure that the Filter Manager is loaded as a driver. + FLT_NOT_INITIALIZED = 0xC01C0007, + + /// The filter is not ready for attachment to volumes because it has not finished initializing (FltStartFiltering has not been called). + FLT_FILTER_NOT_READY = 0xC01C0008, + + /// The filter must clean up any operation-specific context at this time because it is being removed from the system before the operation is completed by the lower drivers. + FLT_POST_OPERATION_CLEANUP = 0xC01C0009, + + /// The Filter Manager had an internal error from which it cannot recover; therefore, the operation has failed. + /// This is usually the result of a filter returning an invalid value from a pre-operation callback. + FLT_INTERNAL_ERROR = 0xC01C000A, + + /// The object specified for this action is in the process of being deleted; therefore, the action requested cannot be completed at this time. + FLT_DELETING_OBJECT = 0xC01C000B, + + /// A nonpaged pool must be used for this type of context. + FLT_MUST_BE_NONPAGED_POOL = 0xC01C000C, + + /// A duplicate handler definition has been provided for an operation. + FLT_DUPLICATE_ENTRY = 0xC01C000D, + + /// The callback data queue has been disabled. + FLT_CBDQ_DISABLED = 0xC01C000E, + + /// Do not attach the filter to the volume at this time. + FLT_DO_NOT_ATTACH = 0xC01C000F, + + /// Do not detach the filter from the volume at this time. + FLT_DO_NOT_DETACH = 0xC01C0010, + + /// An instance already exists at this altitude on the volume specified. + FLT_INSTANCE_ALTITUDE_COLLISION = 0xC01C0011, + + /// An instance already exists with this name on the volume specified. + FLT_INSTANCE_NAME_COLLISION = 0xC01C0012, + + /// The system could not find the filter specified. + FLT_FILTER_NOT_FOUND = 0xC01C0013, + + /// The system could not find the volume specified. + FLT_VOLUME_NOT_FOUND = 0xC01C0014, + + /// The system could not find the instance specified. + FLT_INSTANCE_NOT_FOUND = 0xC01C0015, + + /// No registered context allocation definition was found for the given request. + FLT_CONTEXT_ALLOCATION_NOT_FOUND = 0xC01C0016, + + /// An invalid parameter was specified during context registration. + FLT_INVALID_CONTEXT_REGISTRATION = 0xC01C0017, + + /// The name requested was not found in the Filter Manager name cache and could not be retrieved from the file system. + FLT_NAME_CACHE_MISS = 0xC01C0018, + + /// The requested device object does not exist for the given volume. + FLT_NO_DEVICE_OBJECT = 0xC01C0019, + + /// The specified volume is already mounted. + FLT_VOLUME_ALREADY_MOUNTED = 0xC01C001A, + + /// The specified transaction context is already enlisted in a transaction. + FLT_ALREADY_ENLISTED = 0xC01C001B, + + /// The specified context is already attached to another object. + FLT_CONTEXT_ALREADY_LINKED = 0xC01C001C, + + /// No waiter is present for the filter's reply to this message. + FLT_NO_WAITER_FOR_REPLY = 0xC01C0020, + + /// A monitor descriptor could not be obtained. + MONITOR_NO_DESCRIPTOR = 0xC01D0001, + + /// This release does not support the format of the obtained monitor descriptor. + MONITOR_UNKNOWN_DESCRIPTOR_FORMAT = 0xC01D0002, + + /// The checksum of the obtained monitor descriptor is invalid. + MONITOR_INVALID_DESCRIPTOR_CHECKSUM = 0xC01D0003, + + /// The monitor descriptor contains an invalid standard timing block. + MONITOR_INVALID_STANDARD_TIMING_BLOCK = 0xC01D0004, + + /// WMI data-block registration failed for one of the MSMonitorClass WMI subclasses. + MONITOR_WMI_DATABLOCK_REGISTRATION_FAILED = 0xC01D0005, + + /// The provided monitor descriptor block is either corrupted or does not contain the monitor's detailed serial number. + MONITOR_INVALID_SERIAL_NUMBER_MONDSC_BLOCK = 0xC01D0006, + + /// The provided monitor descriptor block is either corrupted or does not contain the monitor's user-friendly name. + MONITOR_INVALID_USER_FRIENDLY_MONDSC_BLOCK = 0xC01D0007, + + /// There is no monitor descriptor data at the specified (offset or size) region. + MONITOR_NO_MORE_DESCRIPTOR_DATA = 0xC01D0008, + + /// The monitor descriptor contains an invalid detailed timing block. + MONITOR_INVALID_DETAILED_TIMING_BLOCK = 0xC01D0009, + + /// Monitor descriptor contains invalid manufacture date. + MONITOR_INVALID_MANUFACTURE_DATE = 0xC01D000A, + + /// Exclusive mode ownership is needed to create an unmanaged primary allocation. + GRAPHICS_NOT_EXCLUSIVE_MODE_OWNER = 0xC01E0000, + + /// The driver needs more DMA buffer space to complete the requested operation. + GRAPHICS_INSUFFICIENT_DMA_BUFFER = 0xC01E0001, + + /// The specified display adapter handle is invalid. + GRAPHICS_INVALID_DISPLAY_ADAPTER = 0xC01E0002, + + /// The specified display adapter and all of its state have been reset. + GRAPHICS_ADAPTER_WAS_RESET = 0xC01E0003, + + /// The driver stack does not match the expected driver model. + GRAPHICS_INVALID_DRIVER_MODEL = 0xC01E0004, + + /// Present happened but ended up into the changed desktop mode. + GRAPHICS_PRESENT_MODE_CHANGED = 0xC01E0005, + + /// Nothing to present due to desktop occlusion. + GRAPHICS_PRESENT_OCCLUDED = 0xC01E0006, + + /// Not able to present due to denial of desktop access. + GRAPHICS_PRESENT_DENIED = 0xC01E0007, + + /// Not able to present with color conversion. + GRAPHICS_CANNOTCOLORCONVERT = 0xC01E0008, + + /// Present redirection is disabled (desktop windowing management subsystem is off). + GRAPHICS_PRESENT_REDIRECTION_DISABLED = 0xC01E000B, + + /// Previous exclusive VidPn source owner has released its ownership + GRAPHICS_PRESENT_UNOCCLUDED = 0xC01E000C, + + /// Not enough video memory is available to complete the operation. + GRAPHICS_NO_VIDEO_MEMORY = 0xC01E0100, + + /// Could not probe and lock the underlying memory of an allocation. + GRAPHICS_CANT_LOCK_MEMORY = 0xC01E0101, + + /// The allocation is currently busy. + GRAPHICS_ALLOCATION_BUSY = 0xC01E0102, + + /// An object being referenced has already reached the maximum reference count and cannot be referenced further. + GRAPHICS_TOO_MANY_REFERENCES = 0xC01E0103, + + /// A problem could not be solved due to an existing condition. Try again later. + GRAPHICS_TRY_AGAIN_LATER = 0xC01E0104, + + /// A problem could not be solved due to an existing condition. Try again now. + GRAPHICS_TRY_AGAIN_NOW = 0xC01E0105, + + /// The allocation is invalid. + GRAPHICS_ALLOCATION_INVALID = 0xC01E0106, + + /// No more unswizzling apertures are currently available. + GRAPHICS_UNSWIZZLING_APERTURE_UNAVAILABLE = 0xC01E0107, + + /// The current allocation cannot be unswizzled by an aperture. + GRAPHICS_UNSWIZZLING_APERTURE_UNSUPPORTED = 0xC01E0108, + + /// The request failed because a pinned allocation cannot be evicted. + GRAPHICS_CANT_EVICT_PINNED_ALLOCATION = 0xC01E0109, + + /// The allocation cannot be used from its current segment location for the specified operation. + GRAPHICS_INVALID_ALLOCATION_USAGE = 0xC01E0110, + + /// A locked allocation cannot be used in the current command buffer. + GRAPHICS_CANT_RENDER_LOCKED_ALLOCATION = 0xC01E0111, + + /// The allocation being referenced has been closed permanently. + GRAPHICS_ALLOCATION_CLOSED = 0xC01E0112, + + /// An invalid allocation instance is being referenced. + GRAPHICS_INVALID_ALLOCATION_INSTANCE = 0xC01E0113, + + /// An invalid allocation handle is being referenced. + GRAPHICS_INVALID_ALLOCATION_HANDLE = 0xC01E0114, + + /// The allocation being referenced does not belong to the current device. + GRAPHICS_WRONG_ALLOCATION_DEVICE = 0xC01E0115, + + /// The specified allocation lost its content. + GRAPHICS_ALLOCATION_CONTENT_LOST = 0xC01E0116, + + /// A GPU exception was detected on the given device. The device cannot be scheduled. + GRAPHICS_GPU_EXCEPTION_ON_DEVICE = 0xC01E0200, + + /// The specified VidPN topology is invalid. + GRAPHICS_INVALID_VIDPN_TOPOLOGY = 0xC01E0300, + + /// The specified VidPN topology is valid but is not supported by this model of the display adapter. + GRAPHICS_VIDPN_TOPOLOGY_NOT_SUPPORTED = 0xC01E0301, + + /// The specified VidPN topology is valid but is not currently supported by the display adapter due to allocation of its resources. + GRAPHICS_VIDPN_TOPOLOGY_CURRENTLY_NOT_SUPPORTED = 0xC01E0302, + + /// The specified VidPN handle is invalid. + GRAPHICS_INVALID_VIDPN = 0xC01E0303, + + /// The specified video present source is invalid. + GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE = 0xC01E0304, + + /// The specified video present target is invalid. + GRAPHICS_INVALID_VIDEO_PRESENT_TARGET = 0xC01E0305, + + /// The specified VidPN modality is not supported (for example, at least two of the pinned modes are not co-functional). + GRAPHICS_VIDPN_MODALITY_NOT_SUPPORTED = 0xC01E0306, + + /// The specified VidPN source mode set is invalid. + GRAPHICS_INVALID_VIDPN_SOURCEMODESET = 0xC01E0308, + + /// The specified VidPN target mode set is invalid. + GRAPHICS_INVALID_VIDPN_TARGETMODESET = 0xC01E0309, + + /// The specified video signal frequency is invalid. + GRAPHICS_INVALID_FREQUENCY = 0xC01E030A, + + /// The specified video signal active region is invalid. + GRAPHICS_INVALID_ACTIVE_REGION = 0xC01E030B, + + /// The specified video signal total region is invalid. + GRAPHICS_INVALID_TOTAL_REGION = 0xC01E030C, + + /// The specified video present source mode is invalid. + GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE_MODE = 0xC01E0310, + + /// The specified video present target mode is invalid. + GRAPHICS_INVALID_VIDEO_PRESENT_TARGET_MODE = 0xC01E0311, + + /// The pinned mode must remain in the set on the VidPN's co-functional modality enumeration. + GRAPHICS_PINNED_MODE_MUST_REMAIN_IN_SET = 0xC01E0312, + + /// The specified video present path is already in the VidPN's topology. + GRAPHICS_PATH_ALREADY_IN_TOPOLOGY = 0xC01E0313, + + /// The specified mode is already in the mode set. + GRAPHICS_MODE_ALREADY_IN_MODESET = 0xC01E0314, + + /// The specified video present source set is invalid. + GRAPHICS_INVALID_VIDEOPRESENTSOURCESET = 0xC01E0315, + + /// The specified video present target set is invalid. + GRAPHICS_INVALID_VIDEOPRESENTTARGETSET = 0xC01E0316, + + /// The specified video present source is already in the video present source set. + GRAPHICS_SOURCE_ALREADY_IN_SET = 0xC01E0317, + + /// The specified video present target is already in the video present target set. + GRAPHICS_TARGET_ALREADY_IN_SET = 0xC01E0318, + + /// The specified VidPN present path is invalid. + GRAPHICS_INVALID_VIDPN_PRESENT_PATH = 0xC01E0319, + + /// The miniport has no recommendation for augmenting the specified VidPN's topology. + GRAPHICS_NO_RECOMMENDED_VIDPN_TOPOLOGY = 0xC01E031A, + + /// The specified monitor frequency range set is invalid. + GRAPHICS_INVALID_MONITOR_FREQUENCYRANGESET = 0xC01E031B, + + /// The specified monitor frequency range is invalid. + GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE = 0xC01E031C, + + /// The specified frequency range is not in the specified monitor frequency range set. + GRAPHICS_FREQUENCYRANGE_NOT_IN_SET = 0xC01E031D, + + /// The specified frequency range is already in the specified monitor frequency range set. + GRAPHICS_FREQUENCYRANGE_ALREADY_IN_SET = 0xC01E031F, + + /// The specified mode set is stale. Reacquire the new mode set. + GRAPHICS_STALE_MODESET = 0xC01E0320, + + /// The specified monitor source mode set is invalid. + GRAPHICS_INVALID_MONITOR_SOURCEMODESET = 0xC01E0321, + + /// The specified monitor source mode is invalid. + GRAPHICS_INVALID_MONITOR_SOURCE_MODE = 0xC01E0322, + + /// The miniport does not have a recommendation regarding the request to provide a functional VidPN given the current display adapter configuration. + GRAPHICS_NO_RECOMMENDED_FUNCTIONAL_VIDPN = 0xC01E0323, + + /// The ID of the specified mode is being used by another mode in the set. + GRAPHICS_MODE_ID_MUST_BE_UNIQUE = 0xC01E0324, + + /// The system failed to determine a mode that is supported by both the display adapter and the monitor connected to it. + GRAPHICS_EMPTY_ADAPTER_MONITOR_MODE_SUPPORT_INTERSECTION = 0xC01E0325, + + /// The number of video present targets must be greater than or equal to the number of video present sources. + GRAPHICS_VIDEO_PRESENT_TARGETS_LESS_THAN_SOURCES = 0xC01E0326, + + /// The specified present path is not in the VidPN's topology. + GRAPHICS_PATH_NOT_IN_TOPOLOGY = 0xC01E0327, + + /// The display adapter must have at least one video present source. + GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_SOURCE = 0xC01E0328, + + /// The display adapter must have at least one video present target. + GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_TARGET = 0xC01E0329, + + /// The specified monitor descriptor set is invalid. + GRAPHICS_INVALID_MONITORDESCRIPTORSET = 0xC01E032A, + + /// The specified monitor descriptor is invalid. + GRAPHICS_INVALID_MONITORDESCRIPTOR = 0xC01E032B, + + /// The specified descriptor is not in the specified monitor descriptor set. + GRAPHICS_MONITORDESCRIPTOR_NOT_IN_SET = 0xC01E032C, + + /// The specified descriptor is already in the specified monitor descriptor set. + GRAPHICS_MONITORDESCRIPTOR_ALREADY_IN_SET = 0xC01E032D, + + /// The ID of the specified monitor descriptor is being used by another descriptor in the set. + GRAPHICS_MONITORDESCRIPTOR_ID_MUST_BE_UNIQUE = 0xC01E032E, + + /// The specified video present target subset type is invalid. + GRAPHICS_INVALID_VIDPN_TARGET_SUBSET_TYPE = 0xC01E032F, + + /// Two or more of the specified resources are not related to each other, as defined by the interface semantics. + GRAPHICS_RESOURCES_NOT_RELATED = 0xC01E0330, + + /// The ID of the specified video present source is being used by another source in the set. + GRAPHICS_SOURCE_ID_MUST_BE_UNIQUE = 0xC01E0331, + + /// The ID of the specified video present target is being used by another target in the set. + GRAPHICS_TARGET_ID_MUST_BE_UNIQUE = 0xC01E0332, + + /// The specified VidPN source cannot be used because there is no available VidPN target to connect it to. + GRAPHICS_NO_AVAILABLE_VIDPN_TARGET = 0xC01E0333, + + /// The newly arrived monitor could not be associated with a display adapter. + GRAPHICS_MONITOR_COULD_NOT_BE_ASSOCIATED_WITH_ADAPTER = 0xC01E0334, + + /// The particular display adapter does not have an associated VidPN manager. + GRAPHICS_NO_VIDPNMGR = 0xC01E0335, + + /// The VidPN manager of the particular display adapter does not have an active VidPN. + GRAPHICS_NO_ACTIVE_VIDPN = 0xC01E0336, + + /// The specified VidPN topology is stale; obtain the new topology. + GRAPHICS_STALE_VIDPN_TOPOLOGY = 0xC01E0337, + + /// No monitor is connected on the specified video present target. + GRAPHICS_MONITOR_NOT_CONNECTED = 0xC01E0338, + + /// The specified source is not part of the specified VidPN's topology. + GRAPHICS_SOURCE_NOT_IN_TOPOLOGY = 0xC01E0339, + + /// The specified primary surface size is invalid. + GRAPHICS_INVALID_PRIMARYSURFACE_SIZE = 0xC01E033A, + + /// The specified visible region size is invalid. + GRAPHICS_INVALID_VISIBLEREGION_SIZE = 0xC01E033B, + + /// The specified stride is invalid. + GRAPHICS_INVALID_STRIDE = 0xC01E033C, + + /// The specified pixel format is invalid. + GRAPHICS_INVALID_PIXELFORMAT = 0xC01E033D, + + /// The specified color basis is invalid. + GRAPHICS_INVALID_COLORBASIS = 0xC01E033E, + + /// The specified pixel value access mode is invalid. + GRAPHICS_INVALID_PIXELVALUEACCESSMODE = 0xC01E033F, + + /// The specified target is not part of the specified VidPN's topology. + GRAPHICS_TARGET_NOT_IN_TOPOLOGY = 0xC01E0340, + + /// Failed to acquire the display mode management interface. + GRAPHICS_NO_DISPLAY_MODE_MANAGEMENT_SUPPORT = 0xC01E0341, + + /// The specified VidPN source is already owned by a DMM client and cannot be used until that client releases it. + GRAPHICS_VIDPN_SOURCE_IN_USE = 0xC01E0342, + + /// The specified VidPN is active and cannot be accessed. + GRAPHICS_CANT_ACCESS_ACTIVE_VIDPN = 0xC01E0343, + + /// The specified VidPN's present path importance ordinal is invalid. + GRAPHICS_INVALID_PATH_IMPORTANCE_ORDINAL = 0xC01E0344, + + /// The specified VidPN's present path content geometry transformation is invalid. + GRAPHICS_INVALID_PATH_CONTENT_GEOMETRY_TRANSFORMATION = 0xC01E0345, + + /// The specified content geometry transformation is not supported on the respective VidPN present path. + GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_SUPPORTED = 0xC01E0346, + + /// The specified gamma ramp is invalid. + GRAPHICS_INVALID_GAMMA_RAMP = 0xC01E0347, + + /// The specified gamma ramp is not supported on the respective VidPN present path. + GRAPHICS_GAMMA_RAMP_NOT_SUPPORTED = 0xC01E0348, + + /// Multisampling is not supported on the respective VidPN present path. + GRAPHICS_MULTISAMPLING_NOT_SUPPORTED = 0xC01E0349, + + /// The specified mode is not in the specified mode set. + GRAPHICS_MODE_NOT_IN_MODESET = 0xC01E034A, + + /// The specified VidPN topology recommendation reason is invalid. + GRAPHICS_INVALID_VIDPN_TOPOLOGY_RECOMMENDATION_REASON = 0xC01E034D, + + /// The specified VidPN present path content type is invalid. + GRAPHICS_INVALID_PATH_CONTENT_TYPE = 0xC01E034E, + + /// The specified VidPN present path copy protection type is invalid. + GRAPHICS_INVALID_COPYPROTECTION_TYPE = 0xC01E034F, + + /// Only one unassigned mode set can exist at any one time for a particular VidPN source or target. + GRAPHICS_UNASSIGNED_MODESET_ALREADY_EXISTS = 0xC01E0350, + + /// The specified scan line ordering type is invalid. + GRAPHICS_INVALID_SCANLINE_ORDERING = 0xC01E0352, + + /// The topology changes are not allowed for the specified VidPN. + GRAPHICS_TOPOLOGY_CHANGES_NOT_ALLOWED = 0xC01E0353, + + /// All available importance ordinals are being used in the specified topology. + GRAPHICS_NO_AVAILABLE_IMPORTANCE_ORDINALS = 0xC01E0354, + + /// The specified primary surface has a different private-format attribute than the current primary surface. + GRAPHICS_INCOMPATIBLE_PRIVATE_FORMAT = 0xC01E0355, + + /// The specified mode-pruning algorithm is invalid. + GRAPHICS_INVALID_MODE_PRUNING_ALGORITHM = 0xC01E0356, + + /// The specified monitor-capability origin is invalid. + GRAPHICS_INVALID_MONITOR_CAPABILITY_ORIGIN = 0xC01E0357, + + /// The specified monitor-frequency range constraint is invalid. + GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE_CONSTRAINT = 0xC01E0358, + + /// The maximum supported number of present paths has been reached. + GRAPHICS_MAX_NUM_PATHS_REACHED = 0xC01E0359, + + /// The miniport requested that augmentation be canceled for the specified source of the specified VidPN's topology. + GRAPHICS_CANCEL_VIDPN_TOPOLOGY_AUGMENTATION = 0xC01E035A, + + /// The specified client type was not recognized. + GRAPHICS_INVALID_CLIENT_TYPE = 0xC01E035B, + + /// The client VidPN is not set on this adapter (for example, no user mode-initiated mode changes have taken place on this adapter). + GRAPHICS_CLIENTVIDPN_NOT_SET = 0xC01E035C, + + /// The specified display adapter child device already has an external device connected to it. + GRAPHICS_SPECIFIED_CHILD_ALREADY_CONNECTED = 0xC01E0400, + + /// The display adapter child device does not support reporting a descriptor. + GRAPHICS_CHILD_DESCRIPTOR_NOT_SUPPORTED = 0xC01E0401, + + /// The display adapter is not linked to any other adapters. + GRAPHICS_NOT_A_LINKED_ADAPTER = 0xC01E0430, + + /// The lead adapter in a linked configuration was not enumerated yet. + GRAPHICS_LEADLINK_NOT_ENUMERATED = 0xC01E0431, + + /// Some chain adapters in a linked configuration have not yet been enumerated. + GRAPHICS_CHAINLINKS_NOT_ENUMERATED = 0xC01E0432, + + /// The chain of linked adapters is not ready to start because of an unknown failure. + GRAPHICS_ADAPTER_CHAIN_NOT_READY = 0xC01E0433, + + /// An attempt was made to start a lead link display adapter when the chain links had not yet started. + GRAPHICS_CHAINLINKS_NOT_STARTED = 0xC01E0434, + + /// An attempt was made to turn on a lead link display adapter when the chain links were turned off. + GRAPHICS_CHAINLINKS_NOT_POWERED_ON = 0xC01E0435, + + /// The adapter link was found in an inconsistent state. + /// Not all adapters are in an expected PNP/power state. + GRAPHICS_INCONSISTENT_DEVICE_LINK_STATE = 0xC01E0436, + + /// The driver trying to start is not the same as the driver for the posted display adapter. + GRAPHICS_NOT_POST_DEVICE_DRIVER = 0xC01E0438, + + /// An operation is being attempted that requires the display adapter to be in a quiescent state. + GRAPHICS_ADAPTER_ACCESS_NOT_EXCLUDED = 0xC01E043B, + + /// The driver does not support OPM. + GRAPHICS_OPM_NOT_SUPPORTED = 0xC01E0500, + + /// The driver does not support COPP. + GRAPHICS_COPP_NOT_SUPPORTED = 0xC01E0501, + + /// The driver does not support UAB. + GRAPHICS_UAB_NOT_SUPPORTED = 0xC01E0502, + + /// The specified encrypted parameters are invalid. + GRAPHICS_OPM_INVALID_ENCRYPTED_PARAMETERS = 0xC01E0503, + + /// An array passed to a function cannot hold all of the data that the function wants to put in it. + GRAPHICS_OPM_PARAMETER_ARRAY_TOO_SMALL = 0xC01E0504, + + /// The GDI display device passed to this function does not have any active protected outputs. + GRAPHICS_OPM_NO_PROTECTED_OUTPUTS_EXIST = 0xC01E0505, + + /// The PVP cannot find an actual GDI display device that corresponds to the passed-in GDI display device name. + GRAPHICS_PVP_NO_DISPLAY_DEVICE_CORRESPONDS_TO_NAME = 0xC01E0506, + + /// This function failed because the GDI display device passed to it was not attached to the Windows desktop. + GRAPHICS_PVP_DISPLAY_DEVICE_NOT_ATTACHED_TO_DESKTOP = 0xC01E0507, + + /// The PVP does not support mirroring display devices because they do not have any protected outputs. + GRAPHICS_PVP_MIRRORING_DEVICES_NOT_SUPPORTED = 0xC01E0508, + + /// The function failed because an invalid pointer parameter was passed to it. + /// A pointer parameter is invalid if it is null, is not correctly aligned, or it points to an invalid address or a kernel mode address. + GRAPHICS_OPM_INVALID_POINTER = 0xC01E050A, + + /// An internal error caused an operation to fail. + GRAPHICS_OPM_INTERNAL_ERROR = 0xC01E050B, + + /// The function failed because the caller passed in an invalid OPM user-mode handle. + GRAPHICS_OPM_INVALID_HANDLE = 0xC01E050C, + + /// This function failed because the GDI device passed to it did not have any monitors associated with it. + GRAPHICS_PVP_NO_MONITORS_CORRESPOND_TO_DISPLAY_DEVICE = 0xC01E050D, + + /// A certificate could not be returned because the certificate buffer passed to the function was too small. + GRAPHICS_PVP_INVALID_CERTIFICATE_LENGTH = 0xC01E050E, + + /// DxgkDdiOpmCreateProtectedOutput() could not create a protected output because the video present yarget is in spanning mode. + GRAPHICS_OPM_SPANNING_MODE_ENABLED = 0xC01E050F, + + /// DxgkDdiOpmCreateProtectedOutput() could not create a protected output because the video present target is in theater mode. + GRAPHICS_OPM_THEATER_MODE_ENABLED = 0xC01E0510, + + /// The function call failed because the display adapter's hardware functionality scan (HFS) failed to validate the graphics hardware. + GRAPHICS_PVP_HFS_FAILED = 0xC01E0511, + + /// The HDCP SRM passed to this function did not comply with section 5 of the HDCP 1.1 specification. + GRAPHICS_OPM_INVALID_SRM = 0xC01E0512, + + /// The protected output cannot enable the HDCP system because it does not support it. + GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_HDCP = 0xC01E0513, + + /// The protected output cannot enable analog copy protection because it does not support it. + GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_ACP = 0xC01E0514, + + /// The protected output cannot enable the CGMS-A protection technology because it does not support it. + GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_CGMSA = 0xC01E0515, + + /// DxgkDdiOPMGetInformation() cannot return the version of the SRM being used because the application never successfully passed an SRM to the protected output. + GRAPHICS_OPM_HDCP_SRM_NEVER_SET = 0xC01E0516, + + /// DxgkDdiOPMConfigureProtectedOutput() cannot enable the specified output protection technology because the output's screen resolution is too high. + GRAPHICS_OPM_RESOLUTION_TOO_HIGH = 0xC01E0517, + + /// DxgkDdiOPMConfigureProtectedOutput() cannot enable HDCP because other physical outputs are using the display adapter's HDCP hardware. + GRAPHICS_OPM_ALL_HDCP_HARDWARE_ALREADY_IN_USE = 0xC01E0518, + + /// The operating system asynchronously destroyed this OPM-protected output because the operating system state changed. + /// This error typically occurs because the monitor PDO associated with this protected output was removed or stopped, the protected output's session became a nonconsole session, or the protected output's desktop became inactive. + GRAPHICS_OPM_PROTECTED_OUTPUT_NO_LONGER_EXISTS = 0xC01E051A, + + /// OPM functions cannot be called when a session is changing its type. + /// Three types of sessions currently exist: console, disconnected, and remote (RDP or ICA). + GRAPHICS_OPM_SESSION_TYPE_CHANGE_IN_PROGRESS = 0xC01E051B, + + /// The DxgkDdiOPMGetCOPPCompatibleInformation, DxgkDdiOPMGetInformation, or DxgkDdiOPMConfigureProtectedOutput function failed. + /// This error is returned only if a protected output has OPM semantics. + /// DxgkDdiOPMGetCOPPCompatibleInformation always returns this error if a protected output has OPM semantics. + /// DxgkDdiOPMGetInformation returns this error code if the caller requested COPP-specific information. + /// DxgkDdiOPMConfigureProtectedOutput returns this error when the caller tries to use a COPP-specific command. + GRAPHICS_OPM_PROTECTED_OUTPUT_DOES_NOT_HAVE_COPP_SEMANTICS = 0xC01E051C, + + /// The DxgkDdiOPMGetInformation and DxgkDdiOPMGetCOPPCompatibleInformation functions return this error code if the passed-in sequence number is not the expected sequence number or the passed-in OMAC value is invalid. + GRAPHICS_OPM_INVALID_INFORMATION_REQUEST = 0xC01E051D, + + /// The function failed because an unexpected error occurred inside a display driver. + GRAPHICS_OPM_DRIVER_INTERNAL_ERROR = 0xC01E051E, + + /// The DxgkDdiOPMGetCOPPCompatibleInformation, DxgkDdiOPMGetInformation, or DxgkDdiOPMConfigureProtectedOutput function failed. + /// This error is returned only if a protected output has COPP semantics. + /// DxgkDdiOPMGetCOPPCompatibleInformation returns this error code if the caller requested OPM-specific information. + /// DxgkDdiOPMGetInformation always returns this error if a protected output has COPP semantics. + /// DxgkDdiOPMConfigureProtectedOutput returns this error when the caller tries to use an OPM-specific command. + GRAPHICS_OPM_PROTECTED_OUTPUT_DOES_NOT_HAVE_OPM_SEMANTICS = 0xC01E051F, + + /// The DxgkDdiOPMGetCOPPCompatibleInformation and DxgkDdiOPMConfigureProtectedOutput functions return this error if the display driver does not support the DXGKMDT_OPM_GET_ACP_AND_CGMSA_SIGNALING and DXGKMDT_OPM_SET_ACP_AND_CGMSA_SIGNALING GUIDs. + GRAPHICS_OPM_SIGNALING_NOT_SUPPORTED = 0xC01E0520, + + /// The DxgkDdiOPMConfigureProtectedOutput function returns this error code if the passed-in sequence number is not the expected sequence number or the passed-in OMAC value is invalid. + GRAPHICS_OPM_INVALID_CONFIGURATION_REQUEST = 0xC01E0521, + + /// The monitor connected to the specified video output does not have an I2C bus. + GRAPHICS_I2C_NOT_SUPPORTED = 0xC01E0580, + + /// No device on the I2C bus has the specified address. + GRAPHICS_I2C_DEVICE_DOES_NOT_EXIST = 0xC01E0581, + + /// An error occurred while transmitting data to the device on the I2C bus. + GRAPHICS_I2C_ERROR_TRANSMITTING_DATA = 0xC01E0582, + + /// An error occurred while receiving data from the device on the I2C bus. + GRAPHICS_I2C_ERROR_RECEIVING_DATA = 0xC01E0583, + + /// The monitor does not support the specified VCP code. + GRAPHICS_DDCCI_VCP_NOT_SUPPORTED = 0xC01E0584, + + /// The data received from the monitor is invalid. + GRAPHICS_DDCCI_INVALID_DATA = 0xC01E0585, + + /// A function call failed because a monitor returned an invalid timing status byte when the operating system used the DDC/CI get timing report and timing message command to get a timing report from a monitor. + GRAPHICS_DDCCI_MONITOR_RETURNED_INVALID_TIMING_STATUS_BYTE = 0xC01E0586, + + /// A monitor returned a DDC/CI capabilities string that did not comply with the ACCESS.bus 3.0, DDC/CI 1.1, or MCCS 2 Revision 1 specification. + GRAPHICS_DDCCI_INVALID_CAPABILITIES_STRING = 0xC01E0587, + + /// An internal error caused an operation to fail. + GRAPHICS_MCA_INTERNAL_ERROR = 0xC01E0588, + + /// An operation failed because a DDC/CI message had an invalid value in its command field. + GRAPHICS_DDCCI_INVALID_MESSAGE_COMMAND = 0xC01E0589, + + /// This error occurred because a DDC/CI message had an invalid value in its length field. + GRAPHICS_DDCCI_INVALID_MESSAGE_LENGTH = 0xC01E058A, + + /// This error occurred because the value in a DDC/CI message's checksum field did not match the message's computed checksum value. + /// This error implies that the data was corrupted while it was being transmitted from a monitor to a computer. + GRAPHICS_DDCCI_INVALID_MESSAGE_CHECKSUM = 0xC01E058B, + + /// This function failed because an invalid monitor handle was passed to it. + GRAPHICS_INVALID_PHYSICAL_MONITOR_HANDLE = 0xC01E058C, + + /// The operating system asynchronously destroyed the monitor that corresponds to this handle because the operating system's state changed. + /// This error typically occurs because the monitor PDO associated with this handle was removed or stopped, or a display mode change occurred. + /// A display mode change occurs when Windows sends a WM_DISPLAYCHANGE message to applications. + GRAPHICS_MONITOR_NO_LONGER_EXISTS = 0xC01E058D, + + /// This function can be used only if a program is running in the local console session. + /// It cannot be used if a program is running on a remote desktop session or on a terminal server session. + GRAPHICS_ONLY_CONSOLE_SESSION_SUPPORTED = 0xC01E05E0, + + /// This function cannot find an actual GDI display device that corresponds to the specified GDI display device name. + GRAPHICS_NO_DISPLAY_DEVICE_CORRESPONDS_TO_NAME = 0xC01E05E1, + + /// The function failed because the specified GDI display device was not attached to the Windows desktop. + GRAPHICS_DISPLAY_DEVICE_NOT_ATTACHED_TO_DESKTOP = 0xC01E05E2, + + /// This function does not support GDI mirroring display devices because GDI mirroring display devices do not have any physical monitors associated with them. + GRAPHICS_MIRRORING_DEVICES_NOT_SUPPORTED = 0xC01E05E3, + + /// The function failed because an invalid pointer parameter was passed to it. + /// A pointer parameter is invalid if it is null, is not correctly aligned, or points to an invalid address or to a kernel mode address. + GRAPHICS_INVALID_POINTER = 0xC01E05E4, + + /// This function failed because the GDI device passed to it did not have a monitor associated with it. + GRAPHICS_NO_MONITORS_CORRESPOND_TO_DISPLAY_DEVICE = 0xC01E05E5, + + /// An array passed to the function cannot hold all of the data that the function must copy into the array. + GRAPHICS_PARAMETER_ARRAY_TOO_SMALL = 0xC01E05E6, + + /// An internal error caused an operation to fail. + GRAPHICS_INTERNAL_ERROR = 0xC01E05E7, + + /// The function failed because the current session is changing its type. + /// This function cannot be called when the current session is changing its type. + /// Three types of sessions currently exist: console, disconnected, and remote (RDP or ICA). + GRAPHICS_SESSION_TYPE_CHANGE_IN_PROGRESS = 0xC01E05E8, + + /// The volume must be unlocked before it can be used. + FVE_LOCKED_VOLUME = 0xC0210000, + + /// The volume is fully decrypted and no key is available. + FVE_NOT_ENCRYPTED = 0xC0210001, + + /// The control block for the encrypted volume is not valid. + FVE_BAD_INFORMATION = 0xC0210002, + + /// Not enough free space remains on the volume to allow encryption. + FVE_TOO_SMALL = 0xC0210003, + + /// The partition cannot be encrypted because the file system is not supported. + FVE_FAILED_WRONG_FS = 0xC0210004, + + /// The file system is inconsistent. Run the Check Disk utility. + FVE_FAILED_BAD_FS = 0xC0210005, + + /// The file system does not extend to the end of the volume. + FVE_FS_NOT_EXTENDED = 0xC0210006, + + /// This operation cannot be performed while a file system is mounted on the volume. + FVE_FS_MOUNTED = 0xC0210007, + + /// BitLocker Drive Encryption is not included with this version of Windows. + FVE_NO_LICENSE = 0xC0210008, + + /// The requested action was denied by the FVE control engine. + FVE_ACTION_NOT_ALLOWED = 0xC0210009, + + /// The data supplied is malformed. + FVE_BAD_DATA = 0xC021000A, + + /// The volume is not bound to the system. + FVE_VOLUME_NOT_BOUND = 0xC021000B, + + /// The volume specified is not a data volume. + FVE_NOT_DATA_VOLUME = 0xC021000C, + + /// A read operation failed while converting the volume. + FVE_CONV_READ_ERROR = 0xC021000D, + + /// A write operation failed while converting the volume. + FVE_CONV_WRITE_ERROR = 0xC021000E, + + /// The control block for the encrypted volume was updated by another thread. Try again. + FVE_OVERLAPPED_UPDATE = 0xC021000F, + + /// The volume encryption algorithm cannot be used on this sector size. + FVE_FAILED_SECTOR_SIZE = 0xC0210010, + + /// BitLocker recovery authentication failed. + FVE_FAILED_AUTHENTICATION = 0xC0210011, + + /// The volume specified is not the boot operating system volume. + FVE_NOT_OS_VOLUME = 0xC0210012, + + /// The BitLocker startup key or recovery password could not be read from external media. + FVE_KEYFILE_NOT_FOUND = 0xC0210013, + + /// The BitLocker startup key or recovery password file is corrupt or invalid. + FVE_KEYFILE_INVALID = 0xC0210014, + + /// The BitLocker encryption key could not be obtained from the startup key or the recovery password. + FVE_KEYFILE_NO_VMK = 0xC0210015, + + /// The TPM is disabled. + FVE_TPM_DISABLED = 0xC0210016, + + /// The authorization data for the SRK of the TPM is not zero. + FVE_TPM_SRK_AUTH_NOT_ZERO = 0xC0210017, + + /// The system boot information changed or the TPM locked out access to BitLocker encryption keys until the computer is restarted. + FVE_TPM_INVALID_PCR = 0xC0210018, + + /// The BitLocker encryption key could not be obtained from the TPM. + FVE_TPM_NO_VMK = 0xC0210019, + + /// The BitLocker encryption key could not be obtained from the TPM and PIN. + FVE_PIN_INVALID = 0xC021001A, + + /// A boot application hash does not match the hash computed when BitLocker was turned on. + FVE_AUTH_INVALID_APPLICATION = 0xC021001B, + + /// The Boot Configuration Data (BCD) settings are not supported or have changed because BitLocker was enabled. + FVE_AUTH_INVALID_CONFIG = 0xC021001C, + + /// Boot debugging is enabled. Run Windows Boot Configuration Data Store Editor (bcdedit.exe) to turn it off. + FVE_DEBUGGER_ENABLED = 0xC021001D, + + /// The BitLocker encryption key could not be obtained. + FVE_DRY_RUN_FAILED = 0xC021001E, + + /// The metadata disk region pointer is incorrect. + FVE_BAD_METADATA_POINTER = 0xC021001F, + + /// The backup copy of the metadata is out of date. + FVE_OLD_METADATA_COPY = 0xC0210020, + + /// No action was taken because a system restart is required. + FVE_REBOOT_REQUIRED = 0xC0210021, + + /// No action was taken because BitLocker Drive Encryption is in RAW access mode. + FVE_RAW_ACCESS = 0xC0210022, + + /// BitLocker Drive Encryption cannot enter RAW access mode for this volume. + FVE_RAW_BLOCKED = 0xC0210023, + + /// This feature of BitLocker Drive Encryption is not included with this version of Windows. + FVE_NO_FEATURE_LICENSE = 0xC0210026, + + /// Group policy does not permit turning off BitLocker Drive Encryption on roaming data volumes. + FVE_POLICY_USER_DISABLE_RDV_NOT_ALLOWED = 0xC0210027, + + /// Bitlocker Drive Encryption failed to recover from aborted conversion. + /// This could be due to either all conversion logs being corrupted or the media being write-protected. + FVE_CONV_RECOVERY_FAILED = 0xC0210028, + + /// The requested virtualization size is too big. + FVE_VIRTUALIZED_SPACE_TOO_BIG = 0xC0210029, + + /// The drive is too small to be protected using BitLocker Drive Encryption. + FVE_VOLUME_TOO_SMALL = 0xC0210030, + + /// The callout does not exist. + FWP_CALLOUT_NOT_FOUND = 0xC0220001, + + /// The filter condition does not exist. + FWP_CONDITION_NOT_FOUND = 0xC0220002, + + /// The filter does not exist. + FWP_FILTER_NOT_FOUND = 0xC0220003, + + /// The layer does not exist. + FWP_LAYER_NOT_FOUND = 0xC0220004, + + /// The provider does not exist. + FWP_PROVIDER_NOT_FOUND = 0xC0220005, + + /// The provider context does not exist. + FWP_PROVIDER_CONTEXT_NOT_FOUND = 0xC0220006, + + /// The sublayer does not exist. + FWP_SUBLAYER_NOT_FOUND = 0xC0220007, + + /// The object does not exist. + FWP_NOT_FOUND = 0xC0220008, + + /// An object with that GUID or LUID already exists. + FWP_ALREADY_EXISTS = 0xC0220009, + + /// The object is referenced by other objects and cannot be deleted. + FWP_IN_USE = 0xC022000A, + + /// The call is not allowed from within a dynamic session. + FWP_DYNAMIC_SESSION_IN_PROGRESS = 0xC022000B, + + /// The call was made from the wrong session and cannot be completed. + FWP_WRONG_SESSION = 0xC022000C, + + /// The call must be made from within an explicit transaction. + FWP_NO_TXN_IN_PROGRESS = 0xC022000D, + + /// The call is not allowed from within an explicit transaction. + FWP_TXN_IN_PROGRESS = 0xC022000E, + + /// The explicit transaction has been forcibly canceled. + FWP_TXN_ABORTED = 0xC022000F, + + /// The session has been canceled. + FWP_SESSION_ABORTED = 0xC0220010, + + /// The call is not allowed from within a read-only transaction. + FWP_INCOMPATIBLE_TXN = 0xC0220011, + + /// The call timed out while waiting to acquire the transaction lock. + FWP_TIMEOUT = 0xC0220012, + + /// The collection of network diagnostic events is disabled. + FWP_NET_EVENTS_DISABLED = 0xC0220013, + + /// The operation is not supported by the specified layer. + FWP_INCOMPATIBLE_LAYER = 0xC0220014, + + /// The call is allowed for kernel-mode callers only. + FWP_KM_CLIENTS_ONLY = 0xC0220015, + + /// The call tried to associate two objects with incompatible lifetimes. + FWP_LIFETIME_MISMATCH = 0xC0220016, + + /// The object is built-in and cannot be deleted. + FWP_BUILTIN_OBJECT = 0xC0220017, + + /// The maximum number of boot-time filters has been reached. + FWP_TOO_MANY_BOOTTIME_FILTERS = 0xC0220018, + + /// The maximum number of callouts has been reached. + FWP_TOO_MANY_CALLOUTS = 0xC0220018, + + /// A notification could not be delivered because a message queue has reached maximum capacity. + FWP_NOTIFICATION_DROPPED = 0xC0220019, + + /// The traffic parameters do not match those for the security association context. + FWP_TRAFFIC_MISMATCH = 0xC022001A, + + /// The call is not allowed for the current security association state. + FWP_INCOMPATIBLE_SA_STATE = 0xC022001B, + + /// A required pointer is null. + FWP_NULL_POINTER = 0xC022001C, + + /// An enumerator is not valid. + FWP_INVALID_ENUMERATOR = 0xC022001D, + + /// The flags field contains an invalid value. + FWP_INVALID_FLAGS = 0xC022001E, + + /// A network mask is not valid. + FWP_INVALID_NET_MASK = 0xC022001F, + + /// An FWP_RANGE is not valid. + FWP_INVALID_RANGE = 0xC0220020, + + /// The time interval is not valid. + FWP_INVALID_INTERVAL = 0xC0220021, + + /// An array that must contain at least one element has a zero length. + FWP_ZERO_LENGTH_ARRAY = 0xC0220022, + + /// The displayData.name field cannot be null. + FWP_NULL_DISPLAY_NAME = 0xC0220023, + + /// The action type is not one of the allowed action types for a filter. + FWP_INVALID_ACTION_TYPE = 0xC0220024, + + /// The filter weight is not valid. + FWP_INVALID_WEIGHT = 0xC0220025, + + /// A filter condition contains a match type that is not compatible with the operands. + FWP_MATCH_TYPE_MISMATCH = 0xC0220026, + + /// An FWP_VALUE or FWPM_CONDITION_VALUE is of the wrong type. + FWP_TYPE_MISMATCH = 0xC0220027, + + /// An integer value is outside the allowed range. + FWP_OUT_OF_BOUNDS = 0xC0220028, + + /// A reserved field is nonzero. + FWP_RESERVED = 0xC0220029, + + /// A filter cannot contain multiple conditions operating on a single field. + FWP_DUPLICATE_CONDITION = 0xC022002A, + + /// A policy cannot contain the same keying module more than once. + FWP_DUPLICATE_KEYMOD = 0xC022002B, + + /// The action type is not compatible with the layer. + FWP_ACTION_INCOMPATIBLE_WITH_LAYER = 0xC022002C, + + /// The action type is not compatible with the sublayer. + FWP_ACTION_INCOMPATIBLE_WITH_SUBLAYER = 0xC022002D, + + /// The raw context or the provider context is not compatible with the layer. + FWP_CONTEXT_INCOMPATIBLE_WITH_LAYER = 0xC022002E, + + /// The raw context or the provider context is not compatible with the callout. + FWP_CONTEXT_INCOMPATIBLE_WITH_CALLOUT = 0xC022002F, + + /// The authentication method is not compatible with the policy type. + FWP_INCOMPATIBLE_AUTH_METHOD = 0xC0220030, + + /// The Diffie-Hellman group is not compatible with the policy type. + FWP_INCOMPATIBLE_DH_GROUP = 0xC0220031, + + /// An IKE policy cannot contain an Extended Mode policy. + FWP_EM_NOT_SUPPORTED = 0xC0220032, + + /// The enumeration template or subscription will never match any objects. + FWP_NEVER_MATCH = 0xC0220033, + + /// The provider context is of the wrong type. + FWP_PROVIDER_CONTEXT_MISMATCH = 0xC0220034, + + /// The parameter is incorrect. + FWP_INVALID_PARAMETER = 0xC0220035, + + /// The maximum number of sublayers has been reached. + FWP_TOO_MANY_SUBLAYERS = 0xC0220036, + + /// The notification function for a callout returned an error. + FWP_CALLOUT_NOTIFICATION_FAILED = 0xC0220037, + + /// The IPsec authentication configuration is not compatible with the authentication type. + FWP_INCOMPATIBLE_AUTH_CONFIG = 0xC0220038, + + /// The IPsec cipher configuration is not compatible with the cipher type. + FWP_INCOMPATIBLE_CIPHER_CONFIG = 0xC0220039, + + /// A policy cannot contain the same auth method more than once. + FWP_DUPLICATE_AUTH_METHOD = 0xC022003C, + + /// The TCP/IP stack is not ready. + FWP_TCPIP_NOT_READY = 0xC0220100, + + /// The injection handle is being closed by another thread. + FWP_INJECT_HANDLE_CLOSING = 0xC0220101, + + /// The injection handle is stale. + FWP_INJECT_HANDLE_STALE = 0xC0220102, + + /// The classify cannot be pended. + FWP_CANNOT_PEND = 0xC0220103, + + /// The binding to the network interface is being closed. + NDIS_CLOSING = 0xC0230002, + + /// An invalid version was specified. + NDIS_BAD_VERSION = 0xC0230004, + + /// An invalid characteristics table was used. + NDIS_BAD_CHARACTERISTICS = 0xC0230005, + + /// Failed to find the network interface or the network interface is not ready. + NDIS_ADAPTER_NOT_FOUND = 0xC0230006, + + /// Failed to open the network interface. + NDIS_OPEN_FAILED = 0xC0230007, + + /// The network interface has encountered an internal unrecoverable failure. + NDIS_DEVICE_FAILED = 0xC0230008, + + /// The multicast list on the network interface is full. + NDIS_MULTICAST_FULL = 0xC0230009, + + /// An attempt was made to add a duplicate multicast address to the list. + NDIS_MULTICAST_EXISTS = 0xC023000A, + + /// At attempt was made to remove a multicast address that was never added. + NDIS_MULTICAST_NOT_FOUND = 0xC023000B, + + /// The network interface aborted the request. + NDIS_REQUEST_ABORTED = 0xC023000C, + + /// The network interface cannot process the request because it is being reset. + NDIS_RESET_IN_PROGRESS = 0xC023000D, + + /// An attempt was made to send an invalid packet on a network interface. + NDIS_INVALID_PACKET = 0xC023000F, + + /// The specified request is not a valid operation for the target device. + NDIS_INVALID_DEVICE_REQUEST = 0xC0230010, + + /// The network interface is not ready to complete this operation. + NDIS_ADAPTER_NOT_READY = 0xC0230011, + + /// The length of the buffer submitted for this operation is not valid. + NDIS_INVALID_LENGTH = 0xC0230014, + + /// The data used for this operation is not valid. + NDIS_INVALID_DATA = 0xC0230015, + + /// The length of the submitted buffer for this operation is too small. + NDIS_BUFFER_TOO_SHORT = 0xC0230016, + + /// The network interface does not support this object identifier. + NDIS_INVALID_OID = 0xC0230017, + + /// The network interface has been removed. + NDIS_ADAPTER_REMOVED = 0xC0230018, + + /// The network interface does not support this media type. + NDIS_UNSUPPORTED_MEDIA = 0xC0230019, + + /// An attempt was made to remove a token ring group address that is in use by other components. + NDIS_GROUP_ADDRESS_IN_USE = 0xC023001A, + + /// An attempt was made to map a file that cannot be found. + NDIS_FILE_NOT_FOUND = 0xC023001B, + + /// An error occurred while NDIS tried to map the file. + NDIS_ERROR_READING_FILE = 0xC023001C, + + /// An attempt was made to map a file that is already mapped. + NDIS_ALREADY_MAPPED = 0xC023001D, + + /// An attempt to allocate a hardware resource failed because the resource is used by another component. + NDIS_RESOURCE_CONFLICT = 0xC023001E, + + /// The I/O operation failed because the network media is disconnected or the wireless access point is out of range. + NDIS_MEDIA_DISCONNECTED = 0xC023001F, + + /// The network address used in the request is invalid. + NDIS_INVALID_ADDRESS = 0xC0230022, + + /// The offload operation on the network interface has been paused. + NDIS_PAUSED = 0xC023002A, + + /// The network interface was not found. + NDIS_INTERFACE_NOT_FOUND = 0xC023002B, + + /// The revision number specified in the structure is not supported. + NDIS_UNSUPPORTED_REVISION = 0xC023002C, + + /// The specified port does not exist on this network interface. + NDIS_INVALID_PORT = 0xC023002D, + + /// The current state of the specified port on this network interface does not support the requested operation. + NDIS_INVALID_PORT_STATE = 0xC023002E, + + /// The miniport adapter is in a lower power state. + NDIS_LOW_POWER_STATE = 0xC023002F, + + /// The network interface does not support this request. + NDIS_NOT_SUPPORTED = 0xC02300BB, + + /// The TCP connection is not offloadable because of a local policy setting. + NDIS_OFFLOAD_POLICY = 0xC023100F, + + /// The TCP connection is not offloadable by the Chimney offload target. + NDIS_OFFLOAD_CONNECTION_REJECTED = 0xC0231012, + + /// The IP Path object is not in an offloadable state. + NDIS_OFFLOAD_PATH_REJECTED = 0xC0231013, + + /// The wireless LAN interface is in auto-configuration mode and does not support the requested parameter change operation. + NDIS_DOT11_AUTO_CONFIG_ENABLED = 0xC0232000, + + /// The wireless LAN interface is busy and cannot perform the requested operation. + NDIS_DOT11_MEDIA_IN_USE = 0xC0232001, + + /// The wireless LAN interface is power down and does not support the requested operation. + NDIS_DOT11_POWER_STATE_INVALID = 0xC0232002, + + /// The list of wake on LAN patterns is full. + NDIS_PM_WOL_PATTERN_LIST_FULL = 0xC0232003, + + /// The list of low power protocol offloads is full. + NDIS_PM_PROTOCOL_OFFLOAD_LIST_FULL = 0xC0232004, + + /// The SPI in the packet does not match a valid IPsec SA. + IPSEC_BAD_SPI = 0xC0360001, + + /// The packet was received on an IPsec SA whose lifetime has expired. + IPSEC_SA_LIFETIME_EXPIRED = 0xC0360002, + + /// The packet was received on an IPsec SA that does not match the packet characteristics. + IPSEC_WRONG_SA = 0xC0360003, + + /// The packet sequence number replay check failed. + IPSEC_REPLAY_CHECK_FAILED = 0xC0360004, + + /// The IPsec header and/or trailer in the packet is invalid. + IPSEC_INVALID_PACKET = 0xC0360005, + + /// The IPsec integrity check failed. + IPSEC_INTEGRITY_CHECK_FAILED = 0xC0360006, + + /// IPsec dropped a clear text packet. + IPSEC_CLEAR_TEXT_DROP = 0xC0360007, + + /// IPsec dropped an incoming ESP packet in authenticated firewall mode. This drop is benign. + IPSEC_AUTH_FIREWALL_DROP = 0xC0360008, + + /// IPsec dropped a packet due to DOS throttle. + IPSEC_THROTTLE_DROP = 0xC0360009, + + /// IPsec Dos Protection matched an explicit block rule. + IPSEC_DOSP_BLOCK = 0xC0368000, + + /// IPsec Dos Protection received an IPsec specific multicast packet which is not allowed. + IPSEC_DOSP_RECEIVED_MULTICAST = 0xC0368001, + + /// IPsec Dos Protection received an incorrectly formatted packet. + IPSEC_DOSP_INVALID_PACKET = 0xC0368002, + + /// IPsec Dos Protection failed to lookup state. + IPSEC_DOSP_STATE_LOOKUP_FAILED = 0xC0368003, + + /// IPsec Dos Protection failed to create state because there are already maximum number of entries allowed by policy. + IPSEC_DOSP_MAX_ENTRIES = 0xC0368004, + + /// IPsec Dos Protection received an IPsec negotiation packet for a keying module which is not allowed by policy. + IPSEC_DOSP_KEYMOD_NOT_ALLOWED = 0xC0368005, + + /// IPsec Dos Protection failed to create per internal IP ratelimit queue because there is already maximum number of queues allowed by policy. + IPSEC_DOSP_MAX_PER_IP_RATELIMIT_QUEUES = 0xC0368006, + + /// The system does not support mirrored volumes. + VOLMGR_MIRROR_NOT_SUPPORTED = 0xC038005B, + + /// The system does not support RAID-5 volumes. + VOLMGR_RAID5_NOT_SUPPORTED = 0xC038005C, + + /// A virtual disk support provider for the specified file was not found. + VIRTDISK_PROVIDER_NOT_FOUND = 0xC03A0014, + + /// The specified disk is not a virtual disk. + VIRTDISK_NOT_VIRTUAL_DISK = 0xC03A0015, + + /// The chain of virtual hard disks is inaccessible. + /// The process has not been granted access rights to the parent virtual hard disk for the differencing disk. + VHD_PARENT_VHD_ACCESS_DENIED = 0xC03A0016, + + /// The chain of virtual hard disks is corrupted. + /// There is a mismatch in the virtual sizes of the parent virtual hard disk and differencing disk. + VHD_CHILD_PARENT_SIZE_MISMATCH = 0xC03A0017, + + /// The chain of virtual hard disks is corrupted. + /// A differencing disk is indicated in its own parent chain. + VHD_DIFFERENCING_CHAIN_CYCLE_DETECTED = 0xC03A0018, + + /// The chain of virtual hard disks is inaccessible. + /// There was an error opening a virtual hard disk further up the chain. + VHD_DIFFERENCING_CHAIN_ERROR_IN_PARENT = 0xC03A0019, + + _, +}; diff --git a/lib/std/os/windows/status.zig b/lib/std/os/windows/status.zig deleted file mode 100644 index 71c1fbeac..000000000 --- a/lib/std/os/windows/status.zig +++ /dev/null @@ -1,1670 +0,0 @@ -/// The operation completed successfully. -pub const SUCCESS = 0x00000000; - -pub const WAIT_0 = 0x00000000; -pub const WAIT_1 = 0x00000001; -pub const WAIT_2 = 0x00000002; -pub const WAIT_3 = 0x00000003; -pub const WAIT_63 = 0x0000003F; -pub const ABANDONED = 0x00000080; -pub const ABANDONED_WAIT_0 = 0x00000080; -pub const ABANDONED_WAIT_63 = 0x000000BF; -pub const USER_APC = 0x000000C0; -pub const ALERTED = 0x00000101; - -/// The given Timeout interval expired. -pub const TIMEOUT = 0x00000102; - -/// The operation that was requested is pending completion. -pub const PENDING = 0x00000103; - -pub const REPARSE = 0x00000104; -pub const MORE_ENTRIES = 0x00000105; -pub const NOT_ALL_ASSIGNED = 0x00000106; -pub const SOME_NOT_MAPPED = 0x00000107; -pub const OPLOCK_BREAK_IN_PROGRESS = 0x00000108; -pub const VOLUME_MOUNTED = 0x00000109; -pub const RXACT_COMMITTED = 0x0000010A; -pub const NOTIFY_CLEANUP = 0x0000010B; -pub const NOTIFY_ENUM_DIR = 0x0000010C; -pub const NO_QUOTAS_FOR_ACCOUNT = 0x0000010D; -pub const PRIMARY_TRANSPORT_CONNECT_FAILED = 0x0000010E; -pub const PAGE_FAULT_TRANSITION = 0x00000110; -pub const PAGE_FAULT_DEMAND_ZERO = 0x00000111; -pub const PAGE_FAULT_COPY_ON_WRITE = 0x00000112; -pub const PAGE_FAULT_GUARD_PAGE = 0x00000113; -pub const PAGE_FAULT_PAGING_FILE = 0x00000114; -pub const CACHE_PAGE_LOCKED = 0x00000115; -pub const CRASH_DUMP = 0x00000116; -pub const BUFFER_ALL_ZEROS = 0x00000117; -pub const REPARSE_OBJECT = 0x00000118; -pub const RESOURCE_REQUIREMENTS_CHANGED = 0x00000119; -pub const TRANSLATION_COMPLETE = 0x00000120; -pub const DS_MEMBERSHIP_EVALUATED_LOCALLY = 0x00000121; -pub const NOTHING_TO_TERMINATE = 0x00000122; -pub const PROCESS_NOT_IN_JOB = 0x00000123; -pub const PROCESS_IN_JOB = 0x00000124; -pub const VOLSNAP_HIBERNATE_READY = 0x00000125; -pub const FSFILTER_OP_COMPLETED_SUCCESSFULLY = 0x00000126; -pub const INTERRUPT_VECTOR_ALREADY_CONNECTED = 0x00000127; -pub const INTERRUPT_STILL_CONNECTED = 0x00000128; -pub const PROCESS_CLONED = 0x00000129; -pub const FILE_LOCKED_WITH_ONLY_READERS = 0x0000012A; -pub const FILE_LOCKED_WITH_WRITERS = 0x0000012B; -pub const RESOURCEMANAGER_READ_ONLY = 0x00000202; -pub const WAIT_FOR_OPLOCK = 0x00000367; -pub const FLT_IO_COMPLETE = 0x001C0001; -pub const FILE_NOT_AVAILABLE = 0xC0000467; -pub const OBJECT_NAME_EXISTS = 0x40000000; -pub const THREAD_WAS_SUSPENDED = 0x40000001; -pub const WORKING_SET_LIMIT_RANGE = 0x40000002; -pub const IMAGE_NOT_AT_BASE = 0x40000003; -pub const RXACT_STATE_CREATED = 0x40000004; -pub const SEGMENT_NOTIFICATION = 0x40000005; -pub const LOCAL_USER_SESSION_KEY = 0x40000006; -pub const BAD_CURRENT_DIRECTORY = 0x40000007; -pub const SERIAL_MORE_WRITES = 0x40000008; -pub const REGISTRY_RECOVERED = 0x40000009; -pub const FT_READ_RECOVERY_FROM_BACKUP = 0x4000000A; -pub const FT_WRITE_RECOVERY = 0x4000000B; -pub const SERIAL_COUNTER_TIMEOUT = 0x4000000C; -pub const NULL_LM_PASSWORD = 0x4000000D; -pub const IMAGE_MACHINE_TYPE_MISMATCH = 0x4000000E; -pub const RECEIVE_PARTIAL = 0x4000000F; -pub const RECEIVE_EXPEDITED = 0x40000010; -pub const RECEIVE_PARTIAL_EXPEDITED = 0x40000011; -pub const EVENT_DONE = 0x40000012; -pub const EVENT_PENDING = 0x40000013; -pub const CHECKING_FILE_SYSTEM = 0x40000014; -pub const FATAL_APP_EXIT = 0x40000015; -pub const PREDEFINED_HANDLE = 0x40000016; -pub const WAS_UNLOCKED = 0x40000017; -pub const SERVICE_NOTIFICATION = 0x40000018; -pub const WAS_LOCKED = 0x40000019; -pub const LOG_HARD_ERROR = 0x4000001A; -pub const ALREADY_WIN32 = 0x4000001B; -pub const WX86_UNSIMULATE = 0x4000001C; -pub const WX86_CONTINUE = 0x4000001D; -pub const WX86_SINGLE_STEP = 0x4000001E; -pub const WX86_BREAKPOINT = 0x4000001F; -pub const WX86_EXCEPTION_CONTINUE = 0x40000020; -pub const WX86_EXCEPTION_LASTCHANCE = 0x40000021; -pub const WX86_EXCEPTION_CHAIN = 0x40000022; -pub const IMAGE_MACHINE_TYPE_MISMATCH_EXE = 0x40000023; -pub const NO_YIELD_PERFORMED = 0x40000024; -pub const TIMER_RESUME_IGNORED = 0x40000025; -pub const ARBITRATION_UNHANDLED = 0x40000026; -pub const CARDBUS_NOT_SUPPORTED = 0x40000027; -pub const WX86_CREATEWX86TIB = 0x40000028; -pub const MP_PROCESSOR_MISMATCH = 0x40000029; -pub const HIBERNATED = 0x4000002A; -pub const RESUME_HIBERNATION = 0x4000002B; -pub const FIRMWARE_UPDATED = 0x4000002C; -pub const DRIVERS_LEAKING_LOCKED_PAGES = 0x4000002D; -pub const MESSAGE_RETRIEVED = 0x4000002E; -pub const SYSTEM_POWERSTATE_TRANSITION = 0x4000002F; -pub const ALPC_CHECK_COMPLETION_LIST = 0x40000030; -pub const SYSTEM_POWERSTATE_COMPLEX_TRANSITION = 0x40000031; -pub const ACCESS_AUDIT_BY_POLICY = 0x40000032; -pub const ABANDON_HIBERFILE = 0x40000033; -pub const BIZRULES_NOT_ENABLED = 0x40000034; -pub const WAKE_SYSTEM = 0x40000294; -pub const DS_SHUTTING_DOWN = 0x40000370; -pub const CTX_CDM_CONNECT = 0x400A0004; -pub const CTX_CDM_DISCONNECT = 0x400A0005; -pub const SXS_RELEASE_ACTIVATION_CONTEXT = 0x4015000D; -pub const RECOVERY_NOT_NEEDED = 0x40190034; -pub const RM_ALREADY_STARTED = 0x40190035; -pub const LOG_NO_RESTART = 0x401A000C; -pub const VIDEO_DRIVER_DEBUG_REPORT_REQUEST = 0x401B00EC; -pub const GRAPHICS_PARTIAL_DATA_POPULATED = 0x401E000A; -pub const GRAPHICS_DRIVER_MISMATCH = 0x401E0117; -pub const GRAPHICS_MODE_NOT_PINNED = 0x401E0307; -pub const GRAPHICS_NO_PREFERRED_MODE = 0x401E031E; -pub const GRAPHICS_DATASET_IS_EMPTY = 0x401E034B; -pub const GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET = 0x401E034C; -pub const GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_PINNED = 0x401E0351; -pub const GRAPHICS_UNKNOWN_CHILD_STATUS = 0x401E042F; -pub const GRAPHICS_LEADLINK_START_DEFERRED = 0x401E0437; -pub const GRAPHICS_POLLING_TOO_FREQUENTLY = 0x401E0439; -pub const GRAPHICS_START_DEFERRED = 0x401E043A; -pub const NDIS_INDICATION_REQUIRED = 0x40230001; -pub const GUARD_PAGE_VIOLATION = 0x80000001; -pub const DATATYPE_MISALIGNMENT = 0x80000002; -pub const BREAKPOINT = 0x80000003; -pub const SINGLE_STEP = 0x80000004; - -/// The data was too large to fit into the specified buffer. -pub const BUFFER_OVERFLOW = 0x80000005; -pub const NO_MORE_FILES = 0x80000006; -pub const WAKE_SYSTEM_DEBUGGER = 0x80000007; -pub const HANDLES_CLOSED = 0x8000000A; -pub const NO_INHERITANCE = 0x8000000B; -pub const GUID_SUBSTITUTION_MADE = 0x8000000C; -pub const PARTIAL_COPY = 0x8000000D; -pub const DEVICE_PAPER_EMPTY = 0x8000000E; -pub const DEVICE_POWERED_OFF = 0x8000000F; -pub const DEVICE_OFF_LINE = 0x80000010; -pub const DEVICE_BUSY = 0x80000011; -pub const NO_MORE_EAS = 0x80000012; -pub const INVALID_EA_NAME = 0x80000013; -pub const EA_LIST_INCONSISTENT = 0x80000014; -pub const INVALID_EA_FLAG = 0x80000015; -pub const VERIFY_REQUIRED = 0x80000016; -pub const EXTRANEOUS_INFORMATION = 0x80000017; -pub const RXACT_COMMIT_NECESSARY = 0x80000018; -pub const NO_MORE_ENTRIES = 0x8000001A; -pub const FILEMARK_DETECTED = 0x8000001B; -pub const MEDIA_CHANGED = 0x8000001C; -pub const BUS_RESET = 0x8000001D; -pub const END_OF_MEDIA = 0x8000001E; -pub const BEGINNING_OF_MEDIA = 0x8000001F; -pub const MEDIA_CHECK = 0x80000020; -pub const SETMARK_DETECTED = 0x80000021; -pub const NO_DATA_DETECTED = 0x80000022; -pub const REDIRECTOR_HAS_OPEN_HANDLES = 0x80000023; -pub const SERVER_HAS_OPEN_HANDLES = 0x80000024; -pub const ALREADY_DISCONNECTED = 0x80000025; -pub const LONGJUMP = 0x80000026; -pub const CLEANER_CARTRIDGE_INSTALLED = 0x80000027; -pub const PLUGPLAY_QUERY_VETOED = 0x80000028; -pub const UNWIND_CONSOLIDATE = 0x80000029; -pub const REGISTRY_HIVE_RECOVERED = 0x8000002A; -pub const DLL_MIGHT_BE_INSECURE = 0x8000002B; -pub const DLL_MIGHT_BE_INCOMPATIBLE = 0x8000002C; -pub const STOPPED_ON_SYMLINK = 0x8000002D; -pub const DEVICE_REQUIRES_CLEANING = 0x80000288; -pub const DEVICE_DOOR_OPEN = 0x80000289; -pub const DATA_LOST_REPAIR = 0x80000803; -pub const CLUSTER_NODE_ALREADY_UP = 0x80130001; -pub const CLUSTER_NODE_ALREADY_DOWN = 0x80130002; -pub const CLUSTER_NETWORK_ALREADY_ONLINE = 0x80130003; -pub const CLUSTER_NETWORK_ALREADY_OFFLINE = 0x80130004; -pub const CLUSTER_NODE_ALREADY_MEMBER = 0x80130005; -pub const COULD_NOT_RESIZE_LOG = 0x80190009; -pub const NO_TXF_METADATA = 0x80190029; -pub const CANT_RECOVER_WITH_HANDLE_OPEN = 0x80190031; -pub const TXF_METADATA_ALREADY_PRESENT = 0x80190041; -pub const TRANSACTION_SCOPE_CALLBACKS_NOT_SET = 0x80190042; -pub const VIDEO_HUNG_DISPLAY_DRIVER_THREAD_RECOVERED = 0x801B00EB; -pub const FLT_BUFFER_TOO_SMALL = 0x801C0001; -pub const FVE_PARTIAL_METADATA = 0x80210001; -pub const FVE_TRANSIENT_STATE = 0x80210002; -pub const UNSUCCESSFUL = 0xC0000001; -pub const NOT_IMPLEMENTED = 0xC0000002; -pub const INVALID_INFO_CLASS = 0xC0000003; -pub const INFO_LENGTH_MISMATCH = 0xC0000004; -pub const ACCESS_VIOLATION = 0xC0000005; -pub const IN_PAGE_ERROR = 0xC0000006; -pub const PAGEFILE_QUOTA = 0xC0000007; -pub const INVALID_HANDLE = 0xC0000008; -pub const BAD_INITIAL_STACK = 0xC0000009; -pub const BAD_INITIAL_PC = 0xC000000A; -pub const INVALID_CID = 0xC000000B; -pub const TIMER_NOT_CANCELED = 0xC000000C; -pub const INVALID_PARAMETER = 0xC000000D; -pub const NO_SUCH_DEVICE = 0xC000000E; -pub const NO_SUCH_FILE = 0xC000000F; -pub const INVALID_DEVICE_REQUEST = 0xC0000010; -pub const END_OF_FILE = 0xC0000011; -pub const WRONG_VOLUME = 0xC0000012; -pub const NO_MEDIA_IN_DEVICE = 0xC0000013; -pub const UNRECOGNIZED_MEDIA = 0xC0000014; -pub const NONEXISTENT_SECTOR = 0xC0000015; -pub const MORE_PROCESSING_REQUIRED = 0xC0000016; -pub const NO_MEMORY = 0xC0000017; -pub const CONFLICTING_ADDRESSES = 0xC0000018; -pub const NOT_MAPPED_VIEW = 0xC0000019; -pub const UNABLE_TO_FREE_VM = 0xC000001A; -pub const UNABLE_TO_DELETE_SECTION = 0xC000001B; -pub const INVALID_SYSTEM_SERVICE = 0xC000001C; -pub const ILLEGAL_INSTRUCTION = 0xC000001D; -pub const INVALID_LOCK_SEQUENCE = 0xC000001E; -pub const INVALID_VIEW_SIZE = 0xC000001F; -pub const INVALID_FILE_FOR_SECTION = 0xC0000020; -pub const ALREADY_COMMITTED = 0xC0000021; -pub const ACCESS_DENIED = 0xC0000022; -pub const BUFFER_TOO_SMALL = 0xC0000023; -pub const OBJECT_TYPE_MISMATCH = 0xC0000024; -pub const NONCONTINUABLE_EXCEPTION = 0xC0000025; -pub const INVALID_DISPOSITION = 0xC0000026; -pub const UNWIND = 0xC0000027; -pub const BAD_STACK = 0xC0000028; -pub const INVALID_UNWIND_TARGET = 0xC0000029; -pub const NOT_LOCKED = 0xC000002A; -pub const PARITY_ERROR = 0xC000002B; -pub const UNABLE_TO_DECOMMIT_VM = 0xC000002C; -pub const NOT_COMMITTED = 0xC000002D; -pub const INVALID_PORT_ATTRIBUTES = 0xC000002E; -pub const PORT_MESSAGE_TOO_LONG = 0xC000002F; -pub const INVALID_PARAMETER_MIX = 0xC0000030; -pub const INVALID_QUOTA_LOWER = 0xC0000031; -pub const DISK_CORRUPT_ERROR = 0xC0000032; -pub const OBJECT_NAME_INVALID = 0xC0000033; -pub const OBJECT_NAME_NOT_FOUND = 0xC0000034; -pub const OBJECT_NAME_COLLISION = 0xC0000035; -pub const PORT_DISCONNECTED = 0xC0000037; -pub const DEVICE_ALREADY_ATTACHED = 0xC0000038; -pub const OBJECT_PATH_INVALID = 0xC0000039; -pub const OBJECT_PATH_NOT_FOUND = 0xC000003A; -pub const OBJECT_PATH_SYNTAX_BAD = 0xC000003B; -pub const DATA_OVERRUN = 0xC000003C; -pub const DATA_LATE_ERROR = 0xC000003D; -pub const DATA_ERROR = 0xC000003E; -pub const CRC_ERROR = 0xC000003F; -pub const SECTION_TOO_BIG = 0xC0000040; -pub const PORT_CONNECTION_REFUSED = 0xC0000041; -pub const INVALID_PORT_HANDLE = 0xC0000042; -pub const SHARING_VIOLATION = 0xC0000043; -pub const QUOTA_EXCEEDED = 0xC0000044; -pub const INVALID_PAGE_PROTECTION = 0xC0000045; -pub const MUTANT_NOT_OWNED = 0xC0000046; -pub const SEMAPHORE_LIMIT_EXCEEDED = 0xC0000047; -pub const PORT_ALREADY_SET = 0xC0000048; -pub const SECTION_NOT_IMAGE = 0xC0000049; -pub const SUSPEND_COUNT_EXCEEDED = 0xC000004A; -pub const THREAD_IS_TERMINATING = 0xC000004B; -pub const BAD_WORKING_SET_LIMIT = 0xC000004C; -pub const INCOMPATIBLE_FILE_MAP = 0xC000004D; -pub const SECTION_PROTECTION = 0xC000004E; -pub const EAS_NOT_SUPPORTED = 0xC000004F; -pub const EA_TOO_LARGE = 0xC0000050; -pub const NONEXISTENT_EA_ENTRY = 0xC0000051; -pub const NO_EAS_ON_FILE = 0xC0000052; -pub const EA_CORRUPT_ERROR = 0xC0000053; -pub const FILE_LOCK_CONFLICT = 0xC0000054; -pub const LOCK_NOT_GRANTED = 0xC0000055; -pub const DELETE_PENDING = 0xC0000056; -pub const CTL_FILE_NOT_SUPPORTED = 0xC0000057; -pub const UNKNOWN_REVISION = 0xC0000058; -pub const REVISION_MISMATCH = 0xC0000059; -pub const INVALID_OWNER = 0xC000005A; -pub const INVALID_PRIMARY_GROUP = 0xC000005B; -pub const NO_IMPERSONATION_TOKEN = 0xC000005C; -pub const CANT_DISABLE_MANDATORY = 0xC000005D; -pub const NO_LOGON_SERVERS = 0xC000005E; -pub const NO_SUCH_LOGON_SESSION = 0xC000005F; -pub const NO_SUCH_PRIVILEGE = 0xC0000060; -pub const PRIVILEGE_NOT_HELD = 0xC0000061; -pub const INVALID_ACCOUNT_NAME = 0xC0000062; -pub const USER_EXISTS = 0xC0000063; -pub const NO_SUCH_USER = 0xC0000064; -pub const GROUP_EXISTS = 0xC0000065; -pub const NO_SUCH_GROUP = 0xC0000066; -pub const MEMBER_IN_GROUP = 0xC0000067; -pub const MEMBER_NOT_IN_GROUP = 0xC0000068; -pub const LAST_ADMIN = 0xC0000069; -pub const WRONG_PASSWORD = 0xC000006A; -pub const ILL_FORMED_PASSWORD = 0xC000006B; -pub const PASSWORD_RESTRICTION = 0xC000006C; -pub const LOGON_FAILURE = 0xC000006D; -pub const ACCOUNT_RESTRICTION = 0xC000006E; -pub const INVALID_LOGON_HOURS = 0xC000006F; -pub const INVALID_WORKSTATION = 0xC0000070; -pub const PASSWORD_EXPIRED = 0xC0000071; -pub const ACCOUNT_DISABLED = 0xC0000072; -pub const NONE_MAPPED = 0xC0000073; -pub const TOO_MANY_LUIDS_REQUESTED = 0xC0000074; -pub const LUIDS_EXHAUSTED = 0xC0000075; -pub const INVALID_SUB_AUTHORITY = 0xC0000076; -pub const INVALID_ACL = 0xC0000077; -pub const INVALID_SID = 0xC0000078; -pub const INVALID_SECURITY_DESCR = 0xC0000079; -pub const PROCEDURE_NOT_FOUND = 0xC000007A; -pub const INVALID_IMAGE_FORMAT = 0xC000007B; -pub const NO_TOKEN = 0xC000007C; -pub const BAD_INHERITANCE_ACL = 0xC000007D; -pub const RANGE_NOT_LOCKED = 0xC000007E; -pub const DISK_FULL = 0xC000007F; -pub const SERVER_DISABLED = 0xC0000080; -pub const SERVER_NOT_DISABLED = 0xC0000081; -pub const TOO_MANY_GUIDS_REQUESTED = 0xC0000082; -pub const GUIDS_EXHAUSTED = 0xC0000083; -pub const INVALID_ID_AUTHORITY = 0xC0000084; -pub const AGENTS_EXHAUSTED = 0xC0000085; -pub const INVALID_VOLUME_LABEL = 0xC0000086; -pub const SECTION_NOT_EXTENDED = 0xC0000087; -pub const NOT_MAPPED_DATA = 0xC0000088; -pub const RESOURCE_DATA_NOT_FOUND = 0xC0000089; -pub const RESOURCE_TYPE_NOT_FOUND = 0xC000008A; -pub const RESOURCE_NAME_NOT_FOUND = 0xC000008B; -pub const ARRAY_BOUNDS_EXCEEDED = 0xC000008C; -pub const FLOAT_DENORMAL_OPERAND = 0xC000008D; -pub const FLOAT_DIVIDE_BY_ZERO = 0xC000008E; -pub const FLOAT_INEXACT_RESULT = 0xC000008F; -pub const FLOAT_INVALID_OPERATION = 0xC0000090; -pub const FLOAT_OVERFLOW = 0xC0000091; -pub const FLOAT_STACK_CHECK = 0xC0000092; -pub const FLOAT_UNDERFLOW = 0xC0000093; -pub const INTEGER_DIVIDE_BY_ZERO = 0xC0000094; -pub const INTEGER_OVERFLOW = 0xC0000095; -pub const PRIVILEGED_INSTRUCTION = 0xC0000096; -pub const TOO_MANY_PAGING_FILES = 0xC0000097; -pub const FILE_INVALID = 0xC0000098; -pub const ALLOTTED_SPACE_EXCEEDED = 0xC0000099; -pub const INSUFFICIENT_RESOURCES = 0xC000009A; -pub const DFS_EXIT_PATH_FOUND = 0xC000009B; -pub const DEVICE_DATA_ERROR = 0xC000009C; -pub const DEVICE_NOT_CONNECTED = 0xC000009D; -pub const FREE_VM_NOT_AT_BASE = 0xC000009F; -pub const MEMORY_NOT_ALLOCATED = 0xC00000A0; -pub const WORKING_SET_QUOTA = 0xC00000A1; -pub const MEDIA_WRITE_PROTECTED = 0xC00000A2; -pub const DEVICE_NOT_READY = 0xC00000A3; -pub const INVALID_GROUP_ATTRIBUTES = 0xC00000A4; -pub const BAD_IMPERSONATION_LEVEL = 0xC00000A5; -pub const CANT_OPEN_ANONYMOUS = 0xC00000A6; -pub const BAD_VALIDATION_CLASS = 0xC00000A7; -pub const BAD_TOKEN_TYPE = 0xC00000A8; -pub const BAD_MASTER_BOOT_RECORD = 0xC00000A9; -pub const INSTRUCTION_MISALIGNMENT = 0xC00000AA; -pub const INSTANCE_NOT_AVAILABLE = 0xC00000AB; -pub const PIPE_NOT_AVAILABLE = 0xC00000AC; -pub const INVALID_PIPE_STATE = 0xC00000AD; -pub const PIPE_BUSY = 0xC00000AE; -pub const ILLEGAL_FUNCTION = 0xC00000AF; -pub const PIPE_DISCONNECTED = 0xC00000B0; -pub const PIPE_CLOSING = 0xC00000B1; -pub const PIPE_CONNECTED = 0xC00000B2; -pub const PIPE_LISTENING = 0xC00000B3; -pub const INVALID_READ_MODE = 0xC00000B4; -pub const IO_TIMEOUT = 0xC00000B5; -pub const FILE_FORCED_CLOSED = 0xC00000B6; -pub const PROFILING_NOT_STARTED = 0xC00000B7; -pub const PROFILING_NOT_STOPPED = 0xC00000B8; -pub const COULD_NOT_INTERPRET = 0xC00000B9; -pub const FILE_IS_A_DIRECTORY = 0xC00000BA; -pub const NOT_SUPPORTED = 0xC00000BB; -pub const REMOTE_NOT_LISTENING = 0xC00000BC; -pub const DUPLICATE_NAME = 0xC00000BD; -pub const BAD_NETWORK_PATH = 0xC00000BE; -pub const NETWORK_BUSY = 0xC00000BF; -pub const DEVICE_DOES_NOT_EXIST = 0xC00000C0; -pub const TOO_MANY_COMMANDS = 0xC00000C1; -pub const ADAPTER_HARDWARE_ERROR = 0xC00000C2; -pub const INVALID_NETWORK_RESPONSE = 0xC00000C3; -pub const UNEXPECTED_NETWORK_ERROR = 0xC00000C4; -pub const BAD_REMOTE_ADAPTER = 0xC00000C5; -pub const PRINT_QUEUE_FULL = 0xC00000C6; -pub const NO_SPOOL_SPACE = 0xC00000C7; -pub const PRINT_CANCELLED = 0xC00000C8; -pub const NETWORK_NAME_DELETED = 0xC00000C9; -pub const NETWORK_ACCESS_DENIED = 0xC00000CA; -pub const BAD_DEVICE_TYPE = 0xC00000CB; -pub const BAD_NETWORK_NAME = 0xC00000CC; -pub const TOO_MANY_NAMES = 0xC00000CD; -pub const TOO_MANY_SESSIONS = 0xC00000CE; -pub const SHARING_PAUSED = 0xC00000CF; -pub const REQUEST_NOT_ACCEPTED = 0xC00000D0; -pub const REDIRECTOR_PAUSED = 0xC00000D1; -pub const NET_WRITE_FAULT = 0xC00000D2; -pub const PROFILING_AT_LIMIT = 0xC00000D3; -pub const NOT_SAME_DEVICE = 0xC00000D4; -pub const FILE_RENAMED = 0xC00000D5; -pub const VIRTUAL_CIRCUIT_CLOSED = 0xC00000D6; -pub const NO_SECURITY_ON_OBJECT = 0xC00000D7; -pub const CANT_WAIT = 0xC00000D8; -pub const PIPE_EMPTY = 0xC00000D9; -pub const CANT_ACCESS_DOMAIN_INFO = 0xC00000DA; -pub const CANT_TERMINATE_SELF = 0xC00000DB; -pub const INVALID_SERVER_STATE = 0xC00000DC; -pub const INVALID_DOMAIN_STATE = 0xC00000DD; -pub const INVALID_DOMAIN_ROLE = 0xC00000DE; -pub const NO_SUCH_DOMAIN = 0xC00000DF; -pub const DOMAIN_EXISTS = 0xC00000E0; -pub const DOMAIN_LIMIT_EXCEEDED = 0xC00000E1; -pub const OPLOCK_NOT_GRANTED = 0xC00000E2; -pub const INVALID_OPLOCK_PROTOCOL = 0xC00000E3; -pub const INTERNAL_DB_CORRUPTION = 0xC00000E4; -pub const INTERNAL_ERROR = 0xC00000E5; -pub const GENERIC_NOT_MAPPED = 0xC00000E6; -pub const BAD_DESCRIPTOR_FORMAT = 0xC00000E7; -pub const INVALID_USER_BUFFER = 0xC00000E8; -pub const UNEXPECTED_IO_ERROR = 0xC00000E9; -pub const UNEXPECTED_MM_CREATE_ERR = 0xC00000EA; -pub const UNEXPECTED_MM_MAP_ERROR = 0xC00000EB; -pub const UNEXPECTED_MM_EXTEND_ERR = 0xC00000EC; -pub const NOT_LOGON_PROCESS = 0xC00000ED; -pub const LOGON_SESSION_EXISTS = 0xC00000EE; -pub const INVALID_PARAMETER_1 = 0xC00000EF; -pub const INVALID_PARAMETER_2 = 0xC00000F0; -pub const INVALID_PARAMETER_3 = 0xC00000F1; -pub const INVALID_PARAMETER_4 = 0xC00000F2; -pub const INVALID_PARAMETER_5 = 0xC00000F3; -pub const INVALID_PARAMETER_6 = 0xC00000F4; -pub const INVALID_PARAMETER_7 = 0xC00000F5; -pub const INVALID_PARAMETER_8 = 0xC00000F6; -pub const INVALID_PARAMETER_9 = 0xC00000F7; -pub const INVALID_PARAMETER_10 = 0xC00000F8; -pub const INVALID_PARAMETER_11 = 0xC00000F9; -pub const INVALID_PARAMETER_12 = 0xC00000FA; -pub const REDIRECTOR_NOT_STARTED = 0xC00000FB; -pub const REDIRECTOR_STARTED = 0xC00000FC; -pub const STACK_OVERFLOW = 0xC00000FD; -pub const NO_SUCH_PACKAGE = 0xC00000FE; -pub const BAD_FUNCTION_TABLE = 0xC00000FF; -pub const VARIABLE_NOT_FOUND = 0xC0000100; -pub const DIRECTORY_NOT_EMPTY = 0xC0000101; -pub const FILE_CORRUPT_ERROR = 0xC0000102; -pub const NOT_A_DIRECTORY = 0xC0000103; -pub const BAD_LOGON_SESSION_STATE = 0xC0000104; -pub const LOGON_SESSION_COLLISION = 0xC0000105; -pub const NAME_TOO_LONG = 0xC0000106; -pub const FILES_OPEN = 0xC0000107; -pub const CONNECTION_IN_USE = 0xC0000108; -pub const MESSAGE_NOT_FOUND = 0xC0000109; -pub const PROCESS_IS_TERMINATING = 0xC000010A; -pub const INVALID_LOGON_TYPE = 0xC000010B; -pub const NO_GUID_TRANSLATION = 0xC000010C; -pub const CANNOT_IMPERSONATE = 0xC000010D; -pub const IMAGE_ALREADY_LOADED = 0xC000010E; -pub const NO_LDT = 0xC0000117; -pub const INVALID_LDT_SIZE = 0xC0000118; -pub const INVALID_LDT_OFFSET = 0xC0000119; -pub const INVALID_LDT_DESCRIPTOR = 0xC000011A; -pub const INVALID_IMAGE_NE_FORMAT = 0xC000011B; -pub const RXACT_INVALID_STATE = 0xC000011C; -pub const RXACT_COMMIT_FAILURE = 0xC000011D; -pub const MAPPED_FILE_SIZE_ZERO = 0xC000011E; -pub const TOO_MANY_OPENED_FILES = 0xC000011F; -pub const CANCELLED = 0xC0000120; -pub const CANNOT_DELETE = 0xC0000121; -pub const INVALID_COMPUTER_NAME = 0xC0000122; -pub const FILE_DELETED = 0xC0000123; -pub const SPECIAL_ACCOUNT = 0xC0000124; -pub const SPECIAL_GROUP = 0xC0000125; -pub const SPECIAL_USER = 0xC0000126; -pub const MEMBERS_PRIMARY_GROUP = 0xC0000127; -pub const FILE_CLOSED = 0xC0000128; -pub const TOO_MANY_THREADS = 0xC0000129; -pub const THREAD_NOT_IN_PROCESS = 0xC000012A; -pub const TOKEN_ALREADY_IN_USE = 0xC000012B; -pub const PAGEFILE_QUOTA_EXCEEDED = 0xC000012C; -pub const COMMITMENT_LIMIT = 0xC000012D; -pub const INVALID_IMAGE_LE_FORMAT = 0xC000012E; -pub const INVALID_IMAGE_NOT_MZ = 0xC000012F; -pub const INVALID_IMAGE_PROTECT = 0xC0000130; -pub const INVALID_IMAGE_WIN_16 = 0xC0000131; -pub const LOGON_SERVER_CONFLICT = 0xC0000132; -pub const TIME_DIFFERENCE_AT_DC = 0xC0000133; -pub const SYNCHRONIZATION_REQUIRED = 0xC0000134; -pub const DLL_NOT_FOUND = 0xC0000135; -pub const OPEN_FAILED = 0xC0000136; -pub const IO_PRIVILEGE_FAILED = 0xC0000137; -pub const ORDINAL_NOT_FOUND = 0xC0000138; -pub const ENTRYPOINT_NOT_FOUND = 0xC0000139; -pub const CONTROL_C_EXIT = 0xC000013A; -pub const LOCAL_DISCONNECT = 0xC000013B; -pub const REMOTE_DISCONNECT = 0xC000013C; -pub const REMOTE_RESOURCES = 0xC000013D; -pub const LINK_FAILED = 0xC000013E; -pub const LINK_TIMEOUT = 0xC000013F; -pub const INVALID_CONNECTION = 0xC0000140; -pub const INVALID_ADDRESS = 0xC0000141; -pub const DLL_INIT_FAILED = 0xC0000142; -pub const MISSING_SYSTEMFILE = 0xC0000143; -pub const UNHANDLED_EXCEPTION = 0xC0000144; -pub const APP_INIT_FAILURE = 0xC0000145; -pub const PAGEFILE_CREATE_FAILED = 0xC0000146; -pub const NO_PAGEFILE = 0xC0000147; -pub const INVALID_LEVEL = 0xC0000148; -pub const WRONG_PASSWORD_CORE = 0xC0000149; -pub const ILLEGAL_FLOAT_CONTEXT = 0xC000014A; -pub const PIPE_BROKEN = 0xC000014B; -pub const REGISTRY_CORRUPT = 0xC000014C; -pub const REGISTRY_IO_FAILED = 0xC000014D; -pub const NO_EVENT_PAIR = 0xC000014E; -pub const UNRECOGNIZED_VOLUME = 0xC000014F; -pub const SERIAL_NO_DEVICE_INITED = 0xC0000150; -pub const NO_SUCH_ALIAS = 0xC0000151; -pub const MEMBER_NOT_IN_ALIAS = 0xC0000152; -pub const MEMBER_IN_ALIAS = 0xC0000153; -pub const ALIAS_EXISTS = 0xC0000154; -pub const LOGON_NOT_GRANTED = 0xC0000155; -pub const TOO_MANY_SECRETS = 0xC0000156; -pub const SECRET_TOO_LONG = 0xC0000157; -pub const INTERNAL_DB_ERROR = 0xC0000158; -pub const FULLSCREEN_MODE = 0xC0000159; -pub const TOO_MANY_CONTEXT_IDS = 0xC000015A; -pub const LOGON_TYPE_NOT_GRANTED = 0xC000015B; -pub const NOT_REGISTRY_FILE = 0xC000015C; -pub const NT_CROSS_ENCRYPTION_REQUIRED = 0xC000015D; -pub const DOMAIN_CTRLR_CONFIG_ERROR = 0xC000015E; -pub const FT_MISSING_MEMBER = 0xC000015F; -pub const ILL_FORMED_SERVICE_ENTRY = 0xC0000160; -pub const ILLEGAL_CHARACTER = 0xC0000161; -pub const UNMAPPABLE_CHARACTER = 0xC0000162; -pub const UNDEFINED_CHARACTER = 0xC0000163; -pub const FLOPPY_VOLUME = 0xC0000164; -pub const FLOPPY_ID_MARK_NOT_FOUND = 0xC0000165; -pub const FLOPPY_WRONG_CYLINDER = 0xC0000166; -pub const FLOPPY_UNKNOWN_ERROR = 0xC0000167; -pub const FLOPPY_BAD_REGISTERS = 0xC0000168; -pub const DISK_RECALIBRATE_FAILED = 0xC0000169; -pub const DISK_OPERATION_FAILED = 0xC000016A; -pub const DISK_RESET_FAILED = 0xC000016B; -pub const SHARED_IRQ_BUSY = 0xC000016C; -pub const FT_ORPHANING = 0xC000016D; -pub const BIOS_FAILED_TO_CONNECT_INTERRUPT = 0xC000016E; -pub const PARTITION_FAILURE = 0xC0000172; -pub const INVALID_BLOCK_LENGTH = 0xC0000173; -pub const DEVICE_NOT_PARTITIONED = 0xC0000174; -pub const UNABLE_TO_LOCK_MEDIA = 0xC0000175; -pub const UNABLE_TO_UNLOAD_MEDIA = 0xC0000176; -pub const EOM_OVERFLOW = 0xC0000177; -pub const NO_MEDIA = 0xC0000178; -pub const NO_SUCH_MEMBER = 0xC000017A; -pub const INVALID_MEMBER = 0xC000017B; -pub const KEY_DELETED = 0xC000017C; -pub const NO_LOG_SPACE = 0xC000017D; -pub const TOO_MANY_SIDS = 0xC000017E; -pub const LM_CROSS_ENCRYPTION_REQUIRED = 0xC000017F; -pub const KEY_HAS_CHILDREN = 0xC0000180; -pub const CHILD_MUST_BE_VOLATILE = 0xC0000181; -pub const DEVICE_CONFIGURATION_ERROR = 0xC0000182; -pub const DRIVER_INTERNAL_ERROR = 0xC0000183; -pub const INVALID_DEVICE_STATE = 0xC0000184; -pub const IO_DEVICE_ERROR = 0xC0000185; -pub const DEVICE_PROTOCOL_ERROR = 0xC0000186; -pub const BACKUP_CONTROLLER = 0xC0000187; -pub const LOG_FILE_FULL = 0xC0000188; -pub const TOO_LATE = 0xC0000189; -pub const NO_TRUST_LSA_SECRET = 0xC000018A; -pub const NO_TRUST_SAM_ACCOUNT = 0xC000018B; -pub const TRUSTED_DOMAIN_FAILURE = 0xC000018C; -pub const TRUSTED_RELATIONSHIP_FAILURE = 0xC000018D; -pub const EVENTLOG_FILE_CORRUPT = 0xC000018E; -pub const EVENTLOG_CANT_START = 0xC000018F; -pub const TRUST_FAILURE = 0xC0000190; -pub const MUTANT_LIMIT_EXCEEDED = 0xC0000191; -pub const NETLOGON_NOT_STARTED = 0xC0000192; -pub const ACCOUNT_EXPIRED = 0xC0000193; -pub const POSSIBLE_DEADLOCK = 0xC0000194; -pub const NETWORK_CREDENTIAL_CONFLICT = 0xC0000195; -pub const REMOTE_SESSION_LIMIT = 0xC0000196; -pub const EVENTLOG_FILE_CHANGED = 0xC0000197; -pub const NOLOGON_INTERDOMAIN_TRUST_ACCOUNT = 0xC0000198; -pub const NOLOGON_WORKSTATION_TRUST_ACCOUNT = 0xC0000199; -pub const NOLOGON_SERVER_TRUST_ACCOUNT = 0xC000019A; -pub const DOMAIN_TRUST_INCONSISTENT = 0xC000019B; -pub const FS_DRIVER_REQUIRED = 0xC000019C; -pub const IMAGE_ALREADY_LOADED_AS_DLL = 0xC000019D; -pub const INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING = 0xC000019E; -pub const SHORT_NAMES_NOT_ENABLED_ON_VOLUME = 0xC000019F; -pub const SECURITY_STREAM_IS_INCONSISTENT = 0xC00001A0; -pub const INVALID_LOCK_RANGE = 0xC00001A1; -pub const INVALID_ACE_CONDITION = 0xC00001A2; -pub const IMAGE_SUBSYSTEM_NOT_PRESENT = 0xC00001A3; -pub const NOTIFICATION_GUID_ALREADY_DEFINED = 0xC00001A4; -pub const NETWORK_OPEN_RESTRICTION = 0xC0000201; -pub const NO_USER_SESSION_KEY = 0xC0000202; -pub const USER_SESSION_DELETED = 0xC0000203; -pub const RESOURCE_LANG_NOT_FOUND = 0xC0000204; -pub const INSUFF_SERVER_RESOURCES = 0xC0000205; -pub const INVALID_BUFFER_SIZE = 0xC0000206; -pub const INVALID_ADDRESS_COMPONENT = 0xC0000207; -pub const INVALID_ADDRESS_WILDCARD = 0xC0000208; -pub const TOO_MANY_ADDRESSES = 0xC0000209; -pub const ADDRESS_ALREADY_EXISTS = 0xC000020A; -pub const ADDRESS_CLOSED = 0xC000020B; -pub const CONNECTION_DISCONNECTED = 0xC000020C; -pub const CONNECTION_RESET = 0xC000020D; -pub const TOO_MANY_NODES = 0xC000020E; -pub const TRANSACTION_ABORTED = 0xC000020F; -pub const TRANSACTION_TIMED_OUT = 0xC0000210; -pub const TRANSACTION_NO_RELEASE = 0xC0000211; -pub const TRANSACTION_NO_MATCH = 0xC0000212; -pub const TRANSACTION_RESPONDED = 0xC0000213; -pub const TRANSACTION_INVALID_ID = 0xC0000214; -pub const TRANSACTION_INVALID_TYPE = 0xC0000215; -pub const NOT_SERVER_SESSION = 0xC0000216; -pub const NOT_CLIENT_SESSION = 0xC0000217; -pub const CANNOT_LOAD_REGISTRY_FILE = 0xC0000218; -pub const DEBUG_ATTACH_FAILED = 0xC0000219; -pub const SYSTEM_PROCESS_TERMINATED = 0xC000021A; -pub const DATA_NOT_ACCEPTED = 0xC000021B; -pub const NO_BROWSER_SERVERS_FOUND = 0xC000021C; -pub const VDM_HARD_ERROR = 0xC000021D; -pub const DRIVER_CANCEL_TIMEOUT = 0xC000021E; -pub const REPLY_MESSAGE_MISMATCH = 0xC000021F; -pub const MAPPED_ALIGNMENT = 0xC0000220; -pub const IMAGE_CHECKSUM_MISMATCH = 0xC0000221; -pub const LOST_WRITEBEHIND_DATA = 0xC0000222; -pub const CLIENT_SERVER_PARAMETERS_INVALID = 0xC0000223; -pub const PASSWORD_MUST_CHANGE = 0xC0000224; -pub const NOT_FOUND = 0xC0000225; -pub const NOT_TINY_STREAM = 0xC0000226; -pub const RECOVERY_FAILURE = 0xC0000227; -pub const STACK_OVERFLOW_READ = 0xC0000228; -pub const FAIL_CHECK = 0xC0000229; -pub const DUPLICATE_OBJECTID = 0xC000022A; -pub const OBJECTID_EXISTS = 0xC000022B; -pub const CONVERT_TO_LARGE = 0xC000022C; -pub const RETRY = 0xC000022D; -pub const FOUND_OUT_OF_SCOPE = 0xC000022E; -pub const ALLOCATE_BUCKET = 0xC000022F; -pub const PROPSET_NOT_FOUND = 0xC0000230; -pub const MARSHALL_OVERFLOW = 0xC0000231; -pub const INVALID_VARIANT = 0xC0000232; -pub const DOMAIN_CONTROLLER_NOT_FOUND = 0xC0000233; -pub const ACCOUNT_LOCKED_OUT = 0xC0000234; -pub const HANDLE_NOT_CLOSABLE = 0xC0000235; -pub const CONNECTION_REFUSED = 0xC0000236; -pub const GRACEFUL_DISCONNECT = 0xC0000237; -pub const ADDRESS_ALREADY_ASSOCIATED = 0xC0000238; -pub const ADDRESS_NOT_ASSOCIATED = 0xC0000239; -pub const CONNECTION_INVALID = 0xC000023A; -pub const CONNECTION_ACTIVE = 0xC000023B; -pub const NETWORK_UNREACHABLE = 0xC000023C; -pub const HOST_UNREACHABLE = 0xC000023D; -pub const PROTOCOL_UNREACHABLE = 0xC000023E; -pub const PORT_UNREACHABLE = 0xC000023F; -pub const REQUEST_ABORTED = 0xC0000240; -pub const CONNECTION_ABORTED = 0xC0000241; -pub const BAD_COMPRESSION_BUFFER = 0xC0000242; -pub const USER_MAPPED_FILE = 0xC0000243; -pub const AUDIT_FAILED = 0xC0000244; -pub const TIMER_RESOLUTION_NOT_SET = 0xC0000245; -pub const CONNECTION_COUNT_LIMIT = 0xC0000246; -pub const LOGIN_TIME_RESTRICTION = 0xC0000247; -pub const LOGIN_WKSTA_RESTRICTION = 0xC0000248; -pub const IMAGE_MP_UP_MISMATCH = 0xC0000249; -pub const INSUFFICIENT_LOGON_INFO = 0xC0000250; -pub const BAD_DLL_ENTRYPOINT = 0xC0000251; -pub const BAD_SERVICE_ENTRYPOINT = 0xC0000252; -pub const LPC_REPLY_LOST = 0xC0000253; -pub const IP_ADDRESS_CONFLICT1 = 0xC0000254; -pub const IP_ADDRESS_CONFLICT2 = 0xC0000255; -pub const REGISTRY_QUOTA_LIMIT = 0xC0000256; -pub const PATH_NOT_COVERED = 0xC0000257; -pub const NO_CALLBACK_ACTIVE = 0xC0000258; -pub const LICENSE_QUOTA_EXCEEDED = 0xC0000259; -pub const PWD_TOO_SHORT = 0xC000025A; -pub const PWD_TOO_RECENT = 0xC000025B; -pub const PWD_HISTORY_CONFLICT = 0xC000025C; -pub const PLUGPLAY_NO_DEVICE = 0xC000025E; -pub const UNSUPPORTED_COMPRESSION = 0xC000025F; -pub const INVALID_HW_PROFILE = 0xC0000260; -pub const INVALID_PLUGPLAY_DEVICE_PATH = 0xC0000261; -pub const DRIVER_ORDINAL_NOT_FOUND = 0xC0000262; -pub const DRIVER_ENTRYPOINT_NOT_FOUND = 0xC0000263; -pub const RESOURCE_NOT_OWNED = 0xC0000264; -pub const TOO_MANY_LINKS = 0xC0000265; -pub const QUOTA_LIST_INCONSISTENT = 0xC0000266; -pub const FILE_IS_OFFLINE = 0xC0000267; -pub const EVALUATION_EXPIRATION = 0xC0000268; -pub const ILLEGAL_DLL_RELOCATION = 0xC0000269; -pub const LICENSE_VIOLATION = 0xC000026A; -pub const DLL_INIT_FAILED_LOGOFF = 0xC000026B; -pub const DRIVER_UNABLE_TO_LOAD = 0xC000026C; -pub const DFS_UNAVAILABLE = 0xC000026D; -pub const VOLUME_DISMOUNTED = 0xC000026E; -pub const WX86_INTERNAL_ERROR = 0xC000026F; -pub const WX86_FLOAT_STACK_CHECK = 0xC0000270; -pub const VALIDATE_CONTINUE = 0xC0000271; -pub const NO_MATCH = 0xC0000272; -pub const NO_MORE_MATCHES = 0xC0000273; -pub const NOT_A_REPARSE_POINT = 0xC0000275; -pub const IO_REPARSE_TAG_INVALID = 0xC0000276; -pub const IO_REPARSE_TAG_MISMATCH = 0xC0000277; -pub const IO_REPARSE_DATA_INVALID = 0xC0000278; -pub const IO_REPARSE_TAG_NOT_HANDLED = 0xC0000279; -pub const REPARSE_POINT_NOT_RESOLVED = 0xC0000280; -pub const DIRECTORY_IS_A_REPARSE_POINT = 0xC0000281; -pub const RANGE_LIST_CONFLICT = 0xC0000282; -pub const SOURCE_ELEMENT_EMPTY = 0xC0000283; -pub const DESTINATION_ELEMENT_FULL = 0xC0000284; -pub const ILLEGAL_ELEMENT_ADDRESS = 0xC0000285; -pub const MAGAZINE_NOT_PRESENT = 0xC0000286; -pub const REINITIALIZATION_NEEDED = 0xC0000287; -pub const ENCRYPTION_FAILED = 0xC000028A; -pub const DECRYPTION_FAILED = 0xC000028B; -pub const RANGE_NOT_FOUND = 0xC000028C; -pub const NO_RECOVERY_POLICY = 0xC000028D; -pub const NO_EFS = 0xC000028E; -pub const WRONG_EFS = 0xC000028F; -pub const NO_USER_KEYS = 0xC0000290; -pub const FILE_NOT_ENCRYPTED = 0xC0000291; -pub const NOT_EXPORT_FORMAT = 0xC0000292; -pub const FILE_ENCRYPTED = 0xC0000293; -pub const WMI_GUID_NOT_FOUND = 0xC0000295; -pub const WMI_INSTANCE_NOT_FOUND = 0xC0000296; -pub const WMI_ITEMID_NOT_FOUND = 0xC0000297; -pub const WMI_TRY_AGAIN = 0xC0000298; -pub const SHARED_POLICY = 0xC0000299; -pub const POLICY_OBJECT_NOT_FOUND = 0xC000029A; -pub const POLICY_ONLY_IN_DS = 0xC000029B; -pub const VOLUME_NOT_UPGRADED = 0xC000029C; -pub const REMOTE_STORAGE_NOT_ACTIVE = 0xC000029D; -pub const REMOTE_STORAGE_MEDIA_ERROR = 0xC000029E; -pub const NO_TRACKING_SERVICE = 0xC000029F; -pub const SERVER_SID_MISMATCH = 0xC00002A0; -pub const DS_NO_ATTRIBUTE_OR_VALUE = 0xC00002A1; -pub const DS_INVALID_ATTRIBUTE_SYNTAX = 0xC00002A2; -pub const DS_ATTRIBUTE_TYPE_UNDEFINED = 0xC00002A3; -pub const DS_ATTRIBUTE_OR_VALUE_EXISTS = 0xC00002A4; -pub const DS_BUSY = 0xC00002A5; -pub const DS_UNAVAILABLE = 0xC00002A6; -pub const DS_NO_RIDS_ALLOCATED = 0xC00002A7; -pub const DS_NO_MORE_RIDS = 0xC00002A8; -pub const DS_INCORRECT_ROLE_OWNER = 0xC00002A9; -pub const DS_RIDMGR_INIT_ERROR = 0xC00002AA; -pub const DS_OBJ_CLASS_VIOLATION = 0xC00002AB; -pub const DS_CANT_ON_NON_LEAF = 0xC00002AC; -pub const DS_CANT_ON_RDN = 0xC00002AD; -pub const DS_CANT_MOD_OBJ_CLASS = 0xC00002AE; -pub const DS_CROSS_DOM_MOVE_FAILED = 0xC00002AF; -pub const DS_GC_NOT_AVAILABLE = 0xC00002B0; -pub const DIRECTORY_SERVICE_REQUIRED = 0xC00002B1; -pub const REPARSE_ATTRIBUTE_CONFLICT = 0xC00002B2; -pub const CANT_ENABLE_DENY_ONLY = 0xC00002B3; -pub const FLOAT_MULTIPLE_FAULTS = 0xC00002B4; -pub const FLOAT_MULTIPLE_TRAPS = 0xC00002B5; -pub const DEVICE_REMOVED = 0xC00002B6; -pub const JOURNAL_DELETE_IN_PROGRESS = 0xC00002B7; -pub const JOURNAL_NOT_ACTIVE = 0xC00002B8; -pub const NOINTERFACE = 0xC00002B9; -pub const DS_ADMIN_LIMIT_EXCEEDED = 0xC00002C1; -pub const DRIVER_FAILED_SLEEP = 0xC00002C2; -pub const MUTUAL_AUTHENTICATION_FAILED = 0xC00002C3; -pub const CORRUPT_SYSTEM_FILE = 0xC00002C4; -pub const DATATYPE_MISALIGNMENT_ERROR = 0xC00002C5; -pub const WMI_READ_ONLY = 0xC00002C6; -pub const WMI_SET_FAILURE = 0xC00002C7; -pub const COMMITMENT_MINIMUM = 0xC00002C8; -pub const REG_NAT_CONSUMPTION = 0xC00002C9; -pub const TRANSPORT_FULL = 0xC00002CA; -pub const DS_SAM_INIT_FAILURE = 0xC00002CB; -pub const ONLY_IF_CONNECTED = 0xC00002CC; -pub const DS_SENSITIVE_GROUP_VIOLATION = 0xC00002CD; -pub const PNP_RESTART_ENUMERATION = 0xC00002CE; -pub const JOURNAL_ENTRY_DELETED = 0xC00002CF; -pub const DS_CANT_MOD_PRIMARYGROUPID = 0xC00002D0; -pub const SYSTEM_IMAGE_BAD_SIGNATURE = 0xC00002D1; -pub const PNP_REBOOT_REQUIRED = 0xC00002D2; -pub const POWER_STATE_INVALID = 0xC00002D3; -pub const DS_INVALID_GROUP_TYPE = 0xC00002D4; -pub const DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN = 0xC00002D5; -pub const DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN = 0xC00002D6; -pub const DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER = 0xC00002D7; -pub const DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER = 0xC00002D8; -pub const DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER = 0xC00002D9; -pub const DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER = 0xC00002DA; -pub const DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER = 0xC00002DB; -pub const DS_HAVE_PRIMARY_MEMBERS = 0xC00002DC; -pub const WMI_NOT_SUPPORTED = 0xC00002DD; -pub const INSUFFICIENT_POWER = 0xC00002DE; -pub const SAM_NEED_BOOTKEY_PASSWORD = 0xC00002DF; -pub const SAM_NEED_BOOTKEY_FLOPPY = 0xC00002E0; -pub const DS_CANT_START = 0xC00002E1; -pub const DS_INIT_FAILURE = 0xC00002E2; -pub const SAM_INIT_FAILURE = 0xC00002E3; -pub const DS_GC_REQUIRED = 0xC00002E4; -pub const DS_LOCAL_MEMBER_OF_LOCAL_ONLY = 0xC00002E5; -pub const DS_NO_FPO_IN_UNIVERSAL_GROUPS = 0xC00002E6; -pub const DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED = 0xC00002E7; -pub const CURRENT_DOMAIN_NOT_ALLOWED = 0xC00002E9; -pub const CANNOT_MAKE = 0xC00002EA; -pub const SYSTEM_SHUTDOWN = 0xC00002EB; -pub const DS_INIT_FAILURE_CONSOLE = 0xC00002EC; -pub const DS_SAM_INIT_FAILURE_CONSOLE = 0xC00002ED; -pub const UNFINISHED_CONTEXT_DELETED = 0xC00002EE; -pub const NO_TGT_REPLY = 0xC00002EF; -pub const OBJECTID_NOT_FOUND = 0xC00002F0; -pub const NO_IP_ADDRESSES = 0xC00002F1; -pub const WRONG_CREDENTIAL_HANDLE = 0xC00002F2; -pub const CRYPTO_SYSTEM_INVALID = 0xC00002F3; -pub const MAX_REFERRALS_EXCEEDED = 0xC00002F4; -pub const MUST_BE_KDC = 0xC00002F5; -pub const STRONG_CRYPTO_NOT_SUPPORTED = 0xC00002F6; -pub const TOO_MANY_PRINCIPALS = 0xC00002F7; -pub const NO_PA_DATA = 0xC00002F8; -pub const PKINIT_NAME_MISMATCH = 0xC00002F9; -pub const SMARTCARD_LOGON_REQUIRED = 0xC00002FA; -pub const KDC_INVALID_REQUEST = 0xC00002FB; -pub const KDC_UNABLE_TO_REFER = 0xC00002FC; -pub const KDC_UNKNOWN_ETYPE = 0xC00002FD; -pub const SHUTDOWN_IN_PROGRESS = 0xC00002FE; -pub const SERVER_SHUTDOWN_IN_PROGRESS = 0xC00002FF; -pub const NOT_SUPPORTED_ON_SBS = 0xC0000300; -pub const WMI_GUID_DISCONNECTED = 0xC0000301; -pub const WMI_ALREADY_DISABLED = 0xC0000302; -pub const WMI_ALREADY_ENABLED = 0xC0000303; -pub const MFT_TOO_FRAGMENTED = 0xC0000304; -pub const COPY_PROTECTION_FAILURE = 0xC0000305; -pub const CSS_AUTHENTICATION_FAILURE = 0xC0000306; -pub const CSS_KEY_NOT_PRESENT = 0xC0000307; -pub const CSS_KEY_NOT_ESTABLISHED = 0xC0000308; -pub const CSS_SCRAMBLED_SECTOR = 0xC0000309; -pub const CSS_REGION_MISMATCH = 0xC000030A; -pub const CSS_RESETS_EXHAUSTED = 0xC000030B; -pub const PKINIT_FAILURE = 0xC0000320; -pub const SMARTCARD_SUBSYSTEM_FAILURE = 0xC0000321; -pub const NO_KERB_KEY = 0xC0000322; -pub const HOST_DOWN = 0xC0000350; -pub const UNSUPPORTED_PREAUTH = 0xC0000351; -pub const EFS_ALG_BLOB_TOO_BIG = 0xC0000352; -pub const PORT_NOT_SET = 0xC0000353; -pub const DEBUGGER_INACTIVE = 0xC0000354; -pub const DS_VERSION_CHECK_FAILURE = 0xC0000355; -pub const AUDITING_DISABLED = 0xC0000356; -pub const PRENT4_MACHINE_ACCOUNT = 0xC0000357; -pub const DS_AG_CANT_HAVE_UNIVERSAL_MEMBER = 0xC0000358; -pub const INVALID_IMAGE_WIN_32 = 0xC0000359; -pub const INVALID_IMAGE_WIN_64 = 0xC000035A; -pub const BAD_BINDINGS = 0xC000035B; -pub const NETWORK_SESSION_EXPIRED = 0xC000035C; -pub const APPHELP_BLOCK = 0xC000035D; -pub const ALL_SIDS_FILTERED = 0xC000035E; -pub const NOT_SAFE_MODE_DRIVER = 0xC000035F; -pub const ACCESS_DISABLED_BY_POLICY_DEFAULT = 0xC0000361; -pub const ACCESS_DISABLED_BY_POLICY_PATH = 0xC0000362; -pub const ACCESS_DISABLED_BY_POLICY_PUBLISHER = 0xC0000363; -pub const ACCESS_DISABLED_BY_POLICY_OTHER = 0xC0000364; -pub const FAILED_DRIVER_ENTRY = 0xC0000365; -pub const DEVICE_ENUMERATION_ERROR = 0xC0000366; -pub const MOUNT_POINT_NOT_RESOLVED = 0xC0000368; -pub const INVALID_DEVICE_OBJECT_PARAMETER = 0xC0000369; -pub const MCA_OCCURED = 0xC000036A; -pub const DRIVER_BLOCKED_CRITICAL = 0xC000036B; -pub const DRIVER_BLOCKED = 0xC000036C; -pub const DRIVER_DATABASE_ERROR = 0xC000036D; -pub const SYSTEM_HIVE_TOO_LARGE = 0xC000036E; -pub const INVALID_IMPORT_OF_NON_DLL = 0xC000036F; -pub const NO_SECRETS = 0xC0000371; -pub const ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY = 0xC0000372; -pub const FAILED_STACK_SWITCH = 0xC0000373; -pub const HEAP_CORRUPTION = 0xC0000374; -pub const SMARTCARD_WRONG_PIN = 0xC0000380; -pub const SMARTCARD_CARD_BLOCKED = 0xC0000381; -pub const SMARTCARD_CARD_NOT_AUTHENTICATED = 0xC0000382; -pub const SMARTCARD_NO_CARD = 0xC0000383; -pub const SMARTCARD_NO_KEY_CONTAINER = 0xC0000384; -pub const SMARTCARD_NO_CERTIFICATE = 0xC0000385; -pub const SMARTCARD_NO_KEYSET = 0xC0000386; -pub const SMARTCARD_IO_ERROR = 0xC0000387; -pub const DOWNGRADE_DETECTED = 0xC0000388; -pub const SMARTCARD_CERT_REVOKED = 0xC0000389; -pub const ISSUING_CA_UNTRUSTED = 0xC000038A; -pub const REVOCATION_OFFLINE_C = 0xC000038B; -pub const PKINIT_CLIENT_FAILURE = 0xC000038C; -pub const SMARTCARD_CERT_EXPIRED = 0xC000038D; -pub const DRIVER_FAILED_PRIOR_UNLOAD = 0xC000038E; -pub const SMARTCARD_SILENT_CONTEXT = 0xC000038F; -pub const PER_USER_TRUST_QUOTA_EXCEEDED = 0xC0000401; -pub const ALL_USER_TRUST_QUOTA_EXCEEDED = 0xC0000402; -pub const USER_DELETE_TRUST_QUOTA_EXCEEDED = 0xC0000403; -pub const DS_NAME_NOT_UNIQUE = 0xC0000404; -pub const DS_DUPLICATE_ID_FOUND = 0xC0000405; -pub const DS_GROUP_CONVERSION_ERROR = 0xC0000406; -pub const VOLSNAP_PREPARE_HIBERNATE = 0xC0000407; -pub const USER2USER_REQUIRED = 0xC0000408; -pub const STACK_BUFFER_OVERRUN = 0xC0000409; -pub const NO_S4U_PROT_SUPPORT = 0xC000040A; -pub const CROSSREALM_DELEGATION_FAILURE = 0xC000040B; -pub const REVOCATION_OFFLINE_KDC = 0xC000040C; -pub const ISSUING_CA_UNTRUSTED_KDC = 0xC000040D; -pub const KDC_CERT_EXPIRED = 0xC000040E; -pub const KDC_CERT_REVOKED = 0xC000040F; -pub const PARAMETER_QUOTA_EXCEEDED = 0xC0000410; -pub const HIBERNATION_FAILURE = 0xC0000411; -pub const DELAY_LOAD_FAILED = 0xC0000412; -pub const AUTHENTICATION_FIREWALL_FAILED = 0xC0000413; -pub const VDM_DISALLOWED = 0xC0000414; -pub const HUNG_DISPLAY_DRIVER_THREAD = 0xC0000415; -pub const INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE = 0xC0000416; -pub const INVALID_CRUNTIME_PARAMETER = 0xC0000417; -pub const NTLM_BLOCKED = 0xC0000418; -pub const DS_SRC_SID_EXISTS_IN_FOREST = 0xC0000419; -pub const DS_DOMAIN_NAME_EXISTS_IN_FOREST = 0xC000041A; -pub const DS_FLAT_NAME_EXISTS_IN_FOREST = 0xC000041B; -pub const INVALID_USER_PRINCIPAL_NAME = 0xC000041C; -pub const ASSERTION_FAILURE = 0xC0000420; -pub const VERIFIER_STOP = 0xC0000421; -pub const CALLBACK_POP_STACK = 0xC0000423; -pub const INCOMPATIBLE_DRIVER_BLOCKED = 0xC0000424; -pub const HIVE_UNLOADED = 0xC0000425; -pub const COMPRESSION_DISABLED = 0xC0000426; -pub const FILE_SYSTEM_LIMITATION = 0xC0000427; -pub const INVALID_IMAGE_HASH = 0xC0000428; -pub const NOT_CAPABLE = 0xC0000429; -pub const REQUEST_OUT_OF_SEQUENCE = 0xC000042A; -pub const IMPLEMENTATION_LIMIT = 0xC000042B; -pub const ELEVATION_REQUIRED = 0xC000042C; -pub const NO_SECURITY_CONTEXT = 0xC000042D; -pub const PKU2U_CERT_FAILURE = 0xC000042E; -pub const BEYOND_VDL = 0xC0000432; -pub const ENCOUNTERED_WRITE_IN_PROGRESS = 0xC0000433; -pub const PTE_CHANGED = 0xC0000434; -pub const PURGE_FAILED = 0xC0000435; -pub const CRED_REQUIRES_CONFIRMATION = 0xC0000440; -pub const CS_ENCRYPTION_INVALID_SERVER_RESPONSE = 0xC0000441; -pub const CS_ENCRYPTION_UNSUPPORTED_SERVER = 0xC0000442; -pub const CS_ENCRYPTION_EXISTING_ENCRYPTED_FILE = 0xC0000443; -pub const CS_ENCRYPTION_NEW_ENCRYPTED_FILE = 0xC0000444; -pub const CS_ENCRYPTION_FILE_NOT_CSE = 0xC0000445; -pub const INVALID_LABEL = 0xC0000446; -pub const DRIVER_PROCESS_TERMINATED = 0xC0000450; -pub const AMBIGUOUS_SYSTEM_DEVICE = 0xC0000451; -pub const SYSTEM_DEVICE_NOT_FOUND = 0xC0000452; -pub const RESTART_BOOT_APPLICATION = 0xC0000453; -pub const INSUFFICIENT_NVRAM_RESOURCES = 0xC0000454; -pub const INVALID_TASK_NAME = 0xC0000500; -pub const INVALID_TASK_INDEX = 0xC0000501; -pub const THREAD_ALREADY_IN_TASK = 0xC0000502; -pub const CALLBACK_BYPASS = 0xC0000503; -pub const FAIL_FAST_EXCEPTION = 0xC0000602; -pub const IMAGE_CERT_REVOKED = 0xC0000603; -pub const PORT_CLOSED = 0xC0000700; -pub const MESSAGE_LOST = 0xC0000701; -pub const INVALID_MESSAGE = 0xC0000702; -pub const REQUEST_CANCELED = 0xC0000703; -pub const RECURSIVE_DISPATCH = 0xC0000704; -pub const LPC_RECEIVE_BUFFER_EXPECTED = 0xC0000705; -pub const LPC_INVALID_CONNECTION_USAGE = 0xC0000706; -pub const LPC_REQUESTS_NOT_ALLOWED = 0xC0000707; -pub const RESOURCE_IN_USE = 0xC0000708; -pub const HARDWARE_MEMORY_ERROR = 0xC0000709; -pub const THREADPOOL_HANDLE_EXCEPTION = 0xC000070A; -pub const THREADPOOL_SET_EVENT_ON_COMPLETION_FAILED = 0xC000070B; -pub const THREADPOOL_RELEASE_SEMAPHORE_ON_COMPLETION_FAILED = 0xC000070C; -pub const THREADPOOL_RELEASE_MUTEX_ON_COMPLETION_FAILED = 0xC000070D; -pub const THREADPOOL_FREE_LIBRARY_ON_COMPLETION_FAILED = 0xC000070E; -pub const THREADPOOL_RELEASED_DURING_OPERATION = 0xC000070F; -pub const CALLBACK_RETURNED_WHILE_IMPERSONATING = 0xC0000710; -pub const APC_RETURNED_WHILE_IMPERSONATING = 0xC0000711; -pub const PROCESS_IS_PROTECTED = 0xC0000712; -pub const MCA_EXCEPTION = 0xC0000713; -pub const CERTIFICATE_MAPPING_NOT_UNIQUE = 0xC0000714; -pub const SYMLINK_CLASS_DISABLED = 0xC0000715; -pub const INVALID_IDN_NORMALIZATION = 0xC0000716; -pub const NO_UNICODE_TRANSLATION = 0xC0000717; -pub const ALREADY_REGISTERED = 0xC0000718; -pub const CONTEXT_MISMATCH = 0xC0000719; -pub const PORT_ALREADY_HAS_COMPLETION_LIST = 0xC000071A; -pub const CALLBACK_RETURNED_THREAD_PRIORITY = 0xC000071B; -pub const INVALID_THREAD = 0xC000071C; -pub const CALLBACK_RETURNED_TRANSACTION = 0xC000071D; -pub const CALLBACK_RETURNED_LDR_LOCK = 0xC000071E; -pub const CALLBACK_RETURNED_LANG = 0xC000071F; -pub const CALLBACK_RETURNED_PRI_BACK = 0xC0000720; -pub const DISK_REPAIR_DISABLED = 0xC0000800; -pub const DS_DOMAIN_RENAME_IN_PROGRESS = 0xC0000801; -pub const DISK_QUOTA_EXCEEDED = 0xC0000802; -pub const CONTENT_BLOCKED = 0xC0000804; -pub const BAD_CLUSTERS = 0xC0000805; -pub const VOLUME_DIRTY = 0xC0000806; -pub const FILE_CHECKED_OUT = 0xC0000901; -pub const CHECKOUT_REQUIRED = 0xC0000902; -pub const BAD_FILE_TYPE = 0xC0000903; -pub const FILE_TOO_LARGE = 0xC0000904; -pub const FORMS_AUTH_REQUIRED = 0xC0000905; -pub const VIRUS_INFECTED = 0xC0000906; -pub const VIRUS_DELETED = 0xC0000907; -pub const BAD_MCFG_TABLE = 0xC0000908; -pub const CANNOT_BREAK_OPLOCK = 0xC0000909; -pub const WOW_ASSERTION = 0xC0009898; -pub const INVALID_SIGNATURE = 0xC000A000; -pub const HMAC_NOT_SUPPORTED = 0xC000A001; -pub const IPSEC_QUEUE_OVERFLOW = 0xC000A010; -pub const ND_QUEUE_OVERFLOW = 0xC000A011; -pub const HOPLIMIT_EXCEEDED = 0xC000A012; -pub const PROTOCOL_NOT_SUPPORTED = 0xC000A013; -pub const LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED = 0xC000A080; -pub const LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR = 0xC000A081; -pub const LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR = 0xC000A082; -pub const XML_PARSE_ERROR = 0xC000A083; -pub const XMLDSIG_ERROR = 0xC000A084; -pub const WRONG_COMPARTMENT = 0xC000A085; -pub const AUTHIP_FAILURE = 0xC000A086; -pub const DS_OID_MAPPED_GROUP_CANT_HAVE_MEMBERS = 0xC000A087; -pub const DS_OID_NOT_FOUND = 0xC000A088; -pub const HASH_NOT_SUPPORTED = 0xC000A100; -pub const HASH_NOT_PRESENT = 0xC000A101; -pub const PNP_BAD_MPS_TABLE = 0xC0040035; -pub const PNP_TRANSLATION_FAILED = 0xC0040036; -pub const PNP_IRQ_TRANSLATION_FAILED = 0xC0040037; -pub const PNP_INVALID_ID = 0xC0040038; -pub const IO_REISSUE_AS_CACHED = 0xC0040039; -pub const CTX_WINSTATION_NAME_INVALID = 0xC00A0001; -pub const CTX_INVALID_PD = 0xC00A0002; -pub const CTX_PD_NOT_FOUND = 0xC00A0003; -pub const CTX_CLOSE_PENDING = 0xC00A0006; -pub const CTX_NO_OUTBUF = 0xC00A0007; -pub const CTX_MODEM_INF_NOT_FOUND = 0xC00A0008; -pub const CTX_INVALID_MODEMNAME = 0xC00A0009; -pub const CTX_RESPONSE_ERROR = 0xC00A000A; -pub const CTX_MODEM_RESPONSE_TIMEOUT = 0xC00A000B; -pub const CTX_MODEM_RESPONSE_NO_CARRIER = 0xC00A000C; -pub const CTX_MODEM_RESPONSE_NO_DIALTONE = 0xC00A000D; -pub const CTX_MODEM_RESPONSE_BUSY = 0xC00A000E; -pub const CTX_MODEM_RESPONSE_VOICE = 0xC00A000F; -pub const CTX_TD_ERROR = 0xC00A0010; -pub const CTX_LICENSE_CLIENT_INVALID = 0xC00A0012; -pub const CTX_LICENSE_NOT_AVAILABLE = 0xC00A0013; -pub const CTX_LICENSE_EXPIRED = 0xC00A0014; -pub const CTX_WINSTATION_NOT_FOUND = 0xC00A0015; -pub const CTX_WINSTATION_NAME_COLLISION = 0xC00A0016; -pub const CTX_WINSTATION_BUSY = 0xC00A0017; -pub const CTX_BAD_VIDEO_MODE = 0xC00A0018; -pub const CTX_GRAPHICS_INVALID = 0xC00A0022; -pub const CTX_NOT_CONSOLE = 0xC00A0024; -pub const CTX_CLIENT_QUERY_TIMEOUT = 0xC00A0026; -pub const CTX_CONSOLE_DISCONNECT = 0xC00A0027; -pub const CTX_CONSOLE_CONNECT = 0xC00A0028; -pub const CTX_SHADOW_DENIED = 0xC00A002A; -pub const CTX_WINSTATION_ACCESS_DENIED = 0xC00A002B; -pub const CTX_INVALID_WD = 0xC00A002E; -pub const CTX_WD_NOT_FOUND = 0xC00A002F; -pub const CTX_SHADOW_INVALID = 0xC00A0030; -pub const CTX_SHADOW_DISABLED = 0xC00A0031; -pub const RDP_PROTOCOL_ERROR = 0xC00A0032; -pub const CTX_CLIENT_LICENSE_NOT_SET = 0xC00A0033; -pub const CTX_CLIENT_LICENSE_IN_USE = 0xC00A0034; -pub const CTX_SHADOW_ENDED_BY_MODE_CHANGE = 0xC00A0035; -pub const CTX_SHADOW_NOT_RUNNING = 0xC00A0036; -pub const CTX_LOGON_DISABLED = 0xC00A0037; -pub const CTX_SECURITY_LAYER_ERROR = 0xC00A0038; -pub const TS_INCOMPATIBLE_SESSIONS = 0xC00A0039; -pub const MUI_FILE_NOT_FOUND = 0xC00B0001; -pub const MUI_INVALID_FILE = 0xC00B0002; -pub const MUI_INVALID_RC_CONFIG = 0xC00B0003; -pub const MUI_INVALID_LOCALE_NAME = 0xC00B0004; -pub const MUI_INVALID_ULTIMATEFALLBACK_NAME = 0xC00B0005; -pub const MUI_FILE_NOT_LOADED = 0xC00B0006; -pub const RESOURCE_ENUM_USER_STOP = 0xC00B0007; -pub const CLUSTER_INVALID_NODE = 0xC0130001; -pub const CLUSTER_NODE_EXISTS = 0xC0130002; -pub const CLUSTER_JOIN_IN_PROGRESS = 0xC0130003; -pub const CLUSTER_NODE_NOT_FOUND = 0xC0130004; -pub const CLUSTER_LOCAL_NODE_NOT_FOUND = 0xC0130005; -pub const CLUSTER_NETWORK_EXISTS = 0xC0130006; -pub const CLUSTER_NETWORK_NOT_FOUND = 0xC0130007; -pub const CLUSTER_NETINTERFACE_EXISTS = 0xC0130008; -pub const CLUSTER_NETINTERFACE_NOT_FOUND = 0xC0130009; -pub const CLUSTER_INVALID_REQUEST = 0xC013000A; -pub const CLUSTER_INVALID_NETWORK_PROVIDER = 0xC013000B; -pub const CLUSTER_NODE_DOWN = 0xC013000C; -pub const CLUSTER_NODE_UNREACHABLE = 0xC013000D; -pub const CLUSTER_NODE_NOT_MEMBER = 0xC013000E; -pub const CLUSTER_JOIN_NOT_IN_PROGRESS = 0xC013000F; -pub const CLUSTER_INVALID_NETWORK = 0xC0130010; -pub const CLUSTER_NO_NET_ADAPTERS = 0xC0130011; -pub const CLUSTER_NODE_UP = 0xC0130012; -pub const CLUSTER_NODE_PAUSED = 0xC0130013; -pub const CLUSTER_NODE_NOT_PAUSED = 0xC0130014; -pub const CLUSTER_NO_SECURITY_CONTEXT = 0xC0130015; -pub const CLUSTER_NETWORK_NOT_INTERNAL = 0xC0130016; -pub const CLUSTER_POISONED = 0xC0130017; -pub const ACPI_INVALID_OPCODE = 0xC0140001; -pub const ACPI_STACK_OVERFLOW = 0xC0140002; -pub const ACPI_ASSERT_FAILED = 0xC0140003; -pub const ACPI_INVALID_INDEX = 0xC0140004; -pub const ACPI_INVALID_ARGUMENT = 0xC0140005; -pub const ACPI_FATAL = 0xC0140006; -pub const ACPI_INVALID_SUPERNAME = 0xC0140007; -pub const ACPI_INVALID_ARGTYPE = 0xC0140008; -pub const ACPI_INVALID_OBJTYPE = 0xC0140009; -pub const ACPI_INVALID_TARGETTYPE = 0xC014000A; -pub const ACPI_INCORRECT_ARGUMENT_COUNT = 0xC014000B; -pub const ACPI_ADDRESS_NOT_MAPPED = 0xC014000C; -pub const ACPI_INVALID_EVENTTYPE = 0xC014000D; -pub const ACPI_HANDLER_COLLISION = 0xC014000E; -pub const ACPI_INVALID_DATA = 0xC014000F; -pub const ACPI_INVALID_REGION = 0xC0140010; -pub const ACPI_INVALID_ACCESS_SIZE = 0xC0140011; -pub const ACPI_ACQUIRE_GLOBAL_LOCK = 0xC0140012; -pub const ACPI_ALREADY_INITIALIZED = 0xC0140013; -pub const ACPI_NOT_INITIALIZED = 0xC0140014; -pub const ACPI_INVALID_MUTEX_LEVEL = 0xC0140015; -pub const ACPI_MUTEX_NOT_OWNED = 0xC0140016; -pub const ACPI_MUTEX_NOT_OWNER = 0xC0140017; -pub const ACPI_RS_ACCESS = 0xC0140018; -pub const ACPI_INVALID_TABLE = 0xC0140019; -pub const ACPI_REG_HANDLER_FAILED = 0xC0140020; -pub const ACPI_POWER_REQUEST_FAILED = 0xC0140021; -pub const SXS_SECTION_NOT_FOUND = 0xC0150001; -pub const SXS_CANT_GEN_ACTCTX = 0xC0150002; -pub const SXS_INVALID_ACTCTXDATA_FORMAT = 0xC0150003; -pub const SXS_ASSEMBLY_NOT_FOUND = 0xC0150004; -pub const SXS_MANIFEST_FORMAT_ERROR = 0xC0150005; -pub const SXS_MANIFEST_PARSE_ERROR = 0xC0150006; -pub const SXS_ACTIVATION_CONTEXT_DISABLED = 0xC0150007; -pub const SXS_KEY_NOT_FOUND = 0xC0150008; -pub const SXS_VERSION_CONFLICT = 0xC0150009; -pub const SXS_WRONG_SECTION_TYPE = 0xC015000A; -pub const SXS_THREAD_QUERIES_DISABLED = 0xC015000B; -pub const SXS_ASSEMBLY_MISSING = 0xC015000C; -pub const SXS_PROCESS_DEFAULT_ALREADY_SET = 0xC015000E; -pub const SXS_EARLY_DEACTIVATION = 0xC015000F; -pub const SXS_INVALID_DEACTIVATION = 0xC0150010; -pub const SXS_MULTIPLE_DEACTIVATION = 0xC0150011; -pub const SXS_SYSTEM_DEFAULT_ACTIVATION_CONTEXT_EMPTY = 0xC0150012; -pub const SXS_PROCESS_TERMINATION_REQUESTED = 0xC0150013; -pub const SXS_CORRUPT_ACTIVATION_STACK = 0xC0150014; -pub const SXS_CORRUPTION = 0xC0150015; -pub const SXS_INVALID_IDENTITY_ATTRIBUTE_VALUE = 0xC0150016; -pub const SXS_INVALID_IDENTITY_ATTRIBUTE_NAME = 0xC0150017; -pub const SXS_IDENTITY_DUPLICATE_ATTRIBUTE = 0xC0150018; -pub const SXS_IDENTITY_PARSE_ERROR = 0xC0150019; -pub const SXS_COMPONENT_STORE_CORRUPT = 0xC015001A; -pub const SXS_FILE_HASH_MISMATCH = 0xC015001B; -pub const SXS_MANIFEST_IDENTITY_SAME_BUT_CONTENTS_DIFFERENT = 0xC015001C; -pub const SXS_IDENTITIES_DIFFERENT = 0xC015001D; -pub const SXS_ASSEMBLY_IS_NOT_A_DEPLOYMENT = 0xC015001E; -pub const SXS_FILE_NOT_PART_OF_ASSEMBLY = 0xC015001F; -pub const ADVANCED_INSTALLER_FAILED = 0xC0150020; -pub const XML_ENCODING_MISMATCH = 0xC0150021; -pub const SXS_MANIFEST_TOO_BIG = 0xC0150022; -pub const SXS_SETTING_NOT_REGISTERED = 0xC0150023; -pub const SXS_TRANSACTION_CLOSURE_INCOMPLETE = 0xC0150024; -pub const SMI_PRIMITIVE_INSTALLER_FAILED = 0xC0150025; -pub const GENERIC_COMMAND_FAILED = 0xC0150026; -pub const SXS_FILE_HASH_MISSING = 0xC0150027; -pub const TRANSACTIONAL_CONFLICT = 0xC0190001; -pub const INVALID_TRANSACTION = 0xC0190002; -pub const TRANSACTION_NOT_ACTIVE = 0xC0190003; -pub const TM_INITIALIZATION_FAILED = 0xC0190004; -pub const RM_NOT_ACTIVE = 0xC0190005; -pub const RM_METADATA_CORRUPT = 0xC0190006; -pub const TRANSACTION_NOT_JOINED = 0xC0190007; -pub const DIRECTORY_NOT_RM = 0xC0190008; -pub const TRANSACTIONS_UNSUPPORTED_REMOTE = 0xC019000A; -pub const LOG_RESIZE_INVALID_SIZE = 0xC019000B; -pub const REMOTE_FILE_VERSION_MISMATCH = 0xC019000C; -pub const CRM_PROTOCOL_ALREADY_EXISTS = 0xC019000F; -pub const TRANSACTION_PROPAGATION_FAILED = 0xC0190010; -pub const CRM_PROTOCOL_NOT_FOUND = 0xC0190011; -pub const TRANSACTION_SUPERIOR_EXISTS = 0xC0190012; -pub const TRANSACTION_REQUEST_NOT_VALID = 0xC0190013; -pub const TRANSACTION_NOT_REQUESTED = 0xC0190014; -pub const TRANSACTION_ALREADY_ABORTED = 0xC0190015; -pub const TRANSACTION_ALREADY_COMMITTED = 0xC0190016; -pub const TRANSACTION_INVALID_MARSHALL_BUFFER = 0xC0190017; -pub const CURRENT_TRANSACTION_NOT_VALID = 0xC0190018; -pub const LOG_GROWTH_FAILED = 0xC0190019; -pub const OBJECT_NO_LONGER_EXISTS = 0xC0190021; -pub const STREAM_MINIVERSION_NOT_FOUND = 0xC0190022; -pub const STREAM_MINIVERSION_NOT_VALID = 0xC0190023; -pub const MINIVERSION_INACCESSIBLE_FROM_SPECIFIED_TRANSACTION = 0xC0190024; -pub const CANT_OPEN_MINIVERSION_WITH_MODIFY_INTENT = 0xC0190025; -pub const CANT_CREATE_MORE_STREAM_MINIVERSIONS = 0xC0190026; -pub const HANDLE_NO_LONGER_VALID = 0xC0190028; -pub const LOG_CORRUPTION_DETECTED = 0xC0190030; -pub const RM_DISCONNECTED = 0xC0190032; -pub const ENLISTMENT_NOT_SUPERIOR = 0xC0190033; -pub const FILE_IDENTITY_NOT_PERSISTENT = 0xC0190036; -pub const CANT_BREAK_TRANSACTIONAL_DEPENDENCY = 0xC0190037; -pub const CANT_CROSS_RM_BOUNDARY = 0xC0190038; -pub const TXF_DIR_NOT_EMPTY = 0xC0190039; -pub const INDOUBT_TRANSACTIONS_EXIST = 0xC019003A; -pub const TM_VOLATILE = 0xC019003B; -pub const ROLLBACK_TIMER_EXPIRED = 0xC019003C; -pub const TXF_ATTRIBUTE_CORRUPT = 0xC019003D; -pub const EFS_NOT_ALLOWED_IN_TRANSACTION = 0xC019003E; -pub const TRANSACTIONAL_OPEN_NOT_ALLOWED = 0xC019003F; -pub const TRANSACTED_MAPPING_UNSUPPORTED_REMOTE = 0xC0190040; -pub const TRANSACTION_REQUIRED_PROMOTION = 0xC0190043; -pub const CANNOT_EXECUTE_FILE_IN_TRANSACTION = 0xC0190044; -pub const TRANSACTIONS_NOT_FROZEN = 0xC0190045; -pub const TRANSACTION_FREEZE_IN_PROGRESS = 0xC0190046; -pub const NOT_SNAPSHOT_VOLUME = 0xC0190047; -pub const NO_SAVEPOINT_WITH_OPEN_FILES = 0xC0190048; -pub const SPARSE_NOT_ALLOWED_IN_TRANSACTION = 0xC0190049; -pub const TM_IDENTITY_MISMATCH = 0xC019004A; -pub const FLOATED_SECTION = 0xC019004B; -pub const CANNOT_ACCEPT_TRANSACTED_WORK = 0xC019004C; -pub const CANNOT_ABORT_TRANSACTIONS = 0xC019004D; -pub const TRANSACTION_NOT_FOUND = 0xC019004E; -pub const RESOURCEMANAGER_NOT_FOUND = 0xC019004F; -pub const ENLISTMENT_NOT_FOUND = 0xC0190050; -pub const TRANSACTIONMANAGER_NOT_FOUND = 0xC0190051; -pub const TRANSACTIONMANAGER_NOT_ONLINE = 0xC0190052; -pub const TRANSACTIONMANAGER_RECOVERY_NAME_COLLISION = 0xC0190053; -pub const TRANSACTION_NOT_ROOT = 0xC0190054; -pub const TRANSACTION_OBJECT_EXPIRED = 0xC0190055; -pub const COMPRESSION_NOT_ALLOWED_IN_TRANSACTION = 0xC0190056; -pub const TRANSACTION_RESPONSE_NOT_ENLISTED = 0xC0190057; -pub const TRANSACTION_RECORD_TOO_LONG = 0xC0190058; -pub const NO_LINK_TRACKING_IN_TRANSACTION = 0xC0190059; -pub const OPERATION_NOT_SUPPORTED_IN_TRANSACTION = 0xC019005A; -pub const TRANSACTION_INTEGRITY_VIOLATED = 0xC019005B; -pub const EXPIRED_HANDLE = 0xC0190060; -pub const TRANSACTION_NOT_ENLISTED = 0xC0190061; -pub const LOG_SECTOR_INVALID = 0xC01A0001; -pub const LOG_SECTOR_PARITY_INVALID = 0xC01A0002; -pub const LOG_SECTOR_REMAPPED = 0xC01A0003; -pub const LOG_BLOCK_INCOMPLETE = 0xC01A0004; -pub const LOG_INVALID_RANGE = 0xC01A0005; -pub const LOG_BLOCKS_EXHAUSTED = 0xC01A0006; -pub const LOG_READ_CONTEXT_INVALID = 0xC01A0007; -pub const LOG_RESTART_INVALID = 0xC01A0008; -pub const LOG_BLOCK_VERSION = 0xC01A0009; -pub const LOG_BLOCK_INVALID = 0xC01A000A; -pub const LOG_READ_MODE_INVALID = 0xC01A000B; -pub const LOG_METADATA_CORRUPT = 0xC01A000D; -pub const LOG_METADATA_INVALID = 0xC01A000E; -pub const LOG_METADATA_INCONSISTENT = 0xC01A000F; -pub const LOG_RESERVATION_INVALID = 0xC01A0010; -pub const LOG_CANT_DELETE = 0xC01A0011; -pub const LOG_CONTAINER_LIMIT_EXCEEDED = 0xC01A0012; -pub const LOG_START_OF_LOG = 0xC01A0013; -pub const LOG_POLICY_ALREADY_INSTALLED = 0xC01A0014; -pub const LOG_POLICY_NOT_INSTALLED = 0xC01A0015; -pub const LOG_POLICY_INVALID = 0xC01A0016; -pub const LOG_POLICY_CONFLICT = 0xC01A0017; -pub const LOG_PINNED_ARCHIVE_TAIL = 0xC01A0018; -pub const LOG_RECORD_NONEXISTENT = 0xC01A0019; -pub const LOG_RECORDS_RESERVED_INVALID = 0xC01A001A; -pub const LOG_SPACE_RESERVED_INVALID = 0xC01A001B; -pub const LOG_TAIL_INVALID = 0xC01A001C; -pub const LOG_FULL = 0xC01A001D; -pub const LOG_MULTIPLEXED = 0xC01A001E; -pub const LOG_DEDICATED = 0xC01A001F; -pub const LOG_ARCHIVE_NOT_IN_PROGRESS = 0xC01A0020; -pub const LOG_ARCHIVE_IN_PROGRESS = 0xC01A0021; -pub const LOG_EPHEMERAL = 0xC01A0022; -pub const LOG_NOT_ENOUGH_CONTAINERS = 0xC01A0023; -pub const LOG_CLIENT_ALREADY_REGISTERED = 0xC01A0024; -pub const LOG_CLIENT_NOT_REGISTERED = 0xC01A0025; -pub const LOG_FULL_HANDLER_IN_PROGRESS = 0xC01A0026; -pub const LOG_CONTAINER_READ_FAILED = 0xC01A0027; -pub const LOG_CONTAINER_WRITE_FAILED = 0xC01A0028; -pub const LOG_CONTAINER_OPEN_FAILED = 0xC01A0029; -pub const LOG_CONTAINER_STATE_INVALID = 0xC01A002A; -pub const LOG_STATE_INVALID = 0xC01A002B; -pub const LOG_PINNED = 0xC01A002C; -pub const LOG_METADATA_FLUSH_FAILED = 0xC01A002D; -pub const LOG_INCONSISTENT_SECURITY = 0xC01A002E; -pub const LOG_APPENDED_FLUSH_FAILED = 0xC01A002F; -pub const LOG_PINNED_RESERVATION = 0xC01A0030; -pub const VIDEO_HUNG_DISPLAY_DRIVER_THREAD = 0xC01B00EA; -pub const FLT_NO_HANDLER_DEFINED = 0xC01C0001; -pub const FLT_CONTEXT_ALREADY_DEFINED = 0xC01C0002; -pub const FLT_INVALID_ASYNCHRONOUS_REQUEST = 0xC01C0003; -pub const FLT_DISALLOW_FAST_IO = 0xC01C0004; -pub const FLT_INVALID_NAME_REQUEST = 0xC01C0005; -pub const FLT_NOT_SAFE_TO_POST_OPERATION = 0xC01C0006; -pub const FLT_NOT_INITIALIZED = 0xC01C0007; -pub const FLT_FILTER_NOT_READY = 0xC01C0008; -pub const FLT_POST_OPERATION_CLEANUP = 0xC01C0009; -pub const FLT_INTERNAL_ERROR = 0xC01C000A; -pub const FLT_DELETING_OBJECT = 0xC01C000B; -pub const FLT_MUST_BE_NONPAGED_POOL = 0xC01C000C; -pub const FLT_DUPLICATE_ENTRY = 0xC01C000D; -pub const FLT_CBDQ_DISABLED = 0xC01C000E; -pub const FLT_DO_NOT_ATTACH = 0xC01C000F; -pub const FLT_DO_NOT_DETACH = 0xC01C0010; -pub const FLT_INSTANCE_ALTITUDE_COLLISION = 0xC01C0011; -pub const FLT_INSTANCE_NAME_COLLISION = 0xC01C0012; -pub const FLT_FILTER_NOT_FOUND = 0xC01C0013; -pub const FLT_VOLUME_NOT_FOUND = 0xC01C0014; -pub const FLT_INSTANCE_NOT_FOUND = 0xC01C0015; -pub const FLT_CONTEXT_ALLOCATION_NOT_FOUND = 0xC01C0016; -pub const FLT_INVALID_CONTEXT_REGISTRATION = 0xC01C0017; -pub const FLT_NAME_CACHE_MISS = 0xC01C0018; -pub const FLT_NO_DEVICE_OBJECT = 0xC01C0019; -pub const FLT_VOLUME_ALREADY_MOUNTED = 0xC01C001A; -pub const FLT_ALREADY_ENLISTED = 0xC01C001B; -pub const FLT_CONTEXT_ALREADY_LINKED = 0xC01C001C; -pub const FLT_NO_WAITER_FOR_REPLY = 0xC01C0020; -pub const MONITOR_NO_DESCRIPTOR = 0xC01D0001; -pub const MONITOR_UNKNOWN_DESCRIPTOR_FORMAT = 0xC01D0002; -pub const MONITOR_INVALID_DESCRIPTOR_CHECKSUM = 0xC01D0003; -pub const MONITOR_INVALID_STANDARD_TIMING_BLOCK = 0xC01D0004; -pub const MONITOR_WMI_DATABLOCK_REGISTRATION_FAILED = 0xC01D0005; -pub const MONITOR_INVALID_SERIAL_NUMBER_MONDSC_BLOCK = 0xC01D0006; -pub const MONITOR_INVALID_USER_FRIENDLY_MONDSC_BLOCK = 0xC01D0007; -pub const MONITOR_NO_MORE_DESCRIPTOR_DATA = 0xC01D0008; -pub const MONITOR_INVALID_DETAILED_TIMING_BLOCK = 0xC01D0009; -pub const MONITOR_INVALID_MANUFACTURE_DATE = 0xC01D000A; -pub const GRAPHICS_NOT_EXCLUSIVE_MODE_OWNER = 0xC01E0000; -pub const GRAPHICS_INSUFFICIENT_DMA_BUFFER = 0xC01E0001; -pub const GRAPHICS_INVALID_DISPLAY_ADAPTER = 0xC01E0002; -pub const GRAPHICS_ADAPTER_WAS_RESET = 0xC01E0003; -pub const GRAPHICS_INVALID_DRIVER_MODEL = 0xC01E0004; -pub const GRAPHICS_PRESENT_MODE_CHANGED = 0xC01E0005; -pub const GRAPHICS_PRESENT_OCCLUDED = 0xC01E0006; -pub const GRAPHICS_PRESENT_DENIED = 0xC01E0007; -pub const GRAPHICS_CANNOTCOLORCONVERT = 0xC01E0008; -pub const GRAPHICS_PRESENT_REDIRECTION_DISABLED = 0xC01E000B; -pub const GRAPHICS_PRESENT_UNOCCLUDED = 0xC01E000C; -pub const GRAPHICS_NO_VIDEO_MEMORY = 0xC01E0100; -pub const GRAPHICS_CANT_LOCK_MEMORY = 0xC01E0101; -pub const GRAPHICS_ALLOCATION_BUSY = 0xC01E0102; -pub const GRAPHICS_TOO_MANY_REFERENCES = 0xC01E0103; -pub const GRAPHICS_TRY_AGAIN_LATER = 0xC01E0104; -pub const GRAPHICS_TRY_AGAIN_NOW = 0xC01E0105; -pub const GRAPHICS_ALLOCATION_INVALID = 0xC01E0106; -pub const GRAPHICS_UNSWIZZLING_APERTURE_UNAVAILABLE = 0xC01E0107; -pub const GRAPHICS_UNSWIZZLING_APERTURE_UNSUPPORTED = 0xC01E0108; -pub const GRAPHICS_CANT_EVICT_PINNED_ALLOCATION = 0xC01E0109; -pub const GRAPHICS_INVALID_ALLOCATION_USAGE = 0xC01E0110; -pub const GRAPHICS_CANT_RENDER_LOCKED_ALLOCATION = 0xC01E0111; -pub const GRAPHICS_ALLOCATION_CLOSED = 0xC01E0112; -pub const GRAPHICS_INVALID_ALLOCATION_INSTANCE = 0xC01E0113; -pub const GRAPHICS_INVALID_ALLOCATION_HANDLE = 0xC01E0114; -pub const GRAPHICS_WRONG_ALLOCATION_DEVICE = 0xC01E0115; -pub const GRAPHICS_ALLOCATION_CONTENT_LOST = 0xC01E0116; -pub const GRAPHICS_GPU_EXCEPTION_ON_DEVICE = 0xC01E0200; -pub const GRAPHICS_INVALID_VIDPN_TOPOLOGY = 0xC01E0300; -pub const GRAPHICS_VIDPN_TOPOLOGY_NOT_SUPPORTED = 0xC01E0301; -pub const GRAPHICS_VIDPN_TOPOLOGY_CURRENTLY_NOT_SUPPORTED = 0xC01E0302; -pub const GRAPHICS_INVALID_VIDPN = 0xC01E0303; -pub const GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE = 0xC01E0304; -pub const GRAPHICS_INVALID_VIDEO_PRESENT_TARGET = 0xC01E0305; -pub const GRAPHICS_VIDPN_MODALITY_NOT_SUPPORTED = 0xC01E0306; -pub const GRAPHICS_INVALID_VIDPN_SOURCEMODESET = 0xC01E0308; -pub const GRAPHICS_INVALID_VIDPN_TARGETMODESET = 0xC01E0309; -pub const GRAPHICS_INVALID_FREQUENCY = 0xC01E030A; -pub const GRAPHICS_INVALID_ACTIVE_REGION = 0xC01E030B; -pub const GRAPHICS_INVALID_TOTAL_REGION = 0xC01E030C; -pub const GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE_MODE = 0xC01E0310; -pub const GRAPHICS_INVALID_VIDEO_PRESENT_TARGET_MODE = 0xC01E0311; -pub const GRAPHICS_PINNED_MODE_MUST_REMAIN_IN_SET = 0xC01E0312; -pub const GRAPHICS_PATH_ALREADY_IN_TOPOLOGY = 0xC01E0313; -pub const GRAPHICS_MODE_ALREADY_IN_MODESET = 0xC01E0314; -pub const GRAPHICS_INVALID_VIDEOPRESENTSOURCESET = 0xC01E0315; -pub const GRAPHICS_INVALID_VIDEOPRESENTTARGETSET = 0xC01E0316; -pub const GRAPHICS_SOURCE_ALREADY_IN_SET = 0xC01E0317; -pub const GRAPHICS_TARGET_ALREADY_IN_SET = 0xC01E0318; -pub const GRAPHICS_INVALID_VIDPN_PRESENT_PATH = 0xC01E0319; -pub const GRAPHICS_NO_RECOMMENDED_VIDPN_TOPOLOGY = 0xC01E031A; -pub const GRAPHICS_INVALID_MONITOR_FREQUENCYRANGESET = 0xC01E031B; -pub const GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE = 0xC01E031C; -pub const GRAPHICS_FREQUENCYRANGE_NOT_IN_SET = 0xC01E031D; -pub const GRAPHICS_FREQUENCYRANGE_ALREADY_IN_SET = 0xC01E031F; -pub const GRAPHICS_STALE_MODESET = 0xC01E0320; -pub const GRAPHICS_INVALID_MONITOR_SOURCEMODESET = 0xC01E0321; -pub const GRAPHICS_INVALID_MONITOR_SOURCE_MODE = 0xC01E0322; -pub const GRAPHICS_NO_RECOMMENDED_FUNCTIONAL_VIDPN = 0xC01E0323; -pub const GRAPHICS_MODE_ID_MUST_BE_UNIQUE = 0xC01E0324; -pub const GRAPHICS_EMPTY_ADAPTER_MONITOR_MODE_SUPPORT_INTERSECTION = 0xC01E0325; -pub const GRAPHICS_VIDEO_PRESENT_TARGETS_LESS_THAN_SOURCES = 0xC01E0326; -pub const GRAPHICS_PATH_NOT_IN_TOPOLOGY = 0xC01E0327; -pub const GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_SOURCE = 0xC01E0328; -pub const GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_TARGET = 0xC01E0329; -pub const GRAPHICS_INVALID_MONITORDESCRIPTORSET = 0xC01E032A; -pub const GRAPHICS_INVALID_MONITORDESCRIPTOR = 0xC01E032B; -pub const GRAPHICS_MONITORDESCRIPTOR_NOT_IN_SET = 0xC01E032C; -pub const GRAPHICS_MONITORDESCRIPTOR_ALREADY_IN_SET = 0xC01E032D; -pub const GRAPHICS_MONITORDESCRIPTOR_ID_MUST_BE_UNIQUE = 0xC01E032E; -pub const GRAPHICS_INVALID_VIDPN_TARGET_SUBSET_TYPE = 0xC01E032F; -pub const GRAPHICS_RESOURCES_NOT_RELATED = 0xC01E0330; -pub const GRAPHICS_SOURCE_ID_MUST_BE_UNIQUE = 0xC01E0331; -pub const GRAPHICS_TARGET_ID_MUST_BE_UNIQUE = 0xC01E0332; -pub const GRAPHICS_NO_AVAILABLE_VIDPN_TARGET = 0xC01E0333; -pub const GRAPHICS_MONITOR_COULD_NOT_BE_ASSOCIATED_WITH_ADAPTER = 0xC01E0334; -pub const GRAPHICS_NO_VIDPNMGR = 0xC01E0335; -pub const GRAPHICS_NO_ACTIVE_VIDPN = 0xC01E0336; -pub const GRAPHICS_STALE_VIDPN_TOPOLOGY = 0xC01E0337; -pub const GRAPHICS_MONITOR_NOT_CONNECTED = 0xC01E0338; -pub const GRAPHICS_SOURCE_NOT_IN_TOPOLOGY = 0xC01E0339; -pub const GRAPHICS_INVALID_PRIMARYSURFACE_SIZE = 0xC01E033A; -pub const GRAPHICS_INVALID_VISIBLEREGION_SIZE = 0xC01E033B; -pub const GRAPHICS_INVALID_STRIDE = 0xC01E033C; -pub const GRAPHICS_INVALID_PIXELFORMAT = 0xC01E033D; -pub const GRAPHICS_INVALID_COLORBASIS = 0xC01E033E; -pub const GRAPHICS_INVALID_PIXELVALUEACCESSMODE = 0xC01E033F; -pub const GRAPHICS_TARGET_NOT_IN_TOPOLOGY = 0xC01E0340; -pub const GRAPHICS_NO_DISPLAY_MODE_MANAGEMENT_SUPPORT = 0xC01E0341; -pub const GRAPHICS_VIDPN_SOURCE_IN_USE = 0xC01E0342; -pub const GRAPHICS_CANT_ACCESS_ACTIVE_VIDPN = 0xC01E0343; -pub const GRAPHICS_INVALID_PATH_IMPORTANCE_ORDINAL = 0xC01E0344; -pub const GRAPHICS_INVALID_PATH_CONTENT_GEOMETRY_TRANSFORMATION = 0xC01E0345; -pub const GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_SUPPORTED = 0xC01E0346; -pub const GRAPHICS_INVALID_GAMMA_RAMP = 0xC01E0347; -pub const GRAPHICS_GAMMA_RAMP_NOT_SUPPORTED = 0xC01E0348; -pub const GRAPHICS_MULTISAMPLING_NOT_SUPPORTED = 0xC01E0349; -pub const GRAPHICS_MODE_NOT_IN_MODESET = 0xC01E034A; -pub const GRAPHICS_INVALID_VIDPN_TOPOLOGY_RECOMMENDATION_REASON = 0xC01E034D; -pub const GRAPHICS_INVALID_PATH_CONTENT_TYPE = 0xC01E034E; -pub const GRAPHICS_INVALID_COPYPROTECTION_TYPE = 0xC01E034F; -pub const GRAPHICS_UNASSIGNED_MODESET_ALREADY_EXISTS = 0xC01E0350; -pub const GRAPHICS_INVALID_SCANLINE_ORDERING = 0xC01E0352; -pub const GRAPHICS_TOPOLOGY_CHANGES_NOT_ALLOWED = 0xC01E0353; -pub const GRAPHICS_NO_AVAILABLE_IMPORTANCE_ORDINALS = 0xC01E0354; -pub const GRAPHICS_INCOMPATIBLE_PRIVATE_FORMAT = 0xC01E0355; -pub const GRAPHICS_INVALID_MODE_PRUNING_ALGORITHM = 0xC01E0356; -pub const GRAPHICS_INVALID_MONITOR_CAPABILITY_ORIGIN = 0xC01E0357; -pub const GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE_CONSTRAINT = 0xC01E0358; -pub const GRAPHICS_MAX_NUM_PATHS_REACHED = 0xC01E0359; -pub const GRAPHICS_CANCEL_VIDPN_TOPOLOGY_AUGMENTATION = 0xC01E035A; -pub const GRAPHICS_INVALID_CLIENT_TYPE = 0xC01E035B; -pub const GRAPHICS_CLIENTVIDPN_NOT_SET = 0xC01E035C; -pub const GRAPHICS_SPECIFIED_CHILD_ALREADY_CONNECTED = 0xC01E0400; -pub const GRAPHICS_CHILD_DESCRIPTOR_NOT_SUPPORTED = 0xC01E0401; -pub const GRAPHICS_NOT_A_LINKED_ADAPTER = 0xC01E0430; -pub const GRAPHICS_LEADLINK_NOT_ENUMERATED = 0xC01E0431; -pub const GRAPHICS_CHAINLINKS_NOT_ENUMERATED = 0xC01E0432; -pub const GRAPHICS_ADAPTER_CHAIN_NOT_READY = 0xC01E0433; -pub const GRAPHICS_CHAINLINKS_NOT_STARTED = 0xC01E0434; -pub const GRAPHICS_CHAINLINKS_NOT_POWERED_ON = 0xC01E0435; -pub const GRAPHICS_INCONSISTENT_DEVICE_LINK_STATE = 0xC01E0436; -pub const GRAPHICS_NOT_POST_DEVICE_DRIVER = 0xC01E0438; -pub const GRAPHICS_ADAPTER_ACCESS_NOT_EXCLUDED = 0xC01E043B; -pub const GRAPHICS_OPM_NOT_SUPPORTED = 0xC01E0500; -pub const GRAPHICS_COPP_NOT_SUPPORTED = 0xC01E0501; -pub const GRAPHICS_UAB_NOT_SUPPORTED = 0xC01E0502; -pub const GRAPHICS_OPM_INVALID_ENCRYPTED_PARAMETERS = 0xC01E0503; -pub const GRAPHICS_OPM_PARAMETER_ARRAY_TOO_SMALL = 0xC01E0504; -pub const GRAPHICS_OPM_NO_PROTECTED_OUTPUTS_EXIST = 0xC01E0505; -pub const GRAPHICS_PVP_NO_DISPLAY_DEVICE_CORRESPONDS_TO_NAME = 0xC01E0506; -pub const GRAPHICS_PVP_DISPLAY_DEVICE_NOT_ATTACHED_TO_DESKTOP = 0xC01E0507; -pub const GRAPHICS_PVP_MIRRORING_DEVICES_NOT_SUPPORTED = 0xC01E0508; -pub const GRAPHICS_OPM_INVALID_POINTER = 0xC01E050A; -pub const GRAPHICS_OPM_INTERNAL_ERROR = 0xC01E050B; -pub const GRAPHICS_OPM_INVALID_HANDLE = 0xC01E050C; -pub const GRAPHICS_PVP_NO_MONITORS_CORRESPOND_TO_DISPLAY_DEVICE = 0xC01E050D; -pub const GRAPHICS_PVP_INVALID_CERTIFICATE_LENGTH = 0xC01E050E; -pub const GRAPHICS_OPM_SPANNING_MODE_ENABLED = 0xC01E050F; -pub const GRAPHICS_OPM_THEATER_MODE_ENABLED = 0xC01E0510; -pub const GRAPHICS_PVP_HFS_FAILED = 0xC01E0511; -pub const GRAPHICS_OPM_INVALID_SRM = 0xC01E0512; -pub const GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_HDCP = 0xC01E0513; -pub const GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_ACP = 0xC01E0514; -pub const GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_CGMSA = 0xC01E0515; -pub const GRAPHICS_OPM_HDCP_SRM_NEVER_SET = 0xC01E0516; -pub const GRAPHICS_OPM_RESOLUTION_TOO_HIGH = 0xC01E0517; -pub const GRAPHICS_OPM_ALL_HDCP_HARDWARE_ALREADY_IN_USE = 0xC01E0518; -pub const GRAPHICS_OPM_PROTECTED_OUTPUT_NO_LONGER_EXISTS = 0xC01E051A; -pub const GRAPHICS_OPM_SESSION_TYPE_CHANGE_IN_PROGRESS = 0xC01E051B; -pub const GRAPHICS_OPM_PROTECTED_OUTPUT_DOES_NOT_HAVE_COPP_SEMANTICS = 0xC01E051C; -pub const GRAPHICS_OPM_INVALID_INFORMATION_REQUEST = 0xC01E051D; -pub const GRAPHICS_OPM_DRIVER_INTERNAL_ERROR = 0xC01E051E; -pub const GRAPHICS_OPM_PROTECTED_OUTPUT_DOES_NOT_HAVE_OPM_SEMANTICS = 0xC01E051F; -pub const GRAPHICS_OPM_SIGNALING_NOT_SUPPORTED = 0xC01E0520; -pub const GRAPHICS_OPM_INVALID_CONFIGURATION_REQUEST = 0xC01E0521; -pub const GRAPHICS_I2C_NOT_SUPPORTED = 0xC01E0580; -pub const GRAPHICS_I2C_DEVICE_DOES_NOT_EXIST = 0xC01E0581; -pub const GRAPHICS_I2C_ERROR_TRANSMITTING_DATA = 0xC01E0582; -pub const GRAPHICS_I2C_ERROR_RECEIVING_DATA = 0xC01E0583; -pub const GRAPHICS_DDCCI_VCP_NOT_SUPPORTED = 0xC01E0584; -pub const GRAPHICS_DDCCI_INVALID_DATA = 0xC01E0585; -pub const GRAPHICS_DDCCI_MONITOR_RETURNED_INVALID_TIMING_STATUS_BYTE = 0xC01E0586; -pub const GRAPHICS_DDCCI_INVALID_CAPABILITIES_STRING = 0xC01E0587; -pub const GRAPHICS_MCA_INTERNAL_ERROR = 0xC01E0588; -pub const GRAPHICS_DDCCI_INVALID_MESSAGE_COMMAND = 0xC01E0589; -pub const GRAPHICS_DDCCI_INVALID_MESSAGE_LENGTH = 0xC01E058A; -pub const GRAPHICS_DDCCI_INVALID_MESSAGE_CHECKSUM = 0xC01E058B; -pub const GRAPHICS_INVALID_PHYSICAL_MONITOR_HANDLE = 0xC01E058C; -pub const GRAPHICS_MONITOR_NO_LONGER_EXISTS = 0xC01E058D; -pub const GRAPHICS_ONLY_CONSOLE_SESSION_SUPPORTED = 0xC01E05E0; -pub const GRAPHICS_NO_DISPLAY_DEVICE_CORRESPONDS_TO_NAME = 0xC01E05E1; -pub const GRAPHICS_DISPLAY_DEVICE_NOT_ATTACHED_TO_DESKTOP = 0xC01E05E2; -pub const GRAPHICS_MIRRORING_DEVICES_NOT_SUPPORTED = 0xC01E05E3; -pub const GRAPHICS_INVALID_POINTER = 0xC01E05E4; -pub const GRAPHICS_NO_MONITORS_CORRESPOND_TO_DISPLAY_DEVICE = 0xC01E05E5; -pub const GRAPHICS_PARAMETER_ARRAY_TOO_SMALL = 0xC01E05E6; -pub const GRAPHICS_INTERNAL_ERROR = 0xC01E05E7; -pub const GRAPHICS_SESSION_TYPE_CHANGE_IN_PROGRESS = 0xC01E05E8; -pub const FVE_LOCKED_VOLUME = 0xC0210000; -pub const FVE_NOT_ENCRYPTED = 0xC0210001; -pub const FVE_BAD_INFORMATION = 0xC0210002; -pub const FVE_TOO_SMALL = 0xC0210003; -pub const FVE_FAILED_WRONG_FS = 0xC0210004; -pub const FVE_FAILED_BAD_FS = 0xC0210005; -pub const FVE_FS_NOT_EXTENDED = 0xC0210006; -pub const FVE_FS_MOUNTED = 0xC0210007; -pub const FVE_NO_LICENSE = 0xC0210008; -pub const FVE_ACTION_NOT_ALLOWED = 0xC0210009; -pub const FVE_BAD_DATA = 0xC021000A; -pub const FVE_VOLUME_NOT_BOUND = 0xC021000B; -pub const FVE_NOT_DATA_VOLUME = 0xC021000C; -pub const FVE_CONV_READ_ERROR = 0xC021000D; -pub const FVE_CONV_WRITE_ERROR = 0xC021000E; -pub const FVE_OVERLAPPED_UPDATE = 0xC021000F; -pub const FVE_FAILED_SECTOR_SIZE = 0xC0210010; -pub const FVE_FAILED_AUTHENTICATION = 0xC0210011; -pub const FVE_NOT_OS_VOLUME = 0xC0210012; -pub const FVE_KEYFILE_NOT_FOUND = 0xC0210013; -pub const FVE_KEYFILE_INVALID = 0xC0210014; -pub const FVE_KEYFILE_NO_VMK = 0xC0210015; -pub const FVE_TPM_DISABLED = 0xC0210016; -pub const FVE_TPM_SRK_AUTH_NOT_ZERO = 0xC0210017; -pub const FVE_TPM_INVALID_PCR = 0xC0210018; -pub const FVE_TPM_NO_VMK = 0xC0210019; -pub const FVE_PIN_INVALID = 0xC021001A; -pub const FVE_AUTH_INVALID_APPLICATION = 0xC021001B; -pub const FVE_AUTH_INVALID_CONFIG = 0xC021001C; -pub const FVE_DEBUGGER_ENABLED = 0xC021001D; -pub const FVE_DRY_RUN_FAILED = 0xC021001E; -pub const FVE_BAD_METADATA_POINTER = 0xC021001F; -pub const FVE_OLD_METADATA_COPY = 0xC0210020; -pub const FVE_REBOOT_REQUIRED = 0xC0210021; -pub const FVE_RAW_ACCESS = 0xC0210022; -pub const FVE_RAW_BLOCKED = 0xC0210023; -pub const FVE_NO_FEATURE_LICENSE = 0xC0210026; -pub const FVE_POLICY_USER_DISABLE_RDV_NOT_ALLOWED = 0xC0210027; -pub const FVE_CONV_RECOVERY_FAILED = 0xC0210028; -pub const FVE_VIRTUALIZED_SPACE_TOO_BIG = 0xC0210029; -pub const FVE_VOLUME_TOO_SMALL = 0xC0210030; -pub const FWP_CALLOUT_NOT_FOUND = 0xC0220001; -pub const FWP_CONDITION_NOT_FOUND = 0xC0220002; -pub const FWP_FILTER_NOT_FOUND = 0xC0220003; -pub const FWP_LAYER_NOT_FOUND = 0xC0220004; -pub const FWP_PROVIDER_NOT_FOUND = 0xC0220005; -pub const FWP_PROVIDER_CONTEXT_NOT_FOUND = 0xC0220006; -pub const FWP_SUBLAYER_NOT_FOUND = 0xC0220007; -pub const FWP_NOT_FOUND = 0xC0220008; -pub const FWP_ALREADY_EXISTS = 0xC0220009; -pub const FWP_IN_USE = 0xC022000A; -pub const FWP_DYNAMIC_SESSION_IN_PROGRESS = 0xC022000B; -pub const FWP_WRONG_SESSION = 0xC022000C; -pub const FWP_NO_TXN_IN_PROGRESS = 0xC022000D; -pub const FWP_TXN_IN_PROGRESS = 0xC022000E; -pub const FWP_TXN_ABORTED = 0xC022000F; -pub const FWP_SESSION_ABORTED = 0xC0220010; -pub const FWP_INCOMPATIBLE_TXN = 0xC0220011; -pub const FWP_TIMEOUT = 0xC0220012; -pub const FWP_NET_EVENTS_DISABLED = 0xC0220013; -pub const FWP_INCOMPATIBLE_LAYER = 0xC0220014; -pub const FWP_KM_CLIENTS_ONLY = 0xC0220015; -pub const FWP_LIFETIME_MISMATCH = 0xC0220016; -pub const FWP_BUILTIN_OBJECT = 0xC0220017; -pub const FWP_TOO_MANY_BOOTTIME_FILTERS = 0xC0220018; -pub const FWP_TOO_MANY_CALLOUTS = 0xC0220018; -pub const FWP_NOTIFICATION_DROPPED = 0xC0220019; -pub const FWP_TRAFFIC_MISMATCH = 0xC022001A; -pub const FWP_INCOMPATIBLE_SA_STATE = 0xC022001B; -pub const FWP_NULL_POINTER = 0xC022001C; -pub const FWP_INVALID_ENUMERATOR = 0xC022001D; -pub const FWP_INVALID_FLAGS = 0xC022001E; -pub const FWP_INVALID_NET_MASK = 0xC022001F; -pub const FWP_INVALID_RANGE = 0xC0220020; -pub const FWP_INVALID_INTERVAL = 0xC0220021; -pub const FWP_ZERO_LENGTH_ARRAY = 0xC0220022; -pub const FWP_NULL_DISPLAY_NAME = 0xC0220023; -pub const FWP_INVALID_ACTION_TYPE = 0xC0220024; -pub const FWP_INVALID_WEIGHT = 0xC0220025; -pub const FWP_MATCH_TYPE_MISMATCH = 0xC0220026; -pub const FWP_TYPE_MISMATCH = 0xC0220027; -pub const FWP_OUT_OF_BOUNDS = 0xC0220028; -pub const FWP_RESERVED = 0xC0220029; -pub const FWP_DUPLICATE_CONDITION = 0xC022002A; -pub const FWP_DUPLICATE_KEYMOD = 0xC022002B; -pub const FWP_ACTION_INCOMPATIBLE_WITH_LAYER = 0xC022002C; -pub const FWP_ACTION_INCOMPATIBLE_WITH_SUBLAYER = 0xC022002D; -pub const FWP_CONTEXT_INCOMPATIBLE_WITH_LAYER = 0xC022002E; -pub const FWP_CONTEXT_INCOMPATIBLE_WITH_CALLOUT = 0xC022002F; -pub const FWP_INCOMPATIBLE_AUTH_METHOD = 0xC0220030; -pub const FWP_INCOMPATIBLE_DH_GROUP = 0xC0220031; -pub const FWP_EM_NOT_SUPPORTED = 0xC0220032; -pub const FWP_NEVER_MATCH = 0xC0220033; -pub const FWP_PROVIDER_CONTEXT_MISMATCH = 0xC0220034; -pub const FWP_INVALID_PARAMETER = 0xC0220035; -pub const FWP_TOO_MANY_SUBLAYERS = 0xC0220036; -pub const FWP_CALLOUT_NOTIFICATION_FAILED = 0xC0220037; -pub const FWP_INCOMPATIBLE_AUTH_CONFIG = 0xC0220038; -pub const FWP_INCOMPATIBLE_CIPHER_CONFIG = 0xC0220039; -pub const FWP_DUPLICATE_AUTH_METHOD = 0xC022003C; -pub const FWP_TCPIP_NOT_READY = 0xC0220100; -pub const FWP_INJECT_HANDLE_CLOSING = 0xC0220101; -pub const FWP_INJECT_HANDLE_STALE = 0xC0220102; -pub const FWP_CANNOT_PEND = 0xC0220103; -pub const NDIS_CLOSING = 0xC0230002; -pub const NDIS_BAD_VERSION = 0xC0230004; -pub const NDIS_BAD_CHARACTERISTICS = 0xC0230005; -pub const NDIS_ADAPTER_NOT_FOUND = 0xC0230006; -pub const NDIS_OPEN_FAILED = 0xC0230007; -pub const NDIS_DEVICE_FAILED = 0xC0230008; -pub const NDIS_MULTICAST_FULL = 0xC0230009; -pub const NDIS_MULTICAST_EXISTS = 0xC023000A; -pub const NDIS_MULTICAST_NOT_FOUND = 0xC023000B; -pub const NDIS_REQUEST_ABORTED = 0xC023000C; -pub const NDIS_RESET_IN_PROGRESS = 0xC023000D; -pub const NDIS_INVALID_PACKET = 0xC023000F; -pub const NDIS_INVALID_DEVICE_REQUEST = 0xC0230010; -pub const NDIS_ADAPTER_NOT_READY = 0xC0230011; -pub const NDIS_INVALID_LENGTH = 0xC0230014; -pub const NDIS_INVALID_DATA = 0xC0230015; -pub const NDIS_BUFFER_TOO_SHORT = 0xC0230016; -pub const NDIS_INVALID_OID = 0xC0230017; -pub const NDIS_ADAPTER_REMOVED = 0xC0230018; -pub const NDIS_UNSUPPORTED_MEDIA = 0xC0230019; -pub const NDIS_GROUP_ADDRESS_IN_USE = 0xC023001A; -pub const NDIS_FILE_NOT_FOUND = 0xC023001B; -pub const NDIS_ERROR_READING_FILE = 0xC023001C; -pub const NDIS_ALREADY_MAPPED = 0xC023001D; -pub const NDIS_RESOURCE_CONFLICT = 0xC023001E; -pub const NDIS_MEDIA_DISCONNECTED = 0xC023001F; -pub const NDIS_INVALID_ADDRESS = 0xC0230022; -pub const NDIS_PAUSED = 0xC023002A; -pub const NDIS_INTERFACE_NOT_FOUND = 0xC023002B; -pub const NDIS_UNSUPPORTED_REVISION = 0xC023002C; -pub const NDIS_INVALID_PORT = 0xC023002D; -pub const NDIS_INVALID_PORT_STATE = 0xC023002E; -pub const NDIS_LOW_POWER_STATE = 0xC023002F; -pub const NDIS_NOT_SUPPORTED = 0xC02300BB; -pub const NDIS_OFFLOAD_POLICY = 0xC023100F; -pub const NDIS_OFFLOAD_CONNECTION_REJECTED = 0xC0231012; -pub const NDIS_OFFLOAD_PATH_REJECTED = 0xC0231013; -pub const NDIS_DOT11_AUTO_CONFIG_ENABLED = 0xC0232000; -pub const NDIS_DOT11_MEDIA_IN_USE = 0xC0232001; -pub const NDIS_DOT11_POWER_STATE_INVALID = 0xC0232002; -pub const NDIS_PM_WOL_PATTERN_LIST_FULL = 0xC0232003; -pub const NDIS_PM_PROTOCOL_OFFLOAD_LIST_FULL = 0xC0232004; -pub const IPSEC_BAD_SPI = 0xC0360001; -pub const IPSEC_SA_LIFETIME_EXPIRED = 0xC0360002; -pub const IPSEC_WRONG_SA = 0xC0360003; -pub const IPSEC_REPLAY_CHECK_FAILED = 0xC0360004; -pub const IPSEC_INVALID_PACKET = 0xC0360005; -pub const IPSEC_INTEGRITY_CHECK_FAILED = 0xC0360006; -pub const IPSEC_CLEAR_TEXT_DROP = 0xC0360007; -pub const IPSEC_AUTH_FIREWALL_DROP = 0xC0360008; -pub const IPSEC_THROTTLE_DROP = 0xC0360009; -pub const IPSEC_DOSP_BLOCK = 0xC0368000; -pub const IPSEC_DOSP_RECEIVED_MULTICAST = 0xC0368001; -pub const IPSEC_DOSP_INVALID_PACKET = 0xC0368002; -pub const IPSEC_DOSP_STATE_LOOKUP_FAILED = 0xC0368003; -pub const IPSEC_DOSP_MAX_ENTRIES = 0xC0368004; -pub const IPSEC_DOSP_KEYMOD_NOT_ALLOWED = 0xC0368005; -pub const IPSEC_DOSP_MAX_PER_IP_RATELIMIT_QUEUES = 0xC0368006; -pub const VOLMGR_MIRROR_NOT_SUPPORTED = 0xC038005B; -pub const VOLMGR_RAID5_NOT_SUPPORTED = 0xC038005C; -pub const VIRTDISK_PROVIDER_NOT_FOUND = 0xC03A0014; -pub const VIRTDISK_NOT_VIRTUAL_DISK = 0xC03A0015; -pub const VHD_PARENT_VHD_ACCESS_DENIED = 0xC03A0016; -pub const VHD_CHILD_PARENT_SIZE_MISMATCH = 0xC03A0017; -pub const VHD_DIFFERENCING_CHAIN_CYCLE_DETECTED = 0xC03A0018; -pub const VHD_DIFFERENCING_CHAIN_ERROR_IN_PARENT = 0xC03A0019; diff --git a/lib/std/reset_event.zig b/lib/std/reset_event.zig index b9d9517c6..b31906c5f 100644 --- a/lib/std/reset_event.zig +++ b/lib/std/reset_event.zig @@ -283,7 +283,7 @@ const AtomicEvent = struct { var waiting = wake_count; while (waiting != 0) : (waiting -= 1) { const rc = windows.ntdll.NtReleaseKeyedEvent(handle, key, windows.FALSE, null); - assert(rc == 0); + assert(rc == .SUCCESS); } } @@ -302,7 +302,7 @@ const AtomicEvent = struct { // NtWaitForKeyedEvent doesnt have spurious wake-ups var rc = windows.ntdll.NtWaitForKeyedEvent(handle, key, windows.FALSE, timeout_ptr); switch (rc) { - windows.WAIT_TIMEOUT => { + .TIMEOUT => { // update the wait count to signal that we're not waiting anymore. // if the .set() thread already observed that we are, perform a // matching NtWaitForKeyedEvent so that the .set() thread doesn't @@ -311,7 +311,7 @@ const AtomicEvent = struct { while (true) { if (waiting == WAKE) { rc = windows.ntdll.NtWaitForKeyedEvent(handle, key, windows.FALSE, null); - assert(rc == windows.WAIT_OBJECT_0); + assert(rc == .WAIT_0); break; } else { waiting = @cmpxchgWeak(u32, waiters, waiting, waiting - WAIT, .Acquire, .Monotonic) orelse break; @@ -320,7 +320,7 @@ const AtomicEvent = struct { } return error.TimedOut; }, - windows.WAIT_OBJECT_0 => {}, + .WAIT_0 => {}, else => unreachable, } } @@ -336,7 +336,7 @@ const AtomicEvent = struct { EMPTY => handle = @cmpxchgWeak(usize, &event_handle, EMPTY, LOADING, .Acquire, .Monotonic) orelse { const handle_ptr = @ptrCast(*windows.HANDLE, &handle); const access_mask = windows.GENERIC_READ | windows.GENERIC_WRITE; - if (windows.ntdll.NtCreateKeyedEvent(handle_ptr, access_mask, null, 0) != 0) + if (windows.ntdll.NtCreateKeyedEvent(handle_ptr, access_mask, null, 0) != .SUCCESS) handle = 0; @atomicStore(usize, &event_handle, handle, .Monotonic); return @intToPtr(?windows.HANDLE, handle); From b9f720365c0ad20420ead337c1746b8f0a5da649 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Fri, 31 Jan 2020 20:46:09 +1100 Subject: [PATCH 39/60] Turn win32 errors into a non-exhaustive enum --- lib/std/event/fs.zig | 20 +- lib/std/os.zig | 6 +- lib/std/os/windows.zig | 126 +- lib/std/os/windows/bits.zig | 2 +- lib/std/os/windows/error.zig | 3567 ---------------------------- lib/std/os/windows/kernel32.zig | 4 +- lib/std/os/windows/win32error.zig | 3696 +++++++++++++++++++++++++++++ 7 files changed, 3775 insertions(+), 3646 deletions(-) delete mode 100644 lib/std/os/windows/error.zig create mode 100644 lib/std/os/windows/win32error.zig diff --git a/lib/std/event/fs.zig b/lib/std/event/fs.zig index ce88ac4dc..7581d2a1f 100644 --- a/lib/std/event/fs.zig +++ b/lib/std/event/fs.zig @@ -160,12 +160,12 @@ pub fn pwriteWindows(fd: fd_t, data: []const u8, offset: u64) os.WindowsWriteErr var bytes_transferred: windows.DWORD = undefined; if (windows.kernel32.GetOverlappedResult(fd, &resume_node.base.overlapped, &bytes_transferred, windows.FALSE) == 0) { switch (windows.kernel32.GetLastError()) { - windows.ERROR.IO_PENDING => unreachable, - windows.ERROR.INVALID_USER_BUFFER => return error.SystemResources, - windows.ERROR.NOT_ENOUGH_MEMORY => return error.SystemResources, - windows.ERROR.OPERATION_ABORTED => return error.OperationAborted, - windows.ERROR.NOT_ENOUGH_QUOTA => return error.SystemResources, - windows.ERROR.BROKEN_PIPE => return error.BrokenPipe, + .IO_PENDING => unreachable, + .INVALID_USER_BUFFER => return error.SystemResources, + .NOT_ENOUGH_MEMORY => return error.SystemResources, + .OPERATION_ABORTED => return error.OperationAborted, + .NOT_ENOUGH_QUOTA => return error.SystemResources, + .BROKEN_PIPE => return error.BrokenPipe, else => |err| return windows.unexpectedError(err), } } @@ -320,10 +320,10 @@ pub fn preadWindows(fd: fd_t, data: []u8, offset: u64) !usize { var bytes_transferred: windows.DWORD = undefined; if (windows.kernel32.GetOverlappedResult(fd, &resume_node.base.overlapped, &bytes_transferred, windows.FALSE) == 0) { switch (windows.kernel32.GetLastError()) { - windows.ERROR.IO_PENDING => unreachable, - windows.ERROR.OPERATION_ABORTED => return error.OperationAborted, - windows.ERROR.BROKEN_PIPE => return error.BrokenPipe, - windows.ERROR.HANDLE_EOF => return @as(usize, bytes_transferred), + .IO_PENDING => unreachable, + .OPERATION_ABORTED => return error.OperationAborted, + .BROKEN_PIPE => return error.BrokenPipe, + .HANDLE_EOF => return @as(usize, bytes_transferred), else => |err| return windows.unexpectedError(err), } } diff --git a/lib/std/os.zig b/lib/std/os.zig index 47b863250..a9c4a49f1 100644 --- a/lib/std/os.zig +++ b/lib/std/os.zig @@ -2345,9 +2345,9 @@ pub fn accessW(path: [*:0]const u16, mode: u32) windows.GetFileAttributesError!v return; } switch (windows.kernel32.GetLastError()) { - windows.ERROR.FILE_NOT_FOUND => return error.FileNotFound, - windows.ERROR.PATH_NOT_FOUND => return error.FileNotFound, - windows.ERROR.ACCESS_DENIED => return error.PermissionDenied, + .FILE_NOT_FOUND => return error.FileNotFound, + .PATH_NOT_FOUND => return error.FileNotFound, + .ACCESS_DENIED => return error.PermissionDenied, else => |err| return windows.unexpectedError(err), } } diff --git a/lib/std/os/windows.zig b/lib/std/os/windows.zig index c389538ed..643a4eab3 100644 --- a/lib/std/os/windows.zig +++ b/lib/std/os/windows.zig @@ -72,14 +72,14 @@ pub fn CreateFileW( if (result == INVALID_HANDLE_VALUE) { switch (kernel32.GetLastError()) { - ERROR.SHARING_VIOLATION => return error.SharingViolation, - ERROR.ALREADY_EXISTS => return error.PathAlreadyExists, - ERROR.FILE_EXISTS => return error.PathAlreadyExists, - ERROR.FILE_NOT_FOUND => return error.FileNotFound, - ERROR.PATH_NOT_FOUND => return error.FileNotFound, - ERROR.ACCESS_DENIED => return error.AccessDenied, - ERROR.PIPE_BUSY => return error.PipeBusy, - ERROR.FILENAME_EXCED_RANGE => return error.NameTooLong, + .SHARING_VIOLATION => return error.SharingViolation, + .ALREADY_EXISTS => return error.PathAlreadyExists, + .FILE_EXISTS => return error.PathAlreadyExists, + .FILE_NOT_FOUND => return error.FileNotFound, + .PATH_NOT_FOUND => return error.FileNotFound, + .ACCESS_DENIED => return error.AccessDenied, + .PIPE_BUSY => return error.PipeBusy, + .FILENAME_EXCED_RANGE => return error.NameTooLong, else => |err| return unexpectedError(err), } } @@ -132,7 +132,7 @@ pub fn DeviceIoControl( overlapped, ) == 0) { switch (kernel32.GetLastError()) { - ERROR.IO_PENDING => if (overlapped == null) unreachable, + .IO_PENDING => if (overlapped == null) unreachable, else => |err| return unexpectedError(err), } } @@ -143,7 +143,7 @@ pub fn GetOverlappedResult(h: HANDLE, overlapped: *OVERLAPPED, wait: bool) !DWOR var bytes: DWORD = undefined; if (kernel32.GetOverlappedResult(h, overlapped, &bytes, @boolToInt(wait)) == 0) { switch (kernel32.GetLastError()) { - ERROR.IO_INCOMPLETE => if (!wait) return error.WouldBlock else unreachable, + .IO_INCOMPLETE => if (!wait) return error.WouldBlock else unreachable, else => |err| return unexpectedError(err), } } @@ -246,8 +246,8 @@ pub fn FindFirstFile(dir_path: []const u8, find_file_data: *WIN32_FIND_DATAW) Fi if (handle == INVALID_HANDLE_VALUE) { switch (kernel32.GetLastError()) { - ERROR.FILE_NOT_FOUND => return error.FileNotFound, - ERROR.PATH_NOT_FOUND => return error.FileNotFound, + .FILE_NOT_FOUND => return error.FileNotFound, + .PATH_NOT_FOUND => return error.FileNotFound, else => |err| return unexpectedError(err), } } @@ -261,7 +261,7 @@ pub const FindNextFileError = error{Unexpected}; pub fn FindNextFile(handle: HANDLE, find_file_data: *WIN32_FIND_DATAW) FindNextFileError!bool { if (kernel32.FindNextFileW(handle, find_file_data) == 0) { switch (kernel32.GetLastError()) { - ERROR.NO_MORE_FILES => return false, + .NO_MORE_FILES => return false, else => |err| return unexpectedError(err), } } @@ -278,7 +278,7 @@ pub fn CreateIoCompletionPort( ) CreateIoCompletionPortError!HANDLE { const handle = kernel32.CreateIoCompletionPort(file_handle, existing_completion_port, completion_key, concurrent_thread_count) orelse { switch (kernel32.GetLastError()) { - ERROR.INVALID_PARAMETER => unreachable, + .INVALID_PARAMETER => unreachable, else => |err| return unexpectedError(err), } }; @@ -322,9 +322,9 @@ pub fn GetQueuedCompletionStatus( dwMilliseconds, ) == FALSE) { switch (kernel32.GetLastError()) { - ERROR.ABANDONED_WAIT_0 => return GetQueuedCompletionStatusResult.Aborted, - ERROR.OPERATION_ABORTED => return GetQueuedCompletionStatusResult.Cancelled, - ERROR.HANDLE_EOF => return GetQueuedCompletionStatusResult.EOF, + .ABANDONED_WAIT_0 => return GetQueuedCompletionStatusResult.Aborted, + .OPERATION_ABORTED => return GetQueuedCompletionStatusResult.Cancelled, + .HANDLE_EOF => return GetQueuedCompletionStatusResult.EOF, else => |err| { if (std.debug.runtime_safety) { std.debug.panic("unexpected error: {}\n", .{err}); @@ -352,8 +352,8 @@ pub fn ReadFile(in_hFile: HANDLE, buffer: []u8) ReadFileError!usize { var amt_read: DWORD = undefined; if (kernel32.ReadFile(in_hFile, buffer.ptr + index, want_read_count, &amt_read, null) == 0) { switch (kernel32.GetLastError()) { - ERROR.OPERATION_ABORTED => continue, - ERROR.BROKEN_PIPE => return index, + .OPERATION_ABORTED => continue, + .BROKEN_PIPE => return index, else => |err| return unexpectedError(err), } } @@ -377,12 +377,12 @@ pub fn WriteFile(handle: HANDLE, bytes: []const u8) WriteFileError!void { // TODO replace this @intCast with a loop that writes all the bytes if (kernel32.WriteFile(handle, bytes.ptr, @intCast(u32, bytes.len), &bytes_written, null) == 0) { switch (kernel32.GetLastError()) { - ERROR.INVALID_USER_BUFFER => return error.SystemResources, - ERROR.NOT_ENOUGH_MEMORY => return error.SystemResources, - ERROR.OPERATION_ABORTED => return error.OperationAborted, - ERROR.NOT_ENOUGH_QUOTA => return error.SystemResources, - ERROR.IO_PENDING => unreachable, // this function is for blocking files only - ERROR.BROKEN_PIPE => return error.BrokenPipe, + .INVALID_USER_BUFFER => return error.SystemResources, + .NOT_ENOUGH_MEMORY => return error.SystemResources, + .OPERATION_ABORTED => return error.OperationAborted, + .NOT_ENOUGH_QUOTA => return error.SystemResources, + .IO_PENDING => unreachable, // this function is for blocking files only + .BROKEN_PIPE => return error.BrokenPipe, else => |err| return unexpectedError(err), } } @@ -456,12 +456,12 @@ pub fn DeleteFile(filename: []const u8) DeleteFileError!void { pub fn DeleteFileW(filename: [*:0]const u16) DeleteFileError!void { if (kernel32.DeleteFileW(filename) == 0) { switch (kernel32.GetLastError()) { - ERROR.FILE_NOT_FOUND => return error.FileNotFound, - ERROR.PATH_NOT_FOUND => return error.FileNotFound, - ERROR.ACCESS_DENIED => return error.AccessDenied, - ERROR.FILENAME_EXCED_RANGE => return error.NameTooLong, - ERROR.INVALID_PARAMETER => return error.NameTooLong, - ERROR.SHARING_VIOLATION => return error.FileBusy, + .FILE_NOT_FOUND => return error.FileNotFound, + .PATH_NOT_FOUND => return error.FileNotFound, + .ACCESS_DENIED => return error.AccessDenied, + .FILENAME_EXCED_RANGE => return error.NameTooLong, + .INVALID_PARAMETER => return error.NameTooLong, + .SHARING_VIOLATION => return error.FileBusy, else => |err| return unexpectedError(err), } } @@ -497,8 +497,8 @@ pub fn CreateDirectory(pathname: []const u8, attrs: ?*SECURITY_ATTRIBUTES) Creat pub fn CreateDirectoryW(pathname: [*:0]const u16, attrs: ?*SECURITY_ATTRIBUTES) CreateDirectoryError!void { if (kernel32.CreateDirectoryW(pathname, attrs) == 0) { switch (kernel32.GetLastError()) { - ERROR.ALREADY_EXISTS => return error.PathAlreadyExists, - ERROR.PATH_NOT_FOUND => return error.FileNotFound, + .ALREADY_EXISTS => return error.PathAlreadyExists, + .PATH_NOT_FOUND => return error.FileNotFound, else => |err| return unexpectedError(err), } } @@ -518,8 +518,8 @@ pub fn RemoveDirectory(dir_path: []const u8) RemoveDirectoryError!void { pub fn RemoveDirectoryW(dir_path_w: [*:0]const u16) RemoveDirectoryError!void { if (kernel32.RemoveDirectoryW(dir_path_w) == 0) { switch (kernel32.GetLastError()) { - ERROR.PATH_NOT_FOUND => return error.FileNotFound, - ERROR.DIR_NOT_EMPTY => return error.DirNotEmpty, + .PATH_NOT_FOUND => return error.FileNotFound, + .DIR_NOT_EMPTY => return error.DirNotEmpty, else => |err| return unexpectedError(err), } } @@ -550,8 +550,8 @@ pub fn SetFilePointerEx_BEGIN(handle: HANDLE, offset: u64) SetFilePointerError!v const ipos = @bitCast(LARGE_INTEGER, offset); if (kernel32.SetFilePointerEx(handle, ipos, null, FILE_BEGIN) == 0) { switch (kernel32.GetLastError()) { - ERROR.INVALID_PARAMETER => unreachable, - ERROR.INVALID_HANDLE => unreachable, + .INVALID_PARAMETER => unreachable, + .INVALID_HANDLE => unreachable, else => |err| return unexpectedError(err), } } @@ -561,8 +561,8 @@ pub fn SetFilePointerEx_BEGIN(handle: HANDLE, offset: u64) SetFilePointerError!v pub fn SetFilePointerEx_CURRENT(handle: HANDLE, offset: i64) SetFilePointerError!void { if (kernel32.SetFilePointerEx(handle, offset, null, FILE_CURRENT) == 0) { switch (kernel32.GetLastError()) { - ERROR.INVALID_PARAMETER => unreachable, - ERROR.INVALID_HANDLE => unreachable, + .INVALID_PARAMETER => unreachable, + .INVALID_HANDLE => unreachable, else => |err| return unexpectedError(err), } } @@ -572,8 +572,8 @@ pub fn SetFilePointerEx_CURRENT(handle: HANDLE, offset: i64) SetFilePointerError pub fn SetFilePointerEx_END(handle: HANDLE, offset: i64) SetFilePointerError!void { if (kernel32.SetFilePointerEx(handle, offset, null, FILE_END) == 0) { switch (kernel32.GetLastError()) { - ERROR.INVALID_PARAMETER => unreachable, - ERROR.INVALID_HANDLE => unreachable, + .INVALID_PARAMETER => unreachable, + .INVALID_HANDLE => unreachable, else => |err| return unexpectedError(err), } } @@ -584,8 +584,8 @@ pub fn SetFilePointerEx_CURRENT_get(handle: HANDLE) SetFilePointerError!u64 { var result: LARGE_INTEGER = undefined; if (kernel32.SetFilePointerEx(handle, 0, &result, FILE_CURRENT) == 0) { switch (kernel32.GetLastError()) { - ERROR.INVALID_PARAMETER => unreachable, - ERROR.INVALID_HANDLE => unreachable, + .INVALID_PARAMETER => unreachable, + .INVALID_HANDLE => unreachable, else => |err| return unexpectedError(err), } } @@ -610,11 +610,11 @@ pub fn GetFinalPathNameByHandleW( const rc = kernel32.GetFinalPathNameByHandleW(hFile, buf_ptr, buf_len, flags); if (rc == 0) { switch (kernel32.GetLastError()) { - ERROR.FILE_NOT_FOUND => return error.FileNotFound, - ERROR.PATH_NOT_FOUND => return error.FileNotFound, - ERROR.NOT_ENOUGH_MEMORY => return error.SystemResources, - ERROR.FILENAME_EXCED_RANGE => return error.NameTooLong, - ERROR.INVALID_PARAMETER => unreachable, + .FILE_NOT_FOUND => return error.FileNotFound, + .PATH_NOT_FOUND => return error.FileNotFound, + .NOT_ENOUGH_MEMORY => return error.SystemResources, + .FILENAME_EXCED_RANGE => return error.NameTooLong, + .INVALID_PARAMETER => unreachable, else => |err| return unexpectedError(err), } } @@ -648,9 +648,9 @@ pub fn GetFileAttributesW(lpFileName: [*:0]const u16) GetFileAttributesError!DWO const rc = kernel32.GetFileAttributesW(lpFileName); if (rc == INVALID_FILE_ATTRIBUTES) { switch (kernel32.GetLastError()) { - ERROR.FILE_NOT_FOUND => return error.FileNotFound, - ERROR.PATH_NOT_FOUND => return error.FileNotFound, - ERROR.ACCESS_DENIED => return error.PermissionDenied, + .FILE_NOT_FOUND => return error.FileNotFound, + .PATH_NOT_FOUND => return error.FileNotFound, + .ACCESS_DENIED => return error.PermissionDenied, else => |err| return unexpectedError(err), } } @@ -800,7 +800,7 @@ pub fn GetEnvironmentVariableW(lpName: LPWSTR, lpBuffer: [*]u16, nSize: DWORD) G const rc = kernel32.GetEnvironmentVariableW(lpName, lpBuffer, nSize); if (rc == 0) { switch (kernel32.GetLastError()) { - ERROR.ENVVAR_NOT_FOUND => return error.EnvironmentVariableNotFound, + .ENVVAR_NOT_FOUND => return error.EnvironmentVariableNotFound, else => |err| return unexpectedError(err), } } @@ -839,11 +839,11 @@ pub fn CreateProcessW( lpProcessInformation, ) == 0) { switch (kernel32.GetLastError()) { - ERROR.FILE_NOT_FOUND => return error.FileNotFound, - ERROR.PATH_NOT_FOUND => return error.FileNotFound, - ERROR.ACCESS_DENIED => return error.AccessDenied, - ERROR.INVALID_PARAMETER => unreachable, - ERROR.INVALID_NAME => return error.InvalidName, + .FILE_NOT_FOUND => return error.FileNotFound, + .PATH_NOT_FOUND => return error.FileNotFound, + .ACCESS_DENIED => return error.AccessDenied, + .INVALID_PARAMETER => unreachable, + .INVALID_NAME => return error.InvalidName, else => |err| return unexpectedError(err), } } @@ -857,9 +857,9 @@ pub const LoadLibraryError = error{ pub fn LoadLibraryW(lpLibFileName: [*:0]const u16) LoadLibraryError!HMODULE { return kernel32.LoadLibraryW(lpLibFileName) orelse { switch (kernel32.GetLastError()) { - ERROR.FILE_NOT_FOUND => return error.FileNotFound, - ERROR.PATH_NOT_FOUND => return error.FileNotFound, - ERROR.MOD_NOT_FOUND => return error.FileNotFound, + .FILE_NOT_FOUND => return error.FileNotFound, + .PATH_NOT_FOUND => return error.FileNotFound, + .MOD_NOT_FOUND => return error.FileNotFound, else => |err| return unexpectedError(err), } }; @@ -1036,21 +1036,21 @@ inline fn MAKELANGID(p: c_ushort, s: c_ushort) LANGID { /// Call this when you made a windows DLL call or something that does SetLastError /// and you get an unexpected error. -pub fn unexpectedError(err: DWORD) std.os.UnexpectedError { +pub fn unexpectedError(err: Win32Error) std.os.UnexpectedError { if (std.os.unexpected_error_tracing) { // 614 is the length of the longest windows error desciption var buf_u16: [614]u16 = undefined; var buf_u8: [614]u8 = undefined; var len = kernel32.FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, null, err, MAKELANGID(LANG.NEUTRAL, SUBLANG.DEFAULT), buf_u16[0..].ptr, buf_u16.len / @sizeOf(TCHAR), null); _ = std.unicode.utf16leToUtf8(&buf_u8, buf_u16[0..len]) catch unreachable; - std.debug.warn("error.Unexpected: GetLastError({}): {}\n", .{ err, buf_u8[0..len] }); + std.debug.warn("error.Unexpected: GetLastError({}): {}\n", .{ @enumToInt(err), buf_u8[0..len] }); std.debug.dumpCurrentStackTrace(null); } return error.Unexpected; } pub fn unexpectedWSAError(err: c_int) std.os.UnexpectedError { - return unexpectedError(@intCast(DWORD, err)); + return unexpectedError(@intToEnum(Win32Error, @intCast(u16, err))); } /// Call this when you made a windows NtDll call diff --git a/lib/std/os/windows/bits.zig b/lib/std/os/windows/bits.zig index ffd3bb4f1..a3a279628 100644 --- a/lib/std/os/windows/bits.zig +++ b/lib/std/os/windows/bits.zig @@ -5,7 +5,7 @@ const std = @import("../../std.zig"); const assert = std.debug.assert; const maxInt = std.math.maxInt; -pub const ERROR = @import("error.zig"); +pub usingnamespace @import("win32error.zig"); pub usingnamespace @import("ntstatus.zig"); pub const LANG = @import("lang.zig"); pub const SUBLANG = @import("sublang.zig"); diff --git a/lib/std/os/windows/error.zig b/lib/std/os/windows/error.zig deleted file mode 100644 index f90945d00..000000000 --- a/lib/std/os/windows/error.zig +++ /dev/null @@ -1,3567 +0,0 @@ -/// The operation completed successfully. -pub const SUCCESS = 0; - -/// Incorrect function. -pub const INVALID_FUNCTION = 1; - -/// The system cannot find the file specified. -pub const FILE_NOT_FOUND = 2; - -/// The system cannot find the path specified. -pub const PATH_NOT_FOUND = 3; - -/// The system cannot open the file. -pub const TOO_MANY_OPEN_FILES = 4; - -/// Access is denied. -pub const ACCESS_DENIED = 5; - -/// The handle is invalid. -pub const INVALID_HANDLE = 6; - -/// The storage control blocks were destroyed. -pub const ARENA_TRASHED = 7; - -/// Not enough storage is available to process this command. -pub const NOT_ENOUGH_MEMORY = 8; - -/// The storage control block address is invalid. -pub const INVALID_BLOCK = 9; - -/// The environment is incorrect. -pub const BAD_ENVIRONMENT = 10; - -/// An attempt was made to load a program with an incorrect format. -pub const BAD_FORMAT = 11; - -/// The access code is invalid. -pub const INVALID_ACCESS = 12; - -/// The data is invalid. -pub const INVALID_DATA = 13; - -/// Not enough storage is available to complete this operation. -pub const OUTOFMEMORY = 14; - -/// The system cannot find the drive specified. -pub const INVALID_DRIVE = 15; - -/// The directory cannot be removed. -pub const CURRENT_DIRECTORY = 16; - -/// The system cannot move the file to a different disk drive. -pub const NOT_SAME_DEVICE = 17; - -/// There are no more files. -pub const NO_MORE_FILES = 18; - -/// The media is write protected. -pub const WRITE_PROTECT = 19; - -/// The system cannot find the device specified. -pub const BAD_UNIT = 20; - -/// The device is not ready. -pub const NOT_READY = 21; - -/// The device does not recognize the command. -pub const BAD_COMMAND = 22; - -/// Data error (cyclic redundancy check). -pub const CRC = 23; - -/// The program issued a command but the command length is incorrect. -pub const BAD_LENGTH = 24; - -/// The drive cannot locate a specific area or track on the disk. -pub const SEEK = 25; - -/// The specified disk or diskette cannot be accessed. -pub const NOT_DOS_DISK = 26; - -/// The drive cannot find the sector requested. -pub const SECTOR_NOT_FOUND = 27; - -/// The printer is out of paper. -pub const OUT_OF_PAPER = 28; - -/// The system cannot write to the specified device. -pub const WRITE_FAULT = 29; - -/// The system cannot read from the specified device. -pub const READ_FAULT = 30; - -/// A device attached to the system is not functioning. -pub const GEN_FAILURE = 31; - -/// The process cannot access the file because it is being used by another process. -pub const SHARING_VIOLATION = 32; - -/// The process cannot access the file because another process has locked a portion of the file. -pub const LOCK_VIOLATION = 33; - -/// The wrong diskette is in the drive. Insert %2 (Volume Serial Number: %3) into drive %1. -pub const WRONG_DISK = 34; - -/// Too many files opened for sharing. -pub const SHARING_BUFFER_EXCEEDED = 36; - -/// Reached the end of the file. -pub const HANDLE_EOF = 38; - -/// The disk is full. -pub const HANDLE_DISK_FULL = 39; - -/// The request is not supported. -pub const NOT_SUPPORTED = 50; - -/// Windows cannot find the network path. Verify that the network path is correct and the destination computer is not busy or turned off. If Windows still cannot find the network path, contact your network administrator. -pub const REM_NOT_LIST = 51; - -/// You were not connected because a duplicate name exists on the network. If joining a domain, go to System in Control Panel to change the computer name and try again. If joining a workgroup, choose another workgroup name. -pub const DUP_NAME = 52; - -/// The network path was not found. -pub const BAD_NETPATH = 53; - -/// The network is busy. -pub const NETWORK_BUSY = 54; - -/// The specified network resource or device is no longer available. -pub const DEV_NOT_EXIST = 55; - -/// The network BIOS command limit has been reached. -pub const TOO_MANY_CMDS = 56; - -/// A network adapter hardware error occurred. -pub const ADAP_HDW_ERR = 57; - -/// The specified server cannot perform the requested operation. -pub const BAD_NET_RESP = 58; - -/// An unexpected network error occurred. -pub const UNEXP_NET_ERR = 59; - -/// The remote adapter is not compatible. -pub const BAD_REM_ADAP = 60; - -/// The printer queue is full. -pub const PRINTQ_FULL = 61; - -/// Space to store the file waiting to be printed is not available on the server. -pub const NO_SPOOL_SPACE = 62; - -/// Your file waiting to be printed was deleted. -pub const PRINT_CANCELLED = 63; - -/// The specified network name is no longer available. -pub const NETNAME_DELETED = 64; - -/// Network access is denied. -pub const NETWORK_ACCESS_DENIED = 65; - -/// The network resource type is not correct. -pub const BAD_DEV_TYPE = 66; - -/// The network name cannot be found. -pub const BAD_NET_NAME = 67; - -/// The name limit for the local computer network adapter card was exceeded. -pub const TOO_MANY_NAMES = 68; - -/// The network BIOS session limit was exceeded. -pub const TOO_MANY_SESS = 69; - -/// The remote server has been paused or is in the process of being started. -pub const SHARING_PAUSED = 70; - -/// No more connections can be made to this remote computer at this time because there are already as many connections as the computer can accept. -pub const REQ_NOT_ACCEP = 71; - -/// The specified printer or disk device has been paused. -pub const REDIR_PAUSED = 72; - -/// The file exists. -pub const FILE_EXISTS = 80; - -/// The directory or file cannot be created. -pub const CANNOT_MAKE = 82; - -/// Fail on INT 24. -pub const FAIL_I24 = 83; - -/// Storage to process this request is not available. -pub const OUT_OF_STRUCTURES = 84; - -/// The local device name is already in use. -pub const ALREADY_ASSIGNED = 85; - -/// The specified network password is not correct. -pub const INVALID_PASSWORD = 86; - -/// The parameter is incorrect. -pub const INVALID_PARAMETER = 87; - -/// A write fault occurred on the network. -pub const NET_WRITE_FAULT = 88; - -/// The system cannot start another process at this time. -pub const NO_PROC_SLOTS = 89; - -/// Cannot create another system semaphore. -pub const TOO_MANY_SEMAPHORES = 100; - -/// The exclusive semaphore is owned by another process. -pub const EXCL_SEM_ALREADY_OWNED = 101; - -/// The semaphore is set and cannot be closed. -pub const SEM_IS_SET = 102; - -/// The semaphore cannot be set again. -pub const TOO_MANY_SEM_REQUESTS = 103; - -/// Cannot request exclusive semaphores at interrupt time. -pub const INVALID_AT_INTERRUPT_TIME = 104; - -/// The previous ownership of this semaphore has ended. -pub const SEM_OWNER_DIED = 105; - -/// Insert the diskette for drive %1. -pub const SEM_USER_LIMIT = 106; - -/// The program stopped because an alternate diskette was not inserted. -pub const DISK_CHANGE = 107; - -/// The disk is in use or locked by another process. -pub const DRIVE_LOCKED = 108; - -/// The pipe has been ended. -pub const BROKEN_PIPE = 109; - -/// The system cannot open the device or file specified. -pub const OPEN_FAILED = 110; - -/// The file name is too long. -pub const BUFFER_OVERFLOW = 111; - -/// There is not enough space on the disk. -pub const DISK_FULL = 112; - -/// No more internal file identifiers available. -pub const NO_MORE_SEARCH_HANDLES = 113; - -/// The target internal file identifier is incorrect. -pub const INVALID_TARGET_HANDLE = 114; - -/// The IOCTL call made by the application program is not correct. -pub const INVALID_CATEGORY = 117; - -/// The verify-on-write switch parameter value is not correct. -pub const INVALID_VERIFY_SWITCH = 118; - -/// The system does not support the command requested. -pub const BAD_DRIVER_LEVEL = 119; - -/// This function is not supported on this system. -pub const CALL_NOT_IMPLEMENTED = 120; - -/// The semaphore timeout period has expired. -pub const SEM_TIMEOUT = 121; - -/// The data area passed to a system call is too small. -pub const INSUFFICIENT_BUFFER = 122; - -/// The filename, directory name, or volume label syntax is incorrect. -pub const INVALID_NAME = 123; - -/// The system call level is not correct. -pub const INVALID_LEVEL = 124; - -/// The disk has no volume label. -pub const NO_VOLUME_LABEL = 125; - -/// The specified module could not be found. -pub const MOD_NOT_FOUND = 126; - -/// The specified procedure could not be found. -pub const PROC_NOT_FOUND = 127; - -/// There are no child processes to wait for. -pub const WAIT_NO_CHILDREN = 128; - -/// The %1 application cannot be run in Win32 mode. -pub const CHILD_NOT_COMPLETE = 129; - -/// Attempt to use a file handle to an open disk partition for an operation other than raw disk I/O. -pub const DIRECT_ACCESS_HANDLE = 130; - -/// An attempt was made to move the file pointer before the beginning of the file. -pub const NEGATIVE_SEEK = 131; - -/// The file pointer cannot be set on the specified device or file. -pub const SEEK_ON_DEVICE = 132; - -/// A JOIN or SUBST command cannot be used for a drive that contains previously joined drives. -pub const IS_JOIN_TARGET = 133; - -/// An attempt was made to use a JOIN or SUBST command on a drive that has already been joined. -pub const IS_JOINED = 134; - -/// An attempt was made to use a JOIN or SUBST command on a drive that has already been substituted. -pub const IS_SUBSTED = 135; - -/// The system tried to delete the JOIN of a drive that is not joined. -pub const NOT_JOINED = 136; - -/// The system tried to delete the substitution of a drive that is not substituted. -pub const NOT_SUBSTED = 137; - -/// The system tried to join a drive to a directory on a joined drive. -pub const JOIN_TO_JOIN = 138; - -/// The system tried to substitute a drive to a directory on a substituted drive. -pub const SUBST_TO_SUBST = 139; - -/// The system tried to join a drive to a directory on a substituted drive. -pub const JOIN_TO_SUBST = 140; - -/// The system tried to SUBST a drive to a directory on a joined drive. -pub const SUBST_TO_JOIN = 141; - -/// The system cannot perform a JOIN or SUBST at this time. -pub const BUSY_DRIVE = 142; - -/// The system cannot join or substitute a drive to or for a directory on the same drive. -pub const SAME_DRIVE = 143; - -/// The directory is not a subdirectory of the root directory. -pub const DIR_NOT_ROOT = 144; - -/// The directory is not empty. -pub const DIR_NOT_EMPTY = 145; - -/// The path specified is being used in a substitute. -pub const IS_SUBST_PATH = 146; - -/// Not enough resources are available to process this command. -pub const IS_JOIN_PATH = 147; - -/// The path specified cannot be used at this time. -pub const PATH_BUSY = 148; - -/// An attempt was made to join or substitute a drive for which a directory on the drive is the target of a previous substitute. -pub const IS_SUBST_TARGET = 149; - -/// System trace information was not specified in your CONFIG.SYS file, or tracing is disallowed. -pub const SYSTEM_TRACE = 150; - -/// The number of specified semaphore events for DosMuxSemWait is not correct. -pub const INVALID_EVENT_COUNT = 151; - -/// DosMuxSemWait did not execute; too many semaphores are already set. -pub const TOO_MANY_MUXWAITERS = 152; - -/// The DosMuxSemWait list is not correct. -pub const INVALID_LIST_FORMAT = 153; - -/// The volume label you entered exceeds the label character limit of the target file system. -pub const LABEL_TOO_LONG = 154; - -/// Cannot create another thread. -pub const TOO_MANY_TCBS = 155; - -/// The recipient process has refused the signal. -pub const SIGNAL_REFUSED = 156; - -/// The segment is already discarded and cannot be locked. -pub const DISCARDED = 157; - -/// The segment is already unlocked. -pub const NOT_LOCKED = 158; - -/// The address for the thread ID is not correct. -pub const BAD_THREADID_ADDR = 159; - -/// One or more arguments are not correct. -pub const BAD_ARGUMENTS = 160; - -/// The specified path is invalid. -pub const BAD_PATHNAME = 161; - -/// A signal is already pending. -pub const SIGNAL_PENDING = 162; - -/// No more threads can be created in the system. -pub const MAX_THRDS_REACHED = 164; - -/// Unable to lock a region of a file. -pub const LOCK_FAILED = 167; - -/// The requested resource is in use. -pub const BUSY = 170; - -/// Device's command support detection is in progress. -pub const DEVICE_SUPPORT_IN_PROGRESS = 171; - -/// A lock request was not outstanding for the supplied cancel region. -pub const CANCEL_VIOLATION = 173; - -/// The file system does not support atomic changes to the lock type. -pub const ATOMIC_LOCKS_NOT_SUPPORTED = 174; - -/// The system detected a segment number that was not correct. -pub const INVALID_SEGMENT_NUMBER = 180; - -/// The operating system cannot run %1. -pub const INVALID_ORDINAL = 182; - -/// Cannot create a file when that file already exists. -pub const ALREADY_EXISTS = 183; - -/// The flag passed is not correct. -pub const INVALID_FLAG_NUMBER = 186; - -/// The specified system semaphore name was not found. -pub const SEM_NOT_FOUND = 187; - -/// The operating system cannot run %1. -pub const INVALID_STARTING_CODESEG = 188; - -/// The operating system cannot run %1. -pub const INVALID_STACKSEG = 189; - -/// The operating system cannot run %1. -pub const INVALID_MODULETYPE = 190; - -/// Cannot run %1 in Win32 mode. -pub const INVALID_EXE_SIGNATURE = 191; - -/// The operating system cannot run %1. -pub const EXE_MARKED_INVALID = 192; - -/// %1 is not a valid Win32 application. -pub const BAD_EXE_FORMAT = 193; - -/// The operating system cannot run %1. -pub const ITERATED_DATA_EXCEEDS_64k = 194; - -/// The operating system cannot run %1. -pub const INVALID_MINALLOCSIZE = 195; - -/// The operating system cannot run this application program. -pub const DYNLINK_FROM_INVALID_RING = 196; - -/// The operating system is not presently configured to run this application. -pub const IOPL_NOT_ENABLED = 197; - -/// The operating system cannot run %1. -pub const INVALID_SEGDPL = 198; - -/// The operating system cannot run this application program. -pub const AUTODATASEG_EXCEEDS_64k = 199; - -/// The code segment cannot be greater than or equal to 64K. -pub const RING2SEG_MUST_BE_MOVABLE = 200; - -/// The operating system cannot run %1. -pub const RELOC_CHAIN_XEEDS_SEGLIM = 201; - -/// The operating system cannot run %1. -pub const INFLOOP_IN_RELOC_CHAIN = 202; - -/// The system could not find the environment option that was entered. -pub const ENVVAR_NOT_FOUND = 203; - -/// No process in the command subtree has a signal handler. -pub const NO_SIGNAL_SENT = 205; - -/// The filename or extension is too long. -pub const FILENAME_EXCED_RANGE = 206; - -/// The ring 2 stack is in use. -pub const RING2_STACK_IN_USE = 207; - -/// The global filename characters, * or ?, are entered incorrectly or too many global filename characters are specified. -pub const META_EXPANSION_TOO_LONG = 208; - -/// The signal being posted is not correct. -pub const INVALID_SIGNAL_NUMBER = 209; - -/// The signal handler cannot be set. -pub const THREAD_1_INACTIVE = 210; - -/// The segment is locked and cannot be reallocated. -pub const LOCKED = 212; - -/// Too many dynamic-link modules are attached to this program or dynamic-link module. -pub const TOO_MANY_MODULES = 214; - -/// Cannot nest calls to LoadModule. -pub const NESTING_NOT_ALLOWED = 215; - -/// This version of %1 is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher. -pub const EXE_MACHINE_TYPE_MISMATCH = 216; - -/// The image file %1 is signed, unable to modify. -pub const EXE_CANNOT_MODIFY_SIGNED_BINARY = 217; - -/// The image file %1 is strong signed, unable to modify. -pub const EXE_CANNOT_MODIFY_STRONG_SIGNED_BINARY = 218; - -/// This file is checked out or locked for editing by another user. -pub const FILE_CHECKED_OUT = 220; - -/// The file must be checked out before saving changes. -pub const CHECKOUT_REQUIRED = 221; - -/// The file type being saved or retrieved has been blocked. -pub const BAD_FILE_TYPE = 222; - -/// The file size exceeds the limit allowed and cannot be saved. -pub const FILE_TOO_LARGE = 223; - -/// Access Denied. Before opening files in this location, you must first add the web site to your trusted sites list, browse to the web site, and select the option to login automatically. -pub const FORMS_AUTH_REQUIRED = 224; - -/// Operation did not complete successfully because the file contains a virus or potentially unwanted software. -pub const VIRUS_INFECTED = 225; - -/// This file contains a virus or potentially unwanted software and cannot be opened. Due to the nature of this virus or potentially unwanted software, the file has been removed from this location. -pub const VIRUS_DELETED = 226; - -/// The pipe is local. -pub const PIPE_LOCAL = 229; - -/// The pipe state is invalid. -pub const BAD_PIPE = 230; - -/// All pipe instances are busy. -pub const PIPE_BUSY = 231; - -/// The pipe is being closed. -pub const NO_DATA = 232; - -/// No process is on the other end of the pipe. -pub const PIPE_NOT_CONNECTED = 233; - -/// More data is available. -pub const MORE_DATA = 234; - -/// The session was canceled. -pub const VC_DISCONNECTED = 240; - -/// The specified extended attribute name was invalid. -pub const INVALID_EA_NAME = 254; - -/// The extended attributes are inconsistent. -pub const EA_LIST_INCONSISTENT = 255; - -/// The wait operation timed out. -pub const IMEOUT = 258; - -/// No more data is available. -pub const NO_MORE_ITEMS = 259; - -/// The copy functions cannot be used. -pub const CANNOT_COPY = 266; - -/// The directory name is invalid. -pub const DIRECTORY = 267; - -/// The extended attributes did not fit in the buffer. -pub const EAS_DIDNT_FIT = 275; - -/// The extended attribute file on the mounted file system is corrupt. -pub const EA_FILE_CORRUPT = 276; - -/// The extended attribute table file is full. -pub const EA_TABLE_FULL = 277; - -/// The specified extended attribute handle is invalid. -pub const INVALID_EA_HANDLE = 278; - -/// The mounted file system does not support extended attributes. -pub const EAS_NOT_SUPPORTED = 282; - -/// Attempt to release mutex not owned by caller. -pub const NOT_OWNER = 288; - -/// Too many posts were made to a semaphore. -pub const TOO_MANY_POSTS = 298; - -/// Only part of a ReadProcessMemory or WriteProcessMemory request was completed. -pub const PARTIAL_COPY = 299; - -/// The oplock request is denied. -pub const OPLOCK_NOT_GRANTED = 300; - -/// An invalid oplock acknowledgment was received by the system. -pub const INVALID_OPLOCK_PROTOCOL = 301; - -/// The volume is too fragmented to complete this operation. -pub const DISK_TOO_FRAGMENTED = 302; - -/// The file cannot be opened because it is in the process of being deleted. -pub const DELETE_PENDING = 303; - -/// Short name settings may not be changed on this volume due to the global registry setting. -pub const INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING = 304; - -/// Short names are not enabled on this volume. -pub const SHORT_NAMES_NOT_ENABLED_ON_VOLUME = 305; - -/// The security stream for the given volume is in an inconsistent state. Please run CHKDSK on the volume. -pub const SECURITY_STREAM_IS_INCONSISTENT = 306; - -/// A requested file lock operation cannot be processed due to an invalid byte range. -pub const INVALID_LOCK_RANGE = 307; - -/// The subsystem needed to support the image type is not present. -pub const IMAGE_SUBSYSTEM_NOT_PRESENT = 308; - -/// The specified file already has a notification GUID associated with it. -pub const NOTIFICATION_GUID_ALREADY_DEFINED = 309; - -/// An invalid exception handler routine has been detected. -pub const INVALID_EXCEPTION_HANDLER = 310; - -/// Duplicate privileges were specified for the token. -pub const DUPLICATE_PRIVILEGES = 311; - -/// No ranges for the specified operation were able to be processed. -pub const NO_RANGES_PROCESSED = 312; - -/// Operation is not allowed on a file system internal file. -pub const NOT_ALLOWED_ON_SYSTEM_FILE = 313; - -/// The physical resources of this disk have been exhausted. -pub const DISK_RESOURCES_EXHAUSTED = 314; - -/// The token representing the data is invalid. -pub const INVALID_TOKEN = 315; - -/// The device does not support the command feature. -pub const DEVICE_FEATURE_NOT_SUPPORTED = 316; - -/// The system cannot find message text for message number 0x%1 in the message file for %2. -pub const MR_MID_NOT_FOUND = 317; - -/// The scope specified was not found. -pub const SCOPE_NOT_FOUND = 318; - -/// The Central Access Policy specified is not defined on the target machine. -pub const UNDEFINED_SCOPE = 319; - -/// The Central Access Policy obtained from Active Directory is invalid. -pub const INVALID_CAP = 320; - -/// The device is unreachable. -pub const DEVICE_UNREACHABLE = 321; - -/// The target device has insufficient resources to complete the operation. -pub const DEVICE_NO_RESOURCES = 322; - -/// A data integrity checksum error occurred. Data in the file stream is corrupt. -pub const DATA_CHECKSUM_ERROR = 323; - -/// An attempt was made to modify both a KERNEL and normal Extended Attribute (EA) in the same operation. -pub const INTERMIXED_KERNEL_EA_OPERATION = 324; - -/// Device does not support file-level TRIM. -pub const FILE_LEVEL_TRIM_NOT_SUPPORTED = 326; - -/// The command specified a data offset that does not align to the device's granularity/alignment. -pub const OFFSET_ALIGNMENT_VIOLATION = 327; - -/// The command specified an invalid field in its parameter list. -pub const INVALID_FIELD_IN_PARAMETER_LIST = 328; - -/// An operation is currently in progress with the device. -pub const OPERATION_IN_PROGRESS = 329; - -/// An attempt was made to send down the command via an invalid path to the target device. -pub const BAD_DEVICE_PATH = 330; - -/// The command specified a number of descriptors that exceeded the maximum supported by the device. -pub const TOO_MANY_DESCRIPTORS = 331; - -/// Scrub is disabled on the specified file. -pub const SCRUB_DATA_DISABLED = 332; - -/// The storage device does not provide redundancy. -pub const NOT_REDUNDANT_STORAGE = 333; - -/// An operation is not supported on a resident file. -pub const RESIDENT_FILE_NOT_SUPPORTED = 334; - -/// An operation is not supported on a compressed file. -pub const COMPRESSED_FILE_NOT_SUPPORTED = 335; - -/// An operation is not supported on a directory. -pub const DIRECTORY_NOT_SUPPORTED = 336; - -/// The specified copy of the requested data could not be read. -pub const NOT_READ_FROM_COPY = 337; - -/// No action was taken as a system reboot is required. -pub const FAIL_NOACTION_REBOOT = 350; - -/// The shutdown operation failed. -pub const FAIL_SHUTDOWN = 351; - -/// The restart operation failed. -pub const FAIL_RESTART = 352; - -/// The maximum number of sessions has been reached. -pub const MAX_SESSIONS_REACHED = 353; - -/// The thread is already in background processing mode. -pub const THREAD_MODE_ALREADY_BACKGROUND = 400; - -/// The thread is not in background processing mode. -pub const THREAD_MODE_NOT_BACKGROUND = 401; - -/// The process is already in background processing mode. -pub const PROCESS_MODE_ALREADY_BACKGROUND = 402; - -/// The process is not in background processing mode. -pub const PROCESS_MODE_NOT_BACKGROUND = 403; - -/// Attempt to access invalid address. -pub const INVALID_ADDRESS = 487; - -/// User profile cannot be loaded. -pub const USER_PROFILE_LOAD = 500; - -/// Arithmetic result exceeded 32 bits. -pub const ARITHMETIC_OVERFLOW = 534; - -/// There is a process on other end of the pipe. -pub const PIPE_CONNECTED = 535; - -/// Waiting for a process to open the other end of the pipe. -pub const PIPE_LISTENING = 536; - -/// Application verifier has found an error in the current process. -pub const VERIFIER_STOP = 537; - -/// An error occurred in the ABIOS subsystem. -pub const ABIOS_ERROR = 538; - -/// A warning occurred in the WX86 subsystem. -pub const WX86_WARNING = 539; - -/// An error occurred in the WX86 subsystem. -pub const WX86_ERROR = 540; - -/// An attempt was made to cancel or set a timer that has an associated APC and the subject thread is not the thread that originally set the timer with an associated APC routine. -pub const TIMER_NOT_CANCELED = 541; - -/// Unwind exception code. -pub const UNWIND = 542; - -/// An invalid or unaligned stack was encountered during an unwind operation. -pub const BAD_STACK = 543; - -/// An invalid unwind target was encountered during an unwind operation. -pub const INVALID_UNWIND_TARGET = 544; - -/// Invalid Object Attributes specified to NtCreatePort or invalid Port Attributes specified to NtConnectPort -pub const INVALID_PORT_ATTRIBUTES = 545; - -/// Length of message passed to NtRequestPort or NtRequestWaitReplyPort was longer than the maximum message allowed by the port. -pub const PORT_MESSAGE_TOO_LONG = 546; - -/// An attempt was made to lower a quota limit below the current usage. -pub const INVALID_QUOTA_LOWER = 547; - -/// An attempt was made to attach to a device that was already attached to another device. -pub const DEVICE_ALREADY_ATTACHED = 548; - -/// An attempt was made to execute an instruction at an unaligned address and the host system does not support unaligned instruction references. -pub const INSTRUCTION_MISALIGNMENT = 549; - -/// Profiling not started. -pub const PROFILING_NOT_STARTED = 550; - -/// Profiling not stopped. -pub const PROFILING_NOT_STOPPED = 551; - -/// The passed ACL did not contain the minimum required information. -pub const COULD_NOT_INTERPRET = 552; - -/// The number of active profiling objects is at the maximum and no more may be started. -pub const PROFILING_AT_LIMIT = 553; - -/// Used to indicate that an operation cannot continue without blocking for I/O. -pub const CANT_WAIT = 554; - -/// Indicates that a thread attempted to terminate itself by default (called NtTerminateThread with NULL) and it was the last thread in the current process. -pub const CANT_TERMINATE_SELF = 555; - -/// If an MM error is returned which is not defined in the standard FsRtl filter, it is converted to one of the following errors which is guaranteed to be in the filter. In this case information is lost, however, the filter correctly handles the exception. -pub const UNEXPECTED_MM_CREATE_ERR = 556; - -/// If an MM error is returned which is not defined in the standard FsRtl filter, it is converted to one of the following errors which is guaranteed to be in the filter. In this case information is lost, however, the filter correctly handles the exception. -pub const UNEXPECTED_MM_MAP_ERROR = 557; - -/// If an MM error is returned which is not defined in the standard FsRtl filter, it is converted to one of the following errors which is guaranteed to be in the filter. In this case information is lost, however, the filter correctly handles the exception. -pub const UNEXPECTED_MM_EXTEND_ERR = 558; - -/// A malformed function table was encountered during an unwind operation. -pub const BAD_FUNCTION_TABLE = 559; - -/// Indicates that an attempt was made to assign protection to a file system file or directory and one of the SIDs in the security descriptor could not be translated into a GUID that could be stored by the file system. This causes the protection attempt to fail, which may cause a file creation attempt to fail. -pub const NO_GUID_TRANSLATION = 560; - -/// Indicates that an attempt was made to grow an LDT by setting its size, or that the size was not an even number of selectors. -pub const INVALID_LDT_SIZE = 561; - -/// Indicates that the starting value for the LDT information was not an integral multiple of the selector size. -pub const INVALID_LDT_OFFSET = 563; - -/// Indicates that the user supplied an invalid descriptor when trying to set up Ldt descriptors. -pub const INVALID_LDT_DESCRIPTOR = 564; - -/// Indicates a process has too many threads to perform the requested action. For example, assignment of a primary token may only be performed when a process has zero or one threads. -pub const TOO_MANY_THREADS = 565; - -/// An attempt was made to operate on a thread within a specific process, but the thread specified is not in the process specified. -pub const THREAD_NOT_IN_PROCESS = 566; - -/// Page file quota was exceeded. -pub const PAGEFILE_QUOTA_EXCEEDED = 567; - -/// The Netlogon service cannot start because another Netlogon service running in the domain conflicts with the specified role. -pub const LOGON_SERVER_CONFLICT = 568; - -/// The SAM database on a Windows Server is significantly out of synchronization with the copy on the Domain Controller. A complete synchronization is required. -pub const SYNCHRONIZATION_REQUIRED = 569; - -/// The NtCreateFile API failed. This error should never be returned to an application, it is a place holder for the Windows Lan Manager Redirector to use in its internal error mapping routines. -pub const NET_OPEN_FAILED = 570; - -/// {Privilege Failed} The I/O permissions for the process could not be changed. -pub const IO_PRIVILEGE_FAILED = 571; - -/// {Application Exit by CTRL+C} The application terminated as a result of a CTRL+C. -pub const CONTROL_C_EXIT = 572; - -/// {Missing System File} The required system file %hs is bad or missing. -pub const MISSING_SYSTEMFILE = 573; - -/// {Application Error} The exception %s (0x%08lx) occurred in the application at location 0x%08lx. -pub const UNHANDLED_EXCEPTION = 574; - -/// {Application Error} The application was unable to start correctly (0x%lx). Click OK to close the application. -pub const APP_INIT_FAILURE = 575; - -/// {Unable to Create Paging File} The creation of the paging file %hs failed (%lx). The requested size was %ld. -pub const PAGEFILE_CREATE_FAILED = 576; - -/// Windows cannot verify the digital signature for this file. A recent hardware or software change might have installed a file that is signed incorrectly or damaged, or that might be malicious software from an unknown source. -pub const INVALID_IMAGE_HASH = 577; - -/// {No Paging File Specified} No paging file was specified in the system configuration. -pub const NO_PAGEFILE = 578; - -/// {EXCEPTION} A real-mode application issued a floating-point instruction and floating-point hardware is not present. -pub const ILLEGAL_FLOAT_CONTEXT = 579; - -/// An event pair synchronization operation was performed using the thread specific client/server event pair object, but no event pair object was associated with the thread. -pub const NO_EVENT_PAIR = 580; - -/// A Windows Server has an incorrect configuration. -pub const DOMAIN_CTRLR_CONFIG_ERROR = 581; - -/// An illegal character was encountered. For a multi-byte character set this includes a lead byte without a succeeding trail byte. For the Unicode character set this includes the characters 0xFFFF and 0xFFFE. -pub const ILLEGAL_CHARACTER = 582; - -/// The Unicode character is not defined in the Unicode character set installed on the system. -pub const UNDEFINED_CHARACTER = 583; - -/// The paging file cannot be created on a floppy diskette. -pub const FLOPPY_VOLUME = 584; - -/// The system BIOS failed to connect a system interrupt to the device or bus for which the device is connected. -pub const BIOS_FAILED_TO_CONNECT_INTERRUPT = 585; - -/// This operation is only allowed for the Primary Domain Controller of the domain. -pub const BACKUP_CONTROLLER = 586; - -/// An attempt was made to acquire a mutant such that its maximum count would have been exceeded. -pub const MUTANT_LIMIT_EXCEEDED = 587; - -/// A volume has been accessed for which a file system driver is required that has not yet been loaded. -pub const FS_DRIVER_REQUIRED = 588; - -/// {Registry File Failure} The registry cannot load the hive (file): %hs or its log or alternate. It is corrupt, absent, or not writable. -pub const CANNOT_LOAD_REGISTRY_FILE = 589; - -/// {Unexpected Failure in DebugActiveProcess} An unexpected failure occurred while processing a DebugActiveProcess API request. You may choose OK to terminate the process, or Cancel to ignore the error. -pub const DEBUG_ATTACH_FAILED = 590; - -/// {Fatal System Error} The %hs system process terminated unexpectedly with a status of 0x%08x (0x%08x 0x%08x). The system has been shut down. -pub const SYSTEM_PROCESS_TERMINATED = 591; - -/// {Data Not Accepted} The TDI client could not handle the data received during an indication. -pub const DATA_NOT_ACCEPTED = 592; - -/// NTVDM encountered a hard error. -pub const VDM_HARD_ERROR = 593; - -/// {Cancel Timeout} The driver %hs failed to complete a cancelled I/O request in the allotted time. -pub const DRIVER_CANCEL_TIMEOUT = 594; - -/// {Reply Message Mismatch} An attempt was made to reply to an LPC message, but the thread specified by the client ID in the message was not waiting on that message. -pub const REPLY_MESSAGE_MISMATCH = 595; - -/// {Delayed Write Failed} Windows was unable to save all the data for the file %hs. The data has been lost. This error may be caused by a failure of your computer hardware or network connection. Please try to save this file elsewhere. -pub const LOST_WRITEBEHIND_DATA = 596; - -/// The parameter(s) passed to the server in the client/server shared memory window were invalid. Too much data may have been put in the shared memory window. -pub const CLIENT_SERVER_PARAMETERS_INVALID = 597; - -/// The stream is not a tiny stream. -pub const NOT_TINY_STREAM = 598; - -/// The request must be handled by the stack overflow code. -pub const STACK_OVERFLOW_READ = 599; - -/// Internal OFS status codes indicating how an allocation operation is handled. Either it is retried after the containing onode is moved or the extent stream is converted to a large stream. -pub const CONVERT_TO_LARGE = 600; - -/// The attempt to find the object found an object matching by ID on the volume but it is out of the scope of the handle used for the operation. -pub const FOUND_OUT_OF_SCOPE = 601; - -/// The bucket array must be grown. Retry transaction after doing so. -pub const ALLOCATE_BUCKET = 602; - -/// The user/kernel marshalling buffer has overflowed. -pub const MARSHALL_OVERFLOW = 603; - -/// The supplied variant structure contains invalid data. -pub const INVALID_VARIANT = 604; - -/// The specified buffer contains ill-formed data. -pub const BAD_COMPRESSION_BUFFER = 605; - -/// {Audit Failed} An attempt to generate a security audit failed. -pub const AUDIT_FAILED = 606; - -/// The timer resolution was not previously set by the current process. -pub const TIMER_RESOLUTION_NOT_SET = 607; - -/// There is insufficient account information to log you on. -pub const INSUFFICIENT_LOGON_INFO = 608; - -/// {Invalid DLL Entrypoint} The dynamic link library %hs is not written correctly. The stack pointer has been left in an inconsistent state. The entrypoint should be declared as WINAPI or STDCALL. Select YES to fail the DLL load. Select NO to continue execution. Selecting NO may cause the application to operate incorrectly. -pub const BAD_DLL_ENTRYPOINT = 609; - -/// {Invalid Service Callback Entrypoint} The %hs service is not written correctly. The stack pointer has been left in an inconsistent state. The callback entrypoint should be declared as WINAPI or STDCALL. Selecting OK will cause the service to continue operation. However, the service process may operate incorrectly. -pub const BAD_SERVICE_ENTRYPOINT = 610; - -/// There is an IP address conflict with another system on the network. -pub const IP_ADDRESS_CONFLICT1 = 611; - -/// There is an IP address conflict with another system on the network. -pub const IP_ADDRESS_CONFLICT2 = 612; - -/// {Low On Registry Space} The system has reached the maximum size allowed for the system part of the registry. Additional storage requests will be ignored. -pub const REGISTRY_QUOTA_LIMIT = 613; - -/// A callback return system service cannot be executed when no callback is active. -pub const NO_CALLBACK_ACTIVE = 614; - -/// The password provided is too short to meet the policy of your user account. Please choose a longer password. -pub const PWD_TOO_SHORT = 615; - -/// The policy of your user account does not allow you to change passwords too frequently. This is done to prevent users from changing back to a familiar, but potentially discovered, password. If you feel your password has been compromised then please contact your administrator immediately to have a new one assigned. -pub const PWD_TOO_RECENT = 616; - -/// You have attempted to change your password to one that you have used in the past. The policy of your user account does not allow this. Please select a password that you have not previously used. -pub const PWD_HISTORY_CONFLICT = 617; - -/// The specified compression format is unsupported. -pub const UNSUPPORTED_COMPRESSION = 618; - -/// The specified hardware profile configuration is invalid. -pub const INVALID_HW_PROFILE = 619; - -/// The specified Plug and Play registry device path is invalid. -pub const INVALID_PLUGPLAY_DEVICE_PATH = 620; - -/// The specified quota list is internally inconsistent with its descriptor. -pub const QUOTA_LIST_INCONSISTENT = 621; - -/// {Windows Evaluation Notification} The evaluation period for this installation of Windows has expired. This system will shutdown in 1 hour. To restore access to this installation of Windows, please upgrade this installation using a licensed distribution of this product. -pub const EVALUATION_EXPIRATION = 622; - -/// {Illegal System DLL Relocation} The system DLL %hs was relocated in memory. The application will not run properly. The relocation occurred because the DLL %hs occupied an address range reserved for Windows system DLLs. The vendor supplying the DLL should be contacted for a new DLL. -pub const ILLEGAL_DLL_RELOCATION = 623; - -/// {DLL Initialization Failed} The application failed to initialize because the window station is shutting down. -pub const DLL_INIT_FAILED_LOGOFF = 624; - -/// The validation process needs to continue on to the next step. -pub const VALIDATE_CONTINUE = 625; - -/// There are no more matches for the current index enumeration. -pub const NO_MORE_MATCHES = 626; - -/// The range could not be added to the range list because of a conflict. -pub const RANGE_LIST_CONFLICT = 627; - -/// The server process is running under a SID different than that required by client. -pub const SERVER_SID_MISMATCH = 628; - -/// A group marked use for deny only cannot be enabled. -pub const CANT_ENABLE_DENY_ONLY = 629; - -/// {EXCEPTION} Multiple floating point faults. -pub const FLOAT_MULTIPLE_FAULTS = 630; - -/// {EXCEPTION} Multiple floating point traps. -pub const FLOAT_MULTIPLE_TRAPS = 631; - -/// The requested interface is not supported. -pub const NOINTERFACE = 632; - -/// {System Standby Failed} The driver %hs does not support standby mode. Updating this driver may allow the system to go to standby mode. -pub const DRIVER_FAILED_SLEEP = 633; - -/// The system file %1 has become corrupt and has been replaced. -pub const CORRUPT_SYSTEM_FILE = 634; - -/// {Virtual Memory Minimum Too Low} Your system is low on virtual memory. Windows is increasing the size of your virtual memory paging file. During this process, memory requests for some applications may be denied. For more information, see Help. -pub const COMMITMENT_MINIMUM = 635; - -/// A device was removed so enumeration must be restarted. -pub const PNP_RESTART_ENUMERATION = 636; - -/// {Fatal System Error} The system image %s is not properly signed. The file has been replaced with the signed file. The system has been shut down. -pub const SYSTEM_IMAGE_BAD_SIGNATURE = 637; - -/// Device will not start without a reboot. -pub const PNP_REBOOT_REQUIRED = 638; - -/// There is not enough power to complete the requested operation. -pub const INSUFFICIENT_POWER = 639; - -/// ERROR_MULTIPLE_FAULT_VIOLATION -pub const MULTIPLE_FAULT_VIOLATION = 640; - -/// The system is in the process of shutting down. -pub const SYSTEM_SHUTDOWN = 641; - -/// An attempt to remove a processes DebugPort was made, but a port was not already associated with the process. -pub const PORT_NOT_SET = 642; - -/// This version of Windows is not compatible with the behavior version of directory forest, domain or domain controller. -pub const DS_VERSION_CHECK_FAILURE = 643; - -/// The specified range could not be found in the range list. -pub const RANGE_NOT_FOUND = 644; - -/// The driver was not loaded because the system is booting into safe mode. -pub const NOT_SAFE_MODE_DRIVER = 646; - -/// The driver was not loaded because it failed its initialization call. -pub const FAILED_DRIVER_ENTRY = 647; - -/// The "%hs" encountered an error while applying power or reading the device configuration. This may be caused by a failure of your hardware or by a poor connection. -pub const DEVICE_ENUMERATION_ERROR = 648; - -/// The create operation failed because the name contained at least one mount point which resolves to a volume to which the specified device object is not attached. -pub const MOUNT_POINT_NOT_RESOLVED = 649; - -/// The device object parameter is either not a valid device object or is not attached to the volume specified by the file name. -pub const INVALID_DEVICE_OBJECT_PARAMETER = 650; - -/// A Machine Check Error has occurred. Please check the system eventlog for additional information. -pub const MCA_OCCURED = 651; - -/// There was error [%2] processing the driver database. -pub const DRIVER_DATABASE_ERROR = 652; - -/// System hive size has exceeded its limit. -pub const SYSTEM_HIVE_TOO_LARGE = 653; - -/// The driver could not be loaded because a previous version of the driver is still in memory. -pub const DRIVER_FAILED_PRIOR_UNLOAD = 654; - -/// {Volume Shadow Copy Service} Please wait while the Volume Shadow Copy Service prepares volume %hs for hibernation. -pub const VOLSNAP_PREPARE_HIBERNATE = 655; - -/// The system has failed to hibernate (The error code is %hs). Hibernation will be disabled until the system is restarted. -pub const HIBERNATION_FAILURE = 656; - -/// The password provided is too long to meet the policy of your user account. Please choose a shorter password. -pub const PWD_TOO_LONG = 657; - -/// The requested operation could not be completed due to a file system limitation. -pub const FILE_SYSTEM_LIMITATION = 665; - -/// An assertion failure has occurred. -pub const ASSERTION_FAILURE = 668; - -/// An error occurred in the ACPI subsystem. -pub const ACPI_ERROR = 669; - -/// WOW Assertion Error. -pub const WOW_ASSERTION = 670; - -/// A device is missing in the system BIOS MPS table. This device will not be used. Please contact your system vendor for system BIOS update. -pub const PNP_BAD_MPS_TABLE = 671; - -/// A translator failed to translate resources. -pub const PNP_TRANSLATION_FAILED = 672; - -/// A IRQ translator failed to translate resources. -pub const PNP_IRQ_TRANSLATION_FAILED = 673; - -/// Driver %2 returned invalid ID for a child device (%3). -pub const PNP_INVALID_ID = 674; - -/// {Kernel Debugger Awakened} the system debugger was awakened by an interrupt. -pub const WAKE_SYSTEM_DEBUGGER = 675; - -/// {Handles Closed} Handles to objects have been automatically closed as a result of the requested operation. -pub const HANDLES_CLOSED = 676; - -/// {Too Much Information} The specified access control list (ACL) contained more information than was expected. -pub const EXTRANEOUS_INFORMATION = 677; - -/// This warning level status indicates that the transaction state already exists for the registry sub-tree, but that a transaction commit was previously aborted. The commit has NOT been completed, but has not been rolled back either (so it may still be committed if desired). -pub const RXACT_COMMIT_NECESSARY = 678; - -/// {Media Changed} The media may have changed. -pub const MEDIA_CHECK = 679; - -/// {GUID Substitution} During the translation of a global identifier (GUID) to a Windows security ID (SID), no administratively-defined GUID prefix was found. A substitute prefix was used, which will not compromise system security. However, this may provide a more restrictive access than intended. -pub const GUID_SUBSTITUTION_MADE = 680; - -/// The create operation stopped after reaching a symbolic link. -pub const STOPPED_ON_SYMLINK = 681; - -/// A long jump has been executed. -pub const LONGJUMP = 682; - -/// The Plug and Play query operation was not successful. -pub const PLUGPLAY_QUERY_VETOED = 683; - -/// A frame consolidation has been executed. -pub const UNWIND_CONSOLIDATE = 684; - -/// {Registry Hive Recovered} Registry hive (file): %hs was corrupted and it has been recovered. Some data might have been lost. -pub const REGISTRY_HIVE_RECOVERED = 685; - -/// The application is attempting to run executable code from the module %hs. This may be insecure. An alternative, %hs, is available. Should the application use the secure module %hs? -pub const DLL_MIGHT_BE_INSECURE = 686; - -/// The application is loading executable code from the module %hs. This is secure, but may be incompatible with previous releases of the operating system. An alternative, %hs, is available. Should the application use the secure module %hs? -pub const DLL_MIGHT_BE_INCOMPATIBLE = 687; - -/// Debugger did not handle the exception. -pub const DBG_EXCEPTION_NOT_HANDLED = 688; - -/// Debugger will reply later. -pub const DBG_REPLY_LATER = 689; - -/// Debugger cannot provide handle. -pub const DBG_UNABLE_TO_PROVIDE_HANDLE = 690; - -/// Debugger terminated thread. -pub const DBG_TERMINATE_THREAD = 691; - -/// Debugger terminated process. -pub const DBG_TERMINATE_PROCESS = 692; - -/// Debugger got control C. -pub const DBG_CONTROL_C = 693; - -/// Debugger printed exception on control C. -pub const DBG_PRINTEXCEPTION_C = 694; - -/// Debugger received RIP exception. -pub const DBG_RIPEXCEPTION = 695; - -/// Debugger received control break. -pub const DBG_CONTROL_BREAK = 696; - -/// Debugger command communication exception. -pub const DBG_COMMAND_EXCEPTION = 697; - -/// {Object Exists} An attempt was made to create an object and the object name already existed. -pub const OBJECT_NAME_EXISTS = 698; - -/// {Thread Suspended} A thread termination occurred while the thread was suspended. The thread was resumed, and termination proceeded. -pub const THREAD_WAS_SUSPENDED = 699; - -/// {Image Relocated} An image file could not be mapped at the address specified in the image file. Local fixups must be performed on this image. -pub const IMAGE_NOT_AT_BASE = 700; - -/// This informational level status indicates that a specified registry sub-tree transaction state did not yet exist and had to be created. -pub const RXACT_STATE_CREATED = 701; - -/// {Segment Load} A virtual DOS machine (VDM) is loading, unloading, or moving an MS-DOS or Win16 program segment image. An exception is raised so a debugger can load, unload or track symbols and breakpoints within these 16-bit segments. -pub const SEGMENT_NOTIFICATION = 702; - -/// {Invalid Current Directory} The process cannot switch to the startup current directory %hs. Select OK to set current directory to %hs, or select CANCEL to exit. -pub const BAD_CURRENT_DIRECTORY = 703; - -/// {Redundant Read} To satisfy a read request, the NT fault-tolerant file system successfully read the requested data from a redundant copy. This was done because the file system encountered a failure on a member of the fault-tolerant volume, but was unable to reassign the failing area of the device. -pub const FT_READ_RECOVERY_FROM_BACKUP = 704; - -/// {Redundant Write} To satisfy a write request, the NT fault-tolerant file system successfully wrote a redundant copy of the information. This was done because the file system encountered a failure on a member of the fault-tolerant volume, but was not able to reassign the failing area of the device. -pub const FT_WRITE_RECOVERY = 705; - -/// {Machine Type Mismatch} The image file %hs is valid, but is for a machine type other than the current machine. Select OK to continue, or CANCEL to fail the DLL load. -pub const IMAGE_MACHINE_TYPE_MISMATCH = 706; - -/// {Partial Data Received} The network transport returned partial data to its client. The remaining data will be sent later. -pub const RECEIVE_PARTIAL = 707; - -/// {Expedited Data Received} The network transport returned data to its client that was marked as expedited by the remote system. -pub const RECEIVE_EXPEDITED = 708; - -/// {Partial Expedited Data Received} The network transport returned partial data to its client and this data was marked as expedited by the remote system. The remaining data will be sent later. -pub const RECEIVE_PARTIAL_EXPEDITED = 709; - -/// {TDI Event Done} The TDI indication has completed successfully. -pub const EVENT_DONE = 710; - -/// {TDI Event Pending} The TDI indication has entered the pending state. -pub const EVENT_PENDING = 711; - -/// Checking file system on %wZ. -pub const CHECKING_FILE_SYSTEM = 712; - -/// {Fatal Application Exit} %hs. -pub const FATAL_APP_EXIT = 713; - -/// The specified registry key is referenced by a predefined handle. -pub const PREDEFINED_HANDLE = 714; - -/// {Page Unlocked} The page protection of a locked page was changed to 'No Access' and the page was unlocked from memory and from the process. -pub const WAS_UNLOCKED = 715; - -/// %hs -pub const SERVICE_NOTIFICATION = 716; - -/// {Page Locked} One of the pages to lock was already locked. -pub const WAS_LOCKED = 717; - -/// Application popup: %1 : %2 -pub const LOG_HARD_ERROR = 718; - -/// ERROR_ALREADY_WIN32 -pub const ALREADY_WIN32 = 719; - -/// {Machine Type Mismatch} The image file %hs is valid, but is for a machine type other than the current machine. -pub const IMAGE_MACHINE_TYPE_MISMATCH_EXE = 720; - -/// A yield execution was performed and no thread was available to run. -pub const NO_YIELD_PERFORMED = 721; - -/// The resumable flag to a timer API was ignored. -pub const TIMER_RESUME_IGNORED = 722; - -/// The arbiter has deferred arbitration of these resources to its parent. -pub const ARBITRATION_UNHANDLED = 723; - -/// The inserted CardBus device cannot be started because of a configuration error on "%hs". -pub const CARDBUS_NOT_SUPPORTED = 724; - -/// The CPUs in this multiprocessor system are not all the same revision level. To use all processors the operating system restricts itself to the features of the least capable processor in the system. Should problems occur with this system, contact the CPU manufacturer to see if this mix of processors is supported. -pub const MP_PROCESSOR_MISMATCH = 725; - -/// The system was put into hibernation. -pub const HIBERNATED = 726; - -/// The system was resumed from hibernation. -pub const RESUME_HIBERNATION = 727; - -/// Windows has detected that the system firmware (BIOS) was updated [previous firmware date = %2, current firmware date %3]. -pub const FIRMWARE_UPDATED = 728; - -/// A device driver is leaking locked I/O pages causing system degradation. The system has automatically enabled tracking code in order to try and catch the culprit. -pub const DRIVERS_LEAKING_LOCKED_PAGES = 729; - -/// The system has awoken. -pub const WAKE_SYSTEM = 730; - -/// ERROR_WAIT_1 -pub const WAIT_1 = 731; - -/// ERROR_WAIT_2 -pub const WAIT_2 = 732; - -/// ERROR_WAIT_3 -pub const WAIT_3 = 733; - -/// ERROR_WAIT_63 -pub const WAIT_63 = 734; - -/// ERROR_ABANDONED_WAIT_0 -pub const ABANDONED_WAIT_0 = 735; - -/// ERROR_ABANDONED_WAIT_63 -pub const ABANDONED_WAIT_63 = 736; - -/// ERROR_USER_APC -pub const USER_APC = 737; - -/// ERROR_KERNEL_APC -pub const KERNEL_APC = 738; - -/// ERROR_ALERTED -pub const ALERTED = 739; - -/// The requested operation requires elevation. -pub const ELEVATION_REQUIRED = 740; - -/// A reparse should be performed by the Object Manager since the name of the file resulted in a symbolic link. -pub const REPARSE = 741; - -/// An open/create operation completed while an oplock break is underway. -pub const OPLOCK_BREAK_IN_PROGRESS = 742; - -/// A new volume has been mounted by a file system. -pub const VOLUME_MOUNTED = 743; - -/// This success level status indicates that the transaction state already exists for the registry sub-tree, but that a transaction commit was previously aborted. The commit has now been completed. -pub const RXACT_COMMITTED = 744; - -/// This indicates that a notify change request has been completed due to closing the handle which made the notify change request. -pub const NOTIFY_CLEANUP = 745; - -/// {Connect Failure on Primary Transport} An attempt was made to connect to the remote server %hs on the primary transport, but the connection failed. The computer WAS able to connect on a secondary transport. -pub const PRIMARY_TRANSPORT_CONNECT_FAILED = 746; - -/// Page fault was a transition fault. -pub const PAGE_FAULT_TRANSITION = 747; - -/// Page fault was a demand zero fault. -pub const PAGE_FAULT_DEMAND_ZERO = 748; - -/// Page fault was a demand zero fault. -pub const PAGE_FAULT_COPY_ON_WRITE = 749; - -/// Page fault was a demand zero fault. -pub const PAGE_FAULT_GUARD_PAGE = 750; - -/// Page fault was satisfied by reading from a secondary storage device. -pub const PAGE_FAULT_PAGING_FILE = 751; - -/// Cached page was locked during operation. -pub const CACHE_PAGE_LOCKED = 752; - -/// Crash dump exists in paging file. -pub const CRASH_DUMP = 753; - -/// Specified buffer contains all zeros. -pub const BUFFER_ALL_ZEROS = 754; - -/// A reparse should be performed by the Object Manager since the name of the file resulted in a symbolic link. -pub const REPARSE_OBJECT = 755; - -/// The device has succeeded a query-stop and its resource requirements have changed. -pub const RESOURCE_REQUIREMENTS_CHANGED = 756; - -/// The translator has translated these resources into the global space and no further translations should be performed. -pub const TRANSLATION_COMPLETE = 757; - -/// A process being terminated has no threads to terminate. -pub const NOTHING_TO_TERMINATE = 758; - -/// The specified process is not part of a job. -pub const PROCESS_NOT_IN_JOB = 759; - -/// The specified process is part of a job. -pub const PROCESS_IN_JOB = 760; - -/// {Volume Shadow Copy Service} The system is now ready for hibernation. -pub const VOLSNAP_HIBERNATE_READY = 761; - -/// A file system or file system filter driver has successfully completed an FsFilter operation. -pub const FSFILTER_OP_COMPLETED_SUCCESSFULLY = 762; - -/// The specified interrupt vector was already connected. -pub const INTERRUPT_VECTOR_ALREADY_CONNECTED = 763; - -/// The specified interrupt vector is still connected. -pub const INTERRUPT_STILL_CONNECTED = 764; - -/// An operation is blocked waiting for an oplock. -pub const WAIT_FOR_OPLOCK = 765; - -/// Debugger handled exception. -pub const DBG_EXCEPTION_HANDLED = 766; - -/// Debugger continued. -pub const DBG_CONTINUE = 767; - -/// An exception occurred in a user mode callback and the kernel callback frame should be removed. -pub const CALLBACK_POP_STACK = 768; - -/// Compression is disabled for this volume. -pub const COMPRESSION_DISABLED = 769; - -/// The data provider cannot fetch backwards through a result set. -pub const CANTFETCHBACKWARDS = 770; - -/// The data provider cannot scroll backwards through a result set. -pub const CANTSCROLLBACKWARDS = 771; - -/// The data provider requires that previously fetched data is released before asking for more data. -pub const ROWSNOTRELEASED = 772; - -/// The data provider was not able to interpret the flags set for a column binding in an accessor. -pub const BAD_ACCESSOR_FLAGS = 773; - -/// One or more errors occurred while processing the request. -pub const ERRORS_ENCOUNTERED = 774; - -/// The implementation is not capable of performing the request. -pub const NOT_CAPABLE = 775; - -/// The client of a component requested an operation which is not valid given the state of the component instance. -pub const REQUEST_OUT_OF_SEQUENCE = 776; - -/// A version number could not be parsed. -pub const VERSION_PARSE_ERROR = 777; - -/// The iterator's start position is invalid. -pub const BADSTARTPOSITION = 778; - -/// The hardware has reported an uncorrectable memory error. -pub const MEMORY_HARDWARE = 779; - -/// The attempted operation required self healing to be enabled. -pub const DISK_REPAIR_DISABLED = 780; - -/// The Desktop heap encountered an error while allocating session memory. There is more information in the system event log. -pub const INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE = 781; - -/// The system power state is transitioning from %2 to %3. -pub const SYSTEM_POWERSTATE_TRANSITION = 782; - -/// The system power state is transitioning from %2 to %3 but could enter %4. -pub const SYSTEM_POWERSTATE_COMPLEX_TRANSITION = 783; - -/// A thread is getting dispatched with MCA EXCEPTION because of MCA. -pub const MCA_EXCEPTION = 784; - -/// Access to %1 is monitored by policy rule %2. -pub const ACCESS_AUDIT_BY_POLICY = 785; - -/// Access to %1 has been restricted by your Administrator by policy rule %2. -pub const ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY = 786; - -/// A valid hibernation file has been invalidated and should be abandoned. -pub const ABANDON_HIBERFILE = 787; - -/// {Delayed Write Failed} Windows was unable to save all the data for the file %hs; the data has been lost. This error may be caused by network connectivity issues. Please try to save this file elsewhere. -pub const LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED = 788; - -/// {Delayed Write Failed} Windows was unable to save all the data for the file %hs; the data has been lost. This error was returned by the server on which the file exists. Please try to save this file elsewhere. -pub const LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR = 789; - -/// {Delayed Write Failed} Windows was unable to save all the data for the file %hs; the data has been lost. This error may be caused if the device has been removed or the media is write-protected. -pub const LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR = 790; - -/// The resources required for this device conflict with the MCFG table. -pub const BAD_MCFG_TABLE = 791; - -/// The volume repair could not be performed while it is online. Please schedule to take the volume offline so that it can be repaired. -pub const DISK_REPAIR_REDIRECTED = 792; - -/// The volume repair was not successful. -pub const DISK_REPAIR_UNSUCCESSFUL = 793; - -/// One of the volume corruption logs is full. Further corruptions that may be detected won't be logged. -pub const CORRUPT_LOG_OVERFULL = 794; - -/// One of the volume corruption logs is internally corrupted and needs to be recreated. The volume may contain undetected corruptions and must be scanned. -pub const CORRUPT_LOG_CORRUPTED = 795; - -/// One of the volume corruption logs is unavailable for being operated on. -pub const CORRUPT_LOG_UNAVAILABLE = 796; - -/// One of the volume corruption logs was deleted while still having corruption records in them. The volume contains detected corruptions and must be scanned. -pub const CORRUPT_LOG_DELETED_FULL = 797; - -/// One of the volume corruption logs was cleared by chkdsk and no longer contains real corruptions. -pub const CORRUPT_LOG_CLEARED = 798; - -/// Orphaned files exist on the volume but could not be recovered because no more new names could be created in the recovery directory. Files must be moved from the recovery directory. -pub const ORPHAN_NAME_EXHAUSTED = 799; - -/// The oplock that was associated with this handle is now associated with a different handle. -pub const OPLOCK_SWITCHED_TO_NEW_HANDLE = 800; - -/// An oplock of the requested level cannot be granted. An oplock of a lower level may be available. -pub const CANNOT_GRANT_REQUESTED_OPLOCK = 801; - -/// The operation did not complete successfully because it would cause an oplock to be broken. The caller has requested that existing oplocks not be broken. -pub const CANNOT_BREAK_OPLOCK = 802; - -/// The handle with which this oplock was associated has been closed. The oplock is now broken. -pub const OPLOCK_HANDLE_CLOSED = 803; - -/// The specified access control entry (ACE) does not contain a condition. -pub const NO_ACE_CONDITION = 804; - -/// The specified access control entry (ACE) contains an invalid condition. -pub const INVALID_ACE_CONDITION = 805; - -/// Access to the specified file handle has been revoked. -pub const FILE_HANDLE_REVOKED = 806; - -/// An image file was mapped at a different address from the one specified in the image file but fixups will still be automatically performed on the image. -pub const IMAGE_AT_DIFFERENT_BASE = 807; - -/// Access to the extended attribute was denied. -pub const EA_ACCESS_DENIED = 994; - -/// The I/O operation has been aborted because of either a thread exit or an application request. -pub const OPERATION_ABORTED = 995; - -/// Overlapped I/O event is not in a signaled state. -pub const IO_INCOMPLETE = 996; - -/// Overlapped I/O operation is in progress. -pub const IO_PENDING = 997; - -/// Invalid access to memory location. -pub const NOACCESS = 998; - -/// Error performing inpage operation. -pub const SWAPERROR = 999; - -/// Recursion too deep; the stack overflowed. -pub const STACK_OVERFLOW = 1001; - -/// The window cannot act on the sent message. -pub const INVALID_MESSAGE = 1002; - -/// Cannot complete this function. -pub const CAN_NOT_COMPLETE = 1003; - -/// Invalid flags. -pub const INVALID_FLAGS = 1004; - -/// The volume does not contain a recognized file system. Please make sure that all required file system drivers are loaded and that the volume is not corrupted. -pub const UNRECOGNIZED_VOLUME = 1005; - -/// The volume for a file has been externally altered so that the opened file is no longer valid. -pub const FILE_INVALID = 1006; - -/// The requested operation cannot be performed in full-screen mode. -pub const FULLSCREEN_MODE = 1007; - -/// An attempt was made to reference a token that does not exist. -pub const NO_TOKEN = 1008; - -/// The configuration registry database is corrupt. -pub const BADDB = 1009; - -/// The configuration registry key is invalid. -pub const BADKEY = 1010; - -/// The configuration registry key could not be opened. -pub const CANTOPEN = 1011; - -/// The configuration registry key could not be read. -pub const CANTREAD = 1012; - -/// The configuration registry key could not be written. -pub const CANTWRITE = 1013; - -/// One of the files in the registry database had to be recovered by use of a log or alternate copy. The recovery was successful. -pub const REGISTRY_RECOVERED = 1014; - -/// The registry is corrupted. The structure of one of the files containing registry data is corrupted, or the system's memory image of the file is corrupted, or the file could not be recovered because the alternate copy or log was absent or corrupted. -pub const REGISTRY_CORRUPT = 1015; - -/// An I/O operation initiated by the registry failed unrecoverably. The registry could not read in, or write out, or flush, one of the files that contain the system's image of the registry. -pub const REGISTRY_IO_FAILED = 1016; - -/// The system has attempted to load or restore a file into the registry, but the specified file is not in a registry file format. -pub const NOT_REGISTRY_FILE = 1017; - -/// Illegal operation attempted on a registry key that has been marked for deletion. -pub const KEY_DELETED = 1018; - -/// System could not allocate the required space in a registry log. -pub const NO_LOG_SPACE = 1019; - -/// Cannot create a symbolic link in a registry key that already has subkeys or values. -pub const KEY_HAS_CHILDREN = 1020; - -/// Cannot create a stable subkey under a volatile parent key. -pub const CHILD_MUST_BE_VOLATILE = 1021; - -/// A notify change request is being completed and the information is not being returned in the caller's buffer. The caller now needs to enumerate the files to find the changes. -pub const NOTIFY_ENUM_DIR = 1022; - -/// A stop control has been sent to a service that other running services are dependent on. -pub const DEPENDENT_SERVICES_RUNNING = 1051; - -/// The requested control is not valid for this service. -pub const INVALID_SERVICE_CONTROL = 1052; - -/// The service did not respond to the start or control request in a timely fashion. -pub const SERVICE_REQUEST_TIMEOUT = 1053; - -/// A thread could not be created for the service. -pub const SERVICE_NO_THREAD = 1054; - -/// The service database is locked. -pub const SERVICE_DATABASE_LOCKED = 1055; - -/// An instance of the service is already running. -pub const SERVICE_ALREADY_RUNNING = 1056; - -/// The account name is invalid or does not exist, or the password is invalid for the account name specified. -pub const INVALID_SERVICE_ACCOUNT = 1057; - -/// The service cannot be started, either because it is disabled or because it has no enabled devices associated with it. -pub const SERVICE_DISABLED = 1058; - -/// Circular service dependency was specified. -pub const CIRCULAR_DEPENDENCY = 1059; - -/// The specified service does not exist as an installed service. -pub const SERVICE_DOES_NOT_EXIST = 1060; - -/// The service cannot accept control messages at this time. -pub const SERVICE_CANNOT_ACCEPT_CTRL = 1061; - -/// The service has not been started. -pub const SERVICE_NOT_ACTIVE = 1062; - -/// The service process could not connect to the service controller. -pub const FAILED_SERVICE_CONTROLLER_CONNECT = 1063; - -/// An exception occurred in the service when handling the control request. -pub const EXCEPTION_IN_SERVICE = 1064; - -/// The database specified does not exist. -pub const DATABASE_DOES_NOT_EXIST = 1065; - -/// The service has returned a service-specific error code. -pub const SERVICE_SPECIFIC_ERROR = 1066; - -/// The process terminated unexpectedly. -pub const PROCESS_ABORTED = 1067; - -/// The dependency service or group failed to start. -pub const SERVICE_DEPENDENCY_FAIL = 1068; - -/// The service did not start due to a logon failure. -pub const SERVICE_LOGON_FAILED = 1069; - -/// After starting, the service hung in a start-pending state. -pub const SERVICE_START_HANG = 1070; - -/// The specified service database lock is invalid. -pub const INVALID_SERVICE_LOCK = 1071; - -/// The specified service has been marked for deletion. -pub const SERVICE_MARKED_FOR_DELETE = 1072; - -/// The specified service already exists. -pub const SERVICE_EXISTS = 1073; - -/// The system is currently running with the last-known-good configuration. -pub const ALREADY_RUNNING_LKG = 1074; - -/// The dependency service does not exist or has been marked for deletion. -pub const SERVICE_DEPENDENCY_DELETED = 1075; - -/// The current boot has already been accepted for use as the last-known-good control set. -pub const BOOT_ALREADY_ACCEPTED = 1076; - -/// No attempts to start the service have been made since the last boot. -pub const SERVICE_NEVER_STARTED = 1077; - -/// The name is already in use as either a service name or a service display name. -pub const DUPLICATE_SERVICE_NAME = 1078; - -/// The account specified for this service is different from the account specified for other services running in the same process. -pub const DIFFERENT_SERVICE_ACCOUNT = 1079; - -/// Failure actions can only be set for Win32 services, not for drivers. -pub const CANNOT_DETECT_DRIVER_FAILURE = 1080; - -/// This service runs in the same process as the service control manager. Therefore, the service control manager cannot take action if this service's process terminates unexpectedly. -pub const CANNOT_DETECT_PROCESS_ABORT = 1081; - -/// No recovery program has been configured for this service. -pub const NO_RECOVERY_PROGRAM = 1082; - -/// The executable program that this service is configured to run in does not implement the service. -pub const SERVICE_NOT_IN_EXE = 1083; - -/// This service cannot be started in Safe Mode. -pub const NOT_SAFEBOOT_SERVICE = 1084; - -/// The physical end of the tape has been reached. -pub const END_OF_MEDIA = 1100; - -/// A tape access reached a filemark. -pub const FILEMARK_DETECTED = 1101; - -/// The beginning of the tape or a partition was encountered. -pub const BEGINNING_OF_MEDIA = 1102; - -/// A tape access reached the end of a set of files. -pub const SETMARK_DETECTED = 1103; - -/// No more data is on the tape. -pub const NO_DATA_DETECTED = 1104; - -/// Tape could not be partitioned. -pub const PARTITION_FAILURE = 1105; - -/// When accessing a new tape of a multivolume partition, the current block size is incorrect. -pub const INVALID_BLOCK_LENGTH = 1106; - -/// Tape partition information could not be found when loading a tape. -pub const DEVICE_NOT_PARTITIONED = 1107; - -/// Unable to lock the media eject mechanism. -pub const UNABLE_TO_LOCK_MEDIA = 1108; - -/// Unable to unload the media. -pub const UNABLE_TO_UNLOAD_MEDIA = 1109; - -/// The media in the drive may have changed. -pub const MEDIA_CHANGED = 1110; - -/// The I/O bus was reset. -pub const BUS_RESET = 1111; - -/// No media in drive. -pub const NO_MEDIA_IN_DRIVE = 1112; - -/// No mapping for the Unicode character exists in the target multi-byte code page. -pub const NO_UNICODE_TRANSLATION = 1113; - -/// A dynamic link library (DLL) initialization routine failed. -pub const DLL_INIT_FAILED = 1114; - -/// A system shutdown is in progress. -pub const SHUTDOWN_IN_PROGRESS = 1115; - -/// Unable to abort the system shutdown because no shutdown was in progress. -pub const NO_SHUTDOWN_IN_PROGRESS = 1116; - -/// The request could not be performed because of an I/O device error. -pub const IO_DEVICE = 1117; - -/// No serial device was successfully initialized. The serial driver will unload. -pub const SERIAL_NO_DEVICE = 1118; - -/// Unable to open a device that was sharing an interrupt request (IRQ) with other devices. At least one other device that uses that IRQ was already opened. -pub const IRQ_BUSY = 1119; - -/// A serial I/O operation was completed by another write to the serial port. The IOCTL_SERIAL_XOFF_COUNTER reached zero.) -pub const MORE_WRITES = 1120; - -/// A serial I/O operation completed because the timeout period expired. The IOCTL_SERIAL_XOFF_COUNTER did not reach zero.) -pub const COUNTER_TIMEOUT = 1121; - -/// No ID address mark was found on the floppy disk. -pub const FLOPPY_ID_MARK_NOT_FOUND = 1122; - -/// Mismatch between the floppy disk sector ID field and the floppy disk controller track address. -pub const FLOPPY_WRONG_CYLINDER = 1123; - -/// The floppy disk controller reported an error that is not recognized by the floppy disk driver. -pub const FLOPPY_UNKNOWN_ERROR = 1124; - -/// The floppy disk controller returned inconsistent results in its registers. -pub const FLOPPY_BAD_REGISTERS = 1125; - -/// While accessing the hard disk, a recalibrate operation failed, even after retries. -pub const DISK_RECALIBRATE_FAILED = 1126; - -/// While accessing the hard disk, a disk operation failed even after retries. -pub const DISK_OPERATION_FAILED = 1127; - -/// While accessing the hard disk, a disk controller reset was needed, but even that failed. -pub const DISK_RESET_FAILED = 1128; - -/// Physical end of tape encountered. -pub const EOM_OVERFLOW = 1129; - -/// Not enough server storage is available to process this command. -pub const NOT_ENOUGH_SERVER_MEMORY = 1130; - -/// A potential deadlock condition has been detected. -pub const POSSIBLE_DEADLOCK = 1131; - -/// The base address or the file offset specified does not have the proper alignment. -pub const MAPPED_ALIGNMENT = 1132; - -/// An attempt to change the system power state was vetoed by another application or driver. -pub const SET_POWER_STATE_VETOED = 1140; - -/// The system BIOS failed an attempt to change the system power state. -pub const SET_POWER_STATE_FAILED = 1141; - -/// An attempt was made to create more links on a file than the file system supports. -pub const TOO_MANY_LINKS = 1142; - -/// The specified program requires a newer version of Windows. -pub const OLD_WIN_VERSION = 1150; - -/// The specified program is not a Windows or MS-DOS program. -pub const APP_WRONG_OS = 1151; - -/// Cannot start more than one instance of the specified program. -pub const SINGLE_INSTANCE_APP = 1152; - -/// The specified program was written for an earlier version of Windows. -pub const RMODE_APP = 1153; - -/// One of the library files needed to run this application is damaged. -pub const INVALID_DLL = 1154; - -/// No application is associated with the specified file for this operation. -pub const NO_ASSOCIATION = 1155; - -/// An error occurred in sending the command to the application. -pub const DDE_FAIL = 1156; - -/// One of the library files needed to run this application cannot be found. -pub const DLL_NOT_FOUND = 1157; - -/// The current process has used all of its system allowance of handles for Window Manager objects. -pub const NO_MORE_USER_HANDLES = 1158; - -/// The message can be used only with synchronous operations. -pub const MESSAGE_SYNC_ONLY = 1159; - -/// The indicated source element has no media. -pub const SOURCE_ELEMENT_EMPTY = 1160; - -/// The indicated destination element already contains media. -pub const DESTINATION_ELEMENT_FULL = 1161; - -/// The indicated element does not exist. -pub const ILLEGAL_ELEMENT_ADDRESS = 1162; - -/// The indicated element is part of a magazine that is not present. -pub const MAGAZINE_NOT_PRESENT = 1163; - -/// The indicated device requires reinitialization due to hardware errors. -pub const DEVICE_REINITIALIZATION_NEEDED = 1164; - -/// The device has indicated that cleaning is required before further operations are attempted. -pub const DEVICE_REQUIRES_CLEANING = 1165; - -/// The device has indicated that its door is open. -pub const DEVICE_DOOR_OPEN = 1166; - -/// The device is not connected. -pub const DEVICE_NOT_CONNECTED = 1167; - -/// Element not found. -pub const NOT_FOUND = 1168; - -/// There was no match for the specified key in the index. -pub const NO_MATCH = 1169; - -/// The property set specified does not exist on the object. -pub const SET_NOT_FOUND = 1170; - -/// The point passed to GetMouseMovePoints is not in the buffer. -pub const POINT_NOT_FOUND = 1171; - -/// The tracking (workstation) service is not running. -pub const NO_TRACKING_SERVICE = 1172; - -/// The Volume ID could not be found. -pub const NO_VOLUME_ID = 1173; - -/// Unable to remove the file to be replaced. -pub const UNABLE_TO_REMOVE_REPLACED = 1175; - -/// Unable to move the replacement file to the file to be replaced. The file to be replaced has retained its original name. -pub const UNABLE_TO_MOVE_REPLACEMENT = 1176; - -/// Unable to move the replacement file to the file to be replaced. The file to be replaced has been renamed using the backup name. -pub const UNABLE_TO_MOVE_REPLACEMENT_2 = 1177; - -/// The volume change journal is being deleted. -pub const JOURNAL_DELETE_IN_PROGRESS = 1178; - -/// The volume change journal is not active. -pub const JOURNAL_NOT_ACTIVE = 1179; - -/// A file was found, but it may not be the correct file. -pub const POTENTIAL_FILE_FOUND = 1180; - -/// The journal entry has been deleted from the journal. -pub const JOURNAL_ENTRY_DELETED = 1181; - -/// A system shutdown has already been scheduled. -pub const SHUTDOWN_IS_SCHEDULED = 1190; - -/// The system shutdown cannot be initiated because there are other users logged on to the computer. -pub const SHUTDOWN_USERS_LOGGED_ON = 1191; - -/// The specified device name is invalid. -pub const BAD_DEVICE = 1200; - -/// The device is not currently connected but it is a remembered connection. -pub const CONNECTION_UNAVAIL = 1201; - -/// The local device name has a remembered connection to another network resource. -pub const DEVICE_ALREADY_REMEMBERED = 1202; - -/// The network path was either typed incorrectly, does not exist, or the network provider is not currently available. Please try retyping the path or contact your network administrator. -pub const NO_NET_OR_BAD_PATH = 1203; - -/// The specified network provider name is invalid. -pub const BAD_PROVIDER = 1204; - -/// Unable to open the network connection profile. -pub const CANNOT_OPEN_PROFILE = 1205; - -/// The network connection profile is corrupted. -pub const BAD_PROFILE = 1206; - -/// Cannot enumerate a noncontainer. -pub const NOT_CONTAINER = 1207; - -/// An extended error has occurred. -pub const EXTENDED_ERROR = 1208; - -/// The format of the specified group name is invalid. -pub const INVALID_GROUPNAME = 1209; - -/// The format of the specified computer name is invalid. -pub const INVALID_COMPUTERNAME = 1210; - -/// The format of the specified event name is invalid. -pub const INVALID_EVENTNAME = 1211; - -/// The format of the specified domain name is invalid. -pub const INVALID_DOMAINNAME = 1212; - -/// The format of the specified service name is invalid. -pub const INVALID_SERVICENAME = 1213; - -/// The format of the specified network name is invalid. -pub const INVALID_NETNAME = 1214; - -/// The format of the specified share name is invalid. -pub const INVALID_SHARENAME = 1215; - -/// The format of the specified password is invalid. -pub const INVALID_PASSWORDNAME = 1216; - -/// The format of the specified message name is invalid. -pub const INVALID_MESSAGENAME = 1217; - -/// The format of the specified message destination is invalid. -pub const INVALID_MESSAGEDEST = 1218; - -/// Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed. Disconnect all previous connections to the server or shared resource and try again. -pub const SESSION_CREDENTIAL_CONFLICT = 1219; - -/// An attempt was made to establish a session to a network server, but there are already too many sessions established to that server. -pub const REMOTE_SESSION_LIMIT_EXCEEDED = 1220; - -/// The workgroup or domain name is already in use by another computer on the network. -pub const DUP_DOMAINNAME = 1221; - -/// The network is not present or not started. -pub const NO_NETWORK = 1222; - -/// The operation was canceled by the user. -pub const CANCELLED = 1223; - -/// The requested operation cannot be performed on a file with a user-mapped section open. -pub const USER_MAPPED_FILE = 1224; - -/// The remote computer refused the network connection. -pub const CONNECTION_REFUSED = 1225; - -/// The network connection was gracefully closed. -pub const GRACEFUL_DISCONNECT = 1226; - -/// The network transport endpoint already has an address associated with it. -pub const ADDRESS_ALREADY_ASSOCIATED = 1227; - -/// An address has not yet been associated with the network endpoint. -pub const ADDRESS_NOT_ASSOCIATED = 1228; - -/// An operation was attempted on a nonexistent network connection. -pub const CONNECTION_INVALID = 1229; - -/// An invalid operation was attempted on an active network connection. -pub const CONNECTION_ACTIVE = 1230; - -/// The network location cannot be reached. For information about network troubleshooting, see Windows Help. -pub const NETWORK_UNREACHABLE = 1231; - -/// The network location cannot be reached. For information about network troubleshooting, see Windows Help. -pub const HOST_UNREACHABLE = 1232; - -/// The network location cannot be reached. For information about network troubleshooting, see Windows Help. -pub const PROTOCOL_UNREACHABLE = 1233; - -/// No service is operating at the destination network endpoint on the remote system. -pub const PORT_UNREACHABLE = 1234; - -/// The request was aborted. -pub const REQUEST_ABORTED = 1235; - -/// The network connection was aborted by the local system. -pub const CONNECTION_ABORTED = 1236; - -/// The operation could not be completed. A retry should be performed. -pub const RETRY = 1237; - -/// A connection to the server could not be made because the limit on the number of concurrent connections for this account has been reached. -pub const CONNECTION_COUNT_LIMIT = 1238; - -/// Attempting to log in during an unauthorized time of day for this account. -pub const LOGIN_TIME_RESTRICTION = 1239; - -/// The account is not authorized to log in from this station. -pub const LOGIN_WKSTA_RESTRICTION = 1240; - -/// The network address could not be used for the operation requested. -pub const INCORRECT_ADDRESS = 1241; - -/// The service is already registered. -pub const ALREADY_REGISTERED = 1242; - -/// The specified service does not exist. -pub const SERVICE_NOT_FOUND = 1243; - -/// The operation being requested was not performed because the user has not been authenticated. -pub const NOT_AUTHENTICATED = 1244; - -/// The operation being requested was not performed because the user has not logged on to the network. The specified service does not exist. -pub const NOT_LOGGED_ON = 1245; - -/// Continue with work in progress. -pub const CONTINUE = 1246; - -/// An attempt was made to perform an initialization operation when initialization has already been completed. -pub const ALREADY_INITIALIZED = 1247; - -/// No more local devices. -pub const NO_MORE_DEVICES = 1248; - -/// The specified site does not exist. -pub const NO_SUCH_SITE = 1249; - -/// A domain controller with the specified name already exists. -pub const DOMAIN_CONTROLLER_EXISTS = 1250; - -/// This operation is supported only when you are connected to the server. -pub const ONLY_IF_CONNECTED = 1251; - -/// The group policy framework should call the extension even if there are no changes. -pub const OVERRIDE_NOCHANGES = 1252; - -/// The specified user does not have a valid profile. -pub const BAD_USER_PROFILE = 1253; - -/// This operation is not supported on a computer running Windows Server 2003 for Small Business Server. -pub const NOT_SUPPORTED_ON_SBS = 1254; - -/// The server machine is shutting down. -pub const SERVER_SHUTDOWN_IN_PROGRESS = 1255; - -/// The remote system is not available. For information about network troubleshooting, see Windows Help. -pub const HOST_DOWN = 1256; - -/// The security identifier provided is not from an account domain. -pub const NON_ACCOUNT_SID = 1257; - -/// The security identifier provided does not have a domain component. -pub const NON_DOMAIN_SID = 1258; - -/// AppHelp dialog canceled thus preventing the application from starting. -pub const APPHELP_BLOCK = 1259; - -/// This program is blocked by group policy. For more information, contact your system administrator. -pub const ACCESS_DISABLED_BY_POLICY = 1260; - -/// A program attempt to use an invalid register value. Normally caused by an uninitialized register. This error is Itanium specific. -pub const REG_NAT_CONSUMPTION = 1261; - -/// The share is currently offline or does not exist. -pub const CSCSHARE_OFFLINE = 1262; - -/// The Kerberos protocol encountered an error while validating the KDC certificate during smartcard logon. There is more information in the system event log. -pub const PKINIT_FAILURE = 1263; - -/// The Kerberos protocol encountered an error while attempting to utilize the smartcard subsystem. -pub const SMARTCARD_SUBSYSTEM_FAILURE = 1264; - -/// The system cannot contact a domain controller to service the authentication request. Please try again later. -pub const DOWNGRADE_DETECTED = 1265; - -/// The machine is locked and cannot be shut down without the force option. -pub const MACHINE_LOCKED = 1271; - -/// An application-defined callback gave invalid data when called. -pub const CALLBACK_SUPPLIED_INVALID_DATA = 1273; - -/// The group policy framework should call the extension in the synchronous foreground policy refresh. -pub const SYNC_FOREGROUND_REFRESH_REQUIRED = 1274; - -/// This driver has been blocked from loading. -pub const DRIVER_BLOCKED = 1275; - -/// A dynamic link library (DLL) referenced a module that was neither a DLL nor the process's executable image. -pub const INVALID_IMPORT_OF_NON_DLL = 1276; - -/// Windows cannot open this program since it has been disabled. -pub const ACCESS_DISABLED_WEBBLADE = 1277; - -/// Windows cannot open this program because the license enforcement system has been tampered with or become corrupted. -pub const ACCESS_DISABLED_WEBBLADE_TAMPER = 1278; - -/// A transaction recover failed. -pub const RECOVERY_FAILURE = 1279; - -/// The current thread has already been converted to a fiber. -pub const ALREADY_FIBER = 1280; - -/// The current thread has already been converted from a fiber. -pub const ALREADY_THREAD = 1281; - -/// The system detected an overrun of a stack-based buffer in this application. This overrun could potentially allow a malicious user to gain control of this application. -pub const STACK_BUFFER_OVERRUN = 1282; - -/// Data present in one of the parameters is more than the function can operate on. -pub const PARAMETER_QUOTA_EXCEEDED = 1283; - -/// An attempt to do an operation on a debug object failed because the object is in the process of being deleted. -pub const DEBUGGER_INACTIVE = 1284; - -/// An attempt to delay-load a .dll or get a function address in a delay-loaded .dll failed. -pub const DELAY_LOAD_FAILED = 1285; - -/// %1 is a 16-bit application. You do not have permissions to execute 16-bit applications. Check your permissions with your system administrator. -pub const VDM_DISALLOWED = 1286; - -/// Insufficient information exists to identify the cause of failure. -pub const UNIDENTIFIED_ERROR = 1287; - -/// The parameter passed to a C runtime function is incorrect. -pub const INVALID_CRUNTIME_PARAMETER = 1288; - -/// The operation occurred beyond the valid data length of the file. -pub const BEYOND_VDL = 1289; - -/// The service start failed since one or more services in the same process have an incompatible service SID type setting. A service with restricted service SID type can only coexist in the same process with other services with a restricted SID type. If the service SID type for this service was just configured, the hosting process must be restarted in order to start this service. -/// On Windows Server 2003 and Windows XP, an unrestricted service cannot coexist in the same process with other services. The service with the unrestricted service SID type must be moved to an owned process in order to start this service. -pub const INCOMPATIBLE_SERVICE_SID_TYPE = 1290; - -/// The process hosting the driver for this device has been terminated. -pub const DRIVER_PROCESS_TERMINATED = 1291; - -/// An operation attempted to exceed an implementation-defined limit. -pub const IMPLEMENTATION_LIMIT = 1292; - -/// Either the target process, or the target thread's containing process, is a protected process. -pub const PROCESS_IS_PROTECTED = 1293; - -/// The service notification client is lagging too far behind the current state of services in the machine. -pub const SERVICE_NOTIFY_CLIENT_LAGGING = 1294; - -/// The requested file operation failed because the storage quota was exceeded. To free up disk space, move files to a different location or delete unnecessary files. For more information, contact your system administrator. -pub const DISK_QUOTA_EXCEEDED = 1295; - -/// The requested file operation failed because the storage policy blocks that type of file. For more information, contact your system administrator. -pub const CONTENT_BLOCKED = 1296; - -/// A privilege that the service requires to function properly does not exist in the service account configuration. You may use the Services Microsoft Management Console (MMC) snap-in (services.msc) and the Local Security Settings MMC snap-in (secpol.msc) to view the service configuration and the account configuration. -pub const INCOMPATIBLE_SERVICE_PRIVILEGE = 1297; - -/// A thread involved in this operation appears to be unresponsive. -pub const APP_HANG = 1298; - -/// Indicates a particular Security ID may not be assigned as the label of an object. -pub const INVALID_LABEL = 1299; - -/// Not all privileges or groups referenced are assigned to the caller. -pub const NOT_ALL_ASSIGNED = 1300; - -/// Some mapping between account names and security IDs was not done. -pub const SOME_NOT_MAPPED = 1301; - -/// No system quota limits are specifically set for this account. -pub const NO_QUOTAS_FOR_ACCOUNT = 1302; - -/// No encryption key is available. A well-known encryption key was returned. -pub const LOCAL_USER_SESSION_KEY = 1303; - -/// The password is too complex to be converted to a LAN Manager password. The LAN Manager password returned is a NULL string. -pub const NULL_LM_PASSWORD = 1304; - -/// The revision level is unknown. -pub const UNKNOWN_REVISION = 1305; - -/// Indicates two revision levels are incompatible. -pub const REVISION_MISMATCH = 1306; - -/// This security ID may not be assigned as the owner of this object. -pub const INVALID_OWNER = 1307; - -/// This security ID may not be assigned as the primary group of an object. -pub const INVALID_PRIMARY_GROUP = 1308; - -/// An attempt has been made to operate on an impersonation token by a thread that is not currently impersonating a client. -pub const NO_IMPERSONATION_TOKEN = 1309; - -/// The group may not be disabled. -pub const CANT_DISABLE_MANDATORY = 1310; - -/// There are currently no logon servers available to service the logon request. -pub const NO_LOGON_SERVERS = 1311; - -/// A specified logon session does not exist. It may already have been terminated. -pub const NO_SUCH_LOGON_SESSION = 1312; - -/// A specified privilege does not exist. -pub const NO_SUCH_PRIVILEGE = 1313; - -/// A required privilege is not held by the client. -pub const PRIVILEGE_NOT_HELD = 1314; - -/// The name provided is not a properly formed account name. -pub const INVALID_ACCOUNT_NAME = 1315; - -/// The specified account already exists. -pub const USER_EXISTS = 1316; - -/// The specified account does not exist. -pub const NO_SUCH_USER = 1317; - -/// The specified group already exists. -pub const GROUP_EXISTS = 1318; - -/// The specified group does not exist. -pub const NO_SUCH_GROUP = 1319; - -/// Either the specified user account is already a member of the specified group, or the specified group cannot be deleted because it contains a member. -pub const MEMBER_IN_GROUP = 1320; - -/// The specified user account is not a member of the specified group account. -pub const MEMBER_NOT_IN_GROUP = 1321; - -/// This operation is disallowed as it could result in an administration account being disabled, deleted or unable to log on. -pub const LAST_ADMIN = 1322; - -/// Unable to update the password. The value provided as the current password is incorrect. -pub const WRONG_PASSWORD = 1323; - -/// Unable to update the password. The value provided for the new password contains values that are not allowed in passwords. -pub const ILL_FORMED_PASSWORD = 1324; - -/// Unable to update the password. The value provided for the new password does not meet the length, complexity, or history requirements of the domain. -pub const PASSWORD_RESTRICTION = 1325; - -/// The user name or password is incorrect. -pub const LOGON_FAILURE = 1326; - -/// Account restrictions are preventing this user from signing in. For example: blank passwords aren't allowed, sign-in times are limited, or a policy restriction has been enforced. -pub const ACCOUNT_RESTRICTION = 1327; - -/// Your account has time restrictions that keep you from signing in right now. -pub const INVALID_LOGON_HOURS = 1328; - -/// This user isn't allowed to sign in to this computer. -pub const INVALID_WORKSTATION = 1329; - -/// The password for this account has expired. -pub const PASSWORD_EXPIRED = 1330; - -/// This user can't sign in because this account is currently disabled. -pub const ACCOUNT_DISABLED = 1331; - -/// No mapping between account names and security IDs was done. -pub const NONE_MAPPED = 1332; - -/// Too many local user identifiers (LUIDs) were requested at one time. -pub const TOO_MANY_LUIDS_REQUESTED = 1333; - -/// No more local user identifiers (LUIDs) are available. -pub const LUIDS_EXHAUSTED = 1334; - -/// The subauthority part of a security ID is invalid for this particular use. -pub const INVALID_SUB_AUTHORITY = 1335; - -/// The access control list (ACL) structure is invalid. -pub const INVALID_ACL = 1336; - -/// The security ID structure is invalid. -pub const INVALID_SID = 1337; - -/// The security descriptor structure is invalid. -pub const INVALID_SECURITY_DESCR = 1338; - -/// The inherited access control list (ACL) or access control entry (ACE) could not be built. -pub const BAD_INHERITANCE_ACL = 1340; - -/// The server is currently disabled. -pub const SERVER_DISABLED = 1341; - -/// The server is currently enabled. -pub const SERVER_NOT_DISABLED = 1342; - -/// The value provided was an invalid value for an identifier authority. -pub const INVALID_ID_AUTHORITY = 1343; - -/// No more memory is available for security information updates. -pub const ALLOTTED_SPACE_EXCEEDED = 1344; - -/// The specified attributes are invalid, or incompatible with the attributes for the group as a whole. -pub const INVALID_GROUP_ATTRIBUTES = 1345; - -/// Either a required impersonation level was not provided, or the provided impersonation level is invalid. -pub const BAD_IMPERSONATION_LEVEL = 1346; - -/// Cannot open an anonymous level security token. -pub const CANT_OPEN_ANONYMOUS = 1347; - -/// The validation information class requested was invalid. -pub const BAD_VALIDATION_CLASS = 1348; - -/// The type of the token is inappropriate for its attempted use. -pub const BAD_TOKEN_TYPE = 1349; - -/// Unable to perform a security operation on an object that has no associated security. -pub const NO_SECURITY_ON_OBJECT = 1350; - -/// Configuration information could not be read from the domain controller, either because the machine is unavailable, or access has been denied. -pub const CANT_ACCESS_DOMAIN_INFO = 1351; - -/// The security account manager (SAM) or local security authority (LSA) server was in the wrong state to perform the security operation. -pub const INVALID_SERVER_STATE = 1352; - -/// The domain was in the wrong state to perform the security operation. -pub const INVALID_DOMAIN_STATE = 1353; - -/// This operation is only allowed for the Primary Domain Controller of the domain. -pub const INVALID_DOMAIN_ROLE = 1354; - -/// The specified domain either does not exist or could not be contacted. -pub const NO_SUCH_DOMAIN = 1355; - -/// The specified domain already exists. -pub const DOMAIN_EXISTS = 1356; - -/// An attempt was made to exceed the limit on the number of domains per server. -pub const DOMAIN_LIMIT_EXCEEDED = 1357; - -/// Unable to complete the requested operation because of either a catastrophic media failure or a data structure corruption on the disk. -pub const INTERNAL_DB_CORRUPTION = 1358; - -/// An internal error occurred. -pub const INTERNAL_ERROR = 1359; - -/// Generic access types were contained in an access mask which should already be mapped to nongeneric types. -pub const GENERIC_NOT_MAPPED = 1360; - -/// A security descriptor is not in the right format (absolute or self-relative). -pub const BAD_DESCRIPTOR_FORMAT = 1361; - -/// The requested action is restricted for use by logon processes only. The calling process has not registered as a logon process. -pub const NOT_LOGON_PROCESS = 1362; - -/// Cannot start a new logon session with an ID that is already in use. -pub const LOGON_SESSION_EXISTS = 1363; - -/// A specified authentication package is unknown. -pub const NO_SUCH_PACKAGE = 1364; - -/// The logon session is not in a state that is consistent with the requested operation. -pub const BAD_LOGON_SESSION_STATE = 1365; - -/// The logon session ID is already in use. -pub const LOGON_SESSION_COLLISION = 1366; - -/// A logon request contained an invalid logon type value. -pub const INVALID_LOGON_TYPE = 1367; - -/// Unable to impersonate using a named pipe until data has been read from that pipe. -pub const CANNOT_IMPERSONATE = 1368; - -/// The transaction state of a registry subtree is incompatible with the requested operation. -pub const RXACT_INVALID_STATE = 1369; - -/// An internal security database corruption has been encountered. -pub const RXACT_COMMIT_FAILURE = 1370; - -/// Cannot perform this operation on built-in accounts. -pub const SPECIAL_ACCOUNT = 1371; - -/// Cannot perform this operation on this built-in special group. -pub const SPECIAL_GROUP = 1372; - -/// Cannot perform this operation on this built-in special user. -pub const SPECIAL_USER = 1373; - -/// The user cannot be removed from a group because the group is currently the user's primary group. -pub const MEMBERS_PRIMARY_GROUP = 1374; - -/// The token is already in use as a primary token. -pub const TOKEN_ALREADY_IN_USE = 1375; - -/// The specified local group does not exist. -pub const NO_SUCH_ALIAS = 1376; - -/// The specified account name is not a member of the group. -pub const MEMBER_NOT_IN_ALIAS = 1377; - -/// The specified account name is already a member of the group. -pub const MEMBER_IN_ALIAS = 1378; - -/// The specified local group already exists. -pub const ALIAS_EXISTS = 1379; - -/// Logon failure: the user has not been granted the requested logon type at this computer. -pub const LOGON_NOT_GRANTED = 1380; - -/// The maximum number of secrets that may be stored in a single system has been exceeded. -pub const TOO_MANY_SECRETS = 1381; - -/// The length of a secret exceeds the maximum length allowed. -pub const SECRET_TOO_LONG = 1382; - -/// The local security authority database contains an internal inconsistency. -pub const INTERNAL_DB_ERROR = 1383; - -/// During a logon attempt, the user's security context accumulated too many security IDs. -pub const TOO_MANY_CONTEXT_IDS = 1384; - -/// Logon failure: the user has not been granted the requested logon type at this computer. -pub const LOGON_TYPE_NOT_GRANTED = 1385; - -/// A cross-encrypted password is necessary to change a user password. -pub const NT_CROSS_ENCRYPTION_REQUIRED = 1386; - -/// A member could not be added to or removed from the local group because the member does not exist. -pub const NO_SUCH_MEMBER = 1387; - -/// A new member could not be added to a local group because the member has the wrong account type. -pub const INVALID_MEMBER = 1388; - -/// Too many security IDs have been specified. -pub const TOO_MANY_SIDS = 1389; - -/// A cross-encrypted password is necessary to change this user password. -pub const LM_CROSS_ENCRYPTION_REQUIRED = 1390; - -/// Indicates an ACL contains no inheritable components. -pub const NO_INHERITANCE = 1391; - -/// The file or directory is corrupted and unreadable. -pub const FILE_CORRUPT = 1392; - -/// The disk structure is corrupted and unreadable. -pub const DISK_CORRUPT = 1393; - -/// There is no user session key for the specified logon session. -pub const NO_USER_SESSION_KEY = 1394; - -/// The service being accessed is licensed for a particular number of connections. No more connections can be made to the service at this time because there are already as many connections as the service can accept. -pub const LICENSE_QUOTA_EXCEEDED = 1395; - -/// The target account name is incorrect. -pub const WRONG_TARGET_NAME = 1396; - -/// Mutual Authentication failed. The server's password is out of date at the domain controller. -pub const MUTUAL_AUTH_FAILED = 1397; - -/// There is a time and/or date difference between the client and server. -pub const TIME_SKEW = 1398; - -/// This operation cannot be performed on the current domain. -pub const CURRENT_DOMAIN_NOT_ALLOWED = 1399; - -/// Invalid window handle. -pub const INVALID_WINDOW_HANDLE = 1400; - -/// Invalid menu handle. -pub const INVALID_MENU_HANDLE = 1401; - -/// Invalid cursor handle. -pub const INVALID_CURSOR_HANDLE = 1402; - -/// Invalid accelerator table handle. -pub const INVALID_ACCEL_HANDLE = 1403; - -/// Invalid hook handle. -pub const INVALID_HOOK_HANDLE = 1404; - -/// Invalid handle to a multiple-window position structure. -pub const INVALID_DWP_HANDLE = 1405; - -/// Cannot create a top-level child window. -pub const TLW_WITH_WSCHILD = 1406; - -/// Cannot find window class. -pub const CANNOT_FIND_WND_CLASS = 1407; - -/// Invalid window; it belongs to other thread. -pub const WINDOW_OF_OTHER_THREAD = 1408; - -/// Hot key is already registered. -pub const HOTKEY_ALREADY_REGISTERED = 1409; - -/// Class already exists. -pub const CLASS_ALREADY_EXISTS = 1410; - -/// Class does not exist. -pub const CLASS_DOES_NOT_EXIST = 1411; - -/// Class still has open windows. -pub const CLASS_HAS_WINDOWS = 1412; - -/// Invalid index. -pub const INVALID_INDEX = 1413; - -/// Invalid icon handle. -pub const INVALID_ICON_HANDLE = 1414; - -/// Using private DIALOG window words. -pub const PRIVATE_DIALOG_INDEX = 1415; - -/// The list box identifier was not found. -pub const LISTBOX_ID_NOT_FOUND = 1416; - -/// No wildcards were found. -pub const NO_WILDCARD_CHARACTERS = 1417; - -/// Thread does not have a clipboard open. -pub const CLIPBOARD_NOT_OPEN = 1418; - -/// Hot key is not registered. -pub const HOTKEY_NOT_REGISTERED = 1419; - -/// The window is not a valid dialog window. -pub const WINDOW_NOT_DIALOG = 1420; - -/// Control ID not found. -pub const CONTROL_ID_NOT_FOUND = 1421; - -/// Invalid message for a combo box because it does not have an edit control. -pub const INVALID_COMBOBOX_MESSAGE = 1422; - -/// The window is not a combo box. -pub const WINDOW_NOT_COMBOBOX = 1423; - -/// Height must be less than 256. -pub const INVALID_EDIT_HEIGHT = 1424; - -/// Invalid device context (DC) handle. -pub const DC_NOT_FOUND = 1425; - -/// Invalid hook procedure type. -pub const INVALID_HOOK_FILTER = 1426; - -/// Invalid hook procedure. -pub const INVALID_FILTER_PROC = 1427; - -/// Cannot set nonlocal hook without a module handle. -pub const HOOK_NEEDS_HMOD = 1428; - -/// This hook procedure can only be set globally. -pub const GLOBAL_ONLY_HOOK = 1429; - -/// The journal hook procedure is already installed. -pub const JOURNAL_HOOK_SET = 1430; - -/// The hook procedure is not installed. -pub const HOOK_NOT_INSTALLED = 1431; - -/// Invalid message for single-selection list box. -pub const INVALID_LB_MESSAGE = 1432; - -/// LB_SETCOUNT sent to non-lazy list box. -pub const SETCOUNT_ON_BAD_LB = 1433; - -/// This list box does not support tab stops. -pub const LB_WITHOUT_TABSTOPS = 1434; - -/// Cannot destroy object created by another thread. -pub const DESTROY_OBJECT_OF_OTHER_THREAD = 1435; - -/// Child windows cannot have menus. -pub const CHILD_WINDOW_MENU = 1436; - -/// The window does not have a system menu. -pub const NO_SYSTEM_MENU = 1437; - -/// Invalid message box style. -pub const INVALID_MSGBOX_STYLE = 1438; - -/// Invalid system-wide (SPI_*) parameter. -pub const INVALID_SPI_VALUE = 1439; - -/// Screen already locked. -pub const SCREEN_ALREADY_LOCKED = 1440; - -/// All handles to windows in a multiple-window position structure must have the same parent. -pub const HWNDS_HAVE_DIFF_PARENT = 1441; - -/// The window is not a child window. -pub const NOT_CHILD_WINDOW = 1442; - -/// Invalid GW_* command. -pub const INVALID_GW_COMMAND = 1443; - -/// Invalid thread identifier. -pub const INVALID_THREAD_ID = 1444; - -/// Cannot process a message from a window that is not a multiple document interface (MDI) window. -pub const NON_MDICHILD_WINDOW = 1445; - -/// Popup menu already active. -pub const POPUP_ALREADY_ACTIVE = 1446; - -/// The window does not have scroll bars. -pub const NO_SCROLLBARS = 1447; - -/// Scroll bar range cannot be greater than MAXLONG. -pub const INVALID_SCROLLBAR_RANGE = 1448; - -/// Cannot show or remove the window in the way specified. -pub const INVALID_SHOWWIN_COMMAND = 1449; - -/// Insufficient system resources exist to complete the requested service. -pub const NO_SYSTEM_RESOURCES = 1450; - -/// Insufficient system resources exist to complete the requested service. -pub const NONPAGED_SYSTEM_RESOURCES = 1451; - -/// Insufficient system resources exist to complete the requested service. -pub const PAGED_SYSTEM_RESOURCES = 1452; - -/// Insufficient quota to complete the requested service. -pub const WORKING_SET_QUOTA = 1453; - -/// Insufficient quota to complete the requested service. -pub const PAGEFILE_QUOTA = 1454; - -/// The paging file is too small for this operation to complete. -pub const COMMITMENT_LIMIT = 1455; - -/// A menu item was not found. -pub const MENU_ITEM_NOT_FOUND = 1456; - -/// Invalid keyboard layout handle. -pub const INVALID_KEYBOARD_HANDLE = 1457; - -/// Hook type not allowed. -pub const HOOK_TYPE_NOT_ALLOWED = 1458; - -/// This operation requires an interactive window station. -pub const REQUIRES_INTERACTIVE_WINDOWSTATION = 1459; - -/// This operation returned because the timeout period expired. -pub const TIMEOUT = 1460; - -/// Invalid monitor handle. -pub const INVALID_MONITOR_HANDLE = 1461; - -/// Incorrect size argument. -pub const INCORRECT_SIZE = 1462; - -/// The symbolic link cannot be followed because its type is disabled. -pub const SYMLINK_CLASS_DISABLED = 1463; - -/// This application does not support the current operation on symbolic links. -pub const SYMLINK_NOT_SUPPORTED = 1464; - -/// Windows was unable to parse the requested XML data. -pub const XML_PARSE_ERROR = 1465; - -/// An error was encountered while processing an XML digital signature. -pub const XMLDSIG_ERROR = 1466; - -/// This application must be restarted. -pub const RESTART_APPLICATION = 1467; - -/// The caller made the connection request in the wrong routing compartment. -pub const WRONG_COMPARTMENT = 1468; - -/// There was an AuthIP failure when attempting to connect to the remote host. -pub const AUTHIP_FAILURE = 1469; - -/// Insufficient NVRAM resources exist to complete the requested service. A reboot might be required. -pub const NO_NVRAM_RESOURCES = 1470; - -/// Unable to finish the requested operation because the specified process is not a GUI process. -pub const NOT_GUI_PROCESS = 1471; - -/// The event log file is corrupted. -pub const EVENTLOG_FILE_CORRUPT = 1500; - -/// No event log file could be opened, so the event logging service did not start. -pub const EVENTLOG_CANT_START = 1501; - -/// The event log file is full. -pub const LOG_FILE_FULL = 1502; - -/// The event log file has changed between read operations. -pub const EVENTLOG_FILE_CHANGED = 1503; - -/// The specified task name is invalid. -pub const INVALID_TASK_NAME = 1550; - -/// The specified task index is invalid. -pub const INVALID_TASK_INDEX = 1551; - -/// The specified thread is already joining a task. -pub const THREAD_ALREADY_IN_TASK = 1552; - -/// The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance. -pub const INSTALL_SERVICE_FAILURE = 1601; - -/// User cancelled installation. -pub const INSTALL_USEREXIT = 1602; - -/// Fatal error during installation. -pub const INSTALL_FAILURE = 1603; - -/// Installation suspended, incomplete. -pub const INSTALL_SUSPEND = 1604; - -/// This action is only valid for products that are currently installed. -pub const UNKNOWN_PRODUCT = 1605; - -/// Feature ID not registered. -pub const UNKNOWN_FEATURE = 1606; - -/// Component ID not registered. -pub const UNKNOWN_COMPONENT = 1607; - -/// Unknown property. -pub const UNKNOWN_PROPERTY = 1608; - -/// Handle is in an invalid state. -pub const INVALID_HANDLE_STATE = 1609; - -/// The configuration data for this product is corrupt. Contact your support personnel. -pub const BAD_CONFIGURATION = 1610; - -/// Component qualifier not present. -pub const INDEX_ABSENT = 1611; - -/// The installation source for this product is not available. Verify that the source exists and that you can access it. -pub const INSTALL_SOURCE_ABSENT = 1612; - -/// This installation package cannot be installed by the Windows Installer service. You must install a Windows service pack that contains a newer version of the Windows Installer service. -pub const INSTALL_PACKAGE_VERSION = 1613; - -/// Product is uninstalled. -pub const PRODUCT_UNINSTALLED = 1614; - -/// SQL query syntax invalid or unsupported. -pub const BAD_QUERY_SYNTAX = 1615; - -/// Record field does not exist. -pub const INVALID_FIELD = 1616; - -/// The device has been removed. -pub const DEVICE_REMOVED = 1617; - -/// Another installation is already in progress. Complete that installation before proceeding with this install. -pub const INSTALL_ALREADY_RUNNING = 1618; - -/// This installation package could not be opened. Verify that the package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer package. -pub const INSTALL_PACKAGE_OPEN_FAILED = 1619; - -/// This installation package could not be opened. Contact the application vendor to verify that this is a valid Windows Installer package. -pub const INSTALL_PACKAGE_INVALID = 1620; - -/// There was an error starting the Windows Installer service user interface. Contact your support personnel. -pub const INSTALL_UI_FAILURE = 1621; - -/// Error opening installation log file. Verify that the specified log file location exists and that you can write to it. -pub const INSTALL_LOG_FAILURE = 1622; - -/// The language of this installation package is not supported by your system. -pub const INSTALL_LANGUAGE_UNSUPPORTED = 1623; - -/// Error applying transforms. Verify that the specified transform paths are valid. -pub const INSTALL_TRANSFORM_FAILURE = 1624; - -/// This installation is forbidden by system policy. Contact your system administrator. -pub const INSTALL_PACKAGE_REJECTED = 1625; - -/// Function could not be executed. -pub const FUNCTION_NOT_CALLED = 1626; - -/// Function failed during execution. -pub const FUNCTION_FAILED = 1627; - -/// Invalid or unknown table specified. -pub const INVALID_TABLE = 1628; - -/// Data supplied is of wrong type. -pub const DATATYPE_MISMATCH = 1629; - -/// Data of this type is not supported. -pub const UNSUPPORTED_TYPE = 1630; - -/// The Windows Installer service failed to start. Contact your support personnel. -pub const CREATE_FAILED = 1631; - -/// The Temp folder is on a drive that is full or is inaccessible. Free up space on the drive or verify that you have write permission on the Temp folder. -pub const INSTALL_TEMP_UNWRITABLE = 1632; - -/// This installation package is not supported by this processor type. Contact your product vendor. -pub const INSTALL_PLATFORM_UNSUPPORTED = 1633; - -/// Component not used on this computer. -pub const INSTALL_NOTUSED = 1634; - -/// This update package could not be opened. Verify that the update package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer update package. -pub const PATCH_PACKAGE_OPEN_FAILED = 1635; - -/// This update package could not be opened. Contact the application vendor to verify that this is a valid Windows Installer update package. -pub const PATCH_PACKAGE_INVALID = 1636; - -/// This update package cannot be processed by the Windows Installer service. You must install a Windows service pack that contains a newer version of the Windows Installer service. -pub const PATCH_PACKAGE_UNSUPPORTED = 1637; - -/// Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel. -pub const PRODUCT_VERSION = 1638; - -/// Invalid command line argument. Consult the Windows Installer SDK for detailed command line help. -pub const INVALID_COMMAND_LINE = 1639; - -/// Only administrators have permission to add, remove, or configure server software during a Terminal services remote session. If you want to install or configure software on the server, contact your network administrator. -pub const INSTALL_REMOTE_DISALLOWED = 1640; - -/// The requested operation completed successfully. The system will be restarted so the changes can take effect. -pub const SUCCESS_REBOOT_INITIATED = 1641; - -/// The upgrade cannot be installed by the Windows Installer service because the program to be upgraded may be missing, or the upgrade may update a different version of the program. Verify that the program to be upgraded exists on your computer and that you have the correct upgrade. -pub const PATCH_TARGET_NOT_FOUND = 1642; - -/// The update package is not permitted by software restriction policy. -pub const PATCH_PACKAGE_REJECTED = 1643; - -/// One or more customizations are not permitted by software restriction policy. -pub const INSTALL_TRANSFORM_REJECTED = 1644; - -/// The Windows Installer does not permit installation from a Remote Desktop Connection. -pub const INSTALL_REMOTE_PROHIBITED = 1645; - -/// Uninstallation of the update package is not supported. -pub const PATCH_REMOVAL_UNSUPPORTED = 1646; - -/// The update is not applied to this product. -pub const UNKNOWN_PATCH = 1647; - -/// No valid sequence could be found for the set of updates. -pub const PATCH_NO_SEQUENCE = 1648; - -/// Update removal was disallowed by policy. -pub const PATCH_REMOVAL_DISALLOWED = 1649; - -/// The XML update data is invalid. -pub const INVALID_PATCH_XML = 1650; - -/// Windows Installer does not permit updating of managed advertised products. At least one feature of the product must be installed before applying the update. -pub const PATCH_MANAGED_ADVERTISED_PRODUCT = 1651; - -/// The Windows Installer service is not accessible in Safe Mode. Please try again when your computer is not in Safe Mode or you can use System Restore to return your machine to a previous good state. -pub const INSTALL_SERVICE_SAFEBOOT = 1652; - -/// A fail fast exception occurred. Exception handlers will not be invoked and the process will be terminated immediately. -pub const FAIL_FAST_EXCEPTION = 1653; - -/// The app that you are trying to run is not supported on this version of Windows. -pub const INSTALL_REJECTED = 1654; - -/// The string binding is invalid. -pub const RPC_S_INVALID_STRING_BINDING = 1700; - -/// The binding handle is not the correct type. -pub const RPC_S_WRONG_KIND_OF_BINDING = 1701; - -/// The binding handle is invalid. -pub const RPC_S_INVALID_BINDING = 1702; - -/// The RPC protocol sequence is not supported. -pub const RPC_S_PROTSEQ_NOT_SUPPORTED = 1703; - -/// The RPC protocol sequence is invalid. -pub const RPC_S_INVALID_RPC_PROTSEQ = 1704; - -/// The string universal unique identifier (UUID) is invalid. -pub const RPC_S_INVALID_STRING_UUID = 1705; - -/// The endpoint format is invalid. -pub const RPC_S_INVALID_ENDPOINT_FORMAT = 1706; - -/// The network address is invalid. -pub const RPC_S_INVALID_NET_ADDR = 1707; - -/// No endpoint was found. -pub const RPC_S_NO_ENDPOINT_FOUND = 1708; - -/// The timeout value is invalid. -pub const RPC_S_INVALID_TIMEOUT = 1709; - -/// The object universal unique identifier (UUID) was not found. -pub const RPC_S_OBJECT_NOT_FOUND = 1710; - -/// The object universal unique identifier (UUID) has already been registered. -pub const RPC_S_ALREADY_REGISTERED = 1711; - -/// The type universal unique identifier (UUID) has already been registered. -pub const RPC_S_TYPE_ALREADY_REGISTERED = 1712; - -/// The RPC server is already listening. -pub const RPC_S_ALREADY_LISTENING = 1713; - -/// No protocol sequences have been registered. -pub const RPC_S_NO_PROTSEQS_REGISTERED = 1714; - -/// The RPC server is not listening. -pub const RPC_S_NOT_LISTENING = 1715; - -/// The manager type is unknown. -pub const RPC_S_UNKNOWN_MGR_TYPE = 1716; - -/// The interface is unknown. -pub const RPC_S_UNKNOWN_IF = 1717; - -/// There are no bindings. -pub const RPC_S_NO_BINDINGS = 1718; - -/// There are no protocol sequences. -pub const RPC_S_NO_PROTSEQS = 1719; - -/// The endpoint cannot be created. -pub const RPC_S_CANT_CREATE_ENDPOINT = 1720; - -/// Not enough resources are available to complete this operation. -pub const RPC_S_OUT_OF_RESOURCES = 1721; - -/// The RPC server is unavailable. -pub const RPC_S_SERVER_UNAVAILABLE = 1722; - -/// The RPC server is too busy to complete this operation. -pub const RPC_S_SERVER_TOO_BUSY = 1723; - -/// The network options are invalid. -pub const RPC_S_INVALID_NETWORK_OPTIONS = 1724; - -/// There are no remote procedure calls active on this thread. -pub const RPC_S_NO_CALL_ACTIVE = 1725; - -/// The remote procedure call failed. -pub const RPC_S_CALL_FAILED = 1726; - -/// The remote procedure call failed and did not execute. -pub const RPC_S_CALL_FAILED_DNE = 1727; - -/// A remote procedure call (RPC) protocol error occurred. -pub const RPC_S_PROTOCOL_ERROR = 1728; - -/// Access to the HTTP proxy is denied. -pub const RPC_S_PROXY_ACCESS_DENIED = 1729; - -/// The transfer syntax is not supported by the RPC server. -pub const RPC_S_UNSUPPORTED_TRANS_SYN = 1730; - -/// The universal unique identifier (UUID) type is not supported. -pub const RPC_S_UNSUPPORTED_TYPE = 1732; - -/// The tag is invalid. -pub const RPC_S_INVALID_TAG = 1733; - -/// The array bounds are invalid. -pub const RPC_S_INVALID_BOUND = 1734; - -/// The binding does not contain an entry name. -pub const RPC_S_NO_ENTRY_NAME = 1735; - -/// The name syntax is invalid. -pub const RPC_S_INVALID_NAME_SYNTAX = 1736; - -/// The name syntax is not supported. -pub const RPC_S_UNSUPPORTED_NAME_SYNTAX = 1737; - -/// No network address is available to use to construct a universal unique identifier (UUID). -pub const RPC_S_UUID_NO_ADDRESS = 1739; - -/// The endpoint is a duplicate. -pub const RPC_S_DUPLICATE_ENDPOINT = 1740; - -/// The authentication type is unknown. -pub const RPC_S_UNKNOWN_AUTHN_TYPE = 1741; - -/// The maximum number of calls is too small. -pub const RPC_S_MAX_CALLS_TOO_SMALL = 1742; - -/// The string is too long. -pub const RPC_S_STRING_TOO_LONG = 1743; - -/// The RPC protocol sequence was not found. -pub const RPC_S_PROTSEQ_NOT_FOUND = 1744; - -/// The procedure number is out of range. -pub const RPC_S_PROCNUM_OUT_OF_RANGE = 1745; - -/// The binding does not contain any authentication information. -pub const RPC_S_BINDING_HAS_NO_AUTH = 1746; - -/// The authentication service is unknown. -pub const RPC_S_UNKNOWN_AUTHN_SERVICE = 1747; - -/// The authentication level is unknown. -pub const RPC_S_UNKNOWN_AUTHN_LEVEL = 1748; - -/// The security context is invalid. -pub const RPC_S_INVALID_AUTH_IDENTITY = 1749; - -/// The authorization service is unknown. -pub const RPC_S_UNKNOWN_AUTHZ_SERVICE = 1750; - -/// The entry is invalid. -pub const EPT_S_INVALID_ENTRY = 1751; - -/// The server endpoint cannot perform the operation. -pub const EPT_S_CANT_PERFORM_OP = 1752; - -/// There are no more endpoints available from the endpoint mapper. -pub const EPT_S_NOT_REGISTERED = 1753; - -/// No interfaces have been exported. -pub const RPC_S_NOTHING_TO_EXPORT = 1754; - -/// The entry name is incomplete. -pub const RPC_S_INCOMPLETE_NAME = 1755; - -/// The version option is invalid. -pub const RPC_S_INVALID_VERS_OPTION = 1756; - -/// There are no more members. -pub const RPC_S_NO_MORE_MEMBERS = 1757; - -/// There is nothing to unexport. -pub const RPC_S_NOT_ALL_OBJS_UNEXPORTED = 1758; - -/// The interface was not found. -pub const RPC_S_INTERFACE_NOT_FOUND = 1759; - -/// The entry already exists. -pub const RPC_S_ENTRY_ALREADY_EXISTS = 1760; - -/// The entry is not found. -pub const RPC_S_ENTRY_NOT_FOUND = 1761; - -/// The name service is unavailable. -pub const RPC_S_NAME_SERVICE_UNAVAILABLE = 1762; - -/// The network address family is invalid. -pub const RPC_S_INVALID_NAF_ID = 1763; - -/// The requested operation is not supported. -pub const RPC_S_CANNOT_SUPPORT = 1764; - -/// No security context is available to allow impersonation. -pub const RPC_S_NO_CONTEXT_AVAILABLE = 1765; - -/// An internal error occurred in a remote procedure call (RPC). -pub const RPC_S_INTERNAL_ERROR = 1766; - -/// The RPC server attempted an integer division by zero. -pub const RPC_S_ZERO_DIVIDE = 1767; - -/// An addressing error occurred in the RPC server. -pub const RPC_S_ADDRESS_ERROR = 1768; - -/// A floating-point operation at the RPC server caused a division by zero. -pub const RPC_S_FP_DIV_ZERO = 1769; - -/// A floating-point underflow occurred at the RPC server. -pub const RPC_S_FP_UNDERFLOW = 1770; - -/// A floating-point overflow occurred at the RPC server. -pub const RPC_S_FP_OVERFLOW = 1771; - -/// The list of RPC servers available for the binding of auto handles has been exhausted. -pub const RPC_X_NO_MORE_ENTRIES = 1772; - -/// Unable to open the character translation table file. -pub const RPC_X_SS_CHAR_TRANS_OPEN_FAIL = 1773; - -/// The file containing the character translation table has fewer than 512 bytes. -pub const RPC_X_SS_CHAR_TRANS_SHORT_FILE = 1774; - -/// A null context handle was passed from the client to the host during a remote procedure call. -pub const RPC_X_SS_IN_NULL_CONTEXT = 1775; - -/// The context handle changed during a remote procedure call. -pub const RPC_X_SS_CONTEXT_DAMAGED = 1777; - -/// The binding handles passed to a remote procedure call do not match. -pub const RPC_X_SS_HANDLES_MISMATCH = 1778; - -/// The stub is unable to get the remote procedure call handle. -pub const RPC_X_SS_CANNOT_GET_CALL_HANDLE = 1779; - -/// A null reference pointer was passed to the stub. -pub const RPC_X_NULL_REF_POINTER = 1780; - -/// The enumeration value is out of range. -pub const RPC_X_ENUM_VALUE_OUT_OF_RANGE = 1781; - -/// The byte count is too small. -pub const RPC_X_BYTE_COUNT_TOO_SMALL = 1782; - -/// The stub received bad data. -pub const RPC_X_BAD_STUB_DATA = 1783; - -/// The supplied user buffer is not valid for the requested operation. -pub const INVALID_USER_BUFFER = 1784; - -/// The disk media is not recognized. It may not be formatted. -pub const UNRECOGNIZED_MEDIA = 1785; - -/// The workstation does not have a trust secret. -pub const NO_TRUST_LSA_SECRET = 1786; - -/// The security database on the server does not have a computer account for this workstation trust relationship. -pub const NO_TRUST_SAM_ACCOUNT = 1787; - -/// The trust relationship between the primary domain and the trusted domain failed. -pub const TRUSTED_DOMAIN_FAILURE = 1788; - -/// The trust relationship between this workstation and the primary domain failed. -pub const TRUSTED_RELATIONSHIP_FAILURE = 1789; - -/// The network logon failed. -pub const TRUST_FAILURE = 1790; - -/// A remote procedure call is already in progress for this thread. -pub const RPC_S_CALL_IN_PROGRESS = 1791; - -/// An attempt was made to logon, but the network logon service was not started. -pub const NETLOGON_NOT_STARTED = 1792; - -/// The user's account has expired. -pub const ACCOUNT_EXPIRED = 1793; - -/// The redirector is in use and cannot be unloaded. -pub const REDIRECTOR_HAS_OPEN_HANDLES = 1794; - -/// The specified printer driver is already installed. -pub const PRINTER_DRIVER_ALREADY_INSTALLED = 1795; - -/// The specified port is unknown. -pub const UNKNOWN_PORT = 1796; - -/// The printer driver is unknown. -pub const UNKNOWN_PRINTER_DRIVER = 1797; - -/// The print processor is unknown. -pub const UNKNOWN_PRINTPROCESSOR = 1798; - -/// The specified separator file is invalid. -pub const INVALID_SEPARATOR_FILE = 1799; - -/// The specified priority is invalid. -pub const INVALID_PRIORITY = 1800; - -/// The printer name is invalid. -pub const INVALID_PRINTER_NAME = 1801; - -/// The printer already exists. -pub const PRINTER_ALREADY_EXISTS = 1802; - -/// The printer command is invalid. -pub const INVALID_PRINTER_COMMAND = 1803; - -/// The specified datatype is invalid. -pub const INVALID_DATATYPE = 1804; - -/// The environment specified is invalid. -pub const INVALID_ENVIRONMENT = 1805; - -/// There are no more bindings. -pub const RPC_S_NO_MORE_BINDINGS = 1806; - -/// The account used is an interdomain trust account. Use your global user account or local user account to access this server. -pub const NOLOGON_INTERDOMAIN_TRUST_ACCOUNT = 1807; - -/// The account used is a computer account. Use your global user account or local user account to access this server. -pub const NOLOGON_WORKSTATION_TRUST_ACCOUNT = 1808; - -/// The account used is a server trust account. Use your global user account or local user account to access this server. -pub const NOLOGON_SERVER_TRUST_ACCOUNT = 1809; - -/// The name or security ID (SID) of the domain specified is inconsistent with the trust information for that domain. -pub const DOMAIN_TRUST_INCONSISTENT = 1810; - -/// The server is in use and cannot be unloaded. -pub const SERVER_HAS_OPEN_HANDLES = 1811; - -/// The specified image file did not contain a resource section. -pub const RESOURCE_DATA_NOT_FOUND = 1812; - -/// The specified resource type cannot be found in the image file. -pub const RESOURCE_TYPE_NOT_FOUND = 1813; - -/// The specified resource name cannot be found in the image file. -pub const RESOURCE_NAME_NOT_FOUND = 1814; - -/// The specified resource language ID cannot be found in the image file. -pub const RESOURCE_LANG_NOT_FOUND = 1815; - -/// Not enough quota is available to process this command. -pub const NOT_ENOUGH_QUOTA = 1816; - -/// No interfaces have been registered. -pub const RPC_S_NO_INTERFACES = 1817; - -/// The remote procedure call was cancelled. -pub const RPC_S_CALL_CANCELLED = 1818; - -/// The binding handle does not contain all required information. -pub const RPC_S_BINDING_INCOMPLETE = 1819; - -/// A communications failure occurred during a remote procedure call. -pub const RPC_S_COMM_FAILURE = 1820; - -/// The requested authentication level is not supported. -pub const RPC_S_UNSUPPORTED_AUTHN_LEVEL = 1821; - -/// No principal name registered. -pub const RPC_S_NO_PRINC_NAME = 1822; - -/// The error specified is not a valid Windows RPC error code. -pub const RPC_S_NOT_RPC_ERROR = 1823; - -/// A UUID that is valid only on this computer has been allocated. -pub const RPC_S_UUID_LOCAL_ONLY = 1824; - -/// A security package specific error occurred. -pub const RPC_S_SEC_PKG_ERROR = 1825; - -/// Thread is not canceled. -pub const RPC_S_NOT_CANCELLED = 1826; - -/// Invalid operation on the encoding/decoding handle. -pub const RPC_X_INVALID_ES_ACTION = 1827; - -/// Incompatible version of the serializing package. -pub const RPC_X_WRONG_ES_VERSION = 1828; - -/// Incompatible version of the RPC stub. -pub const RPC_X_WRONG_STUB_VERSION = 1829; - -/// The RPC pipe object is invalid or corrupted. -pub const RPC_X_INVALID_PIPE_OBJECT = 1830; - -/// An invalid operation was attempted on an RPC pipe object. -pub const RPC_X_WRONG_PIPE_ORDER = 1831; - -/// Unsupported RPC pipe version. -pub const RPC_X_WRONG_PIPE_VERSION = 1832; - -/// HTTP proxy server rejected the connection because the cookie authentication failed. -pub const RPC_S_COOKIE_AUTH_FAILED = 1833; - -/// The group member was not found. -pub const RPC_S_GROUP_MEMBER_NOT_FOUND = 1898; - -/// The endpoint mapper database entry could not be created. -pub const EPT_S_CANT_CREATE = 1899; - -/// The object universal unique identifier (UUID) is the nil UUID. -pub const RPC_S_INVALID_OBJECT = 1900; - -/// The specified time is invalid. -pub const INVALID_TIME = 1901; - -/// The specified form name is invalid. -pub const INVALID_FORM_NAME = 1902; - -/// The specified form size is invalid. -pub const INVALID_FORM_SIZE = 1903; - -/// The specified printer handle is already being waited on. -pub const ALREADY_WAITING = 1904; - -/// The specified printer has been deleted. -pub const PRINTER_DELETED = 1905; - -/// The state of the printer is invalid. -pub const INVALID_PRINTER_STATE = 1906; - -/// The user's password must be changed before signing in. -pub const PASSWORD_MUST_CHANGE = 1907; - -/// Could not find the domain controller for this domain. -pub const DOMAIN_CONTROLLER_NOT_FOUND = 1908; - -/// The referenced account is currently locked out and may not be logged on to. -pub const ACCOUNT_LOCKED_OUT = 1909; - -/// The object exporter specified was not found. -pub const OR_INVALID_OXID = 1910; - -/// The object specified was not found. -pub const OR_INVALID_OID = 1911; - -/// The object resolver set specified was not found. -pub const OR_INVALID_SET = 1912; - -/// Some data remains to be sent in the request buffer. -pub const RPC_S_SEND_INCOMPLETE = 1913; - -/// Invalid asynchronous remote procedure call handle. -pub const RPC_S_INVALID_ASYNC_HANDLE = 1914; - -/// Invalid asynchronous RPC call handle for this operation. -pub const RPC_S_INVALID_ASYNC_CALL = 1915; - -/// The RPC pipe object has already been closed. -pub const RPC_X_PIPE_CLOSED = 1916; - -/// The RPC call completed before all pipes were processed. -pub const RPC_X_PIPE_DISCIPLINE_ERROR = 1917; - -/// No more data is available from the RPC pipe. -pub const RPC_X_PIPE_EMPTY = 1918; - -/// No site name is available for this machine. -pub const NO_SITENAME = 1919; - -/// The file cannot be accessed by the system. -pub const CANT_ACCESS_FILE = 1920; - -/// The name of the file cannot be resolved by the system. -pub const CANT_RESOLVE_FILENAME = 1921; - -/// The entry is not of the expected type. -pub const RPC_S_ENTRY_TYPE_MISMATCH = 1922; - -/// Not all object UUIDs could be exported to the specified entry. -pub const RPC_S_NOT_ALL_OBJS_EXPORTED = 1923; - -/// Interface could not be exported to the specified entry. -pub const RPC_S_INTERFACE_NOT_EXPORTED = 1924; - -/// The specified profile entry could not be added. -pub const RPC_S_PROFILE_NOT_ADDED = 1925; - -/// The specified profile element could not be added. -pub const RPC_S_PRF_ELT_NOT_ADDED = 1926; - -/// The specified profile element could not be removed. -pub const RPC_S_PRF_ELT_NOT_REMOVED = 1927; - -/// The group element could not be added. -pub const RPC_S_GRP_ELT_NOT_ADDED = 1928; - -/// The group element could not be removed. -pub const RPC_S_GRP_ELT_NOT_REMOVED = 1929; - -/// The printer driver is not compatible with a policy enabled on your computer that blocks NT 4.0 drivers. -pub const KM_DRIVER_BLOCKED = 1930; - -/// The context has expired and can no longer be used. -pub const CONTEXT_EXPIRED = 1931; - -/// The current user's delegated trust creation quota has been exceeded. -pub const PER_USER_TRUST_QUOTA_EXCEEDED = 1932; - -/// The total delegated trust creation quota has been exceeded. -pub const ALL_USER_TRUST_QUOTA_EXCEEDED = 1933; - -/// The current user's delegated trust deletion quota has been exceeded. -pub const USER_DELETE_TRUST_QUOTA_EXCEEDED = 1934; - -/// The computer you are signing into is protected by an authentication firewall. The specified account is not allowed to authenticate to the computer. -pub const AUTHENTICATION_FIREWALL_FAILED = 1935; - -/// Remote connections to the Print Spooler are blocked by a policy set on your machine. -pub const REMOTE_PRINT_CONNECTIONS_BLOCKED = 1936; - -/// Authentication failed because NTLM authentication has been disabled. -pub const NTLM_BLOCKED = 1937; - -/// Logon Failure: EAS policy requires that the user change their password before this operation can be performed. -pub const PASSWORD_CHANGE_REQUIRED = 1938; - -/// The pixel format is invalid. -pub const INVALID_PIXEL_FORMAT = 2000; - -/// The specified driver is invalid. -pub const BAD_DRIVER = 2001; - -/// The window style or class attribute is invalid for this operation. -pub const INVALID_WINDOW_STYLE = 2002; - -/// The requested metafile operation is not supported. -pub const METAFILE_NOT_SUPPORTED = 2003; - -/// The requested transformation operation is not supported. -pub const TRANSFORM_NOT_SUPPORTED = 2004; - -/// The requested clipping operation is not supported. -pub const CLIPPING_NOT_SUPPORTED = 2005; - -/// The specified color management module is invalid. -pub const INVALID_CMM = 2010; - -/// The specified color profile is invalid. -pub const INVALID_PROFILE = 2011; - -/// The specified tag was not found. -pub const TAG_NOT_FOUND = 2012; - -/// A required tag is not present. -pub const TAG_NOT_PRESENT = 2013; - -/// The specified tag is already present. -pub const DUPLICATE_TAG = 2014; - -/// The specified color profile is not associated with the specified device. -pub const PROFILE_NOT_ASSOCIATED_WITH_DEVICE = 2015; - -/// The specified color profile was not found. -pub const PROFILE_NOT_FOUND = 2016; - -/// The specified color space is invalid. -pub const INVALID_COLORSPACE = 2017; - -/// Image Color Management is not enabled. -pub const ICM_NOT_ENABLED = 2018; - -/// There was an error while deleting the color transform. -pub const DELETING_ICM_XFORM = 2019; - -/// The specified color transform is invalid. -pub const INVALID_TRANSFORM = 2020; - -/// The specified transform does not match the bitmap's color space. -pub const COLORSPACE_MISMATCH = 2021; - -/// The specified named color index is not present in the profile. -pub const INVALID_COLORINDEX = 2022; - -/// The specified profile is intended for a device of a different type than the specified device. -pub const PROFILE_DOES_NOT_MATCH_DEVICE = 2023; - -/// The network connection was made successfully, but the user had to be prompted for a password other than the one originally specified. -pub const CONNECTED_OTHER_PASSWORD = 2108; - -/// The network connection was made successfully using default credentials. -pub const CONNECTED_OTHER_PASSWORD_DEFAULT = 2109; - -/// The specified username is invalid. -pub const BAD_USERNAME = 2202; - -/// This network connection does not exist. -pub const NOT_CONNECTED = 2250; - -/// This network connection has files open or requests pending. -pub const OPEN_FILES = 2401; - -/// Active connections still exist. -pub const ACTIVE_CONNECTIONS = 2402; - -/// The device is in use by an active process and cannot be disconnected. -pub const DEVICE_IN_USE = 2404; - -/// The specified print monitor is unknown. -pub const UNKNOWN_PRINT_MONITOR = 3000; - -/// The specified printer driver is currently in use. -pub const PRINTER_DRIVER_IN_USE = 3001; - -/// The spool file was not found. -pub const SPOOL_FILE_NOT_FOUND = 3002; - -/// A StartDocPrinter call was not issued. -pub const SPL_NO_STARTDOC = 3003; - -/// An AddJob call was not issued. -pub const SPL_NO_ADDJOB = 3004; - -/// The specified print processor has already been installed. -pub const PRINT_PROCESSOR_ALREADY_INSTALLED = 3005; - -/// The specified print monitor has already been installed. -pub const PRINT_MONITOR_ALREADY_INSTALLED = 3006; - -/// The specified print monitor does not have the required functions. -pub const INVALID_PRINT_MONITOR = 3007; - -/// The specified print monitor is currently in use. -pub const PRINT_MONITOR_IN_USE = 3008; - -/// The requested operation is not allowed when there are jobs queued to the printer. -pub const PRINTER_HAS_JOBS_QUEUED = 3009; - -/// The requested operation is successful. Changes will not be effective until the system is rebooted. -pub const SUCCESS_REBOOT_REQUIRED = 3010; - -/// The requested operation is successful. Changes will not be effective until the service is restarted. -pub const SUCCESS_RESTART_REQUIRED = 3011; - -/// No printers were found. -pub const PRINTER_NOT_FOUND = 3012; - -/// The printer driver is known to be unreliable. -pub const PRINTER_DRIVER_WARNED = 3013; - -/// The printer driver is known to harm the system. -pub const PRINTER_DRIVER_BLOCKED = 3014; - -/// The specified printer driver package is currently in use. -pub const PRINTER_DRIVER_PACKAGE_IN_USE = 3015; - -/// Unable to find a core driver package that is required by the printer driver package. -pub const CORE_DRIVER_PACKAGE_NOT_FOUND = 3016; - -/// The requested operation failed. A system reboot is required to roll back changes made. -pub const FAIL_REBOOT_REQUIRED = 3017; - -/// The requested operation failed. A system reboot has been initiated to roll back changes made. -pub const FAIL_REBOOT_INITIATED = 3018; - -/// The specified printer driver was not found on the system and needs to be downloaded. -pub const PRINTER_DRIVER_DOWNLOAD_NEEDED = 3019; - -/// The requested print job has failed to print. A print system update requires the job to be resubmitted. -pub const PRINT_JOB_RESTART_REQUIRED = 3020; - -/// The printer driver does not contain a valid manifest, or contains too many manifests. -pub const INVALID_PRINTER_DRIVER_MANIFEST = 3021; - -/// The specified printer cannot be shared. -pub const PRINTER_NOT_SHAREABLE = 3022; - -/// The operation was paused. -pub const REQUEST_PAUSED = 3050; - -/// Reissue the given operation as a cached IO operation. -pub const IO_REISSUE_AS_CACHED = 3950; diff --git a/lib/std/os/windows/kernel32.zig b/lib/std/os/windows/kernel32.zig index 9ec40240b..63e52edec 100644 --- a/lib/std/os/windows/kernel32.zig +++ b/lib/std/os/windows/kernel32.zig @@ -73,7 +73,7 @@ pub extern "kernel32" fn FindFirstFileW(lpFileName: [*:0]const u16, lpFindFileDa pub extern "kernel32" fn FindClose(hFindFile: HANDLE) callconv(.Stdcall) BOOL; pub extern "kernel32" fn FindNextFileW(hFindFile: HANDLE, lpFindFileData: *WIN32_FIND_DATAW) callconv(.Stdcall) BOOL; -pub extern "kernel32" fn FormatMessageW(dwFlags: DWORD, lpSource: ?LPVOID, dwMessageId: DWORD, dwLanguageId: DWORD, lpBuffer: [*]u16, nSize: DWORD, Arguments: ?*va_list) callconv(.Stdcall) DWORD; +pub extern "kernel32" fn FormatMessageW(dwFlags: DWORD, lpSource: ?LPVOID, dwMessageId: Win32Error, dwLanguageId: DWORD, lpBuffer: [*]u16, nSize: DWORD, Arguments: ?*va_list) callconv(.Stdcall) DWORD; pub extern "kernel32" fn FreeEnvironmentStringsW(penv: [*:0]u16) callconv(.Stdcall) BOOL; @@ -102,7 +102,7 @@ pub extern "kernel32" fn GetModuleFileNameW(hModule: ?HMODULE, lpFilename: [*]u1 pub extern "kernel32" fn GetModuleHandleW(lpModuleName: ?[*]const WCHAR) callconv(.Stdcall) HMODULE; -pub extern "kernel32" fn GetLastError() callconv(.Stdcall) DWORD; +pub extern "kernel32" fn GetLastError() callconv(.Stdcall) Win32Error; pub extern "kernel32" fn GetFileInformationByHandle( hFile: HANDLE, diff --git a/lib/std/os/windows/win32error.zig b/lib/std/os/windows/win32error.zig new file mode 100644 index 000000000..037797e25 --- /dev/null +++ b/lib/std/os/windows/win32error.zig @@ -0,0 +1,3696 @@ +// Codes are from https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/18d8fbe8-a967-4f1c-ae50-99ca8e491d2d +pub const Win32Error = extern enum(u16) { + /// The operation completed successfully. + SUCCESS = 0, + + /// Incorrect function. + INVALID_FUNCTION = 1, + + /// The system cannot find the file specified. + FILE_NOT_FOUND = 2, + + /// The system cannot find the path specified. + PATH_NOT_FOUND = 3, + + /// The system cannot open the file. + TOO_MANY_OPEN_FILES = 4, + + /// Access is denied. + ACCESS_DENIED = 5, + + /// The handle is invalid. + INVALID_HANDLE = 6, + + /// The storage control blocks were destroyed. + ARENA_TRASHED = 7, + + /// Not enough storage is available to process this command. + NOT_ENOUGH_MEMORY = 8, + + /// The storage control block address is invalid. + INVALID_BLOCK = 9, + + /// The environment is incorrect. + BAD_ENVIRONMENT = 10, + + /// An attempt was made to load a program with an incorrect format. + BAD_FORMAT = 11, + + /// The access code is invalid. + INVALID_ACCESS = 12, + + /// The data is invalid. + INVALID_DATA = 13, + + /// Not enough storage is available to complete this operation. + OUTOFMEMORY = 14, + + /// The system cannot find the drive specified. + INVALID_DRIVE = 15, + + /// The directory cannot be removed. + CURRENT_DIRECTORY = 16, + + /// The system cannot move the file to a different disk drive. + NOT_SAME_DEVICE = 17, + + /// There are no more files. + NO_MORE_FILES = 18, + + /// The media is write protected. + WRITE_PROTECT = 19, + + /// The system cannot find the device specified. + BAD_UNIT = 20, + + /// The device is not ready. + NOT_READY = 21, + + /// The device does not recognize the command. + BAD_COMMAND = 22, + + /// Data error (cyclic redundancy check). + CRC = 23, + + /// The program issued a command but the command length is incorrect. + BAD_LENGTH = 24, + + /// The drive cannot locate a specific area or track on the disk. + SEEK = 25, + + /// The specified disk or diskette cannot be accessed. + NOT_DOS_DISK = 26, + + /// The drive cannot find the sector requested. + SECTOR_NOT_FOUND = 27, + + /// The printer is out of paper. + OUT_OF_PAPER = 28, + + /// The system cannot write to the specified device. + WRITE_FAULT = 29, + + /// The system cannot read from the specified device. + READ_FAULT = 30, + + /// A device attached to the system is not functioning. + GEN_FAILURE = 31, + + /// The process cannot access the file because it is being used by another process. + SHARING_VIOLATION = 32, + + /// The process cannot access the file because another process has locked a portion of the file. + LOCK_VIOLATION = 33, + + /// The wrong diskette is in the drive. + /// Insert %2 (Volume Serial Number: %3) into drive %1. + WRONG_DISK = 34, + + /// Too many files opened for sharing. + SHARING_BUFFER_EXCEEDED = 36, + + /// Reached the end of the file. + HANDLE_EOF = 38, + + /// The disk is full. + HANDLE_DISK_FULL = 39, + + /// The request is not supported. + NOT_SUPPORTED = 50, + + /// Windows cannot find the network path. + /// Verify that the network path is correct and the destination computer is not busy or turned off. + /// If Windows still cannot find the network path, contact your network administrator. + REM_NOT_LIST = 51, + + /// You were not connected because a duplicate name exists on the network. + /// If joining a domain, go to System in Control Panel to change the computer name and try again. + /// If joining a workgroup, choose another workgroup name. + DUP_NAME = 52, + + /// The network path was not found. + BAD_NETPATH = 53, + + /// The network is busy. + NETWORK_BUSY = 54, + + /// The specified network resource or device is no longer available. + DEV_NOT_EXIST = 55, + + /// The network BIOS command limit has been reached. + TOO_MANY_CMDS = 56, + + /// A network adapter hardware error occurred. + ADAP_HDW_ERR = 57, + + /// The specified server cannot perform the requested operation. + BAD_NET_RESP = 58, + + /// An unexpected network error occurred. + UNEXP_NET_ERR = 59, + + /// The remote adapter is not compatible. + BAD_REM_ADAP = 60, + + /// The printer queue is full. + PRINTQ_FULL = 61, + + /// Space to store the file waiting to be printed is not available on the server. + NO_SPOOL_SPACE = 62, + + /// Your file waiting to be printed was deleted. + PRINT_CANCELLED = 63, + + /// The specified network name is no longer available. + NETNAME_DELETED = 64, + + /// Network access is denied. + NETWORK_ACCESS_DENIED = 65, + + /// The network resource type is not correct. + BAD_DEV_TYPE = 66, + + /// The network name cannot be found. + BAD_NET_NAME = 67, + + /// The name limit for the local computer network adapter card was exceeded. + TOO_MANY_NAMES = 68, + + /// The network BIOS session limit was exceeded. + TOO_MANY_SESS = 69, + + /// The remote server has been paused or is in the process of being started. + SHARING_PAUSED = 70, + + /// No more connections can be made to this remote computer at this time because there are already as many connections as the computer can accept. + REQ_NOT_ACCEP = 71, + + /// The specified printer or disk device has been paused. + REDIR_PAUSED = 72, + + /// The file exists. + FILE_EXISTS = 80, + + /// The directory or file cannot be created. + CANNOT_MAKE = 82, + + /// Fail on INT 24. + FAIL_I24 = 83, + + /// Storage to process this request is not available. + OUT_OF_STRUCTURES = 84, + + /// The local device name is already in use. + ALREADY_ASSIGNED = 85, + + /// The specified network password is not correct. + INVALID_PASSWORD = 86, + + /// The parameter is incorrect. + INVALID_PARAMETER = 87, + + /// A write fault occurred on the network. + NET_WRITE_FAULT = 88, + + /// The system cannot start another process at this time. + NO_PROC_SLOTS = 89, + + /// Cannot create another system semaphore. + TOO_MANY_SEMAPHORES = 100, + + /// The exclusive semaphore is owned by another process. + EXCL_SEM_ALREADY_OWNED = 101, + + /// The semaphore is set and cannot be closed. + SEM_IS_SET = 102, + + /// The semaphore cannot be set again. + TOO_MANY_SEM_REQUESTS = 103, + + /// Cannot request exclusive semaphores at interrupt time. + INVALID_AT_INTERRUPT_TIME = 104, + + /// The previous ownership of this semaphore has ended. + SEM_OWNER_DIED = 105, + + /// Insert the diskette for drive %1. + SEM_USER_LIMIT = 106, + + /// The program stopped because an alternate diskette was not inserted. + DISK_CHANGE = 107, + + /// The disk is in use or locked by another process. + DRIVE_LOCKED = 108, + + /// The pipe has been ended. + BROKEN_PIPE = 109, + + /// The system cannot open the device or file specified. + OPEN_FAILED = 110, + + /// The file name is too long. + BUFFER_OVERFLOW = 111, + + /// There is not enough space on the disk. + DISK_FULL = 112, + + /// No more internal file identifiers available. + NO_MORE_SEARCH_HANDLES = 113, + + /// The target internal file identifier is incorrect. + INVALID_TARGET_HANDLE = 114, + + /// The IOCTL call made by the application program is not correct. + INVALID_CATEGORY = 117, + + /// The verify-on-write switch parameter value is not correct. + INVALID_VERIFY_SWITCH = 118, + + /// The system does not support the command requested. + BAD_DRIVER_LEVEL = 119, + + /// This function is not supported on this system. + CALL_NOT_IMPLEMENTED = 120, + + /// The semaphore timeout period has expired. + SEM_TIMEOUT = 121, + + /// The data area passed to a system call is too small. + INSUFFICIENT_BUFFER = 122, + + /// The filename, directory name, or volume label syntax is incorrect. + INVALID_NAME = 123, + + /// The system call level is not correct. + INVALID_LEVEL = 124, + + /// The disk has no volume label. + NO_VOLUME_LABEL = 125, + + /// The specified module could not be found. + MOD_NOT_FOUND = 126, + + /// The specified procedure could not be found. + PROC_NOT_FOUND = 127, + + /// There are no child processes to wait for. + WAIT_NO_CHILDREN = 128, + + /// The %1 application cannot be run in Win32 mode. + CHILD_NOT_COMPLETE = 129, + + /// Attempt to use a file handle to an open disk partition for an operation other than raw disk I/O. + DIRECT_ACCESS_HANDLE = 130, + + /// An attempt was made to move the file pointer before the beginning of the file. + NEGATIVE_SEEK = 131, + + /// The file pointer cannot be set on the specified device or file. + SEEK_ON_DEVICE = 132, + + /// A JOIN or SUBST command cannot be used for a drive that contains previously joined drives. + IS_JOIN_TARGET = 133, + + /// An attempt was made to use a JOIN or SUBST command on a drive that has already been joined. + IS_JOINED = 134, + + /// An attempt was made to use a JOIN or SUBST command on a drive that has already been substituted. + IS_SUBSTED = 135, + + /// The system tried to delete the JOIN of a drive that is not joined. + NOT_JOINED = 136, + + /// The system tried to delete the substitution of a drive that is not substituted. + NOT_SUBSTED = 137, + + /// The system tried to join a drive to a directory on a joined drive. + JOIN_TO_JOIN = 138, + + /// The system tried to substitute a drive to a directory on a substituted drive. + SUBST_TO_SUBST = 139, + + /// The system tried to join a drive to a directory on a substituted drive. + JOIN_TO_SUBST = 140, + + /// The system tried to SUBST a drive to a directory on a joined drive. + SUBST_TO_JOIN = 141, + + /// The system cannot perform a JOIN or SUBST at this time. + BUSY_DRIVE = 142, + + /// The system cannot join or substitute a drive to or for a directory on the same drive. + SAME_DRIVE = 143, + + /// The directory is not a subdirectory of the root directory. + DIR_NOT_ROOT = 144, + + /// The directory is not empty. + DIR_NOT_EMPTY = 145, + + /// The path specified is being used in a substitute. + IS_SUBST_PATH = 146, + + /// Not enough resources are available to process this command. + IS_JOIN_PATH = 147, + + /// The path specified cannot be used at this time. + PATH_BUSY = 148, + + /// An attempt was made to join or substitute a drive for which a directory on the drive is the target of a previous substitute. + IS_SUBST_TARGET = 149, + + /// System trace information was not specified in your CONFIG.SYS file, or tracing is disallowed. + SYSTEM_TRACE = 150, + + /// The number of specified semaphore events for DosMuxSemWait is not correct. + INVALID_EVENT_COUNT = 151, + + /// DosMuxSemWait did not execute; too many semaphores are already set. + TOO_MANY_MUXWAITERS = 152, + + /// The DosMuxSemWait list is not correct. + INVALID_LIST_FORMAT = 153, + + /// The volume label you entered exceeds the label character limit of the target file system. + LABEL_TOO_LONG = 154, + + /// Cannot create another thread. + TOO_MANY_TCBS = 155, + + /// The recipient process has refused the signal. + SIGNAL_REFUSED = 156, + + /// The segment is already discarded and cannot be locked. + DISCARDED = 157, + + /// The segment is already unlocked. + NOT_LOCKED = 158, + + /// The address for the thread ID is not correct. + BAD_THREADID_ADDR = 159, + + /// One or more arguments are not correct. + BAD_ARGUMENTS = 160, + + /// The specified path is invalid. + BAD_PATHNAME = 161, + + /// A signal is already pending. + SIGNAL_PENDING = 162, + + /// No more threads can be created in the system. + MAX_THRDS_REACHED = 164, + + /// Unable to lock a region of a file. + LOCK_FAILED = 167, + + /// The requested resource is in use. + BUSY = 170, + + /// Device's command support detection is in progress. + DEVICE_SUPPORT_IN_PROGRESS = 171, + + /// A lock request was not outstanding for the supplied cancel region. + CANCEL_VIOLATION = 173, + + /// The file system does not support atomic changes to the lock type. + ATOMIC_LOCKS_NOT_SUPPORTED = 174, + + /// The system detected a segment number that was not correct. + INVALID_SEGMENT_NUMBER = 180, + + /// The operating system cannot run %1. + INVALID_ORDINAL = 182, + + /// Cannot create a file when that file already exists. + ALREADY_EXISTS = 183, + + /// The flag passed is not correct. + INVALID_FLAG_NUMBER = 186, + + /// The specified system semaphore name was not found. + SEM_NOT_FOUND = 187, + + /// The operating system cannot run %1. + INVALID_STARTING_CODESEG = 188, + + /// The operating system cannot run %1. + INVALID_STACKSEG = 189, + + /// The operating system cannot run %1. + INVALID_MODULETYPE = 190, + + /// Cannot run %1 in Win32 mode. + INVALID_EXE_SIGNATURE = 191, + + /// The operating system cannot run %1. + EXE_MARKED_INVALID = 192, + + /// %1 is not a valid Win32 application. + BAD_EXE_FORMAT = 193, + + /// The operating system cannot run %1. + ITERATED_DATA_EXCEEDS_64k = 194, + + /// The operating system cannot run %1. + INVALID_MINALLOCSIZE = 195, + + /// The operating system cannot run this application program. + DYNLINK_FROM_INVALID_RING = 196, + + /// The operating system is not presently configured to run this application. + IOPL_NOT_ENABLED = 197, + + /// The operating system cannot run %1. + INVALID_SEGDPL = 198, + + /// The operating system cannot run this application program. + AUTODATASEG_EXCEEDS_64k = 199, + + /// The code segment cannot be greater than or equal to 64K. + RING2SEG_MUST_BE_MOVABLE = 200, + + /// The operating system cannot run %1. + RELOC_CHAIN_XEEDS_SEGLIM = 201, + + /// The operating system cannot run %1. + INFLOOP_IN_RELOC_CHAIN = 202, + + /// The system could not find the environment option that was entered. + ENVVAR_NOT_FOUND = 203, + + /// No process in the command subtree has a signal handler. + NO_SIGNAL_SENT = 205, + + /// The filename or extension is too long. + FILENAME_EXCED_RANGE = 206, + + /// The ring 2 stack is in use. + RING2_STACK_IN_USE = 207, + + /// The global filename characters, * or ?, are entered incorrectly or too many global filename characters are specified. + META_EXPANSION_TOO_LONG = 208, + + /// The signal being posted is not correct. + INVALID_SIGNAL_NUMBER = 209, + + /// The signal handler cannot be set. + THREAD_1_INACTIVE = 210, + + /// The segment is locked and cannot be reallocated. + LOCKED = 212, + + /// Too many dynamic-link modules are attached to this program or dynamic-link module. + TOO_MANY_MODULES = 214, + + /// Cannot nest calls to LoadModule. + NESTING_NOT_ALLOWED = 215, + + /// This version of %1 is not compatible with the version of Windows you're running. + /// Check your computer's system information and then contact the software publisher. + EXE_MACHINE_TYPE_MISMATCH = 216, + + /// The image file %1 is signed, unable to modify. + EXE_CANNOT_MODIFY_SIGNED_BINARY = 217, + + /// The image file %1 is strong signed, unable to modify. + EXE_CANNOT_MODIFY_STRONG_SIGNED_BINARY = 218, + + /// This file is checked out or locked for editing by another user. + FILE_CHECKED_OUT = 220, + + /// The file must be checked out before saving changes. + CHECKOUT_REQUIRED = 221, + + /// The file type being saved or retrieved has been blocked. + BAD_FILE_TYPE = 222, + + /// The file size exceeds the limit allowed and cannot be saved. + FILE_TOO_LARGE = 223, + + /// Access Denied. Before opening files in this location, you must first add the web site to your trusted sites list, browse to the web site, and select the option to login automatically. + FORMS_AUTH_REQUIRED = 224, + + /// Operation did not complete successfully because the file contains a virus or potentially unwanted software. + VIRUS_INFECTED = 225, + + /// This file contains a virus or potentially unwanted software and cannot be opened. + /// Due to the nature of this virus or potentially unwanted software, the file has been removed from this location. + VIRUS_DELETED = 226, + + /// The pipe is local. + PIPE_LOCAL = 229, + + /// The pipe state is invalid. + BAD_PIPE = 230, + + /// All pipe instances are busy. + PIPE_BUSY = 231, + + /// The pipe is being closed. + NO_DATA = 232, + + /// No process is on the other end of the pipe. + PIPE_NOT_CONNECTED = 233, + + /// More data is available. + MORE_DATA = 234, + + /// The session was canceled. + VC_DISCONNECTED = 240, + + /// The specified extended attribute name was invalid. + INVALID_EA_NAME = 254, + + /// The extended attributes are inconsistent. + EA_LIST_INCONSISTENT = 255, + + /// The wait operation timed out. + IMEOUT = 258, + + /// No more data is available. + NO_MORE_ITEMS = 259, + + /// The copy functions cannot be used. + CANNOT_COPY = 266, + + /// The directory name is invalid. + DIRECTORY = 267, + + /// The extended attributes did not fit in the buffer. + EAS_DIDNT_FIT = 275, + + /// The extended attribute file on the mounted file system is corrupt. + EA_FILE_CORRUPT = 276, + + /// The extended attribute table file is full. + EA_TABLE_FULL = 277, + + /// The specified extended attribute handle is invalid. + INVALID_EA_HANDLE = 278, + + /// The mounted file system does not support extended attributes. + EAS_NOT_SUPPORTED = 282, + + /// Attempt to release mutex not owned by caller. + NOT_OWNER = 288, + + /// Too many posts were made to a semaphore. + TOO_MANY_POSTS = 298, + + /// Only part of a ReadProcessMemory or WriteProcessMemory request was completed. + PARTIAL_COPY = 299, + + /// The oplock request is denied. + OPLOCK_NOT_GRANTED = 300, + + /// An invalid oplock acknowledgment was received by the system. + INVALID_OPLOCK_PROTOCOL = 301, + + /// The volume is too fragmented to complete this operation. + DISK_TOO_FRAGMENTED = 302, + + /// The file cannot be opened because it is in the process of being deleted. + DELETE_PENDING = 303, + + /// Short name settings may not be changed on this volume due to the global registry setting. + INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING = 304, + + /// Short names are not enabled on this volume. + SHORT_NAMES_NOT_ENABLED_ON_VOLUME = 305, + + /// The security stream for the given volume is in an inconsistent state. Please run CHKDSK on the volume. + SECURITY_STREAM_IS_INCONSISTENT = 306, + + /// A requested file lock operation cannot be processed due to an invalid byte range. + INVALID_LOCK_RANGE = 307, + + /// The subsystem needed to support the image type is not present. + IMAGE_SUBSYSTEM_NOT_PRESENT = 308, + + /// The specified file already has a notification GUID associated with it. + NOTIFICATION_GUID_ALREADY_DEFINED = 309, + + /// An invalid exception handler routine has been detected. + INVALID_EXCEPTION_HANDLER = 310, + + /// Duplicate privileges were specified for the token. + DUPLICATE_PRIVILEGES = 311, + + /// No ranges for the specified operation were able to be processed. + NO_RANGES_PROCESSED = 312, + + /// Operation is not allowed on a file system internal file. + NOT_ALLOWED_ON_SYSTEM_FILE = 313, + + /// The physical resources of this disk have been exhausted. + DISK_RESOURCES_EXHAUSTED = 314, + + /// The token representing the data is invalid. + INVALID_TOKEN = 315, + + /// The device does not support the command feature. + DEVICE_FEATURE_NOT_SUPPORTED = 316, + + /// The system cannot find message text for message number 0x%1 in the message file for %2. + MR_MID_NOT_FOUND = 317, + + /// The scope specified was not found. + SCOPE_NOT_FOUND = 318, + + /// The Central Access Policy specified is not defined on the target machine. + UNDEFINED_SCOPE = 319, + + /// The Central Access Policy obtained from Active Directory is invalid. + INVALID_CAP = 320, + + /// The device is unreachable. + DEVICE_UNREACHABLE = 321, + + /// The target device has insufficient resources to complete the operation. + DEVICE_NO_RESOURCES = 322, + + /// A data integrity checksum error occurred. Data in the file stream is corrupt. + DATA_CHECKSUM_ERROR = 323, + + /// An attempt was made to modify both a KERNEL and normal Extended Attribute (EA) in the same operation. + INTERMIXED_KERNEL_EA_OPERATION = 324, + + /// Device does not support file-level TRIM. + FILE_LEVEL_TRIM_NOT_SUPPORTED = 326, + + /// The command specified a data offset that does not align to the device's granularity/alignment. + OFFSET_ALIGNMENT_VIOLATION = 327, + + /// The command specified an invalid field in its parameter list. + INVALID_FIELD_IN_PARAMETER_LIST = 328, + + /// An operation is currently in progress with the device. + OPERATION_IN_PROGRESS = 329, + + /// An attempt was made to send down the command via an invalid path to the target device. + BAD_DEVICE_PATH = 330, + + /// The command specified a number of descriptors that exceeded the maximum supported by the device. + TOO_MANY_DESCRIPTORS = 331, + + /// Scrub is disabled on the specified file. + SCRUB_DATA_DISABLED = 332, + + /// The storage device does not provide redundancy. + NOT_REDUNDANT_STORAGE = 333, + + /// An operation is not supported on a resident file. + RESIDENT_FILE_NOT_SUPPORTED = 334, + + /// An operation is not supported on a compressed file. + COMPRESSED_FILE_NOT_SUPPORTED = 335, + + /// An operation is not supported on a directory. + DIRECTORY_NOT_SUPPORTED = 336, + + /// The specified copy of the requested data could not be read. + NOT_READ_FROM_COPY = 337, + + /// No action was taken as a system reboot is required. + FAIL_NOACTION_REBOOT = 350, + + /// The shutdown operation failed. + FAIL_SHUTDOWN = 351, + + /// The restart operation failed. + FAIL_RESTART = 352, + + /// The maximum number of sessions has been reached. + MAX_SESSIONS_REACHED = 353, + + /// The thread is already in background processing mode. + THREAD_MODE_ALREADY_BACKGROUND = 400, + + /// The thread is not in background processing mode. + THREAD_MODE_NOT_BACKGROUND = 401, + + /// The process is already in background processing mode. + PROCESS_MODE_ALREADY_BACKGROUND = 402, + + /// The process is not in background processing mode. + PROCESS_MODE_NOT_BACKGROUND = 403, + + /// Attempt to access invalid address. + INVALID_ADDRESS = 487, + + /// User profile cannot be loaded. + USER_PROFILE_LOAD = 500, + + /// Arithmetic result exceeded 32 bits. + ARITHMETIC_OVERFLOW = 534, + + /// There is a process on other end of the pipe. + PIPE_CONNECTED = 535, + + /// Waiting for a process to open the other end of the pipe. + PIPE_LISTENING = 536, + + /// Application verifier has found an error in the current process. + VERIFIER_STOP = 537, + + /// An error occurred in the ABIOS subsystem. + ABIOS_ERROR = 538, + + /// A warning occurred in the WX86 subsystem. + WX86_WARNING = 539, + + /// An error occurred in the WX86 subsystem. + WX86_ERROR = 540, + + /// An attempt was made to cancel or set a timer that has an associated APC and the subject thread is not the thread that originally set the timer with an associated APC routine. + TIMER_NOT_CANCELED = 541, + + /// Unwind exception code. + UNWIND = 542, + + /// An invalid or unaligned stack was encountered during an unwind operation. + BAD_STACK = 543, + + /// An invalid unwind target was encountered during an unwind operation. + INVALID_UNWIND_TARGET = 544, + + /// Invalid Object Attributes specified to NtCreatePort or invalid Port Attributes specified to NtConnectPort + INVALID_PORT_ATTRIBUTES = 545, + + /// Length of message passed to NtRequestPort or NtRequestWaitReplyPort was longer than the maximum message allowed by the port. + PORT_MESSAGE_TOO_LONG = 546, + + /// An attempt was made to lower a quota limit below the current usage. + INVALID_QUOTA_LOWER = 547, + + /// An attempt was made to attach to a device that was already attached to another device. + DEVICE_ALREADY_ATTACHED = 548, + + /// An attempt was made to execute an instruction at an unaligned address and the host system does not support unaligned instruction references. + INSTRUCTION_MISALIGNMENT = 549, + + /// Profiling not started. + PROFILING_NOT_STARTED = 550, + + /// Profiling not stopped. + PROFILING_NOT_STOPPED = 551, + + /// The passed ACL did not contain the minimum required information. + COULD_NOT_INTERPRET = 552, + + /// The number of active profiling objects is at the maximum and no more may be started. + PROFILING_AT_LIMIT = 553, + + /// Used to indicate that an operation cannot continue without blocking for I/O. + CANT_WAIT = 554, + + /// Indicates that a thread attempted to terminate itself by default (called NtTerminateThread with NULL) and it was the last thread in the current process. + CANT_TERMINATE_SELF = 555, + + /// If an MM error is returned which is not defined in the standard FsRtl filter, it is converted to one of the following errors which is guaranteed to be in the filter. + /// In this case information is lost, however, the filter correctly handles the exception. + UNEXPECTED_MM_CREATE_ERR = 556, + + /// If an MM error is returned which is not defined in the standard FsRtl filter, it is converted to one of the following errors which is guaranteed to be in the filter. + /// In this case information is lost, however, the filter correctly handles the exception. + UNEXPECTED_MM_MAP_ERROR = 557, + + /// If an MM error is returned which is not defined in the standard FsRtl filter, it is converted to one of the following errors which is guaranteed to be in the filter. + /// In this case information is lost, however, the filter correctly handles the exception. + UNEXPECTED_MM_EXTEND_ERR = 558, + + /// A malformed function table was encountered during an unwind operation. + BAD_FUNCTION_TABLE = 559, + + /// Indicates that an attempt was made to assign protection to a file system file or directory and one of the SIDs in the security descriptor could not be translated into a GUID that could be stored by the file system. + /// This causes the protection attempt to fail, which may cause a file creation attempt to fail. + NO_GUID_TRANSLATION = 560, + + /// Indicates that an attempt was made to grow an LDT by setting its size, or that the size was not an even number of selectors. + INVALID_LDT_SIZE = 561, + + /// Indicates that the starting value for the LDT information was not an integral multiple of the selector size. + INVALID_LDT_OFFSET = 563, + + /// Indicates that the user supplied an invalid descriptor when trying to set up Ldt descriptors. + INVALID_LDT_DESCRIPTOR = 564, + + /// Indicates a process has too many threads to perform the requested action. + /// For example, assignment of a primary token may only be performed when a process has zero or one threads. + TOO_MANY_THREADS = 565, + + /// An attempt was made to operate on a thread within a specific process, but the thread specified is not in the process specified. + THREAD_NOT_IN_PROCESS = 566, + + /// Page file quota was exceeded. + PAGEFILE_QUOTA_EXCEEDED = 567, + + /// The Netlogon service cannot start because another Netlogon service running in the domain conflicts with the specified role. + LOGON_SERVER_CONFLICT = 568, + + /// The SAM database on a Windows Server is significantly out of synchronization with the copy on the Domain Controller. A complete synchronization is required. + SYNCHRONIZATION_REQUIRED = 569, + + /// The NtCreateFile API failed. This error should never be returned to an application, it is a place holder for the Windows Lan Manager Redirector to use in its internal error mapping routines. + NET_OPEN_FAILED = 570, + + /// {Privilege Failed} The I/O permissions for the process could not be changed. + IO_PRIVILEGE_FAILED = 571, + + /// {Application Exit by CTRL+C} The application terminated as a result of a CTRL+C. + CONTROL_C_EXIT = 572, + + /// {Missing System File} The required system file %hs is bad or missing. + MISSING_SYSTEMFILE = 573, + + /// {Application Error} The exception %s (0x%08lx) occurred in the application at location 0x%08lx. + UNHANDLED_EXCEPTION = 574, + + /// {Application Error} The application was unable to start correctly (0x%lx). Click OK to close the application. + APP_INIT_FAILURE = 575, + + /// {Unable to Create Paging File} The creation of the paging file %hs failed (%lx). The requested size was %ld. + PAGEFILE_CREATE_FAILED = 576, + + /// Windows cannot verify the digital signature for this file. + /// A recent hardware or software change might have installed a file that is signed incorrectly or damaged, or that might be malicious software from an unknown source. + INVALID_IMAGE_HASH = 577, + + /// {No Paging File Specified} No paging file was specified in the system configuration. + NO_PAGEFILE = 578, + + /// {EXCEPTION} A real-mode application issued a floating-point instruction and floating-point hardware is not present. + ILLEGAL_FLOAT_CONTEXT = 579, + + /// An event pair synchronization operation was performed using the thread specific client/server event pair object, but no event pair object was associated with the thread. + NO_EVENT_PAIR = 580, + + /// A Windows Server has an incorrect configuration. + DOMAIN_CTRLR_CONFIG_ERROR = 581, + + /// An illegal character was encountered. + /// For a multi-byte character set this includes a lead byte without a succeeding trail byte. + /// For the Unicode character set this includes the characters 0xFFFF and 0xFFFE. + ILLEGAL_CHARACTER = 582, + + /// The Unicode character is not defined in the Unicode character set installed on the system. + UNDEFINED_CHARACTER = 583, + + /// The paging file cannot be created on a floppy diskette. + FLOPPY_VOLUME = 584, + + /// The system BIOS failed to connect a system interrupt to the device or bus for which the device is connected. + BIOS_FAILED_TO_CONNECT_INTERRUPT = 585, + + /// This operation is only allowed for the Primary Domain Controller of the domain. + BACKUP_CONTROLLER = 586, + + /// An attempt was made to acquire a mutant such that its maximum count would have been exceeded. + MUTANT_LIMIT_EXCEEDED = 587, + + /// A volume has been accessed for which a file system driver is required that has not yet been loaded. + FS_DRIVER_REQUIRED = 588, + + /// {Registry File Failure} The registry cannot load the hive (file): %hs or its log or alternate. It is corrupt, absent, or not writable. + CANNOT_LOAD_REGISTRY_FILE = 589, + + /// {Unexpected Failure in DebugActiveProcess} An unexpected failure occurred while processing a DebugActiveProcess API request. + /// You may choose OK to terminate the process, or Cancel to ignore the error. + DEBUG_ATTACH_FAILED = 590, + + /// {Fatal System Error} The %hs system process terminated unexpectedly with a status of 0x%08x (0x%08x 0x%08x). The system has been shut down. + SYSTEM_PROCESS_TERMINATED = 591, + + /// {Data Not Accepted} The TDI client could not handle the data received during an indication. + DATA_NOT_ACCEPTED = 592, + + /// NTVDM encountered a hard error. + VDM_HARD_ERROR = 593, + + /// {Cancel Timeout} The driver %hs failed to complete a cancelled I/O request in the allotted time. + DRIVER_CANCEL_TIMEOUT = 594, + + /// {Reply Message Mismatch} An attempt was made to reply to an LPC message, but the thread specified by the client ID in the message was not waiting on that message. + REPLY_MESSAGE_MISMATCH = 595, + + /// {Delayed Write Failed} Windows was unable to save all the data for the file %hs. The data has been lost. + /// This error may be caused by a failure of your computer hardware or network connection. Please try to save this file elsewhere. + LOST_WRITEBEHIND_DATA = 596, + + /// The parameter(s) passed to the server in the client/server shared memory window were invalid. + /// Too much data may have been put in the shared memory window. + CLIENT_SERVER_PARAMETERS_INVALID = 597, + + /// The stream is not a tiny stream. + NOT_TINY_STREAM = 598, + + /// The request must be handled by the stack overflow code. + STACK_OVERFLOW_READ = 599, + + /// Internal OFS status codes indicating how an allocation operation is handled. + /// Either it is retried after the containing onode is moved or the extent stream is converted to a large stream. + CONVERT_TO_LARGE = 600, + + /// The attempt to find the object found an object matching by ID on the volume but it is out of the scope of the handle used for the operation. + FOUND_OUT_OF_SCOPE = 601, + + /// The bucket array must be grown. Retry transaction after doing so. + ALLOCATE_BUCKET = 602, + + /// The user/kernel marshalling buffer has overflowed. + MARSHALL_OVERFLOW = 603, + + /// The supplied variant structure contains invalid data. + INVALID_VARIANT = 604, + + /// The specified buffer contains ill-formed data. + BAD_COMPRESSION_BUFFER = 605, + + /// {Audit Failed} An attempt to generate a security audit failed. + AUDIT_FAILED = 606, + + /// The timer resolution was not previously set by the current process. + TIMER_RESOLUTION_NOT_SET = 607, + + /// There is insufficient account information to log you on. + INSUFFICIENT_LOGON_INFO = 608, + + /// {Invalid DLL Entrypoint} The dynamic link library %hs is not written correctly. + /// The stack pointer has been left in an inconsistent state. + /// The entrypoint should be declared as WINAPI or STDCALL. + /// Select YES to fail the DLL load. Select NO to continue execution. + /// Selecting NO may cause the application to operate incorrectly. + BAD_DLL_ENTRYPOINT = 609, + + /// {Invalid Service Callback Entrypoint} The %hs service is not written correctly. + /// The stack pointer has been left in an inconsistent state. + /// The callback entrypoint should be declared as WINAPI or STDCALL. + /// Selecting OK will cause the service to continue operation. + /// However, the service process may operate incorrectly. + BAD_SERVICE_ENTRYPOINT = 610, + + /// There is an IP address conflict with another system on the network. + IP_ADDRESS_CONFLICT1 = 611, + + /// There is an IP address conflict with another system on the network. + IP_ADDRESS_CONFLICT2 = 612, + + /// {Low On Registry Space} The system has reached the maximum size allowed for the system part of the registry. Additional storage requests will be ignored. + REGISTRY_QUOTA_LIMIT = 613, + + /// A callback return system service cannot be executed when no callback is active. + NO_CALLBACK_ACTIVE = 614, + + /// The password provided is too short to meet the policy of your user account. Please choose a longer password. + PWD_TOO_SHORT = 615, + + /// The policy of your user account does not allow you to change passwords too frequently. + /// This is done to prevent users from changing back to a familiar, but potentially discovered, password. + /// If you feel your password has been compromised then please contact your administrator immediately to have a new one assigned. + PWD_TOO_RECENT = 616, + + /// You have attempted to change your password to one that you have used in the past. + /// The policy of your user account does not allow this. + /// Please select a password that you have not previously used. + PWD_HISTORY_CONFLICT = 617, + + /// The specified compression format is unsupported. + UNSUPPORTED_COMPRESSION = 618, + + /// The specified hardware profile configuration is invalid. + INVALID_HW_PROFILE = 619, + + /// The specified Plug and Play registry device path is invalid. + INVALID_PLUGPLAY_DEVICE_PATH = 620, + + /// The specified quota list is internally inconsistent with its descriptor. + QUOTA_LIST_INCONSISTENT = 621, + + /// {Windows Evaluation Notification} The evaluation period for this installation of Windows has expired. This system will shutdown in 1 hour. + /// To restore access to this installation of Windows, please upgrade this installation using a licensed distribution of this product. + EVALUATION_EXPIRATION = 622, + + /// {Illegal System DLL Relocation} The system DLL %hs was relocated in memory. The application will not run properly. + /// The relocation occurred because the DLL %hs occupied an address range reserved for Windows system DLLs. + /// The vendor supplying the DLL should be contacted for a new DLL. + ILLEGAL_DLL_RELOCATION = 623, + + /// {DLL Initialization Failed} The application failed to initialize because the window station is shutting down. + DLL_INIT_FAILED_LOGOFF = 624, + + /// The validation process needs to continue on to the next step. + VALIDATE_CONTINUE = 625, + + /// There are no more matches for the current index enumeration. + NO_MORE_MATCHES = 626, + + /// The range could not be added to the range list because of a conflict. + RANGE_LIST_CONFLICT = 627, + + /// The server process is running under a SID different than that required by client. + SERVER_SID_MISMATCH = 628, + + /// A group marked use for deny only cannot be enabled. + CANT_ENABLE_DENY_ONLY = 629, + + /// {EXCEPTION} Multiple floating point faults. + FLOAT_MULTIPLE_FAULTS = 630, + + /// {EXCEPTION} Multiple floating point traps. + FLOAT_MULTIPLE_TRAPS = 631, + + /// The requested interface is not supported. + NOINTERFACE = 632, + + /// {System Standby Failed} The driver %hs does not support standby mode. + /// Updating this driver may allow the system to go to standby mode. + DRIVER_FAILED_SLEEP = 633, + + /// The system file %1 has become corrupt and has been replaced. + CORRUPT_SYSTEM_FILE = 634, + + /// {Virtual Memory Minimum Too Low} Your system is low on virtual memory. + /// Windows is increasing the size of your virtual memory paging file. + /// During this process, memory requests for some applications may be denied. For more information, see Help. + COMMITMENT_MINIMUM = 635, + + /// A device was removed so enumeration must be restarted. + PNP_RESTART_ENUMERATION = 636, + + /// {Fatal System Error} The system image %s is not properly signed. + /// The file has been replaced with the signed file. The system has been shut down. + SYSTEM_IMAGE_BAD_SIGNATURE = 637, + + /// Device will not start without a reboot. + PNP_REBOOT_REQUIRED = 638, + + /// There is not enough power to complete the requested operation. + INSUFFICIENT_POWER = 639, + + /// ERROR_MULTIPLE_FAULT_VIOLATION + MULTIPLE_FAULT_VIOLATION = 640, + + /// The system is in the process of shutting down. + SYSTEM_SHUTDOWN = 641, + + /// An attempt to remove a processes DebugPort was made, but a port was not already associated with the process. + PORT_NOT_SET = 642, + + /// This version of Windows is not compatible with the behavior version of directory forest, domain or domain controller. + DS_VERSION_CHECK_FAILURE = 643, + + /// The specified range could not be found in the range list. + RANGE_NOT_FOUND = 644, + + /// The driver was not loaded because the system is booting into safe mode. + NOT_SAFE_MODE_DRIVER = 646, + + /// The driver was not loaded because it failed its initialization call. + FAILED_DRIVER_ENTRY = 647, + + /// The "%hs" encountered an error while applying power or reading the device configuration. + /// This may be caused by a failure of your hardware or by a poor connection. + DEVICE_ENUMERATION_ERROR = 648, + + /// The create operation failed because the name contained at least one mount point which resolves to a volume to which the specified device object is not attached. + MOUNT_POINT_NOT_RESOLVED = 649, + + /// The device object parameter is either not a valid device object or is not attached to the volume specified by the file name. + INVALID_DEVICE_OBJECT_PARAMETER = 650, + + /// A Machine Check Error has occurred. + /// Please check the system eventlog for additional information. + MCA_OCCURED = 651, + + /// There was error [%2] processing the driver database. + DRIVER_DATABASE_ERROR = 652, + + /// System hive size has exceeded its limit. + SYSTEM_HIVE_TOO_LARGE = 653, + + /// The driver could not be loaded because a previous version of the driver is still in memory. + DRIVER_FAILED_PRIOR_UNLOAD = 654, + + /// {Volume Shadow Copy Service} Please wait while the Volume Shadow Copy Service prepares volume %hs for hibernation. + VOLSNAP_PREPARE_HIBERNATE = 655, + + /// The system has failed to hibernate (The error code is %hs). + /// Hibernation will be disabled until the system is restarted. + HIBERNATION_FAILURE = 656, + + /// The password provided is too long to meet the policy of your user account. Please choose a shorter password. + PWD_TOO_LONG = 657, + + /// The requested operation could not be completed due to a file system limitation. + FILE_SYSTEM_LIMITATION = 665, + + /// An assertion failure has occurred. + ASSERTION_FAILURE = 668, + + /// An error occurred in the ACPI subsystem. + ACPI_ERROR = 669, + + /// WOW Assertion Error. + WOW_ASSERTION = 670, + + /// A device is missing in the system BIOS MPS table. This device will not be used. + /// Please contact your system vendor for system BIOS update. + PNP_BAD_MPS_TABLE = 671, + + /// A translator failed to translate resources. + PNP_TRANSLATION_FAILED = 672, + + /// A IRQ translator failed to translate resources. + PNP_IRQ_TRANSLATION_FAILED = 673, + + /// Driver %2 returned invalid ID for a child device (%3). + PNP_INVALID_ID = 674, + + /// {Kernel Debugger Awakened} the system debugger was awakened by an interrupt. + WAKE_SYSTEM_DEBUGGER = 675, + + /// {Handles Closed} Handles to objects have been automatically closed as a result of the requested operation. + HANDLES_CLOSED = 676, + + /// {Too Much Information} The specified access control list (ACL) contained more information than was expected. + EXTRANEOUS_INFORMATION = 677, + + /// This warning level status indicates that the transaction state already exists for the registry sub-tree, but that a transaction commit was previously aborted. + /// The commit has NOT been completed, but has not been rolled back either (so it may still be committed if desired). + RXACT_COMMIT_NECESSARY = 678, + + /// {Media Changed} The media may have changed. + MEDIA_CHECK = 679, + + /// {GUID Substitution} During the translation of a global identifier (GUID) to a Windows security ID (SID), no administratively-defined GUID prefix was found. + /// A substitute prefix was used, which will not compromise system security. + /// However, this may provide a more restrictive access than intended. + GUID_SUBSTITUTION_MADE = 680, + + /// The create operation stopped after reaching a symbolic link. + STOPPED_ON_SYMLINK = 681, + + /// A long jump has been executed. + LONGJUMP = 682, + + /// The Plug and Play query operation was not successful. + PLUGPLAY_QUERY_VETOED = 683, + + /// A frame consolidation has been executed. + UNWIND_CONSOLIDATE = 684, + + /// {Registry Hive Recovered} Registry hive (file): %hs was corrupted and it has been recovered. Some data might have been lost. + REGISTRY_HIVE_RECOVERED = 685, + + /// The application is attempting to run executable code from the module %hs. This may be insecure. + /// An alternative, %hs, is available. Should the application use the secure module %hs? + DLL_MIGHT_BE_INSECURE = 686, + + /// The application is loading executable code from the module %hs. + /// This is secure, but may be incompatible with previous releases of the operating system. + /// An alternative, %hs, is available. Should the application use the secure module %hs? + DLL_MIGHT_BE_INCOMPATIBLE = 687, + + /// Debugger did not handle the exception. + DBG_EXCEPTION_NOT_HANDLED = 688, + + /// Debugger will reply later. + DBG_REPLY_LATER = 689, + + /// Debugger cannot provide handle. + DBG_UNABLE_TO_PROVIDE_HANDLE = 690, + + /// Debugger terminated thread. + DBG_TERMINATE_THREAD = 691, + + /// Debugger terminated process. + DBG_TERMINATE_PROCESS = 692, + + /// Debugger got control C. + DBG_CONTROL_C = 693, + + /// Debugger printed exception on control C. + DBG_PRINTEXCEPTION_C = 694, + + /// Debugger received RIP exception. + DBG_RIPEXCEPTION = 695, + + /// Debugger received control break. + DBG_CONTROL_BREAK = 696, + + /// Debugger command communication exception. + DBG_COMMAND_EXCEPTION = 697, + + /// {Object Exists} An attempt was made to create an object and the object name already existed. + OBJECT_NAME_EXISTS = 698, + + /// {Thread Suspended} A thread termination occurred while the thread was suspended. + /// The thread was resumed, and termination proceeded. + THREAD_WAS_SUSPENDED = 699, + + /// {Image Relocated} An image file could not be mapped at the address specified in the image file. Local fixups must be performed on this image. + IMAGE_NOT_AT_BASE = 700, + + /// This informational level status indicates that a specified registry sub-tree transaction state did not yet exist and had to be created. + RXACT_STATE_CREATED = 701, + + /// {Segment Load} A virtual DOS machine (VDM) is loading, unloading, or moving an MS-DOS or Win16 program segment image. + /// An exception is raised so a debugger can load, unload or track symbols and breakpoints within these 16-bit segments. + SEGMENT_NOTIFICATION = 702, + + /// {Invalid Current Directory} The process cannot switch to the startup current directory %hs. + /// Select OK to set current directory to %hs, or select CANCEL to exit. + BAD_CURRENT_DIRECTORY = 703, + + /// {Redundant Read} To satisfy a read request, the NT fault-tolerant file system successfully read the requested data from a redundant copy. + /// This was done because the file system encountered a failure on a member of the fault-tolerant volume, but was unable to reassign the failing area of the device. + FT_READ_RECOVERY_FROM_BACKUP = 704, + + /// {Redundant Write} To satisfy a write request, the NT fault-tolerant file system successfully wrote a redundant copy of the information. + /// This was done because the file system encountered a failure on a member of the fault-tolerant volume, but was not able to reassign the failing area of the device. + FT_WRITE_RECOVERY = 705, + + /// {Machine Type Mismatch} The image file %hs is valid, but is for a machine type other than the current machine. + /// Select OK to continue, or CANCEL to fail the DLL load. + IMAGE_MACHINE_TYPE_MISMATCH = 706, + + /// {Partial Data Received} The network transport returned partial data to its client. The remaining data will be sent later. + RECEIVE_PARTIAL = 707, + + /// {Expedited Data Received} The network transport returned data to its client that was marked as expedited by the remote system. + RECEIVE_EXPEDITED = 708, + + /// {Partial Expedited Data Received} The network transport returned partial data to its client and this data was marked as expedited by the remote system. The remaining data will be sent later. + RECEIVE_PARTIAL_EXPEDITED = 709, + + /// {TDI Event Done} The TDI indication has completed successfully. + EVENT_DONE = 710, + + /// {TDI Event Pending} The TDI indication has entered the pending state. + EVENT_PENDING = 711, + + /// Checking file system on %wZ. + CHECKING_FILE_SYSTEM = 712, + + /// {Fatal Application Exit} %hs. + FATAL_APP_EXIT = 713, + + /// The specified registry key is referenced by a predefined handle. + PREDEFINED_HANDLE = 714, + + /// {Page Unlocked} The page protection of a locked page was changed to 'No Access' and the page was unlocked from memory and from the process. + WAS_UNLOCKED = 715, + + /// %hs + SERVICE_NOTIFICATION = 716, + + /// {Page Locked} One of the pages to lock was already locked. + WAS_LOCKED = 717, + + /// Application popup: %1 : %2 + LOG_HARD_ERROR = 718, + + /// ERROR_ALREADY_WIN32 + ALREADY_WIN32 = 719, + + /// {Machine Type Mismatch} The image file %hs is valid, but is for a machine type other than the current machine. + IMAGE_MACHINE_TYPE_MISMATCH_EXE = 720, + + /// A yield execution was performed and no thread was available to run. + NO_YIELD_PERFORMED = 721, + + /// The resumable flag to a timer API was ignored. + TIMER_RESUME_IGNORED = 722, + + /// The arbiter has deferred arbitration of these resources to its parent. + ARBITRATION_UNHANDLED = 723, + + /// The inserted CardBus device cannot be started because of a configuration error on "%hs". + CARDBUS_NOT_SUPPORTED = 724, + + /// The CPUs in this multiprocessor system are not all the same revision level. + /// To use all processors the operating system restricts itself to the features of the least capable processor in the system. + /// Should problems occur with this system, contact the CPU manufacturer to see if this mix of processors is supported. + MP_PROCESSOR_MISMATCH = 725, + + /// The system was put into hibernation. + HIBERNATED = 726, + + /// The system was resumed from hibernation. + RESUME_HIBERNATION = 727, + + /// Windows has detected that the system firmware (BIOS) was updated [previous firmware date = %2, current firmware date %3]. + FIRMWARE_UPDATED = 728, + + /// A device driver is leaking locked I/O pages causing system degradation. + /// The system has automatically enabled tracking code in order to try and catch the culprit. + DRIVERS_LEAKING_LOCKED_PAGES = 729, + + /// The system has awoken. + WAKE_SYSTEM = 730, + + /// ERROR_WAIT_1 + WAIT_1 = 731, + + /// ERROR_WAIT_2 + WAIT_2 = 732, + + /// ERROR_WAIT_3 + WAIT_3 = 733, + + /// ERROR_WAIT_63 + WAIT_63 = 734, + + /// ERROR_ABANDONED_WAIT_0 + ABANDONED_WAIT_0 = 735, + + /// ERROR_ABANDONED_WAIT_63 + ABANDONED_WAIT_63 = 736, + + /// ERROR_USER_APC + USER_APC = 737, + + /// ERROR_KERNEL_APC + KERNEL_APC = 738, + + /// ERROR_ALERTED + ALERTED = 739, + + /// The requested operation requires elevation. + ELEVATION_REQUIRED = 740, + + /// A reparse should be performed by the Object Manager since the name of the file resulted in a symbolic link. + REPARSE = 741, + + /// An open/create operation completed while an oplock break is underway. + OPLOCK_BREAK_IN_PROGRESS = 742, + + /// A new volume has been mounted by a file system. + VOLUME_MOUNTED = 743, + + /// This success level status indicates that the transaction state already exists for the registry sub-tree, but that a transaction commit was previously aborted. The commit has now been completed. + RXACT_COMMITTED = 744, + + /// This indicates that a notify change request has been completed due to closing the handle which made the notify change request. + NOTIFY_CLEANUP = 745, + + /// {Connect Failure on Primary Transport} An attempt was made to connect to the remote server %hs on the primary transport, but the connection failed. + /// The computer WAS able to connect on a secondary transport. + PRIMARY_TRANSPORT_CONNECT_FAILED = 746, + + /// Page fault was a transition fault. + PAGE_FAULT_TRANSITION = 747, + + /// Page fault was a demand zero fault. + PAGE_FAULT_DEMAND_ZERO = 748, + + /// Page fault was a demand zero fault. + PAGE_FAULT_COPY_ON_WRITE = 749, + + /// Page fault was a demand zero fault. + PAGE_FAULT_GUARD_PAGE = 750, + + /// Page fault was satisfied by reading from a secondary storage device. + PAGE_FAULT_PAGING_FILE = 751, + + /// Cached page was locked during operation. + CACHE_PAGE_LOCKED = 752, + + /// Crash dump exists in paging file. + CRASH_DUMP = 753, + + /// Specified buffer contains all zeros. + BUFFER_ALL_ZEROS = 754, + + /// A reparse should be performed by the Object Manager since the name of the file resulted in a symbolic link. + REPARSE_OBJECT = 755, + + /// The device has succeeded a query-stop and its resource requirements have changed. + RESOURCE_REQUIREMENTS_CHANGED = 756, + + /// The translator has translated these resources into the global space and no further translations should be performed. + TRANSLATION_COMPLETE = 757, + + /// A process being terminated has no threads to terminate. + NOTHING_TO_TERMINATE = 758, + + /// The specified process is not part of a job. + PROCESS_NOT_IN_JOB = 759, + + /// The specified process is part of a job. + PROCESS_IN_JOB = 760, + + /// {Volume Shadow Copy Service} The system is now ready for hibernation. + VOLSNAP_HIBERNATE_READY = 761, + + /// A file system or file system filter driver has successfully completed an FsFilter operation. + FSFILTER_OP_COMPLETED_SUCCESSFULLY = 762, + + /// The specified interrupt vector was already connected. + INTERRUPT_VECTOR_ALREADY_CONNECTED = 763, + + /// The specified interrupt vector is still connected. + INTERRUPT_STILL_CONNECTED = 764, + + /// An operation is blocked waiting for an oplock. + WAIT_FOR_OPLOCK = 765, + + /// Debugger handled exception. + DBG_EXCEPTION_HANDLED = 766, + + /// Debugger continued. + DBG_CONTINUE = 767, + + /// An exception occurred in a user mode callback and the kernel callback frame should be removed. + CALLBACK_POP_STACK = 768, + + /// Compression is disabled for this volume. + COMPRESSION_DISABLED = 769, + + /// The data provider cannot fetch backwards through a result set. + CANTFETCHBACKWARDS = 770, + + /// The data provider cannot scroll backwards through a result set. + CANTSCROLLBACKWARDS = 771, + + /// The data provider requires that previously fetched data is released before asking for more data. + ROWSNOTRELEASED = 772, + + /// The data provider was not able to interpret the flags set for a column binding in an accessor. + BAD_ACCESSOR_FLAGS = 773, + + /// One or more errors occurred while processing the request. + ERRORS_ENCOUNTERED = 774, + + /// The implementation is not capable of performing the request. + NOT_CAPABLE = 775, + + /// The client of a component requested an operation which is not valid given the state of the component instance. + REQUEST_OUT_OF_SEQUENCE = 776, + + /// A version number could not be parsed. + VERSION_PARSE_ERROR = 777, + + /// The iterator's start position is invalid. + BADSTARTPOSITION = 778, + + /// The hardware has reported an uncorrectable memory error. + MEMORY_HARDWARE = 779, + + /// The attempted operation required self healing to be enabled. + DISK_REPAIR_DISABLED = 780, + + /// The Desktop heap encountered an error while allocating session memory. + /// There is more information in the system event log. + INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE = 781, + + /// The system power state is transitioning from %2 to %3. + SYSTEM_POWERSTATE_TRANSITION = 782, + + /// The system power state is transitioning from %2 to %3 but could enter %4. + SYSTEM_POWERSTATE_COMPLEX_TRANSITION = 783, + + /// A thread is getting dispatched with MCA EXCEPTION because of MCA. + MCA_EXCEPTION = 784, + + /// Access to %1 is monitored by policy rule %2. + ACCESS_AUDIT_BY_POLICY = 785, + + /// Access to %1 has been restricted by your Administrator by policy rule %2. + ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY = 786, + + /// A valid hibernation file has been invalidated and should be abandoned. + ABANDON_HIBERFILE = 787, + + /// {Delayed Write Failed} Windows was unable to save all the data for the file %hs; the data has been lost. + /// This error may be caused by network connectivity issues. Please try to save this file elsewhere. + LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED = 788, + + /// {Delayed Write Failed} Windows was unable to save all the data for the file %hs; the data has been lost. + /// This error was returned by the server on which the file exists. Please try to save this file elsewhere. + LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR = 789, + + /// {Delayed Write Failed} Windows was unable to save all the data for the file %hs; the data has been lost. + /// This error may be caused if the device has been removed or the media is write-protected. + LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR = 790, + + /// The resources required for this device conflict with the MCFG table. + BAD_MCFG_TABLE = 791, + + /// The volume repair could not be performed while it is online. + /// Please schedule to take the volume offline so that it can be repaired. + DISK_REPAIR_REDIRECTED = 792, + + /// The volume repair was not successful. + DISK_REPAIR_UNSUCCESSFUL = 793, + + /// One of the volume corruption logs is full. + /// Further corruptions that may be detected won't be logged. + CORRUPT_LOG_OVERFULL = 794, + + /// One of the volume corruption logs is internally corrupted and needs to be recreated. + /// The volume may contain undetected corruptions and must be scanned. + CORRUPT_LOG_CORRUPTED = 795, + + /// One of the volume corruption logs is unavailable for being operated on. + CORRUPT_LOG_UNAVAILABLE = 796, + + /// One of the volume corruption logs was deleted while still having corruption records in them. + /// The volume contains detected corruptions and must be scanned. + CORRUPT_LOG_DELETED_FULL = 797, + + /// One of the volume corruption logs was cleared by chkdsk and no longer contains real corruptions. + CORRUPT_LOG_CLEARED = 798, + + /// Orphaned files exist on the volume but could not be recovered because no more new names could be created in the recovery directory. Files must be moved from the recovery directory. + ORPHAN_NAME_EXHAUSTED = 799, + + /// The oplock that was associated with this handle is now associated with a different handle. + OPLOCK_SWITCHED_TO_NEW_HANDLE = 800, + + /// An oplock of the requested level cannot be granted. An oplock of a lower level may be available. + CANNOT_GRANT_REQUESTED_OPLOCK = 801, + + /// The operation did not complete successfully because it would cause an oplock to be broken. + /// The caller has requested that existing oplocks not be broken. + CANNOT_BREAK_OPLOCK = 802, + + /// The handle with which this oplock was associated has been closed. The oplock is now broken. + OPLOCK_HANDLE_CLOSED = 803, + + /// The specified access control entry (ACE) does not contain a condition. + NO_ACE_CONDITION = 804, + + /// The specified access control entry (ACE) contains an invalid condition. + INVALID_ACE_CONDITION = 805, + + /// Access to the specified file handle has been revoked. + FILE_HANDLE_REVOKED = 806, + + /// An image file was mapped at a different address from the one specified in the image file but fixups will still be automatically performed on the image. + IMAGE_AT_DIFFERENT_BASE = 807, + + /// Access to the extended attribute was denied. + EA_ACCESS_DENIED = 994, + + /// The I/O operation has been aborted because of either a thread exit or an application request. + OPERATION_ABORTED = 995, + + /// Overlapped I/O event is not in a signaled state. + IO_INCOMPLETE = 996, + + /// Overlapped I/O operation is in progress. + IO_PENDING = 997, + + /// Invalid access to memory location. + NOACCESS = 998, + + /// Error performing inpage operation. + SWAPERROR = 999, + + /// Recursion too deep; the stack overflowed. + STACK_OVERFLOW = 1001, + + /// The window cannot act on the sent message. + INVALID_MESSAGE = 1002, + + /// Cannot complete this function. + CAN_NOT_COMPLETE = 1003, + + /// Invalid flags. + INVALID_FLAGS = 1004, + + /// The volume does not contain a recognized file system. + /// Please make sure that all required file system drivers are loaded and that the volume is not corrupted. + UNRECOGNIZED_VOLUME = 1005, + + /// The volume for a file has been externally altered so that the opened file is no longer valid. + FILE_INVALID = 1006, + + /// The requested operation cannot be performed in full-screen mode. + FULLSCREEN_MODE = 1007, + + /// An attempt was made to reference a token that does not exist. + NO_TOKEN = 1008, + + /// The configuration registry database is corrupt. + BADDB = 1009, + + /// The configuration registry key is invalid. + BADKEY = 1010, + + /// The configuration registry key could not be opened. + CANTOPEN = 1011, + + /// The configuration registry key could not be read. + CANTREAD = 1012, + + /// The configuration registry key could not be written. + CANTWRITE = 1013, + + /// One of the files in the registry database had to be recovered by use of a log or alternate copy. The recovery was successful. + REGISTRY_RECOVERED = 1014, + + /// The registry is corrupted. The structure of one of the files containing registry data is corrupted, or the system's memory image of the file is corrupted, or the file could not be recovered because the alternate copy or log was absent or corrupted. + REGISTRY_CORRUPT = 1015, + + /// An I/O operation initiated by the registry failed unrecoverably. + /// The registry could not read in, or write out, or flush, one of the files that contain the system's image of the registry. + REGISTRY_IO_FAILED = 1016, + + /// The system has attempted to load or restore a file into the registry, but the specified file is not in a registry file format. + NOT_REGISTRY_FILE = 1017, + + /// Illegal operation attempted on a registry key that has been marked for deletion. + KEY_DELETED = 1018, + + /// System could not allocate the required space in a registry log. + NO_LOG_SPACE = 1019, + + /// Cannot create a symbolic link in a registry key that already has subkeys or values. + KEY_HAS_CHILDREN = 1020, + + /// Cannot create a stable subkey under a volatile parent key. + CHILD_MUST_BE_VOLATILE = 1021, + + /// A notify change request is being completed and the information is not being returned in the caller's buffer. + /// The caller now needs to enumerate the files to find the changes. + NOTIFY_ENUM_DIR = 1022, + + /// A stop control has been sent to a service that other running services are dependent on. + DEPENDENT_SERVICES_RUNNING = 1051, + + /// The requested control is not valid for this service. + INVALID_SERVICE_CONTROL = 1052, + + /// The service did not respond to the start or control request in a timely fashion. + SERVICE_REQUEST_TIMEOUT = 1053, + + /// A thread could not be created for the service. + SERVICE_NO_THREAD = 1054, + + /// The service database is locked. + SERVICE_DATABASE_LOCKED = 1055, + + /// An instance of the service is already running. + SERVICE_ALREADY_RUNNING = 1056, + + /// The account name is invalid or does not exist, or the password is invalid for the account name specified. + INVALID_SERVICE_ACCOUNT = 1057, + + /// The service cannot be started, either because it is disabled or because it has no enabled devices associated with it. + SERVICE_DISABLED = 1058, + + /// Circular service dependency was specified. + CIRCULAR_DEPENDENCY = 1059, + + /// The specified service does not exist as an installed service. + SERVICE_DOES_NOT_EXIST = 1060, + + /// The service cannot accept control messages at this time. + SERVICE_CANNOT_ACCEPT_CTRL = 1061, + + /// The service has not been started. + SERVICE_NOT_ACTIVE = 1062, + + /// The service process could not connect to the service controller. + FAILED_SERVICE_CONTROLLER_CONNECT = 1063, + + /// An exception occurred in the service when handling the control request. + EXCEPTION_IN_SERVICE = 1064, + + /// The database specified does not exist. + DATABASE_DOES_NOT_EXIST = 1065, + + /// The service has returned a service-specific error code. + SERVICE_SPECIFIC_ERROR = 1066, + + /// The process terminated unexpectedly. + PROCESS_ABORTED = 1067, + + /// The dependency service or group failed to start. + SERVICE_DEPENDENCY_FAIL = 1068, + + /// The service did not start due to a logon failure. + SERVICE_LOGON_FAILED = 1069, + + /// After starting, the service hung in a start-pending state. + SERVICE_START_HANG = 1070, + + /// The specified service database lock is invalid. + INVALID_SERVICE_LOCK = 1071, + + /// The specified service has been marked for deletion. + SERVICE_MARKED_FOR_DELETE = 1072, + + /// The specified service already exists. + SERVICE_EXISTS = 1073, + + /// The system is currently running with the last-known-good configuration. + ALREADY_RUNNING_LKG = 1074, + + /// The dependency service does not exist or has been marked for deletion. + SERVICE_DEPENDENCY_DELETED = 1075, + + /// The current boot has already been accepted for use as the last-known-good control set. + BOOT_ALREADY_ACCEPTED = 1076, + + /// No attempts to start the service have been made since the last boot. + SERVICE_NEVER_STARTED = 1077, + + /// The name is already in use as either a service name or a service display name. + DUPLICATE_SERVICE_NAME = 1078, + + /// The account specified for this service is different from the account specified for other services running in the same process. + DIFFERENT_SERVICE_ACCOUNT = 1079, + + /// Failure actions can only be set for Win32 services, not for drivers. + CANNOT_DETECT_DRIVER_FAILURE = 1080, + + /// This service runs in the same process as the service control manager. + /// Therefore, the service control manager cannot take action if this service's process terminates unexpectedly. + CANNOT_DETECT_PROCESS_ABORT = 1081, + + /// No recovery program has been configured for this service. + NO_RECOVERY_PROGRAM = 1082, + + /// The executable program that this service is configured to run in does not implement the service. + SERVICE_NOT_IN_EXE = 1083, + + /// This service cannot be started in Safe Mode. + NOT_SAFEBOOT_SERVICE = 1084, + + /// The physical end of the tape has been reached. + END_OF_MEDIA = 1100, + + /// A tape access reached a filemark. + FILEMARK_DETECTED = 1101, + + /// The beginning of the tape or a partition was encountered. + BEGINNING_OF_MEDIA = 1102, + + /// A tape access reached the end of a set of files. + SETMARK_DETECTED = 1103, + + /// No more data is on the tape. + NO_DATA_DETECTED = 1104, + + /// Tape could not be partitioned. + PARTITION_FAILURE = 1105, + + /// When accessing a new tape of a multivolume partition, the current block size is incorrect. + INVALID_BLOCK_LENGTH = 1106, + + /// Tape partition information could not be found when loading a tape. + DEVICE_NOT_PARTITIONED = 1107, + + /// Unable to lock the media eject mechanism. + UNABLE_TO_LOCK_MEDIA = 1108, + + /// Unable to unload the media. + UNABLE_TO_UNLOAD_MEDIA = 1109, + + /// The media in the drive may have changed. + MEDIA_CHANGED = 1110, + + /// The I/O bus was reset. + BUS_RESET = 1111, + + /// No media in drive. + NO_MEDIA_IN_DRIVE = 1112, + + /// No mapping for the Unicode character exists in the target multi-byte code page. + NO_UNICODE_TRANSLATION = 1113, + + /// A dynamic link library (DLL) initialization routine failed. + DLL_INIT_FAILED = 1114, + + /// A system shutdown is in progress. + SHUTDOWN_IN_PROGRESS = 1115, + + /// Unable to abort the system shutdown because no shutdown was in progress. + NO_SHUTDOWN_IN_PROGRESS = 1116, + + /// The request could not be performed because of an I/O device error. + IO_DEVICE = 1117, + + /// No serial device was successfully initialized. The serial driver will unload. + SERIAL_NO_DEVICE = 1118, + + /// Unable to open a device that was sharing an interrupt request (IRQ) with other devices. + /// At least one other device that uses that IRQ was already opened. + IRQ_BUSY = 1119, + + /// A serial I/O operation was completed by another write to the serial port. The IOCTL_SERIAL_XOFF_COUNTER reached zero.) + MORE_WRITES = 1120, + + /// A serial I/O operation completed because the timeout period expired. + /// The IOCTL_SERIAL_XOFF_COUNTER did not reach zero.) + COUNTER_TIMEOUT = 1121, + + /// No ID address mark was found on the floppy disk. + FLOPPY_ID_MARK_NOT_FOUND = 1122, + + /// Mismatch between the floppy disk sector ID field and the floppy disk controller track address. + FLOPPY_WRONG_CYLINDER = 1123, + + /// The floppy disk controller reported an error that is not recognized by the floppy disk driver. + FLOPPY_UNKNOWN_ERROR = 1124, + + /// The floppy disk controller returned inconsistent results in its registers. + FLOPPY_BAD_REGISTERS = 1125, + + /// While accessing the hard disk, a recalibrate operation failed, even after retries. + DISK_RECALIBRATE_FAILED = 1126, + + /// While accessing the hard disk, a disk operation failed even after retries. + DISK_OPERATION_FAILED = 1127, + + /// While accessing the hard disk, a disk controller reset was needed, but even that failed. + DISK_RESET_FAILED = 1128, + + /// Physical end of tape encountered. + EOM_OVERFLOW = 1129, + + /// Not enough server storage is available to process this command. + NOT_ENOUGH_SERVER_MEMORY = 1130, + + /// A potential deadlock condition has been detected. + POSSIBLE_DEADLOCK = 1131, + + /// The base address or the file offset specified does not have the proper alignment. + MAPPED_ALIGNMENT = 1132, + + /// An attempt to change the system power state was vetoed by another application or driver. + SET_POWER_STATE_VETOED = 1140, + + /// The system BIOS failed an attempt to change the system power state. + SET_POWER_STATE_FAILED = 1141, + + /// An attempt was made to create more links on a file than the file system supports. + TOO_MANY_LINKS = 1142, + + /// The specified program requires a newer version of Windows. + OLD_WIN_VERSION = 1150, + + /// The specified program is not a Windows or MS-DOS program. + APP_WRONG_OS = 1151, + + /// Cannot start more than one instance of the specified program. + SINGLE_INSTANCE_APP = 1152, + + /// The specified program was written for an earlier version of Windows. + RMODE_APP = 1153, + + /// One of the library files needed to run this application is damaged. + INVALID_DLL = 1154, + + /// No application is associated with the specified file for this operation. + NO_ASSOCIATION = 1155, + + /// An error occurred in sending the command to the application. + DDE_FAIL = 1156, + + /// One of the library files needed to run this application cannot be found. + DLL_NOT_FOUND = 1157, + + /// The current process has used all of its system allowance of handles for Window Manager objects. + NO_MORE_USER_HANDLES = 1158, + + /// The message can be used only with synchronous operations. + MESSAGE_SYNC_ONLY = 1159, + + /// The indicated source element has no media. + SOURCE_ELEMENT_EMPTY = 1160, + + /// The indicated destination element already contains media. + DESTINATION_ELEMENT_FULL = 1161, + + /// The indicated element does not exist. + ILLEGAL_ELEMENT_ADDRESS = 1162, + + /// The indicated element is part of a magazine that is not present. + MAGAZINE_NOT_PRESENT = 1163, + + /// The indicated device requires reinitialization due to hardware errors. + DEVICE_REINITIALIZATION_NEEDED = 1164, + + /// The device has indicated that cleaning is required before further operations are attempted. + DEVICE_REQUIRES_CLEANING = 1165, + + /// The device has indicated that its door is open. + DEVICE_DOOR_OPEN = 1166, + + /// The device is not connected. + DEVICE_NOT_CONNECTED = 1167, + + /// Element not found. + NOT_FOUND = 1168, + + /// There was no match for the specified key in the index. + NO_MATCH = 1169, + + /// The property set specified does not exist on the object. + SET_NOT_FOUND = 1170, + + /// The point passed to GetMouseMovePoints is not in the buffer. + POINT_NOT_FOUND = 1171, + + /// The tracking (workstation) service is not running. + NO_TRACKING_SERVICE = 1172, + + /// The Volume ID could not be found. + NO_VOLUME_ID = 1173, + + /// Unable to remove the file to be replaced. + UNABLE_TO_REMOVE_REPLACED = 1175, + + /// Unable to move the replacement file to the file to be replaced. + /// The file to be replaced has retained its original name. + UNABLE_TO_MOVE_REPLACEMENT = 1176, + + /// Unable to move the replacement file to the file to be replaced. + /// The file to be replaced has been renamed using the backup name. + UNABLE_TO_MOVE_REPLACEMENT_2 = 1177, + + /// The volume change journal is being deleted. + JOURNAL_DELETE_IN_PROGRESS = 1178, + + /// The volume change journal is not active. + JOURNAL_NOT_ACTIVE = 1179, + + /// A file was found, but it may not be the correct file. + POTENTIAL_FILE_FOUND = 1180, + + /// The journal entry has been deleted from the journal. + JOURNAL_ENTRY_DELETED = 1181, + + /// A system shutdown has already been scheduled. + SHUTDOWN_IS_SCHEDULED = 1190, + + /// The system shutdown cannot be initiated because there are other users logged on to the computer. + SHUTDOWN_USERS_LOGGED_ON = 1191, + + /// The specified device name is invalid. + BAD_DEVICE = 1200, + + /// The device is not currently connected but it is a remembered connection. + CONNECTION_UNAVAIL = 1201, + + /// The local device name has a remembered connection to another network resource. + DEVICE_ALREADY_REMEMBERED = 1202, + + /// The network path was either typed incorrectly, does not exist, or the network provider is not currently available. + /// Please try retyping the path or contact your network administrator. + NO_NET_OR_BAD_PATH = 1203, + + /// The specified network provider name is invalid. + BAD_PROVIDER = 1204, + + /// Unable to open the network connection profile. + CANNOT_OPEN_PROFILE = 1205, + + /// The network connection profile is corrupted. + BAD_PROFILE = 1206, + + /// Cannot enumerate a noncontainer. + NOT_CONTAINER = 1207, + + /// An extended error has occurred. + EXTENDED_ERROR = 1208, + + /// The format of the specified group name is invalid. + INVALID_GROUPNAME = 1209, + + /// The format of the specified computer name is invalid. + INVALID_COMPUTERNAME = 1210, + + /// The format of the specified event name is invalid. + INVALID_EVENTNAME = 1211, + + /// The format of the specified domain name is invalid. + INVALID_DOMAINNAME = 1212, + + /// The format of the specified service name is invalid. + INVALID_SERVICENAME = 1213, + + /// The format of the specified network name is invalid. + INVALID_NETNAME = 1214, + + /// The format of the specified share name is invalid. + INVALID_SHARENAME = 1215, + + /// The format of the specified password is invalid. + INVALID_PASSWORDNAME = 1216, + + /// The format of the specified message name is invalid. + INVALID_MESSAGENAME = 1217, + + /// The format of the specified message destination is invalid. + INVALID_MESSAGEDEST = 1218, + + /// Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed. + /// Disconnect all previous connections to the server or shared resource and try again. + SESSION_CREDENTIAL_CONFLICT = 1219, + + /// An attempt was made to establish a session to a network server, but there are already too many sessions established to that server. + REMOTE_SESSION_LIMIT_EXCEEDED = 1220, + + /// The workgroup or domain name is already in use by another computer on the network. + DUP_DOMAINNAME = 1221, + + /// The network is not present or not started. + NO_NETWORK = 1222, + + /// The operation was canceled by the user. + CANCELLED = 1223, + + /// The requested operation cannot be performed on a file with a user-mapped section open. + USER_MAPPED_FILE = 1224, + + /// The remote computer refused the network connection. + CONNECTION_REFUSED = 1225, + + /// The network connection was gracefully closed. + GRACEFUL_DISCONNECT = 1226, + + /// The network transport endpoint already has an address associated with it. + ADDRESS_ALREADY_ASSOCIATED = 1227, + + /// An address has not yet been associated with the network endpoint. + ADDRESS_NOT_ASSOCIATED = 1228, + + /// An operation was attempted on a nonexistent network connection. + CONNECTION_INVALID = 1229, + + /// An invalid operation was attempted on an active network connection. + CONNECTION_ACTIVE = 1230, + + /// The network location cannot be reached. + /// For information about network troubleshooting, see Windows Help. + NETWORK_UNREACHABLE = 1231, + + /// The network location cannot be reached. + /// For information about network troubleshooting, see Windows Help. + HOST_UNREACHABLE = 1232, + + /// The network location cannot be reached. + /// For information about network troubleshooting, see Windows Help. + PROTOCOL_UNREACHABLE = 1233, + + /// No service is operating at the destination network endpoint on the remote system. + PORT_UNREACHABLE = 1234, + + /// The request was aborted. + REQUEST_ABORTED = 1235, + + /// The network connection was aborted by the local system. + CONNECTION_ABORTED = 1236, + + /// The operation could not be completed. A retry should be performed. + RETRY = 1237, + + /// A connection to the server could not be made because the limit on the number of concurrent connections for this account has been reached. + CONNECTION_COUNT_LIMIT = 1238, + + /// Attempting to log in during an unauthorized time of day for this account. + LOGIN_TIME_RESTRICTION = 1239, + + /// The account is not authorized to log in from this station. + LOGIN_WKSTA_RESTRICTION = 1240, + + /// The network address could not be used for the operation requested. + INCORRECT_ADDRESS = 1241, + + /// The service is already registered. + ALREADY_REGISTERED = 1242, + + /// The specified service does not exist. + SERVICE_NOT_FOUND = 1243, + + /// The operation being requested was not performed because the user has not been authenticated. + NOT_AUTHENTICATED = 1244, + + /// The operation being requested was not performed because the user has not logged on to the network. The specified service does not exist. + NOT_LOGGED_ON = 1245, + + /// Continue with work in progress. + CONTINUE = 1246, + + /// An attempt was made to perform an initialization operation when initialization has already been completed. + ALREADY_INITIALIZED = 1247, + + /// No more local devices. + NO_MORE_DEVICES = 1248, + + /// The specified site does not exist. + NO_SUCH_SITE = 1249, + + /// A domain controller with the specified name already exists. + DOMAIN_CONTROLLER_EXISTS = 1250, + + /// This operation is supported only when you are connected to the server. + ONLY_IF_CONNECTED = 1251, + + /// The group policy framework should call the extension even if there are no changes. + OVERRIDE_NOCHANGES = 1252, + + /// The specified user does not have a valid profile. + BAD_USER_PROFILE = 1253, + + /// This operation is not supported on a computer running Windows Server 2003 for Small Business Server. + NOT_SUPPORTED_ON_SBS = 1254, + + /// The server machine is shutting down. + SERVER_SHUTDOWN_IN_PROGRESS = 1255, + + /// The remote system is not available. + /// For information about network troubleshooting, see Windows Help. + HOST_DOWN = 1256, + + /// The security identifier provided is not from an account domain. + NON_ACCOUNT_SID = 1257, + + /// The security identifier provided does not have a domain component. + NON_DOMAIN_SID = 1258, + + /// AppHelp dialog canceled thus preventing the application from starting. + APPHELP_BLOCK = 1259, + + /// This program is blocked by group policy. + /// For more information, contact your system administrator. + ACCESS_DISABLED_BY_POLICY = 1260, + + /// A program attempt to use an invalid register value. + /// Normally caused by an uninitialized register. This error is Itanium specific. + REG_NAT_CONSUMPTION = 1261, + + /// The share is currently offline or does not exist. + CSCSHARE_OFFLINE = 1262, + + /// The Kerberos protocol encountered an error while validating the KDC certificate during smartcard logon. + /// There is more information in the system event log. + PKINIT_FAILURE = 1263, + + /// The Kerberos protocol encountered an error while attempting to utilize the smartcard subsystem. + SMARTCARD_SUBSYSTEM_FAILURE = 1264, + + /// The system cannot contact a domain controller to service the authentication request. Please try again later. + DOWNGRADE_DETECTED = 1265, + + /// The machine is locked and cannot be shut down without the force option. + MACHINE_LOCKED = 1271, + + /// An application-defined callback gave invalid data when called. + CALLBACK_SUPPLIED_INVALID_DATA = 1273, + + /// The group policy framework should call the extension in the synchronous foreground policy refresh. + SYNC_FOREGROUND_REFRESH_REQUIRED = 1274, + + /// This driver has been blocked from loading. + DRIVER_BLOCKED = 1275, + + /// A dynamic link library (DLL) referenced a module that was neither a DLL nor the process's executable image. + INVALID_IMPORT_OF_NON_DLL = 1276, + + /// Windows cannot open this program since it has been disabled. + ACCESS_DISABLED_WEBBLADE = 1277, + + /// Windows cannot open this program because the license enforcement system has been tampered with or become corrupted. + ACCESS_DISABLED_WEBBLADE_TAMPER = 1278, + + /// A transaction recover failed. + RECOVERY_FAILURE = 1279, + + /// The current thread has already been converted to a fiber. + ALREADY_FIBER = 1280, + + /// The current thread has already been converted from a fiber. + ALREADY_THREAD = 1281, + + /// The system detected an overrun of a stack-based buffer in this application. + /// This overrun could potentially allow a malicious user to gain control of this application. + STACK_BUFFER_OVERRUN = 1282, + + /// Data present in one of the parameters is more than the function can operate on. + PARAMETER_QUOTA_EXCEEDED = 1283, + + /// An attempt to do an operation on a debug object failed because the object is in the process of being deleted. + DEBUGGER_INACTIVE = 1284, + + /// An attempt to delay-load a .dll or get a function address in a delay-loaded .dll failed. + DELAY_LOAD_FAILED = 1285, + + /// %1 is a 16-bit application. You do not have permissions to execute 16-bit applications. + /// Check your permissions with your system administrator. + VDM_DISALLOWED = 1286, + + /// Insufficient information exists to identify the cause of failure. + UNIDENTIFIED_ERROR = 1287, + + /// The parameter passed to a C runtime function is incorrect. + INVALID_CRUNTIME_PARAMETER = 1288, + + /// The operation occurred beyond the valid data length of the file. + BEYOND_VDL = 1289, + + /// The service start failed since one or more services in the same process have an incompatible service SID type setting. + /// A service with restricted service SID type can only coexist in the same process with other services with a restricted SID type. + /// If the service SID type for this service was just configured, the hosting process must be restarted in order to start this service. + /// On Windows Server 2003 and Windows XP, an unrestricted service cannot coexist in the same process with other services. + /// The service with the unrestricted service SID type must be moved to an owned process in order to start this service. + INCOMPATIBLE_SERVICE_SID_TYPE = 1290, + + /// The process hosting the driver for this device has been terminated. + DRIVER_PROCESS_TERMINATED = 1291, + + /// An operation attempted to exceed an implementation-defined limit. + IMPLEMENTATION_LIMIT = 1292, + + /// Either the target process, or the target thread's containing process, is a protected process. + PROCESS_IS_PROTECTED = 1293, + + /// The service notification client is lagging too far behind the current state of services in the machine. + SERVICE_NOTIFY_CLIENT_LAGGING = 1294, + + /// The requested file operation failed because the storage quota was exceeded. + /// To free up disk space, move files to a different location or delete unnecessary files. + /// For more information, contact your system administrator. + DISK_QUOTA_EXCEEDED = 1295, + + /// The requested file operation failed because the storage policy blocks that type of file. + /// For more information, contact your system administrator. + CONTENT_BLOCKED = 1296, + + /// A privilege that the service requires to function properly does not exist in the service account configuration. + /// You may use the Services Microsoft Management Console (MMC) snap-in (services.msc) and the Local Security Settings MMC snap-in (secpol.msc) to view the service configuration and the account configuration. + INCOMPATIBLE_SERVICE_PRIVILEGE = 1297, + + /// A thread involved in this operation appears to be unresponsive. + APP_HANG = 1298, + + /// Indicates a particular Security ID may not be assigned as the label of an object. + INVALID_LABEL = 1299, + + /// Not all privileges or groups referenced are assigned to the caller. + NOT_ALL_ASSIGNED = 1300, + + /// Some mapping between account names and security IDs was not done. + SOME_NOT_MAPPED = 1301, + + /// No system quota limits are specifically set for this account. + NO_QUOTAS_FOR_ACCOUNT = 1302, + + /// No encryption key is available. A well-known encryption key was returned. + LOCAL_USER_SESSION_KEY = 1303, + + /// The password is too complex to be converted to a LAN Manager password. + /// The LAN Manager password returned is a NULL string. + NULL_LM_PASSWORD = 1304, + + /// The revision level is unknown. + UNKNOWN_REVISION = 1305, + + /// Indicates two revision levels are incompatible. + REVISION_MISMATCH = 1306, + + /// This security ID may not be assigned as the owner of this object. + INVALID_OWNER = 1307, + + /// This security ID may not be assigned as the primary group of an object. + INVALID_PRIMARY_GROUP = 1308, + + /// An attempt has been made to operate on an impersonation token by a thread that is not currently impersonating a client. + NO_IMPERSONATION_TOKEN = 1309, + + /// The group may not be disabled. + CANT_DISABLE_MANDATORY = 1310, + + /// There are currently no logon servers available to service the logon request. + NO_LOGON_SERVERS = 1311, + + /// A specified logon session does not exist. It may already have been terminated. + NO_SUCH_LOGON_SESSION = 1312, + + /// A specified privilege does not exist. + NO_SUCH_PRIVILEGE = 1313, + + /// A required privilege is not held by the client. + PRIVILEGE_NOT_HELD = 1314, + + /// The name provided is not a properly formed account name. + INVALID_ACCOUNT_NAME = 1315, + + /// The specified account already exists. + USER_EXISTS = 1316, + + /// The specified account does not exist. + NO_SUCH_USER = 1317, + + /// The specified group already exists. + GROUP_EXISTS = 1318, + + /// The specified group does not exist. + NO_SUCH_GROUP = 1319, + + /// Either the specified user account is already a member of the specified group, or the specified group cannot be deleted because it contains a member. + MEMBER_IN_GROUP = 1320, + + /// The specified user account is not a member of the specified group account. + MEMBER_NOT_IN_GROUP = 1321, + + /// This operation is disallowed as it could result in an administration account being disabled, deleted or unable to log on. + LAST_ADMIN = 1322, + + /// Unable to update the password. The value provided as the current password is incorrect. + WRONG_PASSWORD = 1323, + + /// Unable to update the password. The value provided for the new password contains values that are not allowed in passwords. + ILL_FORMED_PASSWORD = 1324, + + /// Unable to update the password. The value provided for the new password does not meet the length, complexity, or history requirements of the domain. + PASSWORD_RESTRICTION = 1325, + + /// The user name or password is incorrect. + LOGON_FAILURE = 1326, + + /// Account restrictions are preventing this user from signing in. + /// For example: blank passwords aren't allowed, sign-in times are limited, or a policy restriction has been enforced. + ACCOUNT_RESTRICTION = 1327, + + /// Your account has time restrictions that keep you from signing in right now. + INVALID_LOGON_HOURS = 1328, + + /// This user isn't allowed to sign in to this computer. + INVALID_WORKSTATION = 1329, + + /// The password for this account has expired. + PASSWORD_EXPIRED = 1330, + + /// This user can't sign in because this account is currently disabled. + ACCOUNT_DISABLED = 1331, + + /// No mapping between account names and security IDs was done. + NONE_MAPPED = 1332, + + /// Too many local user identifiers (LUIDs) were requested at one time. + TOO_MANY_LUIDS_REQUESTED = 1333, + + /// No more local user identifiers (LUIDs) are available. + LUIDS_EXHAUSTED = 1334, + + /// The subauthority part of a security ID is invalid for this particular use. + INVALID_SUB_AUTHORITY = 1335, + + /// The access control list (ACL) structure is invalid. + INVALID_ACL = 1336, + + /// The security ID structure is invalid. + INVALID_SID = 1337, + + /// The security descriptor structure is invalid. + INVALID_SECURITY_DESCR = 1338, + + /// The inherited access control list (ACL) or access control entry (ACE) could not be built. + BAD_INHERITANCE_ACL = 1340, + + /// The server is currently disabled. + SERVER_DISABLED = 1341, + + /// The server is currently enabled. + SERVER_NOT_DISABLED = 1342, + + /// The value provided was an invalid value for an identifier authority. + INVALID_ID_AUTHORITY = 1343, + + /// No more memory is available for security information updates. + ALLOTTED_SPACE_EXCEEDED = 1344, + + /// The specified attributes are invalid, or incompatible with the attributes for the group as a whole. + INVALID_GROUP_ATTRIBUTES = 1345, + + /// Either a required impersonation level was not provided, or the provided impersonation level is invalid. + BAD_IMPERSONATION_LEVEL = 1346, + + /// Cannot open an anonymous level security token. + CANT_OPEN_ANONYMOUS = 1347, + + /// The validation information class requested was invalid. + BAD_VALIDATION_CLASS = 1348, + + /// The type of the token is inappropriate for its attempted use. + BAD_TOKEN_TYPE = 1349, + + /// Unable to perform a security operation on an object that has no associated security. + NO_SECURITY_ON_OBJECT = 1350, + + /// Configuration information could not be read from the domain controller, either because the machine is unavailable, or access has been denied. + CANT_ACCESS_DOMAIN_INFO = 1351, + + /// The security account manager (SAM) or local security authority (LSA) server was in the wrong state to perform the security operation. + INVALID_SERVER_STATE = 1352, + + /// The domain was in the wrong state to perform the security operation. + INVALID_DOMAIN_STATE = 1353, + + /// This operation is only allowed for the Primary Domain Controller of the domain. + INVALID_DOMAIN_ROLE = 1354, + + /// The specified domain either does not exist or could not be contacted. + NO_SUCH_DOMAIN = 1355, + + /// The specified domain already exists. + DOMAIN_EXISTS = 1356, + + /// An attempt was made to exceed the limit on the number of domains per server. + DOMAIN_LIMIT_EXCEEDED = 1357, + + /// Unable to complete the requested operation because of either a catastrophic media failure or a data structure corruption on the disk. + INTERNAL_DB_CORRUPTION = 1358, + + /// An internal error occurred. + INTERNAL_ERROR = 1359, + + /// Generic access types were contained in an access mask which should already be mapped to nongeneric types. + GENERIC_NOT_MAPPED = 1360, + + /// A security descriptor is not in the right format (absolute or self-relative). + BAD_DESCRIPTOR_FORMAT = 1361, + + /// The requested action is restricted for use by logon processes only. + /// The calling process has not registered as a logon process. + NOT_LOGON_PROCESS = 1362, + + /// Cannot start a new logon session with an ID that is already in use. + LOGON_SESSION_EXISTS = 1363, + + /// A specified authentication package is unknown. + NO_SUCH_PACKAGE = 1364, + + /// The logon session is not in a state that is consistent with the requested operation. + BAD_LOGON_SESSION_STATE = 1365, + + /// The logon session ID is already in use. + LOGON_SESSION_COLLISION = 1366, + + /// A logon request contained an invalid logon type value. + INVALID_LOGON_TYPE = 1367, + + /// Unable to impersonate using a named pipe until data has been read from that pipe. + CANNOT_IMPERSONATE = 1368, + + /// The transaction state of a registry subtree is incompatible with the requested operation. + RXACT_INVALID_STATE = 1369, + + /// An internal security database corruption has been encountered. + RXACT_COMMIT_FAILURE = 1370, + + /// Cannot perform this operation on built-in accounts. + SPECIAL_ACCOUNT = 1371, + + /// Cannot perform this operation on this built-in special group. + SPECIAL_GROUP = 1372, + + /// Cannot perform this operation on this built-in special user. + SPECIAL_USER = 1373, + + /// The user cannot be removed from a group because the group is currently the user's primary group. + MEMBERS_PRIMARY_GROUP = 1374, + + /// The token is already in use as a primary token. + TOKEN_ALREADY_IN_USE = 1375, + + /// The specified local group does not exist. + NO_SUCH_ALIAS = 1376, + + /// The specified account name is not a member of the group. + MEMBER_NOT_IN_ALIAS = 1377, + + /// The specified account name is already a member of the group. + MEMBER_IN_ALIAS = 1378, + + /// The specified local group already exists. + ALIAS_EXISTS = 1379, + + /// Logon failure: the user has not been granted the requested logon type at this computer. + LOGON_NOT_GRANTED = 1380, + + /// The maximum number of secrets that may be stored in a single system has been exceeded. + TOO_MANY_SECRETS = 1381, + + /// The length of a secret exceeds the maximum length allowed. + SECRET_TOO_LONG = 1382, + + /// The local security authority database contains an internal inconsistency. + INTERNAL_DB_ERROR = 1383, + + /// During a logon attempt, the user's security context accumulated too many security IDs. + TOO_MANY_CONTEXT_IDS = 1384, + + /// Logon failure: the user has not been granted the requested logon type at this computer. + LOGON_TYPE_NOT_GRANTED = 1385, + + /// A cross-encrypted password is necessary to change a user password. + NT_CROSS_ENCRYPTION_REQUIRED = 1386, + + /// A member could not be added to or removed from the local group because the member does not exist. + NO_SUCH_MEMBER = 1387, + + /// A new member could not be added to a local group because the member has the wrong account type. + INVALID_MEMBER = 1388, + + /// Too many security IDs have been specified. + TOO_MANY_SIDS = 1389, + + /// A cross-encrypted password is necessary to change this user password. + LM_CROSS_ENCRYPTION_REQUIRED = 1390, + + /// Indicates an ACL contains no inheritable components. + NO_INHERITANCE = 1391, + + /// The file or directory is corrupted and unreadable. + FILE_CORRUPT = 1392, + + /// The disk structure is corrupted and unreadable. + DISK_CORRUPT = 1393, + + /// There is no user session key for the specified logon session. + NO_USER_SESSION_KEY = 1394, + + /// The service being accessed is licensed for a particular number of connections. + /// No more connections can be made to the service at this time because there are already as many connections as the service can accept. + LICENSE_QUOTA_EXCEEDED = 1395, + + /// The target account name is incorrect. + WRONG_TARGET_NAME = 1396, + + /// Mutual Authentication failed. The server's password is out of date at the domain controller. + MUTUAL_AUTH_FAILED = 1397, + + /// There is a time and/or date difference between the client and server. + TIME_SKEW = 1398, + + /// This operation cannot be performed on the current domain. + CURRENT_DOMAIN_NOT_ALLOWED = 1399, + + /// Invalid window handle. + INVALID_WINDOW_HANDLE = 1400, + + /// Invalid menu handle. + INVALID_MENU_HANDLE = 1401, + + /// Invalid cursor handle. + INVALID_CURSOR_HANDLE = 1402, + + /// Invalid accelerator table handle. + INVALID_ACCEL_HANDLE = 1403, + + /// Invalid hook handle. + INVALID_HOOK_HANDLE = 1404, + + /// Invalid handle to a multiple-window position structure. + INVALID_DWP_HANDLE = 1405, + + /// Cannot create a top-level child window. + TLW_WITH_WSCHILD = 1406, + + /// Cannot find window class. + CANNOT_FIND_WND_CLASS = 1407, + + /// Invalid window; it belongs to other thread. + WINDOW_OF_OTHER_THREAD = 1408, + + /// Hot key is already registered. + HOTKEY_ALREADY_REGISTERED = 1409, + + /// Class already exists. + CLASS_ALREADY_EXISTS = 1410, + + /// Class does not exist. + CLASS_DOES_NOT_EXIST = 1411, + + /// Class still has open windows. + CLASS_HAS_WINDOWS = 1412, + + /// Invalid index. + INVALID_INDEX = 1413, + + /// Invalid icon handle. + INVALID_ICON_HANDLE = 1414, + + /// Using private DIALOG window words. + PRIVATE_DIALOG_INDEX = 1415, + + /// The list box identifier was not found. + LISTBOX_ID_NOT_FOUND = 1416, + + /// No wildcards were found. + NO_WILDCARD_CHARACTERS = 1417, + + /// Thread does not have a clipboard open. + CLIPBOARD_NOT_OPEN = 1418, + + /// Hot key is not registered. + HOTKEY_NOT_REGISTERED = 1419, + + /// The window is not a valid dialog window. + WINDOW_NOT_DIALOG = 1420, + + /// Control ID not found. + CONTROL_ID_NOT_FOUND = 1421, + + /// Invalid message for a combo box because it does not have an edit control. + INVALID_COMBOBOX_MESSAGE = 1422, + + /// The window is not a combo box. + WINDOW_NOT_COMBOBOX = 1423, + + /// Height must be less than 256. + INVALID_EDIT_HEIGHT = 1424, + + /// Invalid device context (DC) handle. + DC_NOT_FOUND = 1425, + + /// Invalid hook procedure type. + INVALID_HOOK_FILTER = 1426, + + /// Invalid hook procedure. + INVALID_FILTER_PROC = 1427, + + /// Cannot set nonlocal hook without a module handle. + HOOK_NEEDS_HMOD = 1428, + + /// This hook procedure can only be set globally. + GLOBAL_ONLY_HOOK = 1429, + + /// The journal hook procedure is already installed. + JOURNAL_HOOK_SET = 1430, + + /// The hook procedure is not installed. + HOOK_NOT_INSTALLED = 1431, + + /// Invalid message for single-selection list box. + INVALID_LB_MESSAGE = 1432, + + /// LB_SETCOUNT sent to non-lazy list box. + SETCOUNT_ON_BAD_LB = 1433, + + /// This list box does not support tab stops. + LB_WITHOUT_TABSTOPS = 1434, + + /// Cannot destroy object created by another thread. + DESTROY_OBJECT_OF_OTHER_THREAD = 1435, + + /// Child windows cannot have menus. + CHILD_WINDOW_MENU = 1436, + + /// The window does not have a system menu. + NO_SYSTEM_MENU = 1437, + + /// Invalid message box style. + INVALID_MSGBOX_STYLE = 1438, + + /// Invalid system-wide (SPI_*) parameter. + INVALID_SPI_VALUE = 1439, + + /// Screen already locked. + SCREEN_ALREADY_LOCKED = 1440, + + /// All handles to windows in a multiple-window position structure must have the same parent. + HWNDS_HAVE_DIFF_PARENT = 1441, + + /// The window is not a child window. + NOT_CHILD_WINDOW = 1442, + + /// Invalid GW_* command. + INVALID_GW_COMMAND = 1443, + + /// Invalid thread identifier. + INVALID_THREAD_ID = 1444, + + /// Cannot process a message from a window that is not a multiple document interface (MDI) window. + NON_MDICHILD_WINDOW = 1445, + + /// Popup menu already active. + POPUP_ALREADY_ACTIVE = 1446, + + /// The window does not have scroll bars. + NO_SCROLLBARS = 1447, + + /// Scroll bar range cannot be greater than MAXLONG. + INVALID_SCROLLBAR_RANGE = 1448, + + /// Cannot show or remove the window in the way specified. + INVALID_SHOWWIN_COMMAND = 1449, + + /// Insufficient system resources exist to complete the requested service. + NO_SYSTEM_RESOURCES = 1450, + + /// Insufficient system resources exist to complete the requested service. + NONPAGED_SYSTEM_RESOURCES = 1451, + + /// Insufficient system resources exist to complete the requested service. + PAGED_SYSTEM_RESOURCES = 1452, + + /// Insufficient quota to complete the requested service. + WORKING_SET_QUOTA = 1453, + + /// Insufficient quota to complete the requested service. + PAGEFILE_QUOTA = 1454, + + /// The paging file is too small for this operation to complete. + COMMITMENT_LIMIT = 1455, + + /// A menu item was not found. + MENU_ITEM_NOT_FOUND = 1456, + + /// Invalid keyboard layout handle. + INVALID_KEYBOARD_HANDLE = 1457, + + /// Hook type not allowed. + HOOK_TYPE_NOT_ALLOWED = 1458, + + /// This operation requires an interactive window station. + REQUIRES_INTERACTIVE_WINDOWSTATION = 1459, + + /// This operation returned because the timeout period expired. + TIMEOUT = 1460, + + /// Invalid monitor handle. + INVALID_MONITOR_HANDLE = 1461, + + /// Incorrect size argument. + INCORRECT_SIZE = 1462, + + /// The symbolic link cannot be followed because its type is disabled. + SYMLINK_CLASS_DISABLED = 1463, + + /// This application does not support the current operation on symbolic links. + SYMLINK_NOT_SUPPORTED = 1464, + + /// Windows was unable to parse the requested XML data. + XML_PARSE_ERROR = 1465, + + /// An error was encountered while processing an XML digital signature. + XMLDSIG_ERROR = 1466, + + /// This application must be restarted. + RESTART_APPLICATION = 1467, + + /// The caller made the connection request in the wrong routing compartment. + WRONG_COMPARTMENT = 1468, + + /// There was an AuthIP failure when attempting to connect to the remote host. + AUTHIP_FAILURE = 1469, + + /// Insufficient NVRAM resources exist to complete the requested service. A reboot might be required. + NO_NVRAM_RESOURCES = 1470, + + /// Unable to finish the requested operation because the specified process is not a GUI process. + NOT_GUI_PROCESS = 1471, + + /// The event log file is corrupted. + EVENTLOG_FILE_CORRUPT = 1500, + + /// No event log file could be opened, so the event logging service did not start. + EVENTLOG_CANT_START = 1501, + + /// The event log file is full. + LOG_FILE_FULL = 1502, + + /// The event log file has changed between read operations. + EVENTLOG_FILE_CHANGED = 1503, + + /// The specified task name is invalid. + INVALID_TASK_NAME = 1550, + + /// The specified task index is invalid. + INVALID_TASK_INDEX = 1551, + + /// The specified thread is already joining a task. + THREAD_ALREADY_IN_TASK = 1552, + + /// The Windows Installer Service could not be accessed. + /// This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance. + INSTALL_SERVICE_FAILURE = 1601, + + /// User cancelled installation. + INSTALL_USEREXIT = 1602, + + /// Fatal error during installation. + INSTALL_FAILURE = 1603, + + /// Installation suspended, incomplete. + INSTALL_SUSPEND = 1604, + + /// This action is only valid for products that are currently installed. + UNKNOWN_PRODUCT = 1605, + + /// Feature ID not registered. + UNKNOWN_FEATURE = 1606, + + /// Component ID not registered. + UNKNOWN_COMPONENT = 1607, + + /// Unknown property. + UNKNOWN_PROPERTY = 1608, + + /// Handle is in an invalid state. + INVALID_HANDLE_STATE = 1609, + + /// The configuration data for this product is corrupt. Contact your support personnel. + BAD_CONFIGURATION = 1610, + + /// Component qualifier not present. + INDEX_ABSENT = 1611, + + /// The installation source for this product is not available. + /// Verify that the source exists and that you can access it. + INSTALL_SOURCE_ABSENT = 1612, + + /// This installation package cannot be installed by the Windows Installer service. + /// You must install a Windows service pack that contains a newer version of the Windows Installer service. + INSTALL_PACKAGE_VERSION = 1613, + + /// Product is uninstalled. + PRODUCT_UNINSTALLED = 1614, + + /// SQL query syntax invalid or unsupported. + BAD_QUERY_SYNTAX = 1615, + + /// Record field does not exist. + INVALID_FIELD = 1616, + + /// The device has been removed. + DEVICE_REMOVED = 1617, + + /// Another installation is already in progress. + /// Complete that installation before proceeding with this install. + INSTALL_ALREADY_RUNNING = 1618, + + /// This installation package could not be opened. + /// Verify that the package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer package. + INSTALL_PACKAGE_OPEN_FAILED = 1619, + + /// This installation package could not be opened. + /// Contact the application vendor to verify that this is a valid Windows Installer package. + INSTALL_PACKAGE_INVALID = 1620, + + /// There was an error starting the Windows Installer service user interface. Contact your support personnel. + INSTALL_UI_FAILURE = 1621, + + /// Error opening installation log file. + /// Verify that the specified log file location exists and that you can write to it. + INSTALL_LOG_FAILURE = 1622, + + /// The language of this installation package is not supported by your system. + INSTALL_LANGUAGE_UNSUPPORTED = 1623, + + /// Error applying transforms. Verify that the specified transform paths are valid. + INSTALL_TRANSFORM_FAILURE = 1624, + + /// This installation is forbidden by system policy. Contact your system administrator. + INSTALL_PACKAGE_REJECTED = 1625, + + /// Function could not be executed. + FUNCTION_NOT_CALLED = 1626, + + /// Function failed during execution. + FUNCTION_FAILED = 1627, + + /// Invalid or unknown table specified. + INVALID_TABLE = 1628, + + /// Data supplied is of wrong type. + DATATYPE_MISMATCH = 1629, + + /// Data of this type is not supported. + UNSUPPORTED_TYPE = 1630, + + /// The Windows Installer service failed to start. Contact your support personnel. + CREATE_FAILED = 1631, + + /// The Temp folder is on a drive that is full or is inaccessible. + /// Free up space on the drive or verify that you have write permission on the Temp folder. + INSTALL_TEMP_UNWRITABLE = 1632, + + /// This installation package is not supported by this processor type. Contact your product vendor. + INSTALL_PLATFORM_UNSUPPORTED = 1633, + + /// Component not used on this computer. + INSTALL_NOTUSED = 1634, + + /// This update package could not be opened. + /// Verify that the update package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer update package. + PATCH_PACKAGE_OPEN_FAILED = 1635, + + /// This update package could not be opened. + /// Contact the application vendor to verify that this is a valid Windows Installer update package. + PATCH_PACKAGE_INVALID = 1636, + + /// This update package cannot be processed by the Windows Installer service. + /// You must install a Windows service pack that contains a newer version of the Windows Installer service. + PATCH_PACKAGE_UNSUPPORTED = 1637, + + /// Another version of this product is already installed. Installation of this version cannot continue. + /// To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel. + PRODUCT_VERSION = 1638, + + /// Invalid command line argument. Consult the Windows Installer SDK for detailed command line help. + INVALID_COMMAND_LINE = 1639, + + /// Only administrators have permission to add, remove, or configure server software during a Terminal services remote session. + /// If you want to install or configure software on the server, contact your network administrator. + INSTALL_REMOTE_DISALLOWED = 1640, + + /// The requested operation completed successfully. + /// The system will be restarted so the changes can take effect. + SUCCESS_REBOOT_INITIATED = 1641, + + /// The upgrade cannot be installed by the Windows Installer service because the program to be upgraded may be missing, or the upgrade may update a different version of the program. + /// Verify that the program to be upgraded exists on your computer and that you have the correct upgrade. + PATCH_TARGET_NOT_FOUND = 1642, + + /// The update package is not permitted by software restriction policy. + PATCH_PACKAGE_REJECTED = 1643, + + /// One or more customizations are not permitted by software restriction policy. + INSTALL_TRANSFORM_REJECTED = 1644, + + /// The Windows Installer does not permit installation from a Remote Desktop Connection. + INSTALL_REMOTE_PROHIBITED = 1645, + + /// Uninstallation of the update package is not supported. + PATCH_REMOVAL_UNSUPPORTED = 1646, + + /// The update is not applied to this product. + UNKNOWN_PATCH = 1647, + + /// No valid sequence could be found for the set of updates. + PATCH_NO_SEQUENCE = 1648, + + /// Update removal was disallowed by policy. + PATCH_REMOVAL_DISALLOWED = 1649, + + /// The XML update data is invalid. + INVALID_PATCH_XML = 1650, + + /// Windows Installer does not permit updating of managed advertised products. + /// At least one feature of the product must be installed before applying the update. + PATCH_MANAGED_ADVERTISED_PRODUCT = 1651, + + /// The Windows Installer service is not accessible in Safe Mode. + /// Please try again when your computer is not in Safe Mode or you can use System Restore to return your machine to a previous good state. + INSTALL_SERVICE_SAFEBOOT = 1652, + + /// A fail fast exception occurred. + /// Exception handlers will not be invoked and the process will be terminated immediately. + FAIL_FAST_EXCEPTION = 1653, + + /// The app that you are trying to run is not supported on this version of Windows. + INSTALL_REJECTED = 1654, + + /// The string binding is invalid. + RPC_S_INVALID_STRING_BINDING = 1700, + + /// The binding handle is not the correct type. + RPC_S_WRONG_KIND_OF_BINDING = 1701, + + /// The binding handle is invalid. + RPC_S_INVALID_BINDING = 1702, + + /// The RPC protocol sequence is not supported. + RPC_S_PROTSEQ_NOT_SUPPORTED = 1703, + + /// The RPC protocol sequence is invalid. + RPC_S_INVALID_RPC_PROTSEQ = 1704, + + /// The string universal unique identifier (UUID) is invalid. + RPC_S_INVALID_STRING_UUID = 1705, + + /// The endpoint format is invalid. + RPC_S_INVALID_ENDPOINT_FORMAT = 1706, + + /// The network address is invalid. + RPC_S_INVALID_NET_ADDR = 1707, + + /// No endpoint was found. + RPC_S_NO_ENDPOINT_FOUND = 1708, + + /// The timeout value is invalid. + RPC_S_INVALID_TIMEOUT = 1709, + + /// The object universal unique identifier (UUID) was not found. + RPC_S_OBJECT_NOT_FOUND = 1710, + + /// The object universal unique identifier (UUID) has already been registered. + RPC_S_ALREADY_REGISTERED = 1711, + + /// The type universal unique identifier (UUID) has already been registered. + RPC_S_TYPE_ALREADY_REGISTERED = 1712, + + /// The RPC server is already listening. + RPC_S_ALREADY_LISTENING = 1713, + + /// No protocol sequences have been registered. + RPC_S_NO_PROTSEQS_REGISTERED = 1714, + + /// The RPC server is not listening. + RPC_S_NOT_LISTENING = 1715, + + /// The manager type is unknown. + RPC_S_UNKNOWN_MGR_TYPE = 1716, + + /// The interface is unknown. + RPC_S_UNKNOWN_IF = 1717, + + /// There are no bindings. + RPC_S_NO_BINDINGS = 1718, + + /// There are no protocol sequences. + RPC_S_NO_PROTSEQS = 1719, + + /// The endpoint cannot be created. + RPC_S_CANT_CREATE_ENDPOINT = 1720, + + /// Not enough resources are available to complete this operation. + RPC_S_OUT_OF_RESOURCES = 1721, + + /// The RPC server is unavailable. + RPC_S_SERVER_UNAVAILABLE = 1722, + + /// The RPC server is too busy to complete this operation. + RPC_S_SERVER_TOO_BUSY = 1723, + + /// The network options are invalid. + RPC_S_INVALID_NETWORK_OPTIONS = 1724, + + /// There are no remote procedure calls active on this thread. + RPC_S_NO_CALL_ACTIVE = 1725, + + /// The remote procedure call failed. + RPC_S_CALL_FAILED = 1726, + + /// The remote procedure call failed and did not execute. + RPC_S_CALL_FAILED_DNE = 1727, + + /// A remote procedure call (RPC) protocol error occurred. + RPC_S_PROTOCOL_ERROR = 1728, + + /// Access to the HTTP proxy is denied. + RPC_S_PROXY_ACCESS_DENIED = 1729, + + /// The transfer syntax is not supported by the RPC server. + RPC_S_UNSUPPORTED_TRANS_SYN = 1730, + + /// The universal unique identifier (UUID) type is not supported. + RPC_S_UNSUPPORTED_TYPE = 1732, + + /// The tag is invalid. + RPC_S_INVALID_TAG = 1733, + + /// The array bounds are invalid. + RPC_S_INVALID_BOUND = 1734, + + /// The binding does not contain an entry name. + RPC_S_NO_ENTRY_NAME = 1735, + + /// The name syntax is invalid. + RPC_S_INVALID_NAME_SYNTAX = 1736, + + /// The name syntax is not supported. + RPC_S_UNSUPPORTED_NAME_SYNTAX = 1737, + + /// No network address is available to use to construct a universal unique identifier (UUID). + RPC_S_UUID_NO_ADDRESS = 1739, + + /// The endpoint is a duplicate. + RPC_S_DUPLICATE_ENDPOINT = 1740, + + /// The authentication type is unknown. + RPC_S_UNKNOWN_AUTHN_TYPE = 1741, + + /// The maximum number of calls is too small. + RPC_S_MAX_CALLS_TOO_SMALL = 1742, + + /// The string is too long. + RPC_S_STRING_TOO_LONG = 1743, + + /// The RPC protocol sequence was not found. + RPC_S_PROTSEQ_NOT_FOUND = 1744, + + /// The procedure number is out of range. + RPC_S_PROCNUM_OUT_OF_RANGE = 1745, + + /// The binding does not contain any authentication information. + RPC_S_BINDING_HAS_NO_AUTH = 1746, + + /// The authentication service is unknown. + RPC_S_UNKNOWN_AUTHN_SERVICE = 1747, + + /// The authentication level is unknown. + RPC_S_UNKNOWN_AUTHN_LEVEL = 1748, + + /// The security context is invalid. + RPC_S_INVALID_AUTH_IDENTITY = 1749, + + /// The authorization service is unknown. + RPC_S_UNKNOWN_AUTHZ_SERVICE = 1750, + + /// The entry is invalid. + EPT_S_INVALID_ENTRY = 1751, + + /// The server endpoint cannot perform the operation. + EPT_S_CANT_PERFORM_OP = 1752, + + /// There are no more endpoints available from the endpoint mapper. + EPT_S_NOT_REGISTERED = 1753, + + /// No interfaces have been exported. + RPC_S_NOTHING_TO_EXPORT = 1754, + + /// The entry name is incomplete. + RPC_S_INCOMPLETE_NAME = 1755, + + /// The version option is invalid. + RPC_S_INVALID_VERS_OPTION = 1756, + + /// There are no more members. + RPC_S_NO_MORE_MEMBERS = 1757, + + /// There is nothing to unexport. + RPC_S_NOT_ALL_OBJS_UNEXPORTED = 1758, + + /// The interface was not found. + RPC_S_INTERFACE_NOT_FOUND = 1759, + + /// The entry already exists. + RPC_S_ENTRY_ALREADY_EXISTS = 1760, + + /// The entry is not found. + RPC_S_ENTRY_NOT_FOUND = 1761, + + /// The name service is unavailable. + RPC_S_NAME_SERVICE_UNAVAILABLE = 1762, + + /// The network address family is invalid. + RPC_S_INVALID_NAF_ID = 1763, + + /// The requested operation is not supported. + RPC_S_CANNOT_SUPPORT = 1764, + + /// No security context is available to allow impersonation. + RPC_S_NO_CONTEXT_AVAILABLE = 1765, + + /// An internal error occurred in a remote procedure call (RPC). + RPC_S_INTERNAL_ERROR = 1766, + + /// The RPC server attempted an integer division by zero. + RPC_S_ZERO_DIVIDE = 1767, + + /// An addressing error occurred in the RPC server. + RPC_S_ADDRESS_ERROR = 1768, + + /// A floating-point operation at the RPC server caused a division by zero. + RPC_S_FP_DIV_ZERO = 1769, + + /// A floating-point underflow occurred at the RPC server. + RPC_S_FP_UNDERFLOW = 1770, + + /// A floating-point overflow occurred at the RPC server. + RPC_S_FP_OVERFLOW = 1771, + + /// The list of RPC servers available for the binding of auto handles has been exhausted. + RPC_X_NO_MORE_ENTRIES = 1772, + + /// Unable to open the character translation table file. + RPC_X_SS_CHAR_TRANS_OPEN_FAIL = 1773, + + /// The file containing the character translation table has fewer than 512 bytes. + RPC_X_SS_CHAR_TRANS_SHORT_FILE = 1774, + + /// A null context handle was passed from the client to the host during a remote procedure call. + RPC_X_SS_IN_NULL_CONTEXT = 1775, + + /// The context handle changed during a remote procedure call. + RPC_X_SS_CONTEXT_DAMAGED = 1777, + + /// The binding handles passed to a remote procedure call do not match. + RPC_X_SS_HANDLES_MISMATCH = 1778, + + /// The stub is unable to get the remote procedure call handle. + RPC_X_SS_CANNOT_GET_CALL_HANDLE = 1779, + + /// A null reference pointer was passed to the stub. + RPC_X_NULL_REF_POINTER = 1780, + + /// The enumeration value is out of range. + RPC_X_ENUM_VALUE_OUT_OF_RANGE = 1781, + + /// The byte count is too small. + RPC_X_BYTE_COUNT_TOO_SMALL = 1782, + + /// The stub received bad data. + RPC_X_BAD_STUB_DATA = 1783, + + /// The supplied user buffer is not valid for the requested operation. + INVALID_USER_BUFFER = 1784, + + /// The disk media is not recognized. It may not be formatted. + UNRECOGNIZED_MEDIA = 1785, + + /// The workstation does not have a trust secret. + NO_TRUST_LSA_SECRET = 1786, + + /// The security database on the server does not have a computer account for this workstation trust relationship. + NO_TRUST_SAM_ACCOUNT = 1787, + + /// The trust relationship between the primary domain and the trusted domain failed. + TRUSTED_DOMAIN_FAILURE = 1788, + + /// The trust relationship between this workstation and the primary domain failed. + TRUSTED_RELATIONSHIP_FAILURE = 1789, + + /// The network logon failed. + TRUST_FAILURE = 1790, + + /// A remote procedure call is already in progress for this thread. + RPC_S_CALL_IN_PROGRESS = 1791, + + /// An attempt was made to logon, but the network logon service was not started. + NETLOGON_NOT_STARTED = 1792, + + /// The user's account has expired. + ACCOUNT_EXPIRED = 1793, + + /// The redirector is in use and cannot be unloaded. + REDIRECTOR_HAS_OPEN_HANDLES = 1794, + + /// The specified printer driver is already installed. + PRINTER_DRIVER_ALREADY_INSTALLED = 1795, + + /// The specified port is unknown. + UNKNOWN_PORT = 1796, + + /// The printer driver is unknown. + UNKNOWN_PRINTER_DRIVER = 1797, + + /// The print processor is unknown. + UNKNOWN_PRINTPROCESSOR = 1798, + + /// The specified separator file is invalid. + INVALID_SEPARATOR_FILE = 1799, + + /// The specified priority is invalid. + INVALID_PRIORITY = 1800, + + /// The printer name is invalid. + INVALID_PRINTER_NAME = 1801, + + /// The printer already exists. + PRINTER_ALREADY_EXISTS = 1802, + + /// The printer command is invalid. + INVALID_PRINTER_COMMAND = 1803, + + /// The specified datatype is invalid. + INVALID_DATATYPE = 1804, + + /// The environment specified is invalid. + INVALID_ENVIRONMENT = 1805, + + /// There are no more bindings. + RPC_S_NO_MORE_BINDINGS = 1806, + + /// The account used is an interdomain trust account. + /// Use your global user account or local user account to access this server. + NOLOGON_INTERDOMAIN_TRUST_ACCOUNT = 1807, + + /// The account used is a computer account. + /// Use your global user account or local user account to access this server. + NOLOGON_WORKSTATION_TRUST_ACCOUNT = 1808, + + /// The account used is a server trust account. + /// Use your global user account or local user account to access this server. + NOLOGON_SERVER_TRUST_ACCOUNT = 1809, + + /// The name or security ID (SID) of the domain specified is inconsistent with the trust information for that domain. + DOMAIN_TRUST_INCONSISTENT = 1810, + + /// The server is in use and cannot be unloaded. + SERVER_HAS_OPEN_HANDLES = 1811, + + /// The specified image file did not contain a resource section. + RESOURCE_DATA_NOT_FOUND = 1812, + + /// The specified resource type cannot be found in the image file. + RESOURCE_TYPE_NOT_FOUND = 1813, + + /// The specified resource name cannot be found in the image file. + RESOURCE_NAME_NOT_FOUND = 1814, + + /// The specified resource language ID cannot be found in the image file. + RESOURCE_LANG_NOT_FOUND = 1815, + + /// Not enough quota is available to process this command. + NOT_ENOUGH_QUOTA = 1816, + + /// No interfaces have been registered. + RPC_S_NO_INTERFACES = 1817, + + /// The remote procedure call was cancelled. + RPC_S_CALL_CANCELLED = 1818, + + /// The binding handle does not contain all required information. + RPC_S_BINDING_INCOMPLETE = 1819, + + /// A communications failure occurred during a remote procedure call. + RPC_S_COMM_FAILURE = 1820, + + /// The requested authentication level is not supported. + RPC_S_UNSUPPORTED_AUTHN_LEVEL = 1821, + + /// No principal name registered. + RPC_S_NO_PRINC_NAME = 1822, + + /// The error specified is not a valid Windows RPC error code. + RPC_S_NOT_RPC_ERROR = 1823, + + /// A UUID that is valid only on this computer has been allocated. + RPC_S_UUID_LOCAL_ONLY = 1824, + + /// A security package specific error occurred. + RPC_S_SEC_PKG_ERROR = 1825, + + /// Thread is not canceled. + RPC_S_NOT_CANCELLED = 1826, + + /// Invalid operation on the encoding/decoding handle. + RPC_X_INVALID_ES_ACTION = 1827, + + /// Incompatible version of the serializing package. + RPC_X_WRONG_ES_VERSION = 1828, + + /// Incompatible version of the RPC stub. + RPC_X_WRONG_STUB_VERSION = 1829, + + /// The RPC pipe object is invalid or corrupted. + RPC_X_INVALID_PIPE_OBJECT = 1830, + + /// An invalid operation was attempted on an RPC pipe object. + RPC_X_WRONG_PIPE_ORDER = 1831, + + /// Unsupported RPC pipe version. + RPC_X_WRONG_PIPE_VERSION = 1832, + + /// HTTP proxy server rejected the connection because the cookie authentication failed. + RPC_S_COOKIE_AUTH_FAILED = 1833, + + /// The group member was not found. + RPC_S_GROUP_MEMBER_NOT_FOUND = 1898, + + /// The endpoint mapper database entry could not be created. + EPT_S_CANT_CREATE = 1899, + + /// The object universal unique identifier (UUID) is the nil UUID. + RPC_S_INVALID_OBJECT = 1900, + + /// The specified time is invalid. + INVALID_TIME = 1901, + + /// The specified form name is invalid. + INVALID_FORM_NAME = 1902, + + /// The specified form size is invalid. + INVALID_FORM_SIZE = 1903, + + /// The specified printer handle is already being waited on. + ALREADY_WAITING = 1904, + + /// The specified printer has been deleted. + PRINTER_DELETED = 1905, + + /// The state of the printer is invalid. + INVALID_PRINTER_STATE = 1906, + + /// The user's password must be changed before signing in. + PASSWORD_MUST_CHANGE = 1907, + + /// Could not find the domain controller for this domain. + DOMAIN_CONTROLLER_NOT_FOUND = 1908, + + /// The referenced account is currently locked out and may not be logged on to. + ACCOUNT_LOCKED_OUT = 1909, + + /// The object exporter specified was not found. + OR_INVALID_OXID = 1910, + + /// The object specified was not found. + OR_INVALID_OID = 1911, + + /// The object resolver set specified was not found. + OR_INVALID_SET = 1912, + + /// Some data remains to be sent in the request buffer. + RPC_S_SEND_INCOMPLETE = 1913, + + /// Invalid asynchronous remote procedure call handle. + RPC_S_INVALID_ASYNC_HANDLE = 1914, + + /// Invalid asynchronous RPC call handle for this operation. + RPC_S_INVALID_ASYNC_CALL = 1915, + + /// The RPC pipe object has already been closed. + RPC_X_PIPE_CLOSED = 1916, + + /// The RPC call completed before all pipes were processed. + RPC_X_PIPE_DISCIPLINE_ERROR = 1917, + + /// No more data is available from the RPC pipe. + RPC_X_PIPE_EMPTY = 1918, + + /// No site name is available for this machine. + NO_SITENAME = 1919, + + /// The file cannot be accessed by the system. + CANT_ACCESS_FILE = 1920, + + /// The name of the file cannot be resolved by the system. + CANT_RESOLVE_FILENAME = 1921, + + /// The entry is not of the expected type. + RPC_S_ENTRY_TYPE_MISMATCH = 1922, + + /// Not all object UUIDs could be exported to the specified entry. + RPC_S_NOT_ALL_OBJS_EXPORTED = 1923, + + /// Interface could not be exported to the specified entry. + RPC_S_INTERFACE_NOT_EXPORTED = 1924, + + /// The specified profile entry could not be added. + RPC_S_PROFILE_NOT_ADDED = 1925, + + /// The specified profile element could not be added. + RPC_S_PRF_ELT_NOT_ADDED = 1926, + + /// The specified profile element could not be removed. + RPC_S_PRF_ELT_NOT_REMOVED = 1927, + + /// The group element could not be added. + RPC_S_GRP_ELT_NOT_ADDED = 1928, + + /// The group element could not be removed. + RPC_S_GRP_ELT_NOT_REMOVED = 1929, + + /// The printer driver is not compatible with a policy enabled on your computer that blocks NT 4.0 drivers. + KM_DRIVER_BLOCKED = 1930, + + /// The context has expired and can no longer be used. + CONTEXT_EXPIRED = 1931, + + /// The current user's delegated trust creation quota has been exceeded. + PER_USER_TRUST_QUOTA_EXCEEDED = 1932, + + /// The total delegated trust creation quota has been exceeded. + ALL_USER_TRUST_QUOTA_EXCEEDED = 1933, + + /// The current user's delegated trust deletion quota has been exceeded. + USER_DELETE_TRUST_QUOTA_EXCEEDED = 1934, + + /// The computer you are signing into is protected by an authentication firewall. + /// The specified account is not allowed to authenticate to the computer. + AUTHENTICATION_FIREWALL_FAILED = 1935, + + /// Remote connections to the Print Spooler are blocked by a policy set on your machine. + REMOTE_PRINT_CONNECTIONS_BLOCKED = 1936, + + /// Authentication failed because NTLM authentication has been disabled. + NTLM_BLOCKED = 1937, + + /// Logon Failure: EAS policy requires that the user change their password before this operation can be performed. + PASSWORD_CHANGE_REQUIRED = 1938, + + /// The pixel format is invalid. + INVALID_PIXEL_FORMAT = 2000, + + /// The specified driver is invalid. + BAD_DRIVER = 2001, + + /// The window style or class attribute is invalid for this operation. + INVALID_WINDOW_STYLE = 2002, + + /// The requested metafile operation is not supported. + METAFILE_NOT_SUPPORTED = 2003, + + /// The requested transformation operation is not supported. + TRANSFORM_NOT_SUPPORTED = 2004, + + /// The requested clipping operation is not supported. + CLIPPING_NOT_SUPPORTED = 2005, + + /// The specified color management module is invalid. + INVALID_CMM = 2010, + + /// The specified color profile is invalid. + INVALID_PROFILE = 2011, + + /// The specified tag was not found. + TAG_NOT_FOUND = 2012, + + /// A required tag is not present. + TAG_NOT_PRESENT = 2013, + + /// The specified tag is already present. + DUPLICATE_TAG = 2014, + + /// The specified color profile is not associated with the specified device. + PROFILE_NOT_ASSOCIATED_WITH_DEVICE = 2015, + + /// The specified color profile was not found. + PROFILE_NOT_FOUND = 2016, + + /// The specified color space is invalid. + INVALID_COLORSPACE = 2017, + + /// Image Color Management is not enabled. + ICM_NOT_ENABLED = 2018, + + /// There was an error while deleting the color transform. + DELETING_ICM_XFORM = 2019, + + /// The specified color transform is invalid. + INVALID_TRANSFORM = 2020, + + /// The specified transform does not match the bitmap's color space. + COLORSPACE_MISMATCH = 2021, + + /// The specified named color index is not present in the profile. + INVALID_COLORINDEX = 2022, + + /// The specified profile is intended for a device of a different type than the specified device. + PROFILE_DOES_NOT_MATCH_DEVICE = 2023, + + /// The network connection was made successfully, but the user had to be prompted for a password other than the one originally specified. + CONNECTED_OTHER_PASSWORD = 2108, + + /// The network connection was made successfully using default credentials. + CONNECTED_OTHER_PASSWORD_DEFAULT = 2109, + + /// The specified username is invalid. + BAD_USERNAME = 2202, + + /// This network connection does not exist. + NOT_CONNECTED = 2250, + + /// This network connection has files open or requests pending. + OPEN_FILES = 2401, + + /// Active connections still exist. + ACTIVE_CONNECTIONS = 2402, + + /// The device is in use by an active process and cannot be disconnected. + DEVICE_IN_USE = 2404, + + /// The specified print monitor is unknown. + UNKNOWN_PRINT_MONITOR = 3000, + + /// The specified printer driver is currently in use. + PRINTER_DRIVER_IN_USE = 3001, + + /// The spool file was not found. + SPOOL_FILE_NOT_FOUND = 3002, + + /// A StartDocPrinter call was not issued. + SPL_NO_STARTDOC = 3003, + + /// An AddJob call was not issued. + SPL_NO_ADDJOB = 3004, + + /// The specified print processor has already been installed. + PRINT_PROCESSOR_ALREADY_INSTALLED = 3005, + + /// The specified print monitor has already been installed. + PRINT_MONITOR_ALREADY_INSTALLED = 3006, + + /// The specified print monitor does not have the required functions. + INVALID_PRINT_MONITOR = 3007, + + /// The specified print monitor is currently in use. + PRINT_MONITOR_IN_USE = 3008, + + /// The requested operation is not allowed when there are jobs queued to the printer. + PRINTER_HAS_JOBS_QUEUED = 3009, + + /// The requested operation is successful. + /// Changes will not be effective until the system is rebooted. + SUCCESS_REBOOT_REQUIRED = 3010, + + /// The requested operation is successful. + /// Changes will not be effective until the service is restarted. + SUCCESS_RESTART_REQUIRED = 3011, + + /// No printers were found. + PRINTER_NOT_FOUND = 3012, + + /// The printer driver is known to be unreliable. + PRINTER_DRIVER_WARNED = 3013, + + /// The printer driver is known to harm the system. + PRINTER_DRIVER_BLOCKED = 3014, + + /// The specified printer driver package is currently in use. + PRINTER_DRIVER_PACKAGE_IN_USE = 3015, + + /// Unable to find a core driver package that is required by the printer driver package. + CORE_DRIVER_PACKAGE_NOT_FOUND = 3016, + + /// The requested operation failed. + /// A system reboot is required to roll back changes made. + FAIL_REBOOT_REQUIRED = 3017, + + /// The requested operation failed. + /// A system reboot has been initiated to roll back changes made. + FAIL_REBOOT_INITIATED = 3018, + + /// The specified printer driver was not found on the system and needs to be downloaded. + PRINTER_DRIVER_DOWNLOAD_NEEDED = 3019, + + /// The requested print job has failed to print. + /// A print system update requires the job to be resubmitted. + PRINT_JOB_RESTART_REQUIRED = 3020, + + /// The printer driver does not contain a valid manifest, or contains too many manifests. + INVALID_PRINTER_DRIVER_MANIFEST = 3021, + + /// The specified printer cannot be shared. + PRINTER_NOT_SHAREABLE = 3022, + + /// The operation was paused. + REQUEST_PAUSED = 3050, + + /// Reissue the given operation as a cached IO operation. + IO_REISSUE_AS_CACHED = 3950, + + _, +}; From a351350b88980038c0c509d2d3d5cb6941a74fbf Mon Sep 17 00:00:00 2001 From: daurnimator Date: Fri, 31 Jan 2020 21:18:20 +1100 Subject: [PATCH 40/60] std: format non-exhaustive enums --- lib/std/fmt.zig | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/std/fmt.zig b/lib/std/fmt.zig index 64c9006fe..e0d58a23e 100644 --- a/lib/std/fmt.zig +++ b/lib/std/fmt.zig @@ -365,14 +365,21 @@ pub fn formatType( try output(context, "error."); return output(context, @errorName(value)); }, - .Enum => { + .Enum => |enumInfo| { if (comptime std.meta.trait.hasFn("format")(T)) { return value.format(fmt, options, context, Errors, output); } try output(context, @typeName(T)); - try output(context, "."); - return formatType(@tagName(value), "", options, context, Errors, output, max_depth); + if (enumInfo.is_exhaustive) { + try output(context, "."); + return formatType(@tagName(value), "", options, context, Errors, output, max_depth); + } else { + // TODO: when @tagName works on exhaustive enums print known enum strings + try output(context, "("); + try formatType(@enumToInt(value), "", options, context, Errors, output, max_depth); + try output(context, ")"); + } }, .Union => { if (comptime std.meta.trait.hasFn("format")(T)) { From ab46713fa6eb7603e604320b77a4d101d30a0998 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Fri, 31 Jan 2020 19:12:23 +1100 Subject: [PATCH 41/60] std: update for linux 5.5 release --- lib/std/os/bits/linux.zig | 90 ++++++++++++++++++++++++++++----------- 1 file changed, 64 insertions(+), 26 deletions(-) diff --git a/lib/std/os/bits/linux.zig b/lib/std/os/bits/linux.zig index f4024e1f1..b8e8c33be 100644 --- a/lib/std/os/bits/linux.zig +++ b/lib/std/os/bits/linux.zig @@ -604,6 +604,11 @@ pub const CLONE_NEWPID = 0x20000000; pub const CLONE_NEWNET = 0x40000000; pub const CLONE_IO = 0x80000000; +// Flags for the clone3() syscall. + +/// Clear any signal handler and reset to SIG_DFL. +pub const CLONE_CLEAR_SIGHAND = 0x100000000; + pub const EFD_SEMAPHORE = 1; pub const EFD_CLOEXEC = O_CLOEXEC; pub const EFD_NONBLOCK = O_NONBLOCK; @@ -1120,17 +1125,22 @@ pub const io_uring_params = extern struct { // io_uring_params.features flags pub const IORING_FEAT_SINGLE_MMAP = 1 << 0; +pub const IORING_FEAT_NODROP = 1 << 1; +pub const IORING_FEAT_SUBMIT_STABLE = 1 << 2; // io_uring_params.flags /// io_context is polled -pub const IORING_SETUP_IOPOLL = (1 << 0); +pub const IORING_SETUP_IOPOLL = 1 << 0; /// SQ poll thread -pub const IORING_SETUP_SQPOLL = (1 << 1); +pub const IORING_SETUP_SQPOLL = 1 << 1; /// sq_thread_cpu is valid -pub const IORING_SETUP_SQ_AFF = (1 << 2); +pub const IORING_SETUP_SQ_AFF = 1 << 2; + +/// app defines CQ size +pub const IORING_SETUP_CQSIZE = 1 << 3; pub const io_sqring_offsets = extern struct { /// offset of ring head @@ -1178,52 +1188,73 @@ pub const io_uring_sqe = extern struct { flags: u8, ioprio: u16, fd: i32, - off: u64, + pub const union1 = extern union { + off: u64, + addr2: u64, + }; + union1: union1, addr: u64, len: u32, - pub const union1 = extern union { + pub const union2 = extern union { rw_flags: kernel_rwf, fsync_flags: u32, poll_events: u16, sync_range_flags: u32, msg_flags: u32, timeout_flags: u32, + accept_flags: u32, + cancel_flags: u32, }; - union1: union1, + union2: union2, user_data: u64, - pub const union2 = extern union { + pub const union3 = extern union { buf_index: u16, __pad2: [3]u64, }; - union2: union2, + union3: union3, }; // io_uring_sqe.flags /// use fixed fileset -pub const IOSQE_FIXED_FILE = (1 << 0); +pub const IOSQE_FIXED_FILE = 1 << 0; /// issue after inflight IO -pub const IOSQE_IO_DRAIN = (1 << 1); +pub const IOSQE_IO_DRAIN = 1 << 1; /// links next sqe -pub const IOSQE_IO_LINK = (1 << 2); +pub const IOSQE_IO_LINK = 1 << 2; -pub const IORING_OP_NOP = 0; -pub const IORING_OP_READV = 1; -pub const IORING_OP_WRITEV = 2; -pub const IORING_OP_FSYNC = 3; -pub const IORING_OP_READ_FIXED = 4; -pub const IORING_OP_WRITE_FIXED = 5; -pub const IORING_OP_POLL_ADD = 6; -pub const IORING_OP_POLL_REMOVE = 7; -pub const IORING_OP_SYNC_FILE_RANGE = 8; -pub const IORING_OP_SENDMSG = 9; -pub const IORING_OP_RECVMSG = 10; -pub const IORING_OP_TIMEOUT = 11; +/// like LINK, but stronger +pub const IOSQE_IO_HARDLINK = 1 << 3; + +pub const IORING_OP = extern enum { + NOP, + READV, + WRITEV, + FSYNC, + READ_FIXED, + WRITE_FIXED, + POLL_ADD, + POLL_REMOVE, + SYNC_FILE_RANGE, + SENDMSG, + RECVMSG, + TIMEOUT, + TIMEOUT_REMOVE, + ACCEPT, + ASYNC_CANCEL, + LINK_TIMEOUT, + CONNECT, + + _, +}; // io_uring_sqe.fsync_flags -pub const IORING_FSYNC_DATASYNC = (1 << 0); +pub const IORING_FSYNC_DATASYNC = 1 << 0; + +// io_uring_sqe.timeout_flags +pub const IORING_TIMEOUT_ABS = 1 << 0; // IO completion data structure (Completion Queue Entry) pub const io_uring_cqe = extern struct { @@ -1240,8 +1271,8 @@ pub const IORING_OFF_CQ_RING = 0x8000000; pub const IORING_OFF_SQES = 0x10000000; // io_uring_enter flags -pub const IORING_ENTER_GETEVENTS = (1 << 0); -pub const IORING_ENTER_SQ_WAKEUP = (1 << 1); +pub const IORING_ENTER_GETEVENTS = 1 << 0; +pub const IORING_ENTER_SQ_WAKEUP = 1 << 1; // io_uring_register opcodes and arguments pub const IORING_REGISTER_BUFFERS = 0; @@ -1250,6 +1281,13 @@ pub const IORING_REGISTER_FILES = 2; pub const IORING_UNREGISTER_FILES = 3; pub const IORING_REGISTER_EVENTFD = 4; pub const IORING_UNREGISTER_EVENTFD = 5; +pub const IORING_REGISTER_FILES_UPDATE = 6; + +pub const io_uring_files_update = struct { + offset: u32, + resv: u32, + fds: u64, +}; pub const utsname = extern struct { sysname: [65]u8, From 9ffc13b6c40d1bcb1e01edac10b2fd6b775f093b Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Fri, 31 Jan 2020 23:48:08 +0100 Subject: [PATCH 42/60] windows: Add psapi API Export both the "old-style" definitions from psapi and the "new-style" ones from kernel32. --- lib/libc/mingw/lib-common/psapi.def | 34 ++++++++++ lib/libc/mingw/lib32/psapi.def | 34 ++++++++++ lib/std/os/windows.zig | 1 + lib/std/os/windows/bits.zig | 97 ++++++++++++++++++++++++++--- lib/std/os/windows/kernel32.zig | 28 +++++++++ lib/std/os/windows/psapi.zig | 29 +++++++++ 6 files changed, 216 insertions(+), 7 deletions(-) create mode 100644 lib/libc/mingw/lib-common/psapi.def create mode 100644 lib/libc/mingw/lib32/psapi.def create mode 100644 lib/std/os/windows/psapi.zig diff --git a/lib/libc/mingw/lib-common/psapi.def b/lib/libc/mingw/lib-common/psapi.def new file mode 100644 index 000000000..31879b0bd --- /dev/null +++ b/lib/libc/mingw/lib-common/psapi.def @@ -0,0 +1,34 @@ +; +; Definition file of PSAPI.DLL +; Automatic generated by gendef +; written by Kai Tietz 2008 +; +LIBRARY "PSAPI.DLL" +EXPORTS +EmptyWorkingSet +EnumDeviceDrivers +EnumPageFilesA +EnumPageFilesW +EnumProcessModules +EnumProcessModulesEx +EnumProcesses +GetDeviceDriverBaseNameA +GetDeviceDriverBaseNameW +GetDeviceDriverFileNameA +GetDeviceDriverFileNameW +GetMappedFileNameA +GetMappedFileNameW +GetModuleBaseNameA +GetModuleBaseNameW +GetModuleFileNameExA +GetModuleFileNameExW +GetModuleInformation +GetPerformanceInfo +GetProcessImageFileNameA +GetProcessImageFileNameW +GetProcessMemoryInfo +GetWsChanges +GetWsChangesEx +InitializeProcessForWsWatch +QueryWorkingSet +QueryWorkingSetEx diff --git a/lib/libc/mingw/lib32/psapi.def b/lib/libc/mingw/lib32/psapi.def new file mode 100644 index 000000000..494437ea6 --- /dev/null +++ b/lib/libc/mingw/lib32/psapi.def @@ -0,0 +1,34 @@ +; +; Definition file of PSAPI.DLL +; Automatic generated by gendef +; written by Kai Tietz 2008 +; +LIBRARY "PSAPI.DLL" +EXPORTS +EmptyWorkingSet@4 +EnumDeviceDrivers@12 +EnumPageFilesA@8 +EnumPageFilesW@8 +EnumProcessModules@16 +EnumProcessModulesEx@20 +EnumProcesses@12 +GetDeviceDriverBaseNameA@12 +GetDeviceDriverBaseNameW@12 +GetDeviceDriverFileNameA@12 +GetDeviceDriverFileNameW@12 +GetMappedFileNameA@16 +GetMappedFileNameW@16 +GetModuleBaseNameA@16 +GetModuleBaseNameW@16 +GetModuleFileNameExA@16 +GetModuleFileNameExW@16 +GetModuleInformation@16 +GetPerformanceInfo@8 +GetProcessImageFileNameA@12 +GetProcessImageFileNameW@12 +GetProcessMemoryInfo@12 +GetWsChanges@12 +GetWsChangesEx@12 +InitializeProcessForWsWatch@4 +QueryWorkingSet@12 +QueryWorkingSetEx@12 diff --git a/lib/std/os/windows.zig b/lib/std/os/windows.zig index 9254cb1f6..c6e145f11 100644 --- a/lib/std/os/windows.zig +++ b/lib/std/os/windows.zig @@ -15,6 +15,7 @@ pub const advapi32 = @import("windows/advapi32.zig"); pub const kernel32 = @import("windows/kernel32.zig"); pub const ntdll = @import("windows/ntdll.zig"); pub const ole32 = @import("windows/ole32.zig"); +pub const psapi = @import("windows/psapi.zig"); pub const shell32 = @import("windows/shell32.zig"); pub const ws2_32 = @import("windows/ws2_32.zig"); diff --git a/lib/std/os/windows/bits.zig b/lib/std/os/windows/bits.zig index b184e68f6..bc23cee7f 100644 --- a/lib/std/os/windows/bits.zig +++ b/lib/std/os/windows/bits.zig @@ -929,9 +929,12 @@ pub usingnamespace switch (builtin.arch) { SegSs: DWORD, ExtendedRegisters: [512]BYTE, - pub fn getRegs(ctx: *const CONTEXT) struct {bp: usize, ip: usize} { - return .{.bp = ctx.Ebp, .ip = ctx.Eip}; - } + pub fn getRegs(ctx: *const CONTEXT) struct { + bp: usize, + ip: usize, + } { + return .{ .bp = ctx.Ebp, .ip = ctx.Eip }; + } }; pub const PCONTEXT = *CONTEXT; @@ -1032,8 +1035,11 @@ pub usingnamespace switch (builtin.arch) { LastExceptionToRip: DWORD64, LastExceptionFromRip: DWORD64, - pub fn getRegs(ctx: *const CONTEXT) struct {bp: usize, ip: usize} { - return .{.bp = ctx.Rbp, .ip = ctx.Rip}; + pub fn getRegs(ctx: *const CONTEXT) struct { + bp: usize, + ip: usize, + } { + return .{ .bp = ctx.Rbp, .ip = ctx.Rip }; } }; @@ -1100,8 +1106,11 @@ pub usingnamespace switch (builtin.arch) { Wcr: [2]DWORD, Wvr: [2]DWORD64, - pub fn getRegs(ctx: *const CONTEXT) struct {bp: usize, ip: usize} { - return .{.bp = ctx.DUMMYUNIONNAME.DUMMYSTRUCTNAME.Fp, .ip = ctx.Pc}; + pub fn getRegs(ctx: *const CONTEXT) struct { + bp: usize, + ip: usize, + } { + return .{ .bp = ctx.DUMMYUNIONNAME.DUMMYSTRUCTNAME.Fp, .ip = ctx.Pc }; } }; @@ -1237,3 +1246,77 @@ pub const CURDIR = extern struct { }; pub const DUPLICATE_SAME_ACCESS = 2; + +pub const MODULEINFO = extern struct { + lpBaseOfDll: LPVOID, + SizeOfImage: DWORD, + EntryPoint: LPVOID, +}; +pub const LPMODULEINFO = [*c]MODULEINFO; +pub const PSAPI_WS_WATCH_INFORMATION = extern struct { + FaultingPc: LPVOID, + FaultingVa: LPVOID, +}; +pub const PPSAPI_WS_WATCH_INFORMATION = [*c]PSAPI_WS_WATCH_INFORMATION; +pub const PROCESS_MEMORY_COUNTERS = extern struct { + cb: DWORD, + PageFaultCount: DWORD, + PeakWorkingSetSize: SIZE_T, + WorkingSetSize: SIZE_T, + QuotaPeakPagedPoolUsage: SIZE_T, + QuotaPagedPoolUsage: SIZE_T, + QuotaPeakNonPagedPoolUsage: SIZE_T, + QuotaNonPagedPoolUsage: SIZE_T, + PagefileUsage: SIZE_T, + PeakPagefileUsage: SIZE_T, +}; +pub const PPROCESS_MEMORY_COUNTERS = [*c]PROCESS_MEMORY_COUNTERS; +pub const PROCESS_MEMORY_COUNTERS_EX = extern struct { + cb: DWORD, + PageFaultCount: DWORD, + PeakWorkingSetSize: SIZE_T, + WorkingSetSize: SIZE_T, + QuotaPeakPagedPoolUsage: SIZE_T, + QuotaPagedPoolUsage: SIZE_T, + QuotaPeakNonPagedPoolUsage: SIZE_T, + QuotaNonPagedPoolUsage: SIZE_T, + PagefileUsage: SIZE_T, + PeakPagefileUsage: SIZE_T, + PrivateUsage: SIZE_T, +}; +pub const PPROCESS_MEMORY_COUNTERS_EX = [*c]PROCESS_MEMORY_COUNTERS_EX; +pub const PERFORMANCE_INFORMATION = extern struct { + cb: DWORD, + CommitTotal: SIZE_T, + CommitLimit: SIZE_T, + CommitPeak: SIZE_T, + PhysicalTotal: SIZE_T, + PhysicalAvailable: SIZE_T, + SystemCache: SIZE_T, + KernelTotal: SIZE_T, + KernelPaged: SIZE_T, + KernelNonpaged: SIZE_T, + PageSize: SIZE_T, + HandleCount: DWORD, + ProcessCount: DWORD, + ThreadCount: DWORD, +}; +pub const PPERFORMANCE_INFORMATION = [*c]PERFORMANCE_INFORMATION; +pub const PERFORMACE_INFORMATION = PERFORMANCE_INFORMATION; +pub const PPERFORMACE_INFORMATION = [*c]PERFORMANCE_INFORMATION; +pub const ENUM_PAGE_FILE_INFORMATION = extern struct { + cb: DWORD, + Reserved: DWORD, + TotalSize: SIZE_T, + TotalInUse: SIZE_T, + PeakUsage: SIZE_T, +}; +pub const PENUM_PAGE_FILE_INFORMATION = [*c]ENUM_PAGE_FILE_INFORMATION; +pub const PENUM_PAGE_FILE_CALLBACKW = ?fn (LPVOID, PENUM_PAGE_FILE_INFORMATION, LPCWSTR) callconv(.C) BOOL; +pub const PENUM_PAGE_FILE_CALLBACKA = ?fn (LPVOID, PENUM_PAGE_FILE_INFORMATION, LPCSTR) callconv(.C) BOOL; +pub const PSAPI_WS_WATCH_INFORMATION_EX = extern struct { + BasicInfo: PSAPI_WS_WATCH_INFORMATION, + FaultingThreadId: ULONG_PTR, + Flags: ULONG_PTR, +}; +pub const PPSAPI_WS_WATCH_INFORMATION_EX = [*c]PSAPI_WS_WATCH_INFORMATION_EX; diff --git a/lib/std/os/windows/kernel32.zig b/lib/std/os/windows/kernel32.zig index 9ec40240b..a37c97e90 100644 --- a/lib/std/os/windows/kernel32.zig +++ b/lib/std/os/windows/kernel32.zig @@ -246,3 +246,31 @@ pub extern "kernel32" fn LeaveCriticalSection(lpCriticalSection: *CRITICAL_SECTI pub extern "kernel32" fn DeleteCriticalSection(lpCriticalSection: *CRITICAL_SECTION) callconv(.Stdcall) void; pub extern "kernel32" fn InitOnceExecuteOnce(InitOnce: *INIT_ONCE, InitFn: INIT_ONCE_FN, Parameter: ?*c_void, Context: ?*c_void) callconv(.Stdcall) BOOL; + +pub extern "kernel32" fn K32EmptyWorkingSet(hProcess: HANDLE) callconv(.Stdcall) BOOL; +pub extern "kernel32" fn K32EnumDeviceDrivers(lpImageBase: [*c]LPVOID, cb: DWORD, lpcbNeeded: LPDWORD) callconv(.Stdcall) BOOL; +pub extern "kernel32" fn K32EnumPageFilesA(pCallBackRoutine: PENUM_PAGE_FILE_CALLBACKA, pContext: LPVOID) callconv(.Stdcall) BOOL; +pub extern "kernel32" fn K32EnumPageFilesW(pCallBackRoutine: PENUM_PAGE_FILE_CALLBACKW, pContext: LPVOID) callconv(.Stdcall) BOOL; +pub extern "kernel32" fn K32EnumProcessModules(hProcess: HANDLE, lphModule: [*c]HMODULE, cb: DWORD, lpcbNeeded: LPDWORD) callconv(.Stdcall) BOOL; +pub extern "kernel32" fn K32EnumProcessModulesEx(hProcess: HANDLE, lphModule: [*c]HMODULE, cb: DWORD, lpcbNeeded: LPDWORD, dwFilterFlag: DWORD) callconv(.Stdcall) BOOL; +pub extern "kernel32" fn K32EnumProcesses(lpidProcess: [*c]DWORD, cb: DWORD, cbNeeded: [*c]DWORD) callconv(.Stdcall) BOOL; +pub extern "kernel32" fn K32GetDeviceDriverBaseNameA(ImageBase: LPVOID, lpBaseName: LPSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "kernel32" fn K32GetDeviceDriverBaseNameW(ImageBase: LPVOID, lpBaseName: LPWSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "kernel32" fn K32GetDeviceDriverFileNameA(ImageBase: LPVOID, lpFilename: LPSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "kernel32" fn K32GetDeviceDriverFileNameW(ImageBase: LPVOID, lpFilename: LPWSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "kernel32" fn K32GetMappedFileNameA(hProcess: HANDLE, lpv: LPVOID, lpFilename: LPSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "kernel32" fn K32GetMappedFileNameW(hProcess: HANDLE, lpv: LPVOID, lpFilename: LPWSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "kernel32" fn K32GetModuleBaseNameA(hProcess: HANDLE, hModule: HMODULE, lpBaseName: LPSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "kernel32" fn K32GetModuleBaseNameW(hProcess: HANDLE, hModule: HMODULE, lpBaseName: LPWSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "kernel32" fn K32GetModuleFileNameExA(hProcess: HANDLE, hModule: HMODULE, lpFilename: LPSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "kernel32" fn K32GetModuleFileNameExW(hProcess: HANDLE, hModule: HMODULE, lpFilename: LPWSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "kernel32" fn K32GetModuleInformation(hProcess: HANDLE, hModule: HMODULE, lpmodinfo: LPMODULEINFO, cb: DWORD) callconv(.Stdcall) BOOL; +pub extern "kernel32" fn K32GetPerformanceInfo(pPerformanceInformation: PPERFORMACE_INFORMATION, cb: DWORD) callconv(.Stdcall) BOOL; +pub extern "kernel32" fn K32GetProcessImageFileNameA(hProcess: HANDLE, lpImageFileName: LPSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "kernel32" fn K32GetProcessImageFileNameW(hProcess: HANDLE, lpImageFileName: LPWSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "kernel32" fn K32GetProcessMemoryInfo(Process: HANDLE, ppsmemCounters: PPROCESS_MEMORY_COUNTERS, cb: DWORD) callconv(.Stdcall) BOOL; +pub extern "kernel32" fn K32GetWsChanges(hProcess: HANDLE, lpWatchInfo: PPSAPI_WS_WATCH_INFORMATION, cb: DWORD) callconv(.Stdcall) BOOL; +pub extern "kernel32" fn K32GetWsChangesEx(hProcess: HANDLE, lpWatchInfoEx: PPSAPI_WS_WATCH_INFORMATION_EX, cb: DWORD) callconv(.Stdcall) BOOL; +pub extern "kernel32" fn K32InitializeProcessForWsWatch(hProcess: HANDLE) callconv(.Stdcall) BOOL; +pub extern "kernel32" fn K32QueryWorkingSet(hProcess: HANDLE, pv: PVOID, cb: DWORD) callconv(.Stdcall) BOOL; +pub extern "kernel32" fn K32QueryWorkingSetEx(hProcess: HANDLE, pv: PVOID, cb: DWORD) callconv(.Stdcall) BOOL; diff --git a/lib/std/os/windows/psapi.zig b/lib/std/os/windows/psapi.zig new file mode 100644 index 000000000..73ac29e33 --- /dev/null +++ b/lib/std/os/windows/psapi.zig @@ -0,0 +1,29 @@ +usingnamespace @import("bits.zig"); + +pub extern "psapi" fn EmptyWorkingSet(hProcess: HANDLE) callconv(.Stdcall) BOOL; +pub extern "psapi" fn EnumDeviceDrivers(lpImageBase: [*c]LPVOID, cb: DWORD, lpcbNeeded: LPDWORD) callconv(.Stdcall) BOOL; +pub extern "psapi" fn EnumPageFilesA(pCallBackRoutine: PENUM_PAGE_FILE_CALLBACKA, pContext: LPVOID) callconv(.Stdcall) BOOL; +pub extern "psapi" fn EnumPageFilesW(pCallBackRoutine: PENUM_PAGE_FILE_CALLBACKW, pContext: LPVOID) callconv(.Stdcall) BOOL; +pub extern "psapi" fn EnumProcessModules(hProcess: HANDLE, lphModule: [*c]HMODULE, cb: DWORD, lpcbNeeded: LPDWORD) callconv(.Stdcall) BOOL; +pub extern "psapi" fn EnumProcessModulesEx(hProcess: HANDLE, lphModule: [*c]HMODULE, cb: DWORD, lpcbNeeded: LPDWORD, dwFilterFlag: DWORD) callconv(.Stdcall) BOOL; +pub extern "psapi" fn EnumProcesses(lpidProcess: [*c]DWORD, cb: DWORD, cbNeeded: [*c]DWORD) callconv(.Stdcall) BOOL; +pub extern "psapi" fn GetDeviceDriverBaseNameA(ImageBase: LPVOID, lpBaseName: LPSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "psapi" fn GetDeviceDriverBaseNameW(ImageBase: LPVOID, lpBaseName: LPWSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "psapi" fn GetDeviceDriverFileNameA(ImageBase: LPVOID, lpFilename: LPSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "psapi" fn GetDeviceDriverFileNameW(ImageBase: LPVOID, lpFilename: LPWSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "psapi" fn GetMappedFileNameA(hProcess: HANDLE, lpv: LPVOID, lpFilename: LPSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "psapi" fn GetMappedFileNameW(hProcess: HANDLE, lpv: LPVOID, lpFilename: LPWSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "psapi" fn GetModuleBaseNameA(hProcess: HANDLE, hModule: HMODULE, lpBaseName: LPSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "psapi" fn GetModuleBaseNameW(hProcess: HANDLE, hModule: HMODULE, lpBaseName: LPWSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "psapi" fn GetModuleFileNameExA(hProcess: HANDLE, hModule: HMODULE, lpFilename: LPSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "psapi" fn GetModuleFileNameExW(hProcess: HANDLE, hModule: HMODULE, lpFilename: LPWSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "psapi" fn GetModuleInformation(hProcess: HANDLE, hModule: HMODULE, lpmodinfo: LPMODULEINFO, cb: DWORD) callconv(.Stdcall) BOOL; +pub extern "psapi" fn GetPerformanceInfo(pPerformanceInformation: PPERFORMACE_INFORMATION, cb: DWORD) callconv(.Stdcall) BOOL; +pub extern "psapi" fn GetProcessImageFileNameA(hProcess: HANDLE, lpImageFileName: LPSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "psapi" fn GetProcessImageFileNameW(hProcess: HANDLE, lpImageFileName: LPWSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "psapi" fn GetProcessMemoryInfo(Process: HANDLE, ppsmemCounters: PPROCESS_MEMORY_COUNTERS, cb: DWORD) callconv(.Stdcall) BOOL; +pub extern "psapi" fn GetWsChanges(hProcess: HANDLE, lpWatchInfo: PPSAPI_WS_WATCH_INFORMATION, cb: DWORD) callconv(.Stdcall) BOOL; +pub extern "psapi" fn GetWsChangesEx(hProcess: HANDLE, lpWatchInfoEx: PPSAPI_WS_WATCH_INFORMATION_EX, cb: DWORD) callconv(.Stdcall) BOOL; +pub extern "psapi" fn InitializeProcessForWsWatch(hProcess: HANDLE) callconv(.Stdcall) BOOL; +pub extern "psapi" fn QueryWorkingSet(hProcess: HANDLE, pv: PVOID, cb: DWORD) callconv(.Stdcall) BOOL; +pub extern "psapi" fn QueryWorkingSetEx(hProcess: HANDLE, pv: PVOID, cb: DWORD) callconv(.Stdcall) BOOL; From c910aa8555879278802ef1f591f0523db64aee64 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Sat, 1 Feb 2020 00:01:09 +0100 Subject: [PATCH 43/60] windows: Add GetCurrentProcess definition --- lib/std/os/windows/kernel32.zig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/std/os/windows/kernel32.zig b/lib/std/os/windows/kernel32.zig index a37c97e90..7ee1d90b0 100644 --- a/lib/std/os/windows/kernel32.zig +++ b/lib/std/os/windows/kernel32.zig @@ -88,6 +88,8 @@ pub extern "kernel32" fn GetCurrentDirectoryW(nBufferLength: DWORD, lpBuffer: ?[ pub extern "kernel32" fn GetCurrentThread() callconv(.Stdcall) HANDLE; pub extern "kernel32" fn GetCurrentThreadId() callconv(.Stdcall) DWORD; +pub extern "kernel32" fn GetCurrentProcess() callconv(.Stdcall) HANDLE; + pub extern "kernel32" fn GetEnvironmentStringsW() callconv(.Stdcall) ?[*:0]u16; pub extern "kernel32" fn GetEnvironmentVariableW(lpName: LPWSTR, lpBuffer: [*]u16, nSize: DWORD) callconv(.Stdcall) DWORD; From dee7804a8186d3f946860aa639cbf71046532549 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Fri, 31 Jan 2020 15:47:48 +0100 Subject: [PATCH 44/60] fmt: Fix logic to find the argument list closing ) Closes #4341 --- lib/std/zig/parser_test.zig | 38 +++++++++++++++++++++++++++++++++++++ lib/std/zig/render.zig | 17 ++++++++++++++--- 2 files changed, 52 insertions(+), 3 deletions(-) diff --git a/lib/std/zig/parser_test.zig b/lib/std/zig/parser_test.zig index 1640d0999..4154bb6a7 100644 --- a/lib/std/zig/parser_test.zig +++ b/lib/std/zig/parser_test.zig @@ -1,3 +1,41 @@ +test "zig fmt: trailing comma in fn parameter list" { + try testCanonical( + \\pub fn f( + \\ a: i32, + \\ b: i32, + \\) i32 {} + \\pub fn f( + \\ a: i32, + \\ b: i32, + \\) align(8) i32 {} + \\pub fn f( + \\ a: i32, + \\ b: i32, + \\) linksection(".text") i32 {} + \\pub fn f( + \\ a: i32, + \\ b: i32, + \\) callconv(.C) i32 {} + \\pub fn f( + \\ a: i32, + \\ b: i32, + \\) align(8) linksection(".text") i32 {} + \\pub fn f( + \\ a: i32, + \\ b: i32, + \\) align(8) callconv(.C) i32 {} + \\pub fn f( + \\ a: i32, + \\ b: i32, + \\) align(8) linksection(".text") callconv(.C) i32 {} + \\pub fn f( + \\ a: i32, + \\ b: i32, + \\) linksection(".text") callconv(.C) i32 {} + \\ + ); +} + // TODO: Remove condition after deprecating 'typeOf'. See https://github.com/ziglang/zig/issues/1348 test "zig fmt: change @typeOf to @TypeOf" { try testTransform( diff --git a/lib/std/zig/render.zig b/lib/std/zig/render.zig index f2c64a0e4..6c9e3e01a 100644 --- a/lib/std/zig/render.zig +++ b/lib/std/zig/render.zig @@ -1344,11 +1344,22 @@ fn renderExpression( try renderToken(tree, stream, fn_proto.fn_token, indent, start_col, Space.Space); // fn break :blk tree.nextToken(fn_proto.fn_token); }; + assert(tree.tokens.at(lparen).id == .LParen); - const rparen = tree.prevToken(switch (fn_proto.return_type) { - ast.Node.FnProto.ReturnType.Explicit => |node| node.firstToken(), - ast.Node.FnProto.ReturnType.InferErrorSet => |node| tree.prevToken(node.firstToken()), + const rparen = tree.prevToken( + // the first token for the annotation expressions is the left + // parenthesis, hence the need for two prevToken + if (fn_proto.align_expr) |align_expr| + tree.prevToken(tree.prevToken(align_expr.firstToken())) + else if (fn_proto.section_expr) |section_expr| + tree.prevToken(tree.prevToken(section_expr.firstToken())) + else if (fn_proto.callconv_expr) |callconv_expr| + tree.prevToken(tree.prevToken(callconv_expr.firstToken())) + else switch (fn_proto.return_type) { + .Explicit => |node| node.firstToken(), + .InferErrorSet => |node| tree.prevToken(node.firstToken()), }); + assert(tree.tokens.at(rparen).id == .RParen); const src_params_trailing_comma = blk: { const maybe_comma = tree.tokens.at(rparen - 1).id; From 8309ee875236b9fd2fb80482010464e218173c4c Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Sat, 1 Feb 2020 11:28:21 +0100 Subject: [PATCH 45/60] fmt: Respect trailing comma for field declarations Closes #4349 --- lib/std/zig/ast.zig | 11 +++ lib/std/zig/parser_test.zig | 26 ++++---- lib/std/zig/render.zig | 129 +++++++++++++++++++++++++----------- 3 files changed, 114 insertions(+), 52 deletions(-) diff --git a/lib/std/zig/ast.zig b/lib/std/zig/ast.zig index e33934382..f34a6b362 100644 --- a/lib/std/zig/ast.zig +++ b/lib/std/zig/ast.zig @@ -10,6 +10,7 @@ pub const TokenIndex = usize; pub const Tree = struct { source: []const u8, tokens: TokenList, + /// undefined on parse error (errors not empty) root_node: *Node.Root, arena_allocator: std.heap.ArenaAllocator, @@ -780,6 +781,11 @@ pub const Node = struct { i -= 1; } + if (self.align_expr) |align_expr| { + if (i < 1) return align_expr; + i -= 1; + } + if (self.value_expr) |value_expr| { if (i < 1) return value_expr; i -= 1; @@ -796,6 +802,11 @@ pub const Node = struct { if (self.value_expr) |value_expr| { return value_expr.lastToken(); } + if (self.align_expr) |align_expr| { + // The expression refers to what's inside the parenthesis, the + // last token is the closing one + return align_expr.lastToken() + 1; + } if (self.type_expr) |type_expr| { return type_expr.lastToken(); } diff --git a/lib/std/zig/parser_test.zig b/lib/std/zig/parser_test.zig index 4154bb6a7..9602b56c9 100644 --- a/lib/std/zig/parser_test.zig +++ b/lib/std/zig/parser_test.zig @@ -1,3 +1,14 @@ +test "zig fmt: trailing comma in container declaration" { + try testCanonical( + \\const X = struct { foo: i32 }; + \\const X = struct { foo: i32, bar: i32 }; + \\const X = struct { foo: i32 = 1, bar: i32 = 2 }; + \\const X = struct { foo: i32 align(4), bar: i32 align(4) }; + \\const X = struct { foo: i32 align(4) = 1, bar: i32 align(4) = 2 }; + \\ + ); +} + test "zig fmt: trailing comma in fn parameter list" { try testCanonical( \\pub fn f( @@ -727,10 +738,7 @@ test "zig fmt: enum decl with no trailing comma" { try testTransform( \\const StrLitKind = enum {Normal, C}; , - \\const StrLitKind = enum { - \\ Normal, - \\ C, - \\}; + \\const StrLitKind = enum { Normal, C }; \\ ); } @@ -989,11 +997,7 @@ test "zig fmt: no trailing comma on struct decl" { \\ k: usize, s: u32, t: u32 \\}; , - \\const RoundParam = struct { - \\ k: usize, - \\ s: u32, - \\ t: u32, - \\}; + \\const RoundParam = struct { k: usize, s: u32, t: u32 }; \\ ); } @@ -2560,10 +2564,8 @@ test "zig fmt: if type expr" { ); } test "zig fmt: file ends with struct field" { - try testTransform( + try testCanonical( \\a: bool - , - \\a: bool, \\ ); } diff --git a/lib/std/zig/render.zig b/lib/std/zig/render.zig index 6c9e3e01a..1897ed1ae 100644 --- a/lib/std/zig/render.zig +++ b/lib/std/zig/render.zig @@ -206,6 +206,10 @@ fn renderExtraNewline(tree: *ast.Tree, stream: var, start_col: *usize, node: *as } fn renderTopLevelDecl(allocator: *mem.Allocator, stream: var, tree: *ast.Tree, indent: usize, start_col: *usize, decl: *ast.Node) (@TypeOf(stream).Child.Error || Error)!void { + try renderContainerDecl(allocator, stream, tree, indent, start_col, decl, .Newline); +} + +fn renderContainerDecl(allocator: *mem.Allocator, stream: var, tree: *ast.Tree, indent: usize, start_col: *usize, decl: *ast.Node, space: Space) (@TypeOf(stream).Child.Error || Error)!void { switch (decl.id) { .FnProto => { const fn_proto = @fieldParentPtr(ast.Node.FnProto, "base", decl); @@ -213,11 +217,11 @@ fn renderTopLevelDecl(allocator: *mem.Allocator, stream: var, tree: *ast.Tree, i try renderDocComments(tree, stream, fn_proto, indent, start_col); if (fn_proto.body_node) |body_node| { - try renderExpression(allocator, stream, tree, indent, start_col, decl, Space.Space); - try renderExpression(allocator, stream, tree, indent, start_col, body_node, Space.Newline); + try renderExpression(allocator, stream, tree, indent, start_col, decl, .Space); + try renderExpression(allocator, stream, tree, indent, start_col, body_node, space); } else { - try renderExpression(allocator, stream, tree, indent, start_col, decl, Space.None); - try renderToken(tree, stream, tree.nextToken(decl.lastToken()), indent, start_col, Space.Newline); + try renderExpression(allocator, stream, tree, indent, start_col, decl, .None); + try renderToken(tree, stream, tree.nextToken(decl.lastToken()), indent, start_col, space); } }, @@ -225,11 +229,11 @@ fn renderTopLevelDecl(allocator: *mem.Allocator, stream: var, tree: *ast.Tree, i const use_decl = @fieldParentPtr(ast.Node.Use, "base", decl); if (use_decl.visib_token) |visib_token| { - try renderToken(tree, stream, visib_token, indent, start_col, Space.Space); // pub + try renderToken(tree, stream, visib_token, indent, start_col, .Space); // pub } - try renderToken(tree, stream, use_decl.use_token, indent, start_col, Space.Space); // usingnamespace - try renderExpression(allocator, stream, tree, indent, start_col, use_decl.expr, Space.None); - try renderToken(tree, stream, use_decl.semicolon_token, indent, start_col, Space.Newline); // ; + try renderToken(tree, stream, use_decl.use_token, indent, start_col, .Space); // usingnamespace + try renderExpression(allocator, stream, tree, indent, start_col, use_decl.expr, .None); + try renderToken(tree, stream, use_decl.semicolon_token, indent, start_col, space); // ; }, .VarDecl => { @@ -243,9 +247,9 @@ fn renderTopLevelDecl(allocator: *mem.Allocator, stream: var, tree: *ast.Tree, i const test_decl = @fieldParentPtr(ast.Node.TestDecl, "base", decl); try renderDocComments(tree, stream, test_decl, indent, start_col); - try renderToken(tree, stream, test_decl.test_token, indent, start_col, Space.Space); - try renderExpression(allocator, stream, tree, indent, start_col, test_decl.name, Space.Space); - try renderExpression(allocator, stream, tree, indent, start_col, test_decl.body_node, Space.Newline); + try renderToken(tree, stream, test_decl.test_token, indent, start_col, .Space); + try renderExpression(allocator, stream, tree, indent, start_col, test_decl.name, .Space); + try renderExpression(allocator, stream, tree, indent, start_col, test_decl.body_node, space); }, .ContainerField => { @@ -253,62 +257,76 @@ fn renderTopLevelDecl(allocator: *mem.Allocator, stream: var, tree: *ast.Tree, i try renderDocComments(tree, stream, field, indent, start_col); if (field.comptime_token) |t| { - try renderToken(tree, stream, t, indent, start_col, Space.Space); // comptime + try renderToken(tree, stream, t, indent, start_col, .Space); // comptime } + const src_has_trailing_comma = blk: { + const maybe_comma = tree.nextToken(field.lastToken()); + break :blk tree.tokens.at(maybe_comma).id == .Comma; + }; + + // The trailing comma is emitted at the end, but if it's not present + // we still have to respect the specified `space` parameter + const last_token_space: Space = if (src_has_trailing_comma) .None else space; + if (field.type_expr == null and field.value_expr == null) { - return renderToken(tree, stream, field.name_token, indent, start_col, Space.Comma); // name, + try renderToken(tree, stream, field.name_token, indent, start_col, last_token_space); // name } else if (field.type_expr != null and field.value_expr == null) { - try renderToken(tree, stream, field.name_token, indent, start_col, Space.None); // name - try renderToken(tree, stream, tree.nextToken(field.name_token), indent, start_col, Space.Space); // : + try renderToken(tree, stream, field.name_token, indent, start_col, .None); // name + try renderToken(tree, stream, tree.nextToken(field.name_token), indent, start_col, .Space); // : if (field.align_expr) |align_value_expr| { - try renderExpression(allocator, stream, tree, indent, start_col, field.type_expr.?, Space.Space); // type + try renderExpression(allocator, stream, tree, indent, start_col, field.type_expr.?, .Space); // type const lparen_token = tree.prevToken(align_value_expr.firstToken()); const align_kw = tree.prevToken(lparen_token); const rparen_token = tree.nextToken(align_value_expr.lastToken()); - try renderToken(tree, stream, align_kw, indent, start_col, Space.None); // align - try renderToken(tree, stream, lparen_token, indent, start_col, Space.None); // ( - try renderExpression(allocator, stream, tree, indent, start_col, align_value_expr, Space.None); // alignment - try renderToken(tree, stream, rparen_token, indent, start_col, Space.Comma); // ), + try renderToken(tree, stream, align_kw, indent, start_col, .None); // align + try renderToken(tree, stream, lparen_token, indent, start_col, .None); // ( + try renderExpression(allocator, stream, tree, indent, start_col, align_value_expr, .None); // alignment + try renderToken(tree, stream, rparen_token, indent, start_col, last_token_space); // ) } else { - try renderExpression(allocator, stream, tree, indent, start_col, field.type_expr.?, Space.Comma); // type, + try renderExpression(allocator, stream, tree, indent, start_col, field.type_expr.?, last_token_space); // type } } else if (field.type_expr == null and field.value_expr != null) { - try renderToken(tree, stream, field.name_token, indent, start_col, Space.Space); // name - try renderToken(tree, stream, tree.nextToken(field.name_token), indent, start_col, Space.Space); // = - return renderExpression(allocator, stream, tree, indent, start_col, field.value_expr.?, Space.Comma); // value + try renderToken(tree, stream, field.name_token, indent, start_col, .Space); // name + try renderToken(tree, stream, tree.nextToken(field.name_token), indent, start_col, .Space); // = + try renderExpression(allocator, stream, tree, indent, start_col, field.value_expr.?, last_token_space); // value } else { - try renderToken(tree, stream, field.name_token, indent, start_col, Space.None); // name - try renderToken(tree, stream, tree.nextToken(field.name_token), indent, start_col, Space.Space); // : + try renderToken(tree, stream, field.name_token, indent, start_col, .None); // name + try renderToken(tree, stream, tree.nextToken(field.name_token), indent, start_col, .Space); // : if (field.align_expr) |align_value_expr| { - try renderExpression(allocator, stream, tree, indent, start_col, field.type_expr.?, Space.Space); // type + try renderExpression(allocator, stream, tree, indent, start_col, field.type_expr.?, .Space); // type const lparen_token = tree.prevToken(align_value_expr.firstToken()); const align_kw = tree.prevToken(lparen_token); const rparen_token = tree.nextToken(align_value_expr.lastToken()); - try renderToken(tree, stream, align_kw, indent, start_col, Space.None); // align - try renderToken(tree, stream, lparen_token, indent, start_col, Space.None); // ( - try renderExpression(allocator, stream, tree, indent, start_col, align_value_expr, Space.None); // alignment - try renderToken(tree, stream, rparen_token, indent, start_col, Space.Space); // ) + try renderToken(tree, stream, align_kw, indent, start_col, .None); // align + try renderToken(tree, stream, lparen_token, indent, start_col, .None); // ( + try renderExpression(allocator, stream, tree, indent, start_col, align_value_expr, .None); // alignment + try renderToken(tree, stream, rparen_token, indent, start_col, .Space); // ) } else { - try renderExpression(allocator, stream, tree, indent, start_col, field.type_expr.?, Space.Space); // type + try renderExpression(allocator, stream, tree, indent, start_col, field.type_expr.?, .Space); // type } - try renderToken(tree, stream, tree.prevToken(field.value_expr.?.firstToken()), indent, start_col, Space.Space); // = - return renderExpression(allocator, stream, tree, indent, start_col, field.value_expr.?, Space.Comma); // value, + try renderToken(tree, stream, tree.prevToken(field.value_expr.?.firstToken()), indent, start_col, .Space); // = + try renderExpression(allocator, stream, tree, indent, start_col, field.value_expr.?, last_token_space); // value + } + + if (src_has_trailing_comma) { + const comma = tree.nextToken(field.lastToken()); + try renderToken(tree, stream, comma, indent, start_col, space); } }, .Comptime => { assert(!decl.requireSemiColon()); - try renderExpression(allocator, stream, tree, indent, start_col, decl, Space.Newline); + try renderExpression(allocator, stream, tree, indent, start_col, decl, space); }, .DocComment => { const comment = @fieldParentPtr(ast.Node.DocComment, "base", decl); var it = comment.lines.iterator(0); while (it.next()) |line_token_index| { - try renderToken(tree, stream, line_token_index.*, indent, start_col, Space.Newline); + try renderToken(tree, stream, line_token_index.*, indent, start_col, .Newline); if (it.peek()) |_| { try stream.writeByteNTimes(' ', indent); } @@ -1150,14 +1168,36 @@ fn renderExpression( if (container_decl.fields_and_decls.len == 0) { try renderToken(tree, stream, container_decl.lbrace_token, indent + indent_delta, start_col, Space.None); // { return renderToken(tree, stream, container_decl.rbrace_token, indent, start_col, space); // } - } else { + } + + const src_has_trailing_comma = blk: { + var maybe_comma = tree.prevToken(container_decl.lastToken()); + // Doc comments for a field may also appear after the comma, eg. + // field_name: T, // comment attached to field_name + if (tree.tokens.at(maybe_comma).id == .DocComment) + maybe_comma = tree.prevToken(maybe_comma); + break :blk tree.tokens.at(maybe_comma).id == .Comma; + }; + + // We can only print all the elements in-line if all the + // declarations inside are fields + const src_has_only_fields = blk: { + var it = container_decl.fields_and_decls.iterator(0); + while (it.next()) |decl| { + if (decl.*.id != .ContainerField) break :blk false; + } + break :blk true; + }; + + if (src_has_trailing_comma or !src_has_only_fields) { + // One declaration per line const new_indent = indent + indent_delta; - try renderToken(tree, stream, container_decl.lbrace_token, new_indent, start_col, Space.Newline); // { + try renderToken(tree, stream, container_decl.lbrace_token, new_indent, start_col, .Newline); // { var it = container_decl.fields_and_decls.iterator(0); while (it.next()) |decl| { try stream.writeByteNTimes(' ', new_indent); - try renderTopLevelDecl(allocator, stream, tree, new_indent, start_col, decl.*); + try renderContainerDecl(allocator, stream, tree, new_indent, start_col, decl.*, .Newline); if (it.peek()) |next_decl| { try renderExtraNewline(tree, stream, start_col, next_decl.*); @@ -1165,8 +1205,17 @@ fn renderExpression( } try stream.writeByteNTimes(' ', indent); - return renderToken(tree, stream, container_decl.rbrace_token, indent, start_col, space); // } + } else { + // All the declarations on the same line + try renderToken(tree, stream, container_decl.lbrace_token, indent, start_col, .Space); // { + + var it = container_decl.fields_and_decls.iterator(0); + while (it.next()) |decl| { + try renderContainerDecl(allocator, stream, tree, indent, start_col, decl.*, .Space); + } } + + return renderToken(tree, stream, container_decl.rbrace_token, indent, start_col, space); // } }, .ErrorSetDecl => { From 3640c682a2ed8a0f554224936a3c634215543ffe Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Sat, 1 Feb 2020 11:32:53 +0100 Subject: [PATCH 46/60] Run `zig fmt` --- lib/std/c/parse.zig | 1 - lib/std/c/tokenizer.zig | 2 +- lib/std/hash/benchmark.zig | 4 ++-- lib/std/os/uefi.zig | 3 ++- lib/std/os/windows/bits.zig | 20 +++++++------------- lib/std/zig/perf_test.zig | 2 +- src-self-hosted/dep_tokenizer.zig | 2 +- src-self-hosted/link.zig | 2 +- 8 files changed, 15 insertions(+), 21 deletions(-) diff --git a/lib/std/c/parse.zig b/lib/std/c/parse.zig index dd646e06d..4c6c2fb46 100644 --- a/lib/std/c/parse.zig +++ b/lib/std/c/parse.zig @@ -1428,4 +1428,3 @@ const Parser = struct { }); } }; - diff --git a/lib/std/c/tokenizer.zig b/lib/std/c/tokenizer.zig index a64152950..bf8bb2b8c 100644 --- a/lib/std/c/tokenizer.zig +++ b/lib/std/c/tokenizer.zig @@ -631,7 +631,7 @@ pub const Tokenizer = struct { }, .BackSlashCr => switch (c) { '\n' => { - state = .Start; + state = .Start; }, else => { result.id = .Invalid; diff --git a/lib/std/hash/benchmark.zig b/lib/std/hash/benchmark.zig index c792013e0..ed1bab9d8 100644 --- a/lib/std/hash/benchmark.zig +++ b/lib/std/hash/benchmark.zig @@ -250,13 +250,13 @@ pub fn main() !void { if (H.has_iterative_api) { prng.seed(seed); const result = try benchmarkHash(H, count); - try stdout.print(" iterative: {:4} MiB/s [{x:0<16}]\n", .{result.throughput / (1 * MiB), result.hash}); + try stdout.print(" iterative: {:4} MiB/s [{x:0<16}]\n", .{ result.throughput / (1 * MiB), result.hash }); } if (!test_iterative_only) { prng.seed(seed); const result_small = try benchmarkHashSmallKeys(H, key_size, count); - try stdout.print(" small keys: {:4} MiB/s [{x:0<16}]\n", .{result_small.throughput / (1 * MiB), result_small.hash}); + try stdout.print(" small keys: {:4} MiB/s [{x:0<16}]\n", .{ result_small.throughput / (1 * MiB), result_small.hash }); } } } diff --git a/lib/std/os/uefi.zig b/lib/std/os/uefi.zig index 1095706c9..81d13ac1c 100644 --- a/lib/std/os/uefi.zig +++ b/lib/std/os/uefi.zig @@ -40,7 +40,8 @@ pub const Guid = extern struct { self.time_mid, self.time_high_and_version, self.clock_seq_high_and_reserved, - self.clock_seq_low, self.node, + self.clock_seq_low, + self.node, }); } else { @compileError("Unknown format character: '" ++ f ++ "'"); diff --git a/lib/std/os/windows/bits.zig b/lib/std/os/windows/bits.zig index 756c8e7f1..ec4f231ed 100644 --- a/lib/std/os/windows/bits.zig +++ b/lib/std/os/windows/bits.zig @@ -928,10 +928,7 @@ pub usingnamespace switch (builtin.arch) { SegSs: DWORD, ExtendedRegisters: [512]BYTE, - pub fn getRegs(ctx: *const CONTEXT) struct { - bp: usize, - ip: usize, - } { + pub fn getRegs(ctx: *const CONTEXT) struct { bp: usize, ip: usize } { return .{ .bp = ctx.Ebp, .ip = ctx.Eip }; } }; @@ -1034,10 +1031,7 @@ pub usingnamespace switch (builtin.arch) { LastExceptionToRip: DWORD64, LastExceptionFromRip: DWORD64, - pub fn getRegs(ctx: *const CONTEXT) struct { - bp: usize, - ip: usize, - } { + pub fn getRegs(ctx: *const CONTEXT) struct { bp: usize, ip: usize } { return .{ .bp = ctx.Rbp, .ip = ctx.Rip }; } }; @@ -1105,11 +1099,11 @@ pub usingnamespace switch (builtin.arch) { Wcr: [2]DWORD, Wvr: [2]DWORD64, - pub fn getRegs(ctx: *const CONTEXT) struct { - bp: usize, - ip: usize, - } { - return .{ .bp = ctx.DUMMYUNIONNAME.DUMMYSTRUCTNAME.Fp, .ip = ctx.Pc }; + pub fn getRegs(ctx: *const CONTEXT) struct { bp: usize, ip: usize } { + return .{ + .bp = ctx.DUMMYUNIONNAME.DUMMYSTRUCTNAME.Fp, + .ip = ctx.Pc, + }; } }; diff --git a/lib/std/zig/perf_test.zig b/lib/std/zig/perf_test.zig index fe9d35fa4..070d9c3bc 100644 --- a/lib/std/zig/perf_test.zig +++ b/lib/std/zig/perf_test.zig @@ -25,7 +25,7 @@ pub fn main() !void { var stdout_file = std.io.getStdOut(); const stdout = &stdout_file.outStream().stream; - try stdout.print("{:.3} MiB/s, {} KiB used \n", .{mb_per_sec, memory_used / 1024}); + try stdout.print("{:.3} MiB/s, {} KiB used \n", .{ mb_per_sec, memory_used / 1024 }); } fn testOnce() usize { diff --git a/src-self-hosted/dep_tokenizer.zig b/src-self-hosted/dep_tokenizer.zig index c5b0f0cd1..9a13faa5f 100644 --- a/src-self-hosted/dep_tokenizer.zig +++ b/src-self-hosted/dep_tokenizer.zig @@ -894,7 +894,7 @@ fn printSection(out: var, label: []const u8, bytes: []const u8) !void { fn printLabel(out: var, label: []const u8, bytes: []const u8) !void { var buf: [80]u8 = undefined; - var text = try std.fmt.bufPrint(buf[0..], "{} {} bytes ", .{label, bytes.len}); + var text = try std.fmt.bufPrint(buf[0..], "{} {} bytes ", .{ label, bytes.len }); try out.write(text); var i: usize = text.len; const end = 79; diff --git a/src-self-hosted/link.zig b/src-self-hosted/link.zig index efb83710d..96e18514e 100644 --- a/src-self-hosted/link.zig +++ b/src-self-hosted/link.zig @@ -105,7 +105,7 @@ extern fn ZigLLDLink( context: *c_void, ) bool; -extern fn linkDiagCallback(context: *c_void, ptr: [*]const u8, len: usize) void { +fn linkDiagCallback(context: *c_void, ptr: [*]const u8, len: usize) callconv(.C) void { const ctx = @ptrCast(*Context, @alignCast(@alignOf(Context), context)); ctx.link_err = linkDiagCallbackErrorable(ctx, ptr[0..len]); } From f34abbf2602c60a562988631de6a3dcbefbbb4cd Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Sat, 1 Feb 2020 14:43:31 +0100 Subject: [PATCH 47/60] fmt: Handle declarations in line with the opening brace --- lib/std/zig/parser_test.zig | 4 +--- lib/std/zig/render.zig | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/lib/std/zig/parser_test.zig b/lib/std/zig/parser_test.zig index 9602b56c9..50735b0ec 100644 --- a/lib/std/zig/parser_test.zig +++ b/lib/std/zig/parser_test.zig @@ -992,12 +992,10 @@ test "zig fmt: empty block with only comment" { } test "zig fmt: no trailing comma on struct decl" { - try testTransform( + try testCanonical( \\const RoundParam = struct { \\ k: usize, s: u32, t: u32 \\}; - , - \\const RoundParam = struct { k: usize, s: u32, t: u32 }; \\ ); } diff --git a/lib/std/zig/render.zig b/lib/std/zig/render.zig index 1897ed1ae..993b30b0e 100644 --- a/lib/std/zig/render.zig +++ b/lib/std/zig/render.zig @@ -1179,6 +1179,12 @@ fn renderExpression( break :blk tree.tokens.at(maybe_comma).id == .Comma; }; + // Check if the first declaration and the { are on the same line + const src_has_newline = !tree.tokensOnSameLine( + container_decl.fields_and_decls.at(0).*.firstToken(), + container_decl.rbrace_token, + ); + // We can only print all the elements in-line if all the // declarations inside are fields const src_has_only_fields = blk: { @@ -1205,6 +1211,19 @@ fn renderExpression( } try stream.writeByteNTimes(' ', indent); + } else if (src_has_newline) { + // All the declarations on the same line, but place the items on + // their own line + try renderToken(tree, stream, container_decl.lbrace_token, indent, start_col, .Newline); // { + + const new_indent = indent + indent_delta; + try stream.writeByteNTimes(' ', new_indent); + + var it = container_decl.fields_and_decls.iterator(0); + while (it.next()) |decl| { + const space_after_decl: Space = if (it.peek() == null) .Newline else .Space; + try renderContainerDecl(allocator, stream, tree, new_indent, start_col, decl.*, space_after_decl); + } } else { // All the declarations on the same line try renderToken(tree, stream, container_decl.lbrace_token, indent, start_col, .Space); // { From e548195fd5ddedb5b2d87ef4b396666917e6d9b6 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Sat, 1 Feb 2020 15:28:23 +0100 Subject: [PATCH 48/60] fmt: Use left brace position instead of the right one Fix a typo and add a test case. --- lib/std/zig/parser_test.zig | 9 +++++++++ lib/std/zig/render.zig | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/std/zig/parser_test.zig b/lib/std/zig/parser_test.zig index 50735b0ec..7b75aed28 100644 --- a/lib/std/zig/parser_test.zig +++ b/lib/std/zig/parser_test.zig @@ -7,6 +7,15 @@ test "zig fmt: trailing comma in container declaration" { \\const X = struct { foo: i32 align(4) = 1, bar: i32 align(4) = 2 }; \\ ); + try testTransform( + \\const X = struct { + \\ foo: i32, bar: i8 }; + , + \\const X = struct { + \\ foo: i32, bar: i8 + \\}; + \\ + ); } test "zig fmt: trailing comma in fn parameter list" { diff --git a/lib/std/zig/render.zig b/lib/std/zig/render.zig index 993b30b0e..5fda70048 100644 --- a/lib/std/zig/render.zig +++ b/lib/std/zig/render.zig @@ -1181,8 +1181,8 @@ fn renderExpression( // Check if the first declaration and the { are on the same line const src_has_newline = !tree.tokensOnSameLine( + container_decl.lbrace_token, container_decl.fields_and_decls.at(0).*.firstToken(), - container_decl.rbrace_token, ); // We can only print all the elements in-line if all the From 0bf91cce5855b72e0bddfb94912dcfaa9d77417f Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Sat, 1 Feb 2020 15:18:11 +0100 Subject: [PATCH 49/60] windows: Minor changes to psapi prototypes --- lib/std/os/windows/bits.zig | 28 ++++++++++++++++++---------- lib/std/os/windows/kernel32.zig | 20 ++++++++++---------- lib/std/os/windows/psapi.zig | 20 ++++++++++---------- 3 files changed, 38 insertions(+), 30 deletions(-) diff --git a/lib/std/os/windows/bits.zig b/lib/std/os/windows/bits.zig index 756c8e7f1..2d95ae841 100644 --- a/lib/std/os/windows/bits.zig +++ b/lib/std/os/windows/bits.zig @@ -1251,12 +1251,14 @@ pub const MODULEINFO = extern struct { SizeOfImage: DWORD, EntryPoint: LPVOID, }; -pub const LPMODULEINFO = [*c]MODULEINFO; +pub const LPMODULEINFO = *MODULEINFO; + pub const PSAPI_WS_WATCH_INFORMATION = extern struct { FaultingPc: LPVOID, FaultingVa: LPVOID, }; -pub const PPSAPI_WS_WATCH_INFORMATION = [*c]PSAPI_WS_WATCH_INFORMATION; +pub const PPSAPI_WS_WATCH_INFORMATION = *PSAPI_WS_WATCH_INFORMATION; + pub const PROCESS_MEMORY_COUNTERS = extern struct { cb: DWORD, PageFaultCount: DWORD, @@ -1269,7 +1271,8 @@ pub const PROCESS_MEMORY_COUNTERS = extern struct { PagefileUsage: SIZE_T, PeakPagefileUsage: SIZE_T, }; -pub const PPROCESS_MEMORY_COUNTERS = [*c]PROCESS_MEMORY_COUNTERS; +pub const PPROCESS_MEMORY_COUNTERS = *PROCESS_MEMORY_COUNTERS; + pub const PROCESS_MEMORY_COUNTERS_EX = extern struct { cb: DWORD, PageFaultCount: DWORD, @@ -1283,7 +1286,8 @@ pub const PROCESS_MEMORY_COUNTERS_EX = extern struct { PeakPagefileUsage: SIZE_T, PrivateUsage: SIZE_T, }; -pub const PPROCESS_MEMORY_COUNTERS_EX = [*c]PROCESS_MEMORY_COUNTERS_EX; +pub const PPROCESS_MEMORY_COUNTERS_EX = *PROCESS_MEMORY_COUNTERS_EX; + pub const PERFORMANCE_INFORMATION = extern struct { cb: DWORD, CommitTotal: SIZE_T, @@ -1300,9 +1304,11 @@ pub const PERFORMANCE_INFORMATION = extern struct { ProcessCount: DWORD, ThreadCount: DWORD, }; -pub const PPERFORMANCE_INFORMATION = [*c]PERFORMANCE_INFORMATION; +pub const PPERFORMANCE_INFORMATION = *PERFORMANCE_INFORMATION; + pub const PERFORMACE_INFORMATION = PERFORMANCE_INFORMATION; -pub const PPERFORMACE_INFORMATION = [*c]PERFORMANCE_INFORMATION; +pub const PPERFORMACE_INFORMATION = *PERFORMANCE_INFORMATION; + pub const ENUM_PAGE_FILE_INFORMATION = extern struct { cb: DWORD, Reserved: DWORD, @@ -1310,12 +1316,14 @@ pub const ENUM_PAGE_FILE_INFORMATION = extern struct { TotalInUse: SIZE_T, PeakUsage: SIZE_T, }; -pub const PENUM_PAGE_FILE_INFORMATION = [*c]ENUM_PAGE_FILE_INFORMATION; -pub const PENUM_PAGE_FILE_CALLBACKW = ?fn (LPVOID, PENUM_PAGE_FILE_INFORMATION, LPCWSTR) callconv(.C) BOOL; -pub const PENUM_PAGE_FILE_CALLBACKA = ?fn (LPVOID, PENUM_PAGE_FILE_INFORMATION, LPCSTR) callconv(.C) BOOL; +pub const PENUM_PAGE_FILE_INFORMATION = *ENUM_PAGE_FILE_INFORMATION; + +pub const PENUM_PAGE_FILE_CALLBACKW = ?fn (?LPVOID, PENUM_PAGE_FILE_INFORMATION, LPCWSTR) callconv(.C) BOOL; +pub const PENUM_PAGE_FILE_CALLBACKA = ?fn (?LPVOID, PENUM_PAGE_FILE_INFORMATION, LPCSTR) callconv(.C) BOOL; + pub const PSAPI_WS_WATCH_INFORMATION_EX = extern struct { BasicInfo: PSAPI_WS_WATCH_INFORMATION, FaultingThreadId: ULONG_PTR, Flags: ULONG_PTR, }; -pub const PPSAPI_WS_WATCH_INFORMATION_EX = [*c]PSAPI_WS_WATCH_INFORMATION_EX; +pub const PPSAPI_WS_WATCH_INFORMATION_EX = *PSAPI_WS_WATCH_INFORMATION_EX; diff --git a/lib/std/os/windows/kernel32.zig b/lib/std/os/windows/kernel32.zig index f98c95f52..3f65e4d73 100644 --- a/lib/std/os/windows/kernel32.zig +++ b/lib/std/os/windows/kernel32.zig @@ -250,22 +250,22 @@ pub extern "kernel32" fn DeleteCriticalSection(lpCriticalSection: *CRITICAL_SECT pub extern "kernel32" fn InitOnceExecuteOnce(InitOnce: *INIT_ONCE, InitFn: INIT_ONCE_FN, Parameter: ?*c_void, Context: ?*c_void) callconv(.Stdcall) BOOL; pub extern "kernel32" fn K32EmptyWorkingSet(hProcess: HANDLE) callconv(.Stdcall) BOOL; -pub extern "kernel32" fn K32EnumDeviceDrivers(lpImageBase: [*c]LPVOID, cb: DWORD, lpcbNeeded: LPDWORD) callconv(.Stdcall) BOOL; +pub extern "kernel32" fn K32EnumDeviceDrivers(lpImageBase: [*]LPVOID, cb: DWORD, lpcbNeeded: LPDWORD) callconv(.Stdcall) BOOL; pub extern "kernel32" fn K32EnumPageFilesA(pCallBackRoutine: PENUM_PAGE_FILE_CALLBACKA, pContext: LPVOID) callconv(.Stdcall) BOOL; pub extern "kernel32" fn K32EnumPageFilesW(pCallBackRoutine: PENUM_PAGE_FILE_CALLBACKW, pContext: LPVOID) callconv(.Stdcall) BOOL; -pub extern "kernel32" fn K32EnumProcessModules(hProcess: HANDLE, lphModule: [*c]HMODULE, cb: DWORD, lpcbNeeded: LPDWORD) callconv(.Stdcall) BOOL; -pub extern "kernel32" fn K32EnumProcessModulesEx(hProcess: HANDLE, lphModule: [*c]HMODULE, cb: DWORD, lpcbNeeded: LPDWORD, dwFilterFlag: DWORD) callconv(.Stdcall) BOOL; -pub extern "kernel32" fn K32EnumProcesses(lpidProcess: [*c]DWORD, cb: DWORD, cbNeeded: [*c]DWORD) callconv(.Stdcall) BOOL; +pub extern "kernel32" fn K32EnumProcessModules(hProcess: HANDLE, lphModule: [*]HMODULE, cb: DWORD, lpcbNeeded: LPDWORD) callconv(.Stdcall) BOOL; +pub extern "kernel32" fn K32EnumProcessModulesEx(hProcess: HANDLE, lphModule: [*]HMODULE, cb: DWORD, lpcbNeeded: LPDWORD, dwFilterFlag: DWORD) callconv(.Stdcall) BOOL; +pub extern "kernel32" fn K32EnumProcesses(lpidProcess: [*]DWORD, cb: DWORD, cbNeeded: LPDWORD) callconv(.Stdcall) BOOL; pub extern "kernel32" fn K32GetDeviceDriverBaseNameA(ImageBase: LPVOID, lpBaseName: LPSTR, nSize: DWORD) callconv(.Stdcall) DWORD; pub extern "kernel32" fn K32GetDeviceDriverBaseNameW(ImageBase: LPVOID, lpBaseName: LPWSTR, nSize: DWORD) callconv(.Stdcall) DWORD; pub extern "kernel32" fn K32GetDeviceDriverFileNameA(ImageBase: LPVOID, lpFilename: LPSTR, nSize: DWORD) callconv(.Stdcall) DWORD; pub extern "kernel32" fn K32GetDeviceDriverFileNameW(ImageBase: LPVOID, lpFilename: LPWSTR, nSize: DWORD) callconv(.Stdcall) DWORD; -pub extern "kernel32" fn K32GetMappedFileNameA(hProcess: HANDLE, lpv: LPVOID, lpFilename: LPSTR, nSize: DWORD) callconv(.Stdcall) DWORD; -pub extern "kernel32" fn K32GetMappedFileNameW(hProcess: HANDLE, lpv: LPVOID, lpFilename: LPWSTR, nSize: DWORD) callconv(.Stdcall) DWORD; -pub extern "kernel32" fn K32GetModuleBaseNameA(hProcess: HANDLE, hModule: HMODULE, lpBaseName: LPSTR, nSize: DWORD) callconv(.Stdcall) DWORD; -pub extern "kernel32" fn K32GetModuleBaseNameW(hProcess: HANDLE, hModule: HMODULE, lpBaseName: LPWSTR, nSize: DWORD) callconv(.Stdcall) DWORD; -pub extern "kernel32" fn K32GetModuleFileNameExA(hProcess: HANDLE, hModule: HMODULE, lpFilename: LPSTR, nSize: DWORD) callconv(.Stdcall) DWORD; -pub extern "kernel32" fn K32GetModuleFileNameExW(hProcess: HANDLE, hModule: HMODULE, lpFilename: LPWSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "kernel32" fn K32GetMappedFileNameA(hProcess: HANDLE, lpv: ?LPVOID, lpFilename: LPSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "kernel32" fn K32GetMappedFileNameW(hProcess: HANDLE, lpv: ?LPVOID, lpFilename: LPWSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "kernel32" fn K32GetModuleBaseNameA(hProcess: HANDLE, hModule: ?HMODULE, lpBaseName: LPSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "kernel32" fn K32GetModuleBaseNameW(hProcess: HANDLE, hModule: ?HMODULE, lpBaseName: LPWSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "kernel32" fn K32GetModuleFileNameExA(hProcess: HANDLE, hModule: ?HMODULE, lpFilename: LPSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "kernel32" fn K32GetModuleFileNameExW(hProcess: HANDLE, hModule: ?HMODULE, lpFilename: LPWSTR, nSize: DWORD) callconv(.Stdcall) DWORD; pub extern "kernel32" fn K32GetModuleInformation(hProcess: HANDLE, hModule: HMODULE, lpmodinfo: LPMODULEINFO, cb: DWORD) callconv(.Stdcall) BOOL; pub extern "kernel32" fn K32GetPerformanceInfo(pPerformanceInformation: PPERFORMACE_INFORMATION, cb: DWORD) callconv(.Stdcall) BOOL; pub extern "kernel32" fn K32GetProcessImageFileNameA(hProcess: HANDLE, lpImageFileName: LPSTR, nSize: DWORD) callconv(.Stdcall) DWORD; diff --git a/lib/std/os/windows/psapi.zig b/lib/std/os/windows/psapi.zig index 73ac29e33..1a5a7d4bf 100644 --- a/lib/std/os/windows/psapi.zig +++ b/lib/std/os/windows/psapi.zig @@ -1,22 +1,22 @@ usingnamespace @import("bits.zig"); pub extern "psapi" fn EmptyWorkingSet(hProcess: HANDLE) callconv(.Stdcall) BOOL; -pub extern "psapi" fn EnumDeviceDrivers(lpImageBase: [*c]LPVOID, cb: DWORD, lpcbNeeded: LPDWORD) callconv(.Stdcall) BOOL; +pub extern "psapi" fn EnumDeviceDrivers(lpImageBase: [*]LPVOID, cb: DWORD, lpcbNeeded: LPDWORD) callconv(.Stdcall) BOOL; pub extern "psapi" fn EnumPageFilesA(pCallBackRoutine: PENUM_PAGE_FILE_CALLBACKA, pContext: LPVOID) callconv(.Stdcall) BOOL; pub extern "psapi" fn EnumPageFilesW(pCallBackRoutine: PENUM_PAGE_FILE_CALLBACKW, pContext: LPVOID) callconv(.Stdcall) BOOL; -pub extern "psapi" fn EnumProcessModules(hProcess: HANDLE, lphModule: [*c]HMODULE, cb: DWORD, lpcbNeeded: LPDWORD) callconv(.Stdcall) BOOL; -pub extern "psapi" fn EnumProcessModulesEx(hProcess: HANDLE, lphModule: [*c]HMODULE, cb: DWORD, lpcbNeeded: LPDWORD, dwFilterFlag: DWORD) callconv(.Stdcall) BOOL; -pub extern "psapi" fn EnumProcesses(lpidProcess: [*c]DWORD, cb: DWORD, cbNeeded: [*c]DWORD) callconv(.Stdcall) BOOL; +pub extern "psapi" fn EnumProcessModules(hProcess: HANDLE, lphModule: [*]HMODULE, cb: DWORD, lpcbNeeded: LPDWORD) callconv(.Stdcall) BOOL; +pub extern "psapi" fn EnumProcessModulesEx(hProcess: HANDLE, lphModule: [*]HMODULE, cb: DWORD, lpcbNeeded: LPDWORD, dwFilterFlag: DWORD) callconv(.Stdcall) BOOL; +pub extern "psapi" fn EnumProcesses(lpidProcess: [*]DWORD, cb: DWORD, cbNeeded: LPDWORD) callconv(.Stdcall) BOOL; pub extern "psapi" fn GetDeviceDriverBaseNameA(ImageBase: LPVOID, lpBaseName: LPSTR, nSize: DWORD) callconv(.Stdcall) DWORD; pub extern "psapi" fn GetDeviceDriverBaseNameW(ImageBase: LPVOID, lpBaseName: LPWSTR, nSize: DWORD) callconv(.Stdcall) DWORD; pub extern "psapi" fn GetDeviceDriverFileNameA(ImageBase: LPVOID, lpFilename: LPSTR, nSize: DWORD) callconv(.Stdcall) DWORD; pub extern "psapi" fn GetDeviceDriverFileNameW(ImageBase: LPVOID, lpFilename: LPWSTR, nSize: DWORD) callconv(.Stdcall) DWORD; -pub extern "psapi" fn GetMappedFileNameA(hProcess: HANDLE, lpv: LPVOID, lpFilename: LPSTR, nSize: DWORD) callconv(.Stdcall) DWORD; -pub extern "psapi" fn GetMappedFileNameW(hProcess: HANDLE, lpv: LPVOID, lpFilename: LPWSTR, nSize: DWORD) callconv(.Stdcall) DWORD; -pub extern "psapi" fn GetModuleBaseNameA(hProcess: HANDLE, hModule: HMODULE, lpBaseName: LPSTR, nSize: DWORD) callconv(.Stdcall) DWORD; -pub extern "psapi" fn GetModuleBaseNameW(hProcess: HANDLE, hModule: HMODULE, lpBaseName: LPWSTR, nSize: DWORD) callconv(.Stdcall) DWORD; -pub extern "psapi" fn GetModuleFileNameExA(hProcess: HANDLE, hModule: HMODULE, lpFilename: LPSTR, nSize: DWORD) callconv(.Stdcall) DWORD; -pub extern "psapi" fn GetModuleFileNameExW(hProcess: HANDLE, hModule: HMODULE, lpFilename: LPWSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "psapi" fn GetMappedFileNameA(hProcess: HANDLE, lpv: ?LPVOID, lpFilename: LPSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "psapi" fn GetMappedFileNameW(hProcess: HANDLE, lpv: ?LPVOID, lpFilename: LPWSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "psapi" fn GetModuleBaseNameA(hProcess: HANDLE, hModule: ?HMODULE, lpBaseName: LPSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "psapi" fn GetModuleBaseNameW(hProcess: HANDLE, hModule: ?HMODULE, lpBaseName: LPWSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "psapi" fn GetModuleFileNameExA(hProcess: HANDLE, hModule: ?HMODULE, lpFilename: LPSTR, nSize: DWORD) callconv(.Stdcall) DWORD; +pub extern "psapi" fn GetModuleFileNameExW(hProcess: HANDLE, hModule: ?HMODULE, lpFilename: LPWSTR, nSize: DWORD) callconv(.Stdcall) DWORD; pub extern "psapi" fn GetModuleInformation(hProcess: HANDLE, hModule: HMODULE, lpmodinfo: LPMODULEINFO, cb: DWORD) callconv(.Stdcall) BOOL; pub extern "psapi" fn GetPerformanceInfo(pPerformanceInformation: PPERFORMACE_INFORMATION, cb: DWORD) callconv(.Stdcall) BOOL; pub extern "psapi" fn GetProcessImageFileNameA(hProcess: HANDLE, lpImageFileName: LPSTR, nSize: DWORD) callconv(.Stdcall) DWORD; From 4f2652d504c796bbba6d7ccf6a699dc01055e3e7 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Fri, 31 Jan 2020 23:04:24 +1100 Subject: [PATCH 50/60] Winsock errors can be an enum --- lib/std/os/windows.zig | 14 +- lib/std/os/windows/ws2_32.zig | 545 ++++++++++++++++++++++++++++------ 2 files changed, 456 insertions(+), 103 deletions(-) diff --git a/lib/std/os/windows.zig b/lib/std/os/windows.zig index d12044ca6..b48d0e50b 100644 --- a/lib/std/os/windows.zig +++ b/lib/std/os/windows.zig @@ -662,7 +662,7 @@ pub fn WSAStartup(majorVersion: u8, minorVersion: u8) !ws2_32.WSADATA { var wsadata: ws2_32.WSADATA = undefined; return switch (ws2_32.WSAStartup((@as(WORD, minorVersion) << 8) | majorVersion, &wsadata)) { 0 => wsadata, - else => |err| unexpectedWSAError(err), + else => |err| unexpectedWSAError(@intToEnum(WinsockError, err)), }; } @@ -687,10 +687,10 @@ pub fn WSASocketW( const rc = ws2_32.WSASocketW(af, socket_type, protocol, protocolInfo, g, dwFlags); if (rc == ws2_32.INVALID_SOCKET) { switch (ws2_32.WSAGetLastError()) { - ws2_32.WSAEAFNOSUPPORT => return error.AddressFamilyNotSupported, - ws2_32.WSAEMFILE => return error.ProcessFdQuotaExceeded, - ws2_32.WSAENOBUFS => return error.SystemResources, - ws2_32.WSAEPROTONOSUPPORT => return error.ProtocolNotSupported, + .WSAEAFNOSUPPORT => return error.AddressFamilyNotSupported, + .WSAEMFILE => return error.ProcessFdQuotaExceeded, + .WSAENOBUFS => return error.SystemResources, + .WSAEPROTONOSUPPORT => return error.ProtocolNotSupported, else => |err| return unexpectedWSAError(err), } } @@ -1050,8 +1050,8 @@ pub fn unexpectedError(err: Win32Error) std.os.UnexpectedError { return error.Unexpected; } -pub fn unexpectedWSAError(err: c_int) std.os.UnexpectedError { - return unexpectedError(@intToEnum(Win32Error, @intCast(u16, err))); +pub fn unexpectedWSAError(err: WinsockError) std.os.UnexpectedError { + return unexpectedError(@intToEnum(Win32Error, @enumToInt(err))); } /// Call this when you made a windows NtDll call diff --git a/lib/std/os/windows/ws2_32.zig b/lib/std/os/windows/ws2_32.zig index 70cb62ac5..13efb809b 100644 --- a/lib/std/os/windows/ws2_32.zig +++ b/lib/std/os/windows/ws2_32.zig @@ -205,101 +205,454 @@ pub const WSAMSG = extern struct { dwFlags: DWORD, }; -pub const WSA_INVALID_HANDLE = 6; -pub const WSA_NOT_ENOUGH_MEMORY = 8; -pub const WSA_INVALID_PARAMETER = 87; -pub const WSA_OPERATION_ABORTED = 995; -pub const WSA_IO_INCOMPLETE = 996; -pub const WSA_IO_PENDING = 997; -pub const WSAEINTR = 10004; -pub const WSAEBADF = 10009; -pub const WSAEACCES = 10013; -pub const WSAEFAULT = 10014; -pub const WSAEINVAL = 10022; -pub const WSAEMFILE = 10024; -pub const WSAEWOULDBLOCK = 10035; -pub const WSAEINPROGRESS = 10036; -pub const WSAEALREADY = 10037; -pub const WSAENOTSOCK = 10038; -pub const WSAEDESTADDRREQ = 10039; -pub const WSAEMSGSIZE = 10040; -pub const WSAEPROTOTYPE = 10041; -pub const WSAENOPROTOOPT = 10042; -pub const WSAEPROTONOSUPPORT = 10043; -pub const WSAESOCKTNOSUPPORT = 10044; -pub const WSAEOPNOTSUPP = 10045; -pub const WSAEPFNOSUPPORT = 10046; -pub const WSAEAFNOSUPPORT = 10047; -pub const WSAEADDRINUSE = 10048; -pub const WSAEADDRNOTAVAIL = 10049; -pub const WSAENETDOWN = 10050; -pub const WSAENETUNREACH = 10051; -pub const WSAENETRESET = 10052; -pub const WSAECONNABORTED = 10053; -pub const WSAECONNRESET = 10054; -pub const WSAENOBUFS = 10055; -pub const WSAEISCONN = 10056; -pub const WSAENOTCONN = 10057; -pub const WSAESHUTDOWN = 10058; -pub const WSAETOOMANYREFS = 10059; -pub const WSAETIMEDOUT = 10060; -pub const WSAECONNREFUSED = 10061; -pub const WSAELOOP = 10062; -pub const WSAENAMETOOLONG = 10063; -pub const WSAEHOSTDOWN = 10064; -pub const WSAEHOSTUNREACH = 10065; -pub const WSAENOTEMPTY = 10066; -pub const WSAEPROCLIM = 10067; -pub const WSAEUSERS = 10068; -pub const WSAEDQUOT = 10069; -pub const WSAESTALE = 10070; -pub const WSAEREMOTE = 10071; -pub const WSASYSNOTREADY = 10091; -pub const WSAVERNOTSUPPORTED = 10092; -pub const WSANOTINITIALISED = 10093; -pub const WSAEDISCON = 10101; -pub const WSAENOMORE = 10102; -pub const WSAECANCELLED = 10103; -pub const WSAEINVALIDPROCTABLE = 10104; -pub const WSAEINVALIDPROVIDER = 10105; -pub const WSAEPROVIDERFAILEDINIT = 10106; -pub const WSASYSCALLFAILURE = 10107; -pub const WSASERVICE_NOT_FOUND = 10108; -pub const WSATYPE_NOT_FOUND = 10109; -pub const WSA_E_NO_MORE = 10110; -pub const WSA_E_CANCELLED = 10111; -pub const WSAEREFUSED = 10112; -pub const WSAHOST_NOT_FOUND = 11001; -pub const WSATRY_AGAIN = 11002; -pub const WSANO_RECOVERY = 11003; -pub const WSANO_DATA = 11004; -pub const WSA_QOS_RECEIVERS = 11005; -pub const WSA_QOS_SENDERS = 11006; -pub const WSA_QOS_NO_SENDERS = 11007; -pub const WSA_QOS_NO_RECEIVERS = 11008; -pub const WSA_QOS_REQUEST_CONFIRMED = 11009; -pub const WSA_QOS_ADMISSION_FAILURE = 11010; -pub const WSA_QOS_POLICY_FAILURE = 11011; -pub const WSA_QOS_BAD_STYLE = 11012; -pub const WSA_QOS_BAD_OBJECT = 11013; -pub const WSA_QOS_TRAFFIC_CTRL_ERROR = 11014; -pub const WSA_QOS_GENERIC_ERROR = 11015; -pub const WSA_QOS_ESERVICETYPE = 11016; -pub const WSA_QOS_EFLOWSPEC = 11017; -pub const WSA_QOS_EPROVSPECBUF = 11018; -pub const WSA_QOS_EFILTERSTYLE = 11019; -pub const WSA_QOS_EFILTERTYPE = 11020; -pub const WSA_QOS_EFILTERCOUNT = 11021; -pub const WSA_QOS_EOBJLENGTH = 11022; -pub const WSA_QOS_EFLOWCOUNT = 11023; -pub const WSA_QOS_EUNKOWNPSOBJ = 11024; -pub const WSA_QOS_EPOLICYOBJ = 11025; -pub const WSA_QOS_EFLOWDESC = 11026; -pub const WSA_QOS_EPSFLOWSPEC = 11027; -pub const WSA_QOS_EPSFILTERSPEC = 11028; -pub const WSA_QOS_ESDMODEOBJ = 11029; -pub const WSA_QOS_ESHAPERATEOBJ = 11030; -pub const WSA_QOS_RESERVED_PETYPE = 11031; +// https://docs.microsoft.com/en-au/windows/win32/winsock/windows-sockets-error-codes-2 +pub const WinsockError = extern enum(u16) { + /// Specified event object handle is invalid. + /// An application attempts to use an event object, but the specified handle is not valid. + WSA_INVALID_HANDLE = 6, + + /// Insufficient memory available. + /// An application used a Windows Sockets function that directly maps to a Windows function. + /// The Windows function is indicating a lack of required memory resources. + WSA_NOT_ENOUGH_MEMORY = 8, + + /// One or more parameters are invalid. + /// An application used a Windows Sockets function which directly maps to a Windows function. + /// The Windows function is indicating a problem with one or more parameters. + WSA_INVALID_PARAMETER = 87, + + /// Overlapped operation aborted. + /// An overlapped operation was canceled due to the closure of the socket, or the execution of the SIO_FLUSH command in WSAIoctl. + WSA_OPERATION_ABORTED = 995, + + /// Overlapped I/O event object not in signaled state. + /// The application has tried to determine the status of an overlapped operation which is not yet completed. + /// Applications that use WSAGetOverlappedResult (with the fWait flag set to FALSE) in a polling mode to determine when an overlapped operation has completed, get this error code until the operation is complete. + WSA_IO_INCOMPLETE = 996, + + /// The application has initiated an overlapped operation that cannot be completed immediately. + /// A completion indication will be given later when the operation has been completed. + WSA_IO_PENDING = 997, + + /// Interrupted function call. + /// A blocking operation was interrupted by a call to WSACancelBlockingCall. + WSAEINTR = 10004, + + /// File handle is not valid. + /// The file handle supplied is not valid. + WSAEBADF = 10009, + + /// Permission denied. + /// An attempt was made to access a socket in a way forbidden by its access permissions. + /// An example is using a broadcast address for sendto without broadcast permission being set using setsockopt(SO_BROADCAST). + /// Another possible reason for the WSAEACCES error is that when the bind function is called (on Windows NT 4.0 with SP4 and later), another application, service, or kernel mode driver is bound to the same address with exclusive access. + /// Such exclusive access is a new feature of Windows NT 4.0 with SP4 and later, and is implemented by using the SO_EXCLUSIVEADDRUSE option. + WSAEACCES = 10013, + + /// Bad address. + /// The system detected an invalid pointer address in attempting to use a pointer argument of a call. + /// This error occurs if an application passes an invalid pointer value, or if the length of the buffer is too small. + /// For instance, if the length of an argument, which is a sockaddr structure, is smaller than the sizeof(sockaddr). + WSAEFAULT = 10014, + + /// Invalid argument. + /// Some invalid argument was supplied (for example, specifying an invalid level to the setsockopt function). + /// In some instances, it also refers to the current state of the socket—for instance, calling accept on a socket that is not listening. + WSAEINVAL = 10022, + + /// Too many open files. + /// Too many open sockets. Each implementation may have a maximum number of socket handles available, either globally, per process, or per thread. + WSAEMFILE = 10024, + + /// Resource temporarily unavailable. + /// This error is returned from operations on nonblocking sockets that cannot be completed immediately, for example recv when no data is queued to be read from the socket. + /// It is a nonfatal error, and the operation should be retried later. + /// It is normal for WSAEWOULDBLOCK to be reported as the result from calling connect on a nonblocking SOCK_STREAM socket, since some time must elapse for the connection to be established. + WSAEWOULDBLOCK = 10035, + + /// Operation now in progress. + /// A blocking operation is currently executing. + /// Windows Sockets only allows a single blocking operation—per- task or thread—to be outstanding, and if any other function call is made (whether or not it references that or any other socket) the function fails with the WSAEINPROGRESS error. + WSAEINPROGRESS = 10036, + + /// Operation already in progress. + /// An operation was attempted on a nonblocking socket with an operation already in progress—that is, calling connect a second time on a nonblocking socket that is already connecting, or canceling an asynchronous request (WSAAsyncGetXbyY) that has already been canceled or completed. + WSAEALREADY = 10037, + + /// Socket operation on nonsocket. + /// An operation was attempted on something that is not a socket. + /// Either the socket handle parameter did not reference a valid socket, or for select, a member of an fd_set was not valid. + WSAENOTSOCK = 10038, + + /// Destination address required. + /// A required address was omitted from an operation on a socket. + /// For example, this error is returned if sendto is called with the remote address of ADDR_ANY. + WSAEDESTADDRREQ = 10039, + + /// Message too long. + /// A message sent on a datagram socket was larger than the internal message buffer or some other network limit, or the buffer used to receive a datagram was smaller than the datagram itself. + WSAEMSGSIZE = 10040, + + /// Protocol wrong type for socket. + /// A protocol was specified in the socket function call that does not support the semantics of the socket type requested. + /// For example, the ARPA Internet UDP protocol cannot be specified with a socket type of SOCK_STREAM. + WSAEPROTOTYPE = 10041, + + /// Bad protocol option. + /// An unknown, invalid or unsupported option or level was specified in a getsockopt or setsockopt call. + WSAENOPROTOOPT = 10042, + + /// Protocol not supported. + /// The requested protocol has not been configured into the system, or no implementation for it exists. + /// For example, a socket call requests a SOCK_DGRAM socket, but specifies a stream protocol. + WSAEPROTONOSUPPORT = 10043, + + /// Socket type not supported. + /// The support for the specified socket type does not exist in this address family. + /// For example, the optional type SOCK_RAW might be selected in a socket call, and the implementation does not support SOCK_RAW sockets at all. + WSAESOCKTNOSUPPORT = 10044, + + /// Operation not supported. + /// The attempted operation is not supported for the type of object referenced. + /// Usually this occurs when a socket descriptor to a socket that cannot support this operation is trying to accept a connection on a datagram socket. + WSAEOPNOTSUPP = 10045, + + /// Protocol family not supported. + /// The protocol family has not been configured into the system or no implementation for it exists. + /// This message has a slightly different meaning from WSAEAFNOSUPPORT. + /// However, it is interchangeable in most cases, and all Windows Sockets functions that return one of these messages also specify WSAEAFNOSUPPORT. + WSAEPFNOSUPPORT = 10046, + + /// Address family not supported by protocol family. + /// An address incompatible with the requested protocol was used. + /// All sockets are created with an associated address family (that is, AF_INET for Internet Protocols) and a generic protocol type (that is, SOCK_STREAM). + /// This error is returned if an incorrect protocol is explicitly requested in the socket call, or if an address of the wrong family is used for a socket, for example, in sendto. + WSAEAFNOSUPPORT = 10047, + + /// Address already in use. + /// Typically, only one usage of each socket address (protocol/IP address/port) is permitted. + /// This error occurs if an application attempts to bind a socket to an IP address/port that has already been used for an existing socket, or a socket that was not closed properly, or one that is still in the process of closing. + /// For server applications that need to bind multiple sockets to the same port number, consider using setsockopt (SO_REUSEADDR). + /// Client applications usually need not call bind at all—connect chooses an unused port automatically. + /// When bind is called with a wildcard address (involving ADDR_ANY), a WSAEADDRINUSE error could be delayed until the specific address is committed. + /// This could happen with a call to another function later, including connect, listen, WSAConnect, or WSAJoinLeaf. + WSAEADDRINUSE = 10048, + + /// Cannot assign requested address. + /// The requested address is not valid in its context. + /// This normally results from an attempt to bind to an address that is not valid for the local computer. + /// This can also result from connect, sendto, WSAConnect, WSAJoinLeaf, or WSASendTo when the remote address or port is not valid for a remote computer (for example, address or port 0). + WSAEADDRNOTAVAIL = 10049, + + /// Network is down. + /// A socket operation encountered a dead network. + /// This could indicate a serious failure of the network system (that is, the protocol stack that the Windows Sockets DLL runs over), the network interface, or the local network itself. + WSAENETDOWN = 10050, + + /// Network is unreachable. + /// A socket operation was attempted to an unreachable network. + /// This usually means the local software knows no route to reach the remote host. + WSAENETUNREACH = 10051, + + /// Network dropped connection on reset. + /// The connection has been broken due to keep-alive activity detecting a failure while the operation was in progress. + /// It can also be returned by setsockopt if an attempt is made to set SO_KEEPALIVE on a connection that has already failed. + WSAENETRESET = 10052, + + /// Software caused connection abort. + /// An established connection was aborted by the software in your host computer, possibly due to a data transmission time-out or protocol error. + WSAECONNABORTED = 10053, + + /// Connection reset by peer. + /// An existing connection was forcibly closed by the remote host. + /// This normally results if the peer application on the remote host is suddenly stopped, the host is rebooted, the host or remote network interface is disabled, or the remote host uses a hard close (see setsockopt for more information on the SO_LINGER option on the remote socket). + /// This error may also result if a connection was broken due to keep-alive activity detecting a failure while one or more operations are in progress. + /// Operations that were in progress fail with WSAENETRESET. Subsequent operations fail with WSAECONNRESET. + WSAECONNRESET = 10054, + + /// No buffer space available. + /// An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full. + WSAENOBUFS = 10055, + + /// Socket is already connected. + /// A connect request was made on an already-connected socket. + /// Some implementations also return this error if sendto is called on a connected SOCK_DGRAM socket (for SOCK_STREAM sockets, the to parameter in sendto is ignored) although other implementations treat this as a legal occurrence. + WSAEISCONN = 10056, + + /// Socket is not connected. + /// A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using sendto) no address was supplied. + /// Any other type of operation might also return this error—for example, setsockopt setting SO_KEEPALIVE if the connection has been reset. + WSAENOTCONN = 10057, + + /// Cannot send after socket shutdown. + /// A request to send or receive data was disallowed because the socket had already been shut down in that direction with a previous shutdown call. + /// By calling shutdown a partial close of a socket is requested, which is a signal that sending or receiving, or both have been discontinued. + WSAESHUTDOWN = 10058, + + /// Too many references. + /// Too many references to some kernel object. + WSAETOOMANYREFS = 10059, + + /// Connection timed out. + /// A connection attempt failed because the connected party did not properly respond after a period of time, or the established connection failed because the connected host has failed to respond. + WSAETIMEDOUT = 10060, + + /// Connection refused. + /// No connection could be made because the target computer actively refused it. + /// This usually results from trying to connect to a service that is inactive on the foreign host—that is, one with no server application running. + WSAECONNREFUSED = 10061, + + /// Cannot translate name. + /// Cannot translate a name. + WSAELOOP = 10062, + + /// Name too long. + /// A name component or a name was too long. + WSAENAMETOOLONG = 10063, + + /// Host is down. + /// A socket operation failed because the destination host is down. A socket operation encountered a dead host. + /// Networking activity on the local host has not been initiated. + /// These conditions are more likely to be indicated by the error WSAETIMEDOUT. + WSAEHOSTDOWN = 10064, + + /// No route to host. + /// A socket operation was attempted to an unreachable host. See WSAENETUNREACH. + WSAEHOSTUNREACH = 10065, + + /// Directory not empty. + /// Cannot remove a directory that is not empty. + WSAENOTEMPTY = 10066, + + /// Too many processes. + /// A Windows Sockets implementation may have a limit on the number of applications that can use it simultaneously. + /// WSAStartup may fail with this error if the limit has been reached. + WSAEPROCLIM = 10067, + + /// User quota exceeded. + /// Ran out of user quota. + WSAEUSERS = 10068, + + /// Disk quota exceeded. + /// Ran out of disk quota. + WSAEDQUOT = 10069, + + /// Stale file handle reference. + /// The file handle reference is no longer available. + WSAESTALE = 10070, + + /// Item is remote. + /// The item is not available locally. + WSAEREMOTE = 10071, + + /// Network subsystem is unavailable. + /// This error is returned by WSAStartup if the Windows Sockets implementation cannot function at this time because the underlying system it uses to provide network services is currently unavailable. + /// Users should check: + /// - That the appropriate Windows Sockets DLL file is in the current path. + /// - That they are not trying to use more than one Windows Sockets implementation simultaneously. + /// - If there is more than one Winsock DLL on your system, be sure the first one in the path is appropriate for the network subsystem currently loaded. + /// - The Windows Sockets implementation documentation to be sure all necessary components are currently installed and configured correctly. + WSASYSNOTREADY = 10091, + + /// Winsock.dll version out of range. + /// The current Windows Sockets implementation does not support the Windows Sockets specification version requested by the application. + /// Check that no old Windows Sockets DLL files are being accessed. + WSAVERNOTSUPPORTED = 10092, + + /// Successful WSAStartup not yet performed. + /// Either the application has not called WSAStartup or WSAStartup failed. + /// The application may be accessing a socket that the current active task does not own (that is, trying to share a socket between tasks), or WSACleanup has been called too many times. + WSANOTINITIALISED = 10093, + + /// Graceful shutdown in progress. + /// Returned by WSARecv and WSARecvFrom to indicate that the remote party has initiated a graceful shutdown sequence. + WSAEDISCON = 10101, + + /// No more results. + /// No more results can be returned by the WSALookupServiceNext function. + WSAENOMORE = 10102, + + /// Call has been canceled. + /// A call to the WSALookupServiceEnd function was made while this call was still processing. The call has been canceled. + WSAECANCELLED = 10103, + + /// Procedure call table is invalid. + /// The service provider procedure call table is invalid. + /// A service provider returned a bogus procedure table to Ws2_32.dll. + /// This is usually caused by one or more of the function pointers being NULL. + WSAEINVALIDPROCTABLE = 10104, + + /// Service provider is invalid. + /// The requested service provider is invalid. + /// This error is returned by the WSCGetProviderInfo and WSCGetProviderInfo32 functions if the protocol entry specified could not be found. + /// This error is also returned if the service provider returned a version number other than 2.0. + WSAEINVALIDPROVIDER = 10105, + + /// Service provider failed to initialize. + /// The requested service provider could not be loaded or initialized. + /// This error is returned if either a service provider's DLL could not be loaded (LoadLibrary failed) or the provider's WSPStartup or NSPStartup function failed. + WSAEPROVIDERFAILEDINIT = 10106, + + /// System call failure. + /// A system call that should never fail has failed. + /// This is a generic error code, returned under various conditions. + /// Returned when a system call that should never fail does fail. + /// For example, if a call to WaitForMultipleEvents fails or one of the registry functions fails trying to manipulate the protocol/namespace catalogs. + /// Returned when a provider does not return SUCCESS and does not provide an extended error code. + /// Can indicate a service provider implementation error. + WSASYSCALLFAILURE = 10107, + + /// Service not found. + /// No such service is known. The service cannot be found in the specified name space. + WSASERVICE_NOT_FOUND = 10108, + + /// Class type not found. + /// The specified class was not found. + WSATYPE_NOT_FOUND = 10109, + + /// No more results. + /// No more results can be returned by the WSALookupServiceNext function. + WSA_E_NO_MORE = 10110, + + /// Call was canceled. + /// A call to the WSALookupServiceEnd function was made while this call was still processing. The call has been canceled. + WSA_E_CANCELLED = 10111, + + /// Database query was refused. + /// A database query failed because it was actively refused. + WSAEREFUSED = 10112, + + /// Host not found. + /// No such host is known. The name is not an official host name or alias, or it cannot be found in the database(s) being queried. + /// This error may also be returned for protocol and service queries, and means that the specified name could not be found in the relevant database. + WSAHOST_NOT_FOUND = 11001, + + /// Nonauthoritative host not found. + /// This is usually a temporary error during host name resolution and means that the local server did not receive a response from an authoritative server. A retry at some time later may be successful. + WSATRY_AGAIN = 11002, + + /// This is a nonrecoverable error. + /// This indicates that some sort of nonrecoverable error occurred during a database lookup. + /// This may be because the database files (for example, BSD-compatible HOSTS, SERVICES, or PROTOCOLS files) could not be found, or a DNS request was returned by the server with a severe error. + WSANO_RECOVERY = 11003, + + /// Valid name, no data record of requested type. + /// The requested name is valid and was found in the database, but it does not have the correct associated data being resolved for. + /// The usual example for this is a host name-to-address translation attempt (using gethostbyname or WSAAsyncGetHostByName) which uses the DNS (Domain Name Server). + /// An MX record is returned but no A record—indicating the host itself exists, but is not directly reachable. + WSANO_DATA = 11004, + + /// QoS receivers. + /// At least one QoS reserve has arrived. + WSA_QOS_RECEIVERS = 11005, + + /// QoS senders. + /// At least one QoS send path has arrived. + WSA_QOS_SENDERS = 11006, + + /// No QoS senders. + /// There are no QoS senders. + WSA_QOS_NO_SENDERS = 11007, + + /// QoS no receivers. + /// There are no QoS receivers. + WSA_QOS_NO_RECEIVERS = 11008, + + /// QoS request confirmed. + /// The QoS reserve request has been confirmed. + WSA_QOS_REQUEST_CONFIRMED = 11009, + + /// QoS admission error. + /// A QoS error occurred due to lack of resources. + WSA_QOS_ADMISSION_FAILURE = 11010, + + /// QoS policy failure. + /// The QoS request was rejected because the policy system couldn't allocate the requested resource within the existing policy. + WSA_QOS_POLICY_FAILURE = 11011, + + /// QoS bad style. + /// An unknown or conflicting QoS style was encountered. + WSA_QOS_BAD_STYLE = 11012, + + /// QoS bad object. + /// A problem was encountered with some part of the filterspec or the provider-specific buffer in general. + WSA_QOS_BAD_OBJECT = 11013, + + /// QoS traffic control error. + /// An error with the underlying traffic control (TC) API as the generic QoS request was converted for local enforcement by the TC API. + /// This could be due to an out of memory error or to an internal QoS provider error. + WSA_QOS_TRAFFIC_CTRL_ERROR = 11014, + + /// QoS generic error. + /// A general QoS error. + WSA_QOS_GENERIC_ERROR = 11015, + + /// QoS service type error. + /// An invalid or unrecognized service type was found in the QoS flowspec. + WSA_QOS_ESERVICETYPE = 11016, + + /// QoS flowspec error. + /// An invalid or inconsistent flowspec was found in the QOS structure. + WSA_QOS_EFLOWSPEC = 11017, + + /// Invalid QoS provider buffer. + /// An invalid QoS provider-specific buffer. + WSA_QOS_EPROVSPECBUF = 11018, + + /// Invalid QoS filter style. + /// An invalid QoS filter style was used. + WSA_QOS_EFILTERSTYLE = 11019, + + /// Invalid QoS filter type. + /// An invalid QoS filter type was used. + WSA_QOS_EFILTERTYPE = 11020, + + /// Incorrect QoS filter count. + /// An incorrect number of QoS FILTERSPECs were specified in the FLOWDESCRIPTOR. + WSA_QOS_EFILTERCOUNT = 11021, + + /// Invalid QoS object length. + /// An object with an invalid ObjectLength field was specified in the QoS provider-specific buffer. + WSA_QOS_EOBJLENGTH = 11022, + + /// Incorrect QoS flow count. + /// An incorrect number of flow descriptors was specified in the QoS structure. + WSA_QOS_EFLOWCOUNT = 11023, + + /// Unrecognized QoS object. + /// An unrecognized object was found in the QoS provider-specific buffer. + WSA_QOS_EUNKOWNPSOBJ = 11024, + + /// Invalid QoS policy object. + /// An invalid policy object was found in the QoS provider-specific buffer. + WSA_QOS_EPOLICYOBJ = 11025, + + /// Invalid QoS flow descriptor. + /// An invalid QoS flow descriptor was found in the flow descriptor list. + WSA_QOS_EFLOWDESC = 11026, + + /// Invalid QoS provider-specific flowspec. + /// An invalid or inconsistent flowspec was found in the QoS provider-specific buffer. + WSA_QOS_EPSFLOWSPEC = 11027, + + /// Invalid QoS provider-specific filterspec. + /// An invalid FILTERSPEC was found in the QoS provider-specific buffer. + WSA_QOS_EPSFILTERSPEC = 11028, + + /// Invalid QoS shape discard mode object. + /// An invalid shape discard mode object was found in the QoS provider-specific buffer. + WSA_QOS_ESDMODEOBJ = 11029, + + /// Invalid QoS shaping rate object. + /// An invalid shaping rate object was found in the QoS provider-specific buffer. + WSA_QOS_ESHAPERATEOBJ = 11030, + + /// Reserved policy QoS element type. + /// A reserved policy element was found in the QoS provider-specific buffer. + WSA_QOS_RESERVED_PETYPE = 11031, + + _, +}; /// no parameters const IOC_VOID = 0x80000000; @@ -320,7 +673,7 @@ pub extern "ws2_32" fn WSAStartup( lpWSAData: *WSADATA, ) callconv(.Stdcall) c_int; pub extern "ws2_32" fn WSACleanup() callconv(.Stdcall) c_int; -pub extern "ws2_32" fn WSAGetLastError() callconv(.Stdcall) c_int; +pub extern "ws2_32" fn WSAGetLastError() callconv(.Stdcall) WinsockError; pub extern "ws2_32" fn WSASocketA( af: c_int, type: c_int, From 4b86c1e3bbe65b8caa9c2e769af633fa8825bb94 Mon Sep 17 00:00:00 2001 From: Jay Petacat Date: Sat, 1 Feb 2020 22:29:51 -0500 Subject: [PATCH 51/60] crypto: Add BLAKE3 hashing algorithm This is a translation of the [official reference implementation][1] with few other changes. The bad news is that the reference implementation is designed for simplicity and not speed, so there's a lot of room for performance improvement. The good news is that, according to the crypto benchmark, the implementation is still fast relative to the other hashing algorithms: ``` md5: 430 MiB/s sha1: 386 MiB/s sha256: 191 MiB/s sha512: 275 MiB/s sha3-256: 233 MiB/s sha3-512: 137 MiB/s blake2s: 464 MiB/s blake2b: 526 MiB/s blake3: 576 MiB/s poly1305: 1479 MiB/s hmac-md5: 653 MiB/s hmac-sha1: 553 MiB/s hmac-sha256: 222 MiB/s x25519: 8685 exchanges/s ``` [1]: https://github.com/BLAKE3-team/BLAKE3 --- lib/std/crypto.zig | 3 + lib/std/crypto/benchmark.zig | 1 + lib/std/crypto/blake3.zig | 587 +++++++++++++++++++++++++++++++++++ 3 files changed, 591 insertions(+) create mode 100644 lib/std/crypto/blake3.zig diff --git a/lib/std/crypto.zig b/lib/std/crypto.zig index 922288600..6f4ff863a 100644 --- a/lib/std/crypto.zig +++ b/lib/std/crypto.zig @@ -21,6 +21,8 @@ pub const Blake2s256 = blake2.Blake2s256; pub const Blake2b384 = blake2.Blake2b384; pub const Blake2b512 = blake2.Blake2b512; +pub const Blake3 = @import("crypto/blake3.zig").Blake3; + const hmac = @import("crypto/hmac.zig"); pub const HmacMd5 = hmac.HmacMd5; pub const HmacSha1 = hmac.HmacSha1; @@ -44,6 +46,7 @@ pub const randomBytes = std.os.getrandom; test "crypto" { _ = @import("crypto/aes.zig"); _ = @import("crypto/blake2.zig"); + _ = @import("crypto/blake3.zig"); _ = @import("crypto/chacha20.zig"); _ = @import("crypto/gimli.zig"); _ = @import("crypto/hmac.zig"); diff --git a/lib/std/crypto/benchmark.zig b/lib/std/crypto/benchmark.zig index b8bb69419..d9b84a6ed 100644 --- a/lib/std/crypto/benchmark.zig +++ b/lib/std/crypto/benchmark.zig @@ -25,6 +25,7 @@ const hashes = [_]Crypto{ Crypto{ .ty = crypto.Sha3_512, .name = "sha3-512" }, Crypto{ .ty = crypto.Blake2s256, .name = "blake2s" }, Crypto{ .ty = crypto.Blake2b512, .name = "blake2b" }, + Crypto{ .ty = crypto.Blake3, .name = "blake3" }, }; pub fn benchmarkHash(comptime Hash: var, comptime bytes: comptime_int) !u64 { diff --git a/lib/std/crypto/blake3.zig b/lib/std/crypto/blake3.zig new file mode 100644 index 000000000..1a6e2955c --- /dev/null +++ b/lib/std/crypto/blake3.zig @@ -0,0 +1,587 @@ +// Translated from BLAKE3 reference implementation. +// Source: https://github.com/BLAKE3-team/BLAKE3 + +const std = @import("../std.zig"); +const fmt = std.fmt; +const math = std.math; +const mem = std.mem; +const testing = std.testing; + +const ChunkIterator = struct { + slice: []u8, + chunk_len: usize, + + fn init(slice: []u8, chunk_len: usize) ChunkIterator { + return ChunkIterator{ + .slice = slice, + .chunk_len = chunk_len, + }; + } + + fn next(self: *ChunkIterator) ?[]u8 { + const next_chunk = self.slice[0..math.min(self.chunk_len, self.slice.len)]; + self.slice = self.slice[next_chunk.len..]; + return if (next_chunk.len > 0) next_chunk else null; + } +}; + +const OUT_LEN: usize = 32; +const KEY_LEN: usize = 32; +const BLOCK_LEN: usize = 64; +const CHUNK_LEN: usize = 1024; + +const IV = [8]u32{ + 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19, +}; + +const MSG_SCHEDULE = [7][16]u8{ + [_]u8{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, + [_]u8{ 2, 6, 3, 10, 7, 0, 4, 13, 1, 11, 12, 5, 9, 14, 15, 8 }, + [_]u8{ 3, 4, 10, 12, 13, 2, 7, 14, 6, 5, 9, 0, 11, 15, 8, 1 }, + [_]u8{ 10, 7, 12, 9, 14, 3, 13, 15, 4, 0, 11, 2, 5, 8, 1, 6 }, + [_]u8{ 12, 13, 9, 11, 15, 10, 14, 8, 7, 2, 5, 3, 0, 1, 6, 4 }, + [_]u8{ 9, 14, 11, 5, 8, 12, 15, 1, 13, 3, 0, 10, 2, 6, 4, 7 }, + [_]u8{ 11, 15, 5, 0, 1, 9, 8, 6, 14, 10, 2, 12, 3, 4, 7, 13 }, +}; + +// These are the internal flags that we use to domain separate root/non-root, +// chunk/parent, and chunk beginning/middle/end. These get set at the high end +// of the block flags word in the compression function, so their values start +// high and go down. +const CHUNK_START: u8 = 1 << 0; +const CHUNK_END: u8 = 1 << 1; +const PARENT: u8 = 1 << 2; +const ROOT: u8 = 1 << 3; +const KEYED_HASH: u8 = 1 << 4; +const DERIVE_KEY_CONTEXT: u8 = 1 << 5; +const DERIVE_KEY_MATERIAL: u8 = 1 << 6; + +// The mixing function, G, which mixes either a column or a diagonal. +fn g(state: *[16]u32, a: usize, b: usize, c: usize, d: usize, mx: u32, my: u32) void { + _ = @addWithOverflow(u32, state[a], state[b], &state[a]); + _ = @addWithOverflow(u32, state[a], mx, &state[a]); + state[d] = math.rotr(u32, state[d] ^ state[a], 16); + _ = @addWithOverflow(u32, state[c], state[d], &state[c]); + state[b] = math.rotr(u32, state[b] ^ state[c], 12); + _ = @addWithOverflow(u32, state[a], state[b], &state[a]); + _ = @addWithOverflow(u32, state[a], my, &state[a]); + state[d] = math.rotr(u32, state[d] ^ state[a], 8); + _ = @addWithOverflow(u32, state[c], state[d], &state[c]); + state[b] = math.rotr(u32, state[b] ^ state[c], 7); +} + +fn round(state: *[16]u32, msg: *const [16]u32, schedule: *const [16]u8) void { + // Mix the columns. + g(state, 0, 4, 8, 12, msg[schedule[0]], msg[schedule[1]]); + g(state, 1, 5, 9, 13, msg[schedule[2]], msg[schedule[3]]); + g(state, 2, 6, 10, 14, msg[schedule[4]], msg[schedule[5]]); + g(state, 3, 7, 11, 15, msg[schedule[6]], msg[schedule[7]]); + + // Mix the diagonals. + g(state, 0, 5, 10, 15, msg[schedule[8]], msg[schedule[9]]); + g(state, 1, 6, 11, 12, msg[schedule[10]], msg[schedule[11]]); + g(state, 2, 7, 8, 13, msg[schedule[12]], msg[schedule[13]]); + g(state, 3, 4, 9, 14, msg[schedule[14]], msg[schedule[15]]); +} + +fn compress( + chaining_value: *const [8]u32, + block_words: *const [16]u32, + block_len: u32, + counter: u64, + flags: u8, +) [16]u32 { + var state = [16]u32{ + chaining_value[0], + chaining_value[1], + chaining_value[2], + chaining_value[3], + chaining_value[4], + chaining_value[5], + chaining_value[6], + chaining_value[7], + IV[0], + IV[1], + IV[2], + IV[3], + @truncate(u32, counter), + @truncate(u32, counter >> 32), + block_len, + flags, + }; + for (MSG_SCHEDULE) |*schedule| { + round(&state, block_words, schedule); + } + for (chaining_value) |_, i| { + state[i] ^= state[i + 8]; + state[i + 8] ^= chaining_value[i]; + } + return state; +} + +fn first_8_words(compression_output: [16]u32) [8]u32 { + return @ptrCast(*const [8]u32, &compression_output).*; +} + +fn words_from_little_endian_bytes(bytes: []const u8, words: []u32) void { + var byte_slice = bytes; + for (words) |*word| { + word.* = mem.readIntSliceLittle(u32, byte_slice); + byte_slice = byte_slice[4..]; + } +} + +// Each chunk or parent node can produce either an 8-word chaining value or, by +// setting the ROOT flag, any number of final output bytes. The Output struct +// captures the state just prior to choosing between those two possibilities. +const Output = struct { + input_chaining_value: [8]u32, + block_words: [16]u32, + block_len: u32, + counter: u64, + flags: u8, + + fn chaining_value(self: *Output) [8]u32 { + return first_8_words(compress( + &self.input_chaining_value, + &self.block_words, + self.block_len, + self.counter, + self.flags, + )); + } + + fn root_output_bytes(self: *Output, output: []u8) void { + var out_block_it = ChunkIterator.init(output, 2 * OUT_LEN); + var output_block_counter: usize = 0; + while (out_block_it.next()) |out_block| { + var words = compress( + &self.input_chaining_value, + &self.block_words, + self.block_len, + output_block_counter, + self.flags | ROOT, + ); + var out_word_it = ChunkIterator.init(out_block, 4); + var word_counter: usize = 0; + while (out_word_it.next()) |out_word| { + var word_bytes: [4]u8 = undefined; + mem.writeIntLittle(u32, &word_bytes, words[word_counter]); + mem.copy(u8, out_word, word_bytes[0..out_word.len]); + word_counter += 1; + } + output_block_counter += 1; + } + } +}; + +const ChunkState = struct { + chaining_value: [8]u32, + chunk_counter: u64, + block: [BLOCK_LEN]u8 = [_]u8{0} ** BLOCK_LEN, + block_len: u8 = 0, + blocks_compressed: u8 = 0, + flags: u8, + + fn init(key: [8]u32, chunk_counter: u64, flags: u8) ChunkState { + return ChunkState{ + .chaining_value = key, + .chunk_counter = chunk_counter, + .flags = flags, + }; + } + + fn len(self: *const ChunkState) usize { + return BLOCK_LEN * @as(usize, self.blocks_compressed) + @as(usize, self.block_len); + } + + fn fill_block_buf(self: *ChunkState, input: []const u8) []const u8 { + const want = BLOCK_LEN - self.block_len; + const take = math.min(want, input.len); + mem.copy(u8, self.block[self.block_len..][0..take], input[0..take]); + self.block_len += @truncate(u8, take); + return input[take..]; + } + + fn start_flag(self: *const ChunkState) u8 { + return if (self.blocks_compressed == 0) CHUNK_START else 0; + } + + fn update(self: *ChunkState, input_slice: []const u8) void { + var input = input_slice; + while (input.len > 0) { + // If the block buffer is full, compress it and clear it. More + // input is coming, so this compression is not CHUNK_END. + if (self.block_len == BLOCK_LEN) { + var block_words: [16]u32 = undefined; + words_from_little_endian_bytes(&self.block, &block_words); + self.chaining_value = first_8_words(compress( + &self.chaining_value, + &block_words, + BLOCK_LEN, + self.chunk_counter, + self.flags | self.start_flag(), + )); + self.blocks_compressed += 1; + self.block = [_]u8{0} ** BLOCK_LEN; + self.block_len = 0; + } + + // Copy input bytes into the block buffer. + input = self.fill_block_buf(input); + } + } + + fn output(self: *ChunkState) Output { + var block_words: [16]u32 = undefined; + words_from_little_endian_bytes(&self.block, &block_words); + return Output{ + .input_chaining_value = self.chaining_value, + .block_words = block_words, + .block_len = self.block_len, + .counter = self.chunk_counter, + .flags = self.flags | self.start_flag() | CHUNK_END, + }; + } +}; + +fn parent_output( + left_child_cv: [8]u32, + right_child_cv: [8]u32, + key: [8]u32, + flags: u8, +) Output { + var block_words: [16]u32 = undefined; + mem.copy(u32, block_words[0..8], left_child_cv[0..]); + mem.copy(u32, block_words[8..], right_child_cv[0..]); + return Output{ + .input_chaining_value = key, + .block_words = block_words, + .block_len = BLOCK_LEN, // Always BLOCK_LEN (64) for parent nodes. + .counter = 0, // Always 0 for parent nodes. + .flags = PARENT | flags, + }; +} + +fn parent_cv( + left_child_cv: [8]u32, + right_child_cv: [8]u32, + key: [8]u32, + flags: u8, +) [8]u32 { + return parent_output(left_child_cv, right_child_cv, key, flags).chaining_value(); +} + +/// An incremental hasher that can accept any number of writes. +pub const Blake3 = struct { + chunk_state: ChunkState, + key: [8]u32, + cv_stack: [54][8]u32 = undefined, // Space for 54 subtree chaining values: + cv_stack_len: u8 = 0, // 2^54 * CHUNK_LEN = 2^64 + flags: u8, + + pub const digest_length = OUT_LEN; + pub const block_length = BLOCK_LEN; + + fn init_internal(key: [8]u32, flags: u8) Blake3 { + return Blake3{ + .chunk_state = ChunkState.init(key, 0, flags), + .key = key, + .flags = flags, + }; + } + + /// Construct a new `Blake3` for the regular hash function. + pub fn init() Blake3 { + return Blake3.init_internal(IV, 0); + } + + /// Construct a new `Blake3` for the keyed hash function. + pub fn init_keyed(key: *const [KEY_LEN]u8) Blake3 { + var key_words: [8]u32 = undefined; + words_from_little_endian_bytes(key, &key_words); + return Blake3.init_internal(key_words, KEYED_HASH); + } + + /// Construct a new `Blake3` for the key derivation function. The context + /// string should be hardcoded, globally unique, and application-specific. + pub fn init_derive_key(context: []const u8) Blake3 { + var context_hasher = Blake3.init_internal(IV, DERIVE_KEY_CONTEXT); + context_hasher.update(context); + var context_key: [KEY_LEN]u8 = undefined; + context_hasher.final(context_key[0..]); + var context_key_words: [8]u32 = undefined; + words_from_little_endian_bytes(&context_key, &context_key_words); + return Blake3.init_internal(context_key_words, DERIVE_KEY_MATERIAL); + } + + pub fn hash(in: []const u8, out: []u8) void { + var hasher = Blake3.init(); + hasher.update(in); + hasher.final(out); + } + + /// Reset the `Blake3` to its initial state. + pub fn reset(self: *Blake3) void { + self.chunk_state = ChunkState.init(self.key, 0, self.flags); + self.cv_stack_len = 0; + } + + fn push_stack(self: *Blake3, cv: [8]u32) void { + self.cv_stack[self.cv_stack_len] = cv; + self.cv_stack_len += 1; + } + + fn pop_stack(self: *Blake3) [8]u32 { + self.cv_stack_len -= 1; + return self.cv_stack[self.cv_stack_len]; + } + + // Section 5.1.2 of the BLAKE3 spec explains this algorithm in more detail. + fn add_chunk_chaining_value(self: *Blake3, new_cv: [8]u32, total_chunks: u64) void { + // This chunk might complete some subtrees. For each completed subtree, + // its left child will be the current top entry in the CV stack, and + // its right child will be the current value of `new_cv`. Pop each left + // child off the stack, merge it with `new_cv`, and overwrite `new_cv` + // with the result. After all these merges, push the final value of + // `new_cv` onto the stack. The number of completed subtrees is given + // by the number of trailing 0-bits in the new total number of chunks. + var chunk_counter = total_chunks; + while (chunk_counter & 1 == 0) { + new_cv = parent_cv(self.pop_stack(), new_cv, self.key, self.flags); + chunk_counter >>= 1; + } + self.push_stack(new_cv); + } + + /// Add input to the hash state. This can be called any number of times. + pub fn update(self: *Blake3, input_slice: []const u8) void { + var input = input_slice; + while (input.len > 0) { + // If the current chunk is complete, finalize it and reset the + // chunk state. More input is coming, so this chunk is not ROOT. + if (self.chunk_state.len() == CHUNK_LEN) { + const chunk_cv = self.chunk_state.output().chaining_value(); + const total_chunks = self.chunk_state.chunk_counter + 1; + self.add_chunk_chaining_value(chunk_cv, total_chunks); + self.chunk_state = ChunkState.init(self.key, total_chunks, self.flags); + } + + // Compress input bytes into the current chunk state. + const want = CHUNK_LEN - self.chunk_state.len(); + const take = math.min(want, input.len); + self.chunk_state.update(input[0..take]); + input = input[take..]; + } + } + + /// Finalize the hash and write any number of output bytes. + pub fn final(self: *Blake3, out_slice: []u8) void { + // Starting with the Output from the current chunk, compute all the + // parent chaining values along the right edge of the tree, until we + // have the root Output. + var output = self.chunk_state.output(); + var parent_nodes_remaining: usize = self.cv_stack_len; + while (parent_nodes_remaining > 0) { + parent_nodes_remaining -= 1; + output = parent_output( + self.cv_stack[parent_nodes_remaining], + output.chaining_value(), + self.key, + self.flags, + ); + } + output.root_output_bytes(out_slice); + } +}; + +// Each test is an input length and three outputs, one for each of the `hash`, `keyed_hash`, and +// `derive_key` modes. The input in each case is filled with a 251-byte-long repeating pattern: +// 0, 1, 2, ..., 249, 250, 0, 1, ... The key used with `keyed_hash` is the 32-byte ASCII string +// given in the `key` field below. For `derive_key`, the test input is used as the input key, and +// the context string is 'BLAKE3 2019-12-27 16:29:52 test vectors context'. (As good practice for +// following the security requirements of `derive_key`, test runners should make that context +// string a hardcoded constant, and we do not provided it in machine-readable form.) Outputs are +// encoded as hexadecimal. Each case is an extended output, and implementations should also check +// that the first 32 bytes match their default-length output. +// +// Source: https://github.com/BLAKE3-team/BLAKE3/blob/92d421dea1a89e2f079f4dbd93b0dab41234b279/test_vectors/test_vectors.json +const reference_test = .{ + .key = "whats the Elvish word for friend", + .context_string = "BLAKE3 2019-12-27 16:29:52 test vectors context", + .cases = [_]struct { + input_len: usize, + hash: *const [262]u8, + keyed_hash: *const [262]u8, + derive_key: *const [262]u8, + }{ + .{ + .input_len = 0, + .hash = "af1349b9f5f9a1a6a0404dea36dcc9499bcb25c9adc112b7cc9a93cae41f3262e00f03e7b69af26b7faaf09fcd333050338ddfe085b8cc869ca98b206c08243a26f5487789e8f660afe6c99ef9e0c52b92e7393024a80459cf91f476f9ffdbda7001c22e159b402631f277ca96f2defdf1078282314e763699a31c5363165421cce14d", + .keyed_hash = "92b2b75604ed3c761f9d6f62392c8a9227ad0ea3f09573e783f1498a4ed60d26b18171a2f22a4b94822c701f107153dba24918c4bae4d2945c20ece13387627d3b73cbf97b797d5e59948c7ef788f54372df45e45e4293c7dc18c1d41144a9758be58960856be1eabbe22c2653190de560ca3b2ac4aa692a9210694254c371e851bc8f", + .derive_key = "2cc39783c223154fea8dfb7c1b1660f2ac2dcbd1c1de8277b0b0dd39b7e50d7d905630c8be290dfcf3e6842f13bddd573c098c3f17361f1f206b8cad9d088aa4a3f746752c6b0ce6a83b0da81d59649257cdf8eb3e9f7d4998e41021fac119deefb896224ac99f860011f73609e6e0e4540f93b273e56547dfd3aa1a035ba6689d89a0", + }, + .{ + .input_len = 1, + .hash = "2d3adedff11b61f14c886e35afa036736dcd87a74d27b5c1510225d0f592e213c3a6cb8bf623e20cdb535f8d1a5ffb86342d9c0b64aca3bce1d31f60adfa137b358ad4d79f97b47c3d5e79f179df87a3b9776ef8325f8329886ba42f07fb138bb502f4081cbcec3195c5871e6c23e2cc97d3c69a613eba131e5f1351f3f1da786545e5", + .keyed_hash = "6d7878dfff2f485635d39013278ae14f1454b8c0a3a2d34bc1ab38228a80c95b6568c0490609413006fbd428eb3fd14e7756d90f73a4725fad147f7bf70fd61c4e0cf7074885e92b0e3f125978b4154986d4fb202a3f331a3fb6cf349a3a70e49990f98fe4289761c8602c4e6ab1138d31d3b62218078b2f3ba9a88e1d08d0dd4cea11", + .derive_key = "b3e2e340a117a499c6cf2398a19ee0d29cca2bb7404c73063382693bf66cb06c5827b91bf889b6b97c5477f535361caefca0b5d8c4746441c57617111933158950670f9aa8a05d791daae10ac683cbef8faf897c84e6114a59d2173c3f417023a35d6983f2c7dfa57e7fc559ad751dbfb9ffab39c2ef8c4aafebc9ae973a64f0c76551", + }, + .{ + .input_len = 1023, + .hash = "10108970eeda3eb932baac1428c7a2163b0e924c9a9e25b35bba72b28f70bd11a182d27a591b05592b15607500e1e8dd56bc6c7fc063715b7a1d737df5bad3339c56778957d870eb9717b57ea3d9fb68d1b55127bba6a906a4a24bbd5acb2d123a37b28f9e9a81bbaae360d58f85e5fc9d75f7c370a0cc09b6522d9c8d822f2f28f485", + .keyed_hash = "c951ecdf03288d0fcc96ee3413563d8a6d3589547f2c2fb36d9786470f1b9d6e890316d2e6d8b8c25b0a5b2180f94fb1a158ef508c3cde45e2966bd796a696d3e13efd86259d756387d9becf5c8bf1ce2192b87025152907b6d8cc33d17826d8b7b9bc97e38c3c85108ef09f013e01c229c20a83d9e8efac5b37470da28575fd755a10", + .derive_key = "74a16c1c3d44368a86e1ca6df64be6a2f64cce8f09220787450722d85725dea59c413264404661e9e4d955409dfe4ad3aa487871bcd454ed12abfe2c2b1eb7757588cf6cb18d2eccad49e018c0d0fec323bec82bf1644c6325717d13ea712e6840d3e6e730d35553f59eff5377a9c350bcc1556694b924b858f329c44ee64b884ef00d", + }, + .{ + .input_len = 1024, + .hash = "42214739f095a406f3fc83deb889744ac00df831c10daa55189b5d121c855af71cf8107265ecdaf8505b95d8fcec83a98a6a96ea5109d2c179c47a387ffbb404756f6eeae7883b446b70ebb144527c2075ab8ab204c0086bb22b7c93d465efc57f8d917f0b385c6df265e77003b85102967486ed57db5c5ca170ba441427ed9afa684e", + .keyed_hash = "75c46f6f3d9eb4f55ecaaee480db732e6c2105546f1e675003687c31719c7ba4a78bc838c72852d4f49c864acb7adafe2478e824afe51c8919d06168414c265f298a8094b1ad813a9b8614acabac321f24ce61c5a5346eb519520d38ecc43e89b5000236df0597243e4d2493fd626730e2ba17ac4d8824d09d1a4a8f57b8227778e2de", + .derive_key = "7356cd7720d5b66b6d0697eb3177d9f8d73a4a5c5e968896eb6a6896843027066c23b601d3ddfb391e90d5c8eccdef4ae2a264bce9e612ba15e2bc9d654af1481b2e75dbabe615974f1070bba84d56853265a34330b4766f8e75edd1f4a1650476c10802f22b64bd3919d246ba20a17558bc51c199efdec67e80a227251808d8ce5bad", + }, + .{ + .input_len = 1025, + .hash = "d00278ae47eb27b34faecf67b4fe263f82d5412916c1ffd97c8cb7fb814b8444f4c4a22b4b399155358a994e52bf255de60035742ec71bd08ac275a1b51cc6bfe332b0ef84b409108cda080e6269ed4b3e2c3f7d722aa4cdc98d16deb554e5627be8f955c98e1d5f9565a9194cad0c4285f93700062d9595adb992ae68ff12800ab67a", + .keyed_hash = "357dc55de0c7e382c900fd6e320acc04146be01db6a8ce7210b7189bd664ea69362396b77fdc0d2634a552970843722066c3c15902ae5097e00ff53f1e116f1cd5352720113a837ab2452cafbde4d54085d9cf5d21ca613071551b25d52e69d6c81123872b6f19cd3bc1333edf0c52b94de23ba772cf82636cff4542540a7738d5b930", + .derive_key = "effaa245f065fbf82ac186839a249707c3bddf6d3fdda22d1b95a3c970379bcb5d31013a167509e9066273ab6e2123bc835b408b067d88f96addb550d96b6852dad38e320b9d940f86db74d398c770f462118b35d2724efa13da97194491d96dd37c3c09cbef665953f2ee85ec83d88b88d11547a6f911c8217cca46defa2751e7f3ad", + }, + .{ + .input_len = 2048, + .hash = "e776b6028c7cd22a4d0ba182a8bf62205d2ef576467e838ed6f2529b85fba24a9a60bf80001410ec9eea6698cd537939fad4749edd484cb541aced55cd9bf54764d063f23f6f1e32e12958ba5cfeb1bf618ad094266d4fc3c968c2088f677454c288c67ba0dba337b9d91c7e1ba586dc9a5bc2d5e90c14f53a8863ac75655461cea8f9", + .keyed_hash = "879cf1fa2ea0e79126cb1063617a05b6ad9d0b696d0d757cf053439f60a99dd10173b961cd574288194b23ece278c330fbb8585485e74967f31352a8183aa782b2b22f26cdcadb61eed1a5bc144b8198fbb0c13abbf8e3192c145d0a5c21633b0ef86054f42809df823389ee40811a5910dcbd1018af31c3b43aa55201ed4edaac74fe", + .derive_key = "7b2945cb4fef70885cc5d78a87bf6f6207dd901ff239201351ffac04e1088a23e2c11a1ebffcea4d80447867b61badb1383d842d4e79645d48dd82ccba290769caa7af8eaa1bd78a2a5e6e94fbdab78d9c7b74e894879f6a515257ccf6f95056f4e25390f24f6b35ffbb74b766202569b1d797f2d4bd9d17524c720107f985f4ddc583", + }, + .{ + .input_len = 2049, + .hash = "5f4d72f40d7a5f82b15ca2b2e44b1de3c2ef86c426c95c1af0b687952256303096de31d71d74103403822a2e0bc1eb193e7aecc9643a76b7bbc0c9f9c52e8783aae98764ca468962b5c2ec92f0c74eb5448d519713e09413719431c802f948dd5d90425a4ecdadece9eb178d80f26efccae630734dff63340285adec2aed3b51073ad3", + .keyed_hash = "9f29700902f7c86e514ddc4df1e3049f258b2472b6dd5267f61bf13983b78dd5f9a88abfefdfa1e00b418971f2b39c64ca621e8eb37fceac57fd0c8fc8e117d43b81447be22d5d8186f8f5919ba6bcc6846bd7d50726c06d245672c2ad4f61702c646499ee1173daa061ffe15bf45a631e2946d616a4c345822f1151284712f76b2b0e", + .derive_key = "2ea477c5515cc3dd606512ee72bb3e0e758cfae7232826f35fb98ca1bcbdf27316d8e9e79081a80b046b60f6a263616f33ca464bd78d79fa18200d06c7fc9bffd808cc4755277a7d5e09da0f29ed150f6537ea9bed946227ff184cc66a72a5f8c1e4bd8b04e81cf40fe6dc4427ad5678311a61f4ffc39d195589bdbc670f63ae70f4b6", + }, + .{ + .input_len = 3072, + .hash = "b98cb0ff3623be03326b373de6b9095218513e64f1ee2edd2525c7ad1e5cffd29a3f6b0b978d6608335c09dc94ccf682f9951cdfc501bfe47b9c9189a6fc7b404d120258506341a6d802857322fbd20d3e5dae05b95c88793fa83db1cb08e7d8008d1599b6209d78336e24839724c191b2a52a80448306e0daa84a3fdb566661a37e11", + .keyed_hash = "044a0e7b172a312dc02a4c9a818c036ffa2776368d7f528268d2e6b5df19177022f302d0529e4174cc507c463671217975e81dab02b8fdeb0d7ccc7568dd22574c783a76be215441b32e91b9a904be8ea81f7a0afd14bad8ee7c8efc305ace5d3dd61b996febe8da4f56ca0919359a7533216e2999fc87ff7d8f176fbecb3d6f34278b", + .derive_key = "050df97f8c2ead654d9bb3ab8c9178edcd902a32f8495949feadcc1e0480c46b3604131bbd6e3ba573b6dd682fa0a63e5b165d39fc43a625d00207607a2bfeb65ff1d29292152e26b298868e3b87be95d6458f6f2ce6118437b632415abe6ad522874bcd79e4030a5e7bad2efa90a7a7c67e93f0a18fb28369d0a9329ab5c24134ccb0", + }, + .{ + .input_len = 3073, + .hash = "7124b49501012f81cc7f11ca069ec9226cecb8a2c850cfe644e327d22d3e1cd39a27ae3b79d68d89da9bf25bc27139ae65a324918a5f9b7828181e52cf373c84f35b639b7fccbb985b6f2fa56aea0c18f531203497b8bbd3a07ceb5926f1cab74d14bd66486d9a91eba99059a98bd1cd25876b2af5a76c3e9eed554ed72ea952b603bf", + .keyed_hash = "68dede9bef00ba89e43f31a6825f4cf433389fedae75c04ee9f0cf16a427c95a96d6da3fe985054d3478865be9a092250839a697bbda74e279e8a9e69f0025e4cfddd6cfb434b1cd9543aaf97c635d1b451a4386041e4bb100f5e45407cbbc24fa53ea2de3536ccb329e4eb9466ec37093a42cf62b82903c696a93a50b702c80f3c3c5", + .derive_key = "72613c9ec9ff7e40f8f5c173784c532ad852e827dba2bf85b2ab4b76f7079081576288e552647a9d86481c2cae75c2dd4e7c5195fb9ada1ef50e9c5098c249d743929191441301c69e1f48505a4305ec1778450ee48b8e69dc23a25960fe33070ea549119599760a8a2d28aeca06b8c5e9ba58bc19e11fe57b6ee98aa44b2a8e6b14a5", + }, + .{ + .input_len = 4096, + .hash = "015094013f57a5277b59d8475c0501042c0b642e531b0a1c8f58d2163229e9690289e9409ddb1b99768eafe1623da896faf7e1114bebeadc1be30829b6f8af707d85c298f4f0ff4d9438aef948335612ae921e76d411c3a9111df62d27eaf871959ae0062b5492a0feb98ef3ed4af277f5395172dbe5c311918ea0074ce0036454f620", + .keyed_hash = "befc660aea2f1718884cd8deb9902811d332f4fc4a38cf7c7300d597a081bfc0bbb64a36edb564e01e4b4aaf3b060092a6b838bea44afebd2deb8298fa562b7b597c757b9df4c911c3ca462e2ac89e9a787357aaf74c3b56d5c07bc93ce899568a3eb17d9250c20f6c5f6c1e792ec9a2dcb715398d5a6ec6d5c54f586a00403a1af1de", + .derive_key = "1e0d7f3db8c414c97c6307cbda6cd27ac3b030949da8e23be1a1a924ad2f25b9d78038f7b198596c6cc4a9ccf93223c08722d684f240ff6569075ed81591fd93f9fff1110b3a75bc67e426012e5588959cc5a4c192173a03c00731cf84544f65a2fb9378989f72e9694a6a394a8a30997c2e67f95a504e631cd2c5f55246024761b245", + }, + .{ + .input_len = 4097, + .hash = "9b4052b38f1c5fc8b1f9ff7ac7b27cd242487b3d890d15c96a1c25b8aa0fb99505f91b0b5600a11251652eacfa9497b31cd3c409ce2e45cfe6c0a016967316c426bd26f619eab5d70af9a418b845c608840390f361630bd497b1ab44019316357c61dbe091ce72fc16dc340ac3d6e009e050b3adac4b5b2c92e722cffdc46501531956", + .keyed_hash = "00df940cd36bb9fa7cbbc3556744e0dbc8191401afe70520ba292ee3ca80abbc606db4976cfdd266ae0abf667d9481831ff12e0caa268e7d3e57260c0824115a54ce595ccc897786d9dcbf495599cfd90157186a46ec800a6763f1c59e36197e9939e900809f7077c102f888caaf864b253bc41eea812656d46742e4ea42769f89b83f", + .derive_key = "aca51029626b55fda7117b42a7c211f8c6e9ba4fe5b7a8ca922f34299500ead8a897f66a400fed9198fd61dd2d58d382458e64e100128075fc54b860934e8de2e84170734b06e1d212a117100820dbc48292d148afa50567b8b84b1ec336ae10d40c8c975a624996e12de31abbe135d9d159375739c333798a80c64ae895e51e22f3ad", + }, + .{ + .input_len = 5120, + .hash = "9cadc15fed8b5d854562b26a9536d9707cadeda9b143978f319ab34230535833acc61c8fdc114a2010ce8038c853e121e1544985133fccdd0a2d507e8e615e611e9a0ba4f47915f49e53d721816a9198e8b30f12d20ec3689989175f1bf7a300eee0d9321fad8da232ece6efb8e9fd81b42ad161f6b9550a069e66b11b40487a5f5059", + .keyed_hash = "2c493e48e9b9bf31e0553a22b23503c0a3388f035cece68eb438d22fa1943e209b4dc9209cd80ce7c1f7c9a744658e7e288465717ae6e56d5463d4f80cdb2ef56495f6a4f5487f69749af0c34c2cdfa857f3056bf8d807336a14d7b89bf62bef2fb54f9af6a546f818dc1e98b9e07f8a5834da50fa28fb5874af91bf06020d1bf0120e", + .derive_key = "7a7acac8a02adcf3038d74cdd1d34527de8a0fcc0ee3399d1262397ce5817f6055d0cefd84d9d57fe792d65a278fd20384ac6c30fdb340092f1a74a92ace99c482b28f0fc0ef3b923e56ade20c6dba47e49227166251337d80a037e987ad3a7f728b5ab6dfafd6e2ab1bd583a95d9c895ba9c2422c24ea0f62961f0dca45cad47bfa0d", + }, + .{ + .input_len = 5121, + .hash = "628bd2cb2004694adaab7bbd778a25df25c47b9d4155a55f8fbd79f2fe154cff96adaab0613a6146cdaabe498c3a94e529d3fc1da2bd08edf54ed64d40dcd6777647eac51d8277d70219a9694334a68bc8f0f23e20b0ff70ada6f844542dfa32cd4204ca1846ef76d811cdb296f65e260227f477aa7aa008bac878f72257484f2b6c95", + .keyed_hash = "6ccf1c34753e7a044db80798ecd0782a8f76f33563accaddbfbb2e0ea4b2d0240d07e63f13667a8d1490e5e04f13eb617aea16a8c8a5aaed1ef6fbde1b0515e3c81050b361af6ead126032998290b563e3caddeaebfab592e155f2e161fb7cba939092133f23f9e65245e58ec23457b78a2e8a125588aad6e07d7f11a85b88d375b72d", + .derive_key = "b07f01e518e702f7ccb44a267e9e112d403a7b3f4883a47ffbed4b48339b3c341a0add0ac032ab5aaea1e4e5b004707ec5681ae0fcbe3796974c0b1cf31a194740c14519273eedaabec832e8a784b6e7cfc2c5952677e6c3f2c3914454082d7eb1ce1766ac7d75a4d3001fc89544dd46b5147382240d689bbbaefc359fb6ae30263165", + }, + .{ + .input_len = 6144, + .hash = "3e2e5b74e048f3add6d21faab3f83aa44d3b2278afb83b80b3c35164ebeca2054d742022da6fdda444ebc384b04a54c3ac5839b49da7d39f6d8a9db03deab32aade156c1c0311e9b3435cde0ddba0dce7b26a376cad121294b689193508dd63151603c6ddb866ad16c2ee41585d1633a2cea093bea714f4c5d6b903522045b20395c83", + .keyed_hash = "3d6b6d21281d0ade5b2b016ae4034c5dec10ca7e475f90f76eac7138e9bc8f1dc35754060091dc5caf3efabe0603c60f45e415bb3407db67e6beb3d11cf8e4f7907561f05dace0c15807f4b5f389c841eb114d81a82c02a00b57206b1d11fa6e803486b048a5ce87105a686dee041207e095323dfe172df73deb8c9532066d88f9da7e", + .derive_key = "2a95beae63ddce523762355cf4b9c1d8f131465780a391286a5d01abb5683a1597099e3c6488aab6c48f3c15dbe1942d21dbcdc12115d19a8b8465fb54e9053323a9178e4275647f1a9927f6439e52b7031a0b465c861a3fc531527f7758b2b888cf2f20582e9e2c593709c0a44f9c6e0f8b963994882ea4168827823eef1f64169fef", + }, + .{ + .input_len = 6145, + .hash = "f1323a8631446cc50536a9f705ee5cb619424d46887f3c376c695b70e0f0507f18a2cfdd73c6e39dd75ce7c1c6e3ef238fd54465f053b25d21044ccb2093beb015015532b108313b5829c3621ce324b8e14229091b7c93f32db2e4e63126a377d2a63a3597997d4f1cba59309cb4af240ba70cebff9a23d5e3ff0cdae2cfd54e070022", + .keyed_hash = "9ac301e9e39e45e3250a7e3b3df701aa0fb6889fbd80eeecf28dbc6300fbc539f3c184ca2f59780e27a576c1d1fb9772e99fd17881d02ac7dfd39675aca918453283ed8c3169085ef4a466b91c1649cc341dfdee60e32231fc34c9c4e0b9a2ba87ca8f372589c744c15fd6f985eec15e98136f25beeb4b13c4e43dc84abcc79cd4646c", + .derive_key = "379bcc61d0051dd489f686c13de00d5b14c505245103dc040d9e4dd1facab8e5114493d029bdbd295aaa744a59e31f35c7f52dba9c3642f773dd0b4262a9980a2aef811697e1305d37ba9d8b6d850ef07fe41108993180cf779aeece363704c76483458603bbeeb693cffbbe5588d1f3535dcad888893e53d977424bb707201569a8d2", + }, + .{ + .input_len = 7168, + .hash = "61da957ec2499a95d6b8023e2b0e604ec7f6b50e80a9678b89d2628e99ada77a5707c321c83361793b9af62a40f43b523df1c8633cecb4cd14d00bdc79c78fca5165b863893f6d38b02ff7236c5a9a8ad2dba87d24c547cab046c29fc5bc1ed142e1de4763613bb162a5a538e6ef05ed05199d751f9eb58d332791b8d73fb74e4fce95", + .keyed_hash = "b42835e40e9d4a7f42ad8cc04f85a963a76e18198377ed84adddeaecacc6f3fca2f01d5277d69bb681c70fa8d36094f73ec06e452c80d2ff2257ed82e7ba348400989a65ee8daa7094ae0933e3d2210ac6395c4af24f91c2b590ef87d7788d7066ea3eaebca4c08a4f14b9a27644f99084c3543711b64a070b94f2c9d1d8a90d035d52", + .derive_key = "11c37a112765370c94a51415d0d651190c288566e295d505defdad895dae223730d5a5175a38841693020669c7638f40b9bc1f9f39cf98bda7a5b54ae24218a800a2116b34665aa95d846d97ea988bfcb53dd9c055d588fa21ba78996776ea6c40bc428b53c62b5f3ccf200f647a5aae8067f0ea1976391fcc72af1945100e2a6dcb88", + }, + .{ + .input_len = 7169, + .hash = "a003fc7a51754a9b3c7fae0367ab3d782dccf28855a03d435f8cfe74605e781798a8b20534be1ca9eb2ae2df3fae2ea60e48c6fb0b850b1385b5de0fe460dbe9d9f9b0d8db4435da75c601156df9d047f4ede008732eb17adc05d96180f8a73548522840779e6062d643b79478a6e8dbce68927f36ebf676ffa7d72d5f68f050b119c8", + .keyed_hash = "ed9b1a922c046fdb3d423ae34e143b05ca1bf28b710432857bf738bcedbfa5113c9e28d72fcbfc020814ce3f5d4fc867f01c8f5b6caf305b3ea8a8ba2da3ab69fabcb438f19ff11f5378ad4484d75c478de425fb8e6ee809b54eec9bdb184315dc856617c09f5340451bf42fd3270a7b0b6566169f242e533777604c118a6358250f54", + .derive_key = "554b0a5efea9ef183f2f9b931b7497995d9eb26f5c5c6dad2b97d62fc5ac31d99b20652c016d88ba2a611bbd761668d5eda3e568e940faae24b0d9991c3bd25a65f770b89fdcadabcb3d1a9c1cb63e69721cacf1ae69fefdcef1e3ef41bc5312ccc17222199e47a26552c6adc460cf47a72319cb5039369d0060eaea59d6c65130f1dd", + }, + .{ + .input_len = 8192, + .hash = "aae792484c8efe4f19e2ca7d371d8c467ffb10748d8a5a1ae579948f718a2a635fe51a27db045a567c1ad51be5aa34c01c6651c4d9b5b5ac5d0fd58cf18dd61a47778566b797a8c67df7b1d60b97b19288d2d877bb2df417ace009dcb0241ca1257d62712b6a4043b4ff33f690d849da91ea3bf711ed583cb7b7a7da2839ba71309bbf", + .keyed_hash = "dc9637c8845a770b4cbf76b8daec0eebf7dc2eac11498517f08d44c8fc00d58a4834464159dcbc12a0ba0c6d6eb41bac0ed6585cabfe0aca36a375e6c5480c22afdc40785c170f5a6b8a1107dbee282318d00d915ac9ed1143ad40765ec120042ee121cd2baa36250c618adaf9e27260fda2f94dea8fb6f08c04f8f10c78292aa46102", + .derive_key = "ad01d7ae4ad059b0d33baa3c01319dcf8088094d0359e5fd45d6aeaa8b2d0c3d4c9e58958553513b67f84f8eac653aeeb02ae1d5672dcecf91cd9985a0e67f4501910ecba25555395427ccc7241d70dc21c190e2aadee875e5aae6bf1912837e53411dabf7a56cbf8e4fb780432b0d7fe6cec45024a0788cf5874616407757e9e6bef7", + }, + .{ + .input_len = 8193, + .hash = "bab6c09cb8ce8cf459261398d2e7aef35700bf488116ceb94a36d0f5f1b7bc3bb2282aa69be089359ea1154b9a9286c4a56af4de975a9aa4a5c497654914d279bea60bb6d2cf7225a2fa0ff5ef56bbe4b149f3ed15860f78b4e2ad04e158e375c1e0c0b551cd7dfc82f1b155c11b6b3ed51ec9edb30d133653bb5709d1dbd55f4e1ff6", + .keyed_hash = "954a2a75420c8d6547e3ba5b98d963e6fa6491addc8c023189cc519821b4a1f5f03228648fd983aef045c2fa8290934b0866b615f585149587dda2299039965328835a2b18f1d63b7e300fc76ff260b571839fe44876a4eae66cbac8c67694411ed7e09df51068a22c6e67d6d3dd2cca8ff12e3275384006c80f4db68023f24eebba57", + .derive_key = "af1e0346e389b17c23200270a64aa4e1ead98c61695d917de7d5b00491c9b0f12f20a01d6d622edf3de026a4db4e4526225debb93c1237934d71c7340bb5916158cbdafe9ac3225476b6ab57a12357db3abbad7a26c6e66290e44034fb08a20a8d0ec264f309994d2810c49cfba6989d7abb095897459f5425adb48aba07c5fb3c83c0", + }, + .{ + .input_len = 16384, + .hash = "f875d6646de28985646f34ee13be9a576fd515f76b5b0a26bb324735041ddde49d764c270176e53e97bdffa58d549073f2c660be0e81293767ed4e4929f9ad34bbb39a529334c57c4a381ffd2a6d4bfdbf1482651b172aa883cc13408fa67758a3e47503f93f87720a3177325f7823251b85275f64636a8f1d599c2e49722f42e93893", + .keyed_hash = "9e9fc4eb7cf081ea7c47d1807790ed211bfec56aa25bb7037784c13c4b707b0df9e601b101e4cf63a404dfe50f2e1865bb12edc8fca166579ce0c70dba5a5c0fc960ad6f3772183416a00bd29d4c6e651ea7620bb100c9449858bf14e1ddc9ecd35725581ca5b9160de04060045993d972571c3e8f71e9d0496bfa744656861b169d65", + .derive_key = "160e18b5878cd0df1c3af85eb25a0db5344d43a6fbd7a8ef4ed98d0714c3f7e160dc0b1f09caa35f2f417b9ef309dfe5ebd67f4c9507995a531374d099cf8ae317542e885ec6f589378864d3ea98716b3bbb65ef4ab5e0ab5bb298a501f19a41ec19af84a5e6b428ecd813b1a47ed91c9657c3fba11c406bc316768b58f6802c9e9b57", + }, + .{ + .input_len = 31744, + .hash = "62b6960e1a44bcc1eb1a611a8d6235b6b4b78f32e7abc4fb4c6cdcce94895c47860cc51f2b0c28a7b77304bd55fe73af663c02d3f52ea053ba43431ca5bab7bfea2f5e9d7121770d88f70ae9649ea713087d1914f7f312147e247f87eb2d4ffef0ac978bf7b6579d57d533355aa20b8b77b13fd09748728a5cc327a8ec470f4013226f", + .keyed_hash = "efa53b389ab67c593dba624d898d0f7353ab99e4ac9d42302ee64cbf9939a4193a7258db2d9cd32a7a3ecfce46144114b15c2fcb68a618a976bd74515d47be08b628be420b5e830fade7c080e351a076fbc38641ad80c736c8a18fe3c66ce12f95c61c2462a9770d60d0f77115bbcd3782b593016a4e728d4c06cee4505cb0c08a42ec", + .derive_key = "39772aef80e0ebe60596361e45b061e8f417429d529171b6764468c22928e28e9759adeb797a3fbf771b1bcea30150a020e317982bf0d6e7d14dd9f064bc11025c25f31e81bd78a921db0174f03dd481d30e93fd8e90f8b2fee209f849f2d2a52f31719a490fb0ba7aea1e09814ee912eba111a9fde9d5c274185f7bae8ba85d300a2b", + }, + .{ + .input_len = 102400, + .hash = "bc3e3d41a1146b069abffad3c0d44860cf664390afce4d9661f7902e7943e085e01c59dab908c04c3342b816941a26d69c2605ebee5ec5291cc55e15b76146e6745f0601156c3596cb75065a9c57f35585a52e1ac70f69131c23d611ce11ee4ab1ec2c009012d236648e77be9295dd0426f29b764d65de58eb7d01dd42248204f45f8e", + .keyed_hash = "1c35d1a5811083fd7119f5d5d1ba027b4d01c0c6c49fb6ff2cf75393ea5db4a7f9dbdd3e1d81dcbca3ba241bb18760f207710b751846faaeb9dff8262710999a59b2aa1aca298a032d94eacfadf1aa192418eb54808db23b56e34213266aa08499a16b354f018fc4967d05f8b9d2ad87a7278337be9693fc638a3bfdbe314574ee6fc4", + .derive_key = "4652cff7a3f385a6103b5c260fc1593e13c778dbe608efb092fe7ee69df6e9c6d83a3e041bc3a48df2879f4a0a3ed40e7c961c73eff740f3117a0504c2dff4786d44fb17f1549eb0ba585e40ec29bf7732f0b7e286ff8acddc4cb1e23b87ff5d824a986458dcc6a04ac83969b80637562953df51ed1a7e90a7926924d2763778be8560", + }, + }, +}; + +fn test_blake3(hasher: *Blake3, input_len: usize, expected_hex: *const [262]u8) void { + // Setup input pattern + var input_pattern: [251]u8 = undefined; + for (input_pattern) |*e, i| e.* = @truncate(u8, i); + + // Write repeating input pattern to hasher + var input_counter = input_len; + while (input_counter > 0) { + const update_len = math.min(input_counter, input_pattern.len); + hasher.update(input_pattern[0..update_len]); + input_counter -= update_len; + } + + // Read final hash value + var actual_bytes: [expected_hex.len / 2]u8 = undefined; + hasher.final(actual_bytes[0..]); + hasher.reset(); + + // Compare to expected value + var expected_bytes: [expected_hex.len / 2]u8 = undefined; + fmt.hexToBytes(expected_bytes[0..], expected_hex) catch unreachable; + testing.expectEqual(actual_bytes, expected_bytes); +} + +test "BLAKE3 reference test cases" { + var hash = &Blake3.init(); + var keyed_hash = &Blake3.init_keyed(reference_test.key); + var derive_key = &Blake3.init_derive_key(reference_test.context_string); + + for (reference_test.cases) |t| { + test_blake3(hash, t.input_len, t.hash); + test_blake3(keyed_hash, t.input_len, t.keyed_hash); + test_blake3(derive_key, t.input_len, t.derive_key); + } +} From d098e212ad9b18cd0f74b19dea0f4f3b11092dca Mon Sep 17 00:00:00 2001 From: Jay Petacat Date: Sun, 2 Feb 2020 14:08:10 -0500 Subject: [PATCH 52/60] blake3: Convert `*const [n]u8` types to `[n]u8` I do not see many cases of constant pointers to arrays in the stdlib. In fact, this makes the code run a little faster, probably because Zig automatically converts to pointers where it makes sense. --- lib/std/crypto/blake3.zig | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/lib/std/crypto/blake3.zig b/lib/std/crypto/blake3.zig index 1a6e2955c..b1463705b 100644 --- a/lib/std/crypto/blake3.zig +++ b/lib/std/crypto/blake3.zig @@ -70,7 +70,7 @@ fn g(state: *[16]u32, a: usize, b: usize, c: usize, d: usize, mx: u32, my: u32) state[b] = math.rotr(u32, state[b] ^ state[c], 7); } -fn round(state: *[16]u32, msg: *const [16]u32, schedule: *const [16]u8) void { +fn round(state: *[16]u32, msg: [16]u32, schedule: [16]u8) void { // Mix the columns. g(state, 0, 4, 8, 12, msg[schedule[0]], msg[schedule[1]]); g(state, 1, 5, 9, 13, msg[schedule[2]], msg[schedule[3]]); @@ -85,8 +85,8 @@ fn round(state: *[16]u32, msg: *const [16]u32, schedule: *const [16]u8) void { } fn compress( - chaining_value: *const [8]u32, - block_words: *const [16]u32, + chaining_value: [8]u32, + block_words: [16]u32, block_len: u32, counter: u64, flags: u8, @@ -109,7 +109,7 @@ fn compress( block_len, flags, }; - for (MSG_SCHEDULE) |*schedule| { + for (MSG_SCHEDULE) |schedule| { round(&state, block_words, schedule); } for (chaining_value) |_, i| { @@ -143,8 +143,8 @@ const Output = struct { fn chaining_value(self: *Output) [8]u32 { return first_8_words(compress( - &self.input_chaining_value, - &self.block_words, + self.input_chaining_value, + self.block_words, self.block_len, self.counter, self.flags, @@ -156,8 +156,8 @@ const Output = struct { var output_block_counter: usize = 0; while (out_block_it.next()) |out_block| { var words = compress( - &self.input_chaining_value, - &self.block_words, + self.input_chaining_value, + self.block_words, self.block_len, output_block_counter, self.flags | ROOT, @@ -216,8 +216,8 @@ const ChunkState = struct { var block_words: [16]u32 = undefined; words_from_little_endian_bytes(&self.block, &block_words); self.chaining_value = first_8_words(compress( - &self.chaining_value, - &block_words, + self.chaining_value, + block_words, BLOCK_LEN, self.chunk_counter, self.flags | self.start_flag(), @@ -232,7 +232,7 @@ const ChunkState = struct { } } - fn output(self: *ChunkState) Output { + fn output(self: *const ChunkState) Output { var block_words: [16]u32 = undefined; words_from_little_endian_bytes(&self.block, &block_words); return Output{ @@ -297,9 +297,9 @@ pub const Blake3 = struct { } /// Construct a new `Blake3` for the keyed hash function. - pub fn init_keyed(key: *const [KEY_LEN]u8) Blake3 { + pub fn init_keyed(key: [KEY_LEN]u8) Blake3 { var key_words: [8]u32 = undefined; - words_from_little_endian_bytes(key, &key_words); + words_from_little_endian_bytes(key[0..], &key_words); return Blake3.init_internal(key_words, KEYED_HASH); } @@ -550,7 +550,7 @@ const reference_test = .{ }, }; -fn test_blake3(hasher: *Blake3, input_len: usize, expected_hex: *const [262]u8) void { +fn test_blake3(hasher: *Blake3, input_len: usize, expected_hex: [262]u8) void { // Setup input pattern var input_pattern: [251]u8 = undefined; for (input_pattern) |*e, i| e.* = @truncate(u8, i); @@ -570,18 +570,18 @@ fn test_blake3(hasher: *Blake3, input_len: usize, expected_hex: *const [262]u8) // Compare to expected value var expected_bytes: [expected_hex.len / 2]u8 = undefined; - fmt.hexToBytes(expected_bytes[0..], expected_hex) catch unreachable; + fmt.hexToBytes(expected_bytes[0..], expected_hex[0..]) catch unreachable; testing.expectEqual(actual_bytes, expected_bytes); } test "BLAKE3 reference test cases" { var hash = &Blake3.init(); - var keyed_hash = &Blake3.init_keyed(reference_test.key); + var keyed_hash = &Blake3.init_keyed(reference_test.key.*); var derive_key = &Blake3.init_derive_key(reference_test.context_string); for (reference_test.cases) |t| { - test_blake3(hash, t.input_len, t.hash); - test_blake3(keyed_hash, t.input_len, t.keyed_hash); - test_blake3(derive_key, t.input_len, t.derive_key); + test_blake3(hash, t.input_len, t.hash.*); + test_blake3(keyed_hash, t.input_len, t.keyed_hash.*); + test_blake3(derive_key, t.input_len, t.derive_key.*); } } From b143fc0d32cff6bb6c2d6abe704c33de3f83ba35 Mon Sep 17 00:00:00 2001 From: Jay Petacat Date: Sun, 2 Feb 2020 14:42:57 -0500 Subject: [PATCH 53/60] blake3: Name and const pointer refinements --- lib/std/crypto/blake3.zig | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/std/crypto/blake3.zig b/lib/std/crypto/blake3.zig index b1463705b..dbcba0125 100644 --- a/lib/std/crypto/blake3.zig +++ b/lib/std/crypto/blake3.zig @@ -119,11 +119,11 @@ fn compress( return state; } -fn first_8_words(compression_output: [16]u32) [8]u32 { - return @ptrCast(*const [8]u32, &compression_output).*; +fn first_8_words(words: [16]u32) [8]u32 { + return @ptrCast(*const [8]u32, &words).*; } -fn words_from_little_endian_bytes(bytes: []const u8, words: []u32) void { +fn words_from_little_endian_bytes(words: []u32, bytes: []const u8) void { var byte_slice = bytes; for (words) |*word| { word.* = mem.readIntSliceLittle(u32, byte_slice); @@ -141,7 +141,7 @@ const Output = struct { counter: u64, flags: u8, - fn chaining_value(self: *Output) [8]u32 { + fn chaining_value(self: *const Output) [8]u32 { return first_8_words(compress( self.input_chaining_value, self.block_words, @@ -151,7 +151,7 @@ const Output = struct { )); } - fn root_output_bytes(self: *Output, output: []u8) void { + fn root_output_bytes(self: *const Output, output: []u8) void { var out_block_it = ChunkIterator.init(output, 2 * OUT_LEN); var output_block_counter: usize = 0; while (out_block_it.next()) |out_block| { @@ -214,7 +214,7 @@ const ChunkState = struct { // input is coming, so this compression is not CHUNK_END. if (self.block_len == BLOCK_LEN) { var block_words: [16]u32 = undefined; - words_from_little_endian_bytes(&self.block, &block_words); + words_from_little_endian_bytes(&block_words, &self.block); self.chaining_value = first_8_words(compress( self.chaining_value, block_words, @@ -234,7 +234,7 @@ const ChunkState = struct { fn output(self: *const ChunkState) Output { var block_words: [16]u32 = undefined; - words_from_little_endian_bytes(&self.block, &block_words); + words_from_little_endian_bytes(&block_words, &self.block); return Output{ .input_chaining_value = self.chaining_value, .block_words = block_words, @@ -299,7 +299,7 @@ pub const Blake3 = struct { /// Construct a new `Blake3` for the keyed hash function. pub fn init_keyed(key: [KEY_LEN]u8) Blake3 { var key_words: [8]u32 = undefined; - words_from_little_endian_bytes(key[0..], &key_words); + words_from_little_endian_bytes(&key_words, key[0..]); return Blake3.init_internal(key_words, KEYED_HASH); } @@ -311,7 +311,7 @@ pub const Blake3 = struct { var context_key: [KEY_LEN]u8 = undefined; context_hasher.final(context_key[0..]); var context_key_words: [8]u32 = undefined; - words_from_little_endian_bytes(&context_key, &context_key_words); + words_from_little_endian_bytes(&context_key_words, &context_key); return Blake3.init_internal(context_key_words, DERIVE_KEY_MATERIAL); } @@ -327,12 +327,12 @@ pub const Blake3 = struct { self.cv_stack_len = 0; } - fn push_stack(self: *Blake3, cv: [8]u32) void { + fn push_cv(self: *Blake3, cv: [8]u32) void { self.cv_stack[self.cv_stack_len] = cv; self.cv_stack_len += 1; } - fn pop_stack(self: *Blake3) [8]u32 { + fn pop_cv(self: *Blake3) [8]u32 { self.cv_stack_len -= 1; return self.cv_stack[self.cv_stack_len]; } @@ -348,10 +348,10 @@ pub const Blake3 = struct { // by the number of trailing 0-bits in the new total number of chunks. var chunk_counter = total_chunks; while (chunk_counter & 1 == 0) { - new_cv = parent_cv(self.pop_stack(), new_cv, self.key, self.flags); + new_cv = parent_cv(self.pop_cv(), new_cv, self.key, self.flags); chunk_counter >>= 1; } - self.push_stack(new_cv); + self.push_cv(new_cv); } /// Add input to the hash state. This can be called any number of times. @@ -376,7 +376,7 @@ pub const Blake3 = struct { } /// Finalize the hash and write any number of output bytes. - pub fn final(self: *Blake3, out_slice: []u8) void { + pub fn final(self: *const Blake3, out_slice: []u8) void { // Starting with the Output from the current chunk, compute all the // parent chaining values along the right edge of the tree, until we // have the root Output. From 923e567c6d73c4dea4ffff937c5e4cc4a26264da Mon Sep 17 00:00:00 2001 From: Jay Petacat Date: Sun, 2 Feb 2020 14:59:36 -0500 Subject: [PATCH 54/60] blake3: Replace `&arr` with `arr[0..]` for slice args --- lib/std/crypto/blake3.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/std/crypto/blake3.zig b/lib/std/crypto/blake3.zig index dbcba0125..6c00de637 100644 --- a/lib/std/crypto/blake3.zig +++ b/lib/std/crypto/blake3.zig @@ -214,7 +214,7 @@ const ChunkState = struct { // input is coming, so this compression is not CHUNK_END. if (self.block_len == BLOCK_LEN) { var block_words: [16]u32 = undefined; - words_from_little_endian_bytes(&block_words, &self.block); + words_from_little_endian_bytes(block_words[0..], self.block[0..]); self.chaining_value = first_8_words(compress( self.chaining_value, block_words, @@ -234,7 +234,7 @@ const ChunkState = struct { fn output(self: *const ChunkState) Output { var block_words: [16]u32 = undefined; - words_from_little_endian_bytes(&block_words, &self.block); + words_from_little_endian_bytes(block_words[0..], self.block[0..]); return Output{ .input_chaining_value = self.chaining_value, .block_words = block_words, @@ -299,7 +299,7 @@ pub const Blake3 = struct { /// Construct a new `Blake3` for the keyed hash function. pub fn init_keyed(key: [KEY_LEN]u8) Blake3 { var key_words: [8]u32 = undefined; - words_from_little_endian_bytes(&key_words, key[0..]); + words_from_little_endian_bytes(key_words[0..], key[0..]); return Blake3.init_internal(key_words, KEYED_HASH); } @@ -311,7 +311,7 @@ pub const Blake3 = struct { var context_key: [KEY_LEN]u8 = undefined; context_hasher.final(context_key[0..]); var context_key_words: [8]u32 = undefined; - words_from_little_endian_bytes(&context_key_words, &context_key); + words_from_little_endian_bytes(context_key_words[0..], context_key[0..]); return Blake3.init_internal(context_key_words, DERIVE_KEY_MATERIAL); } From 32291ab70249c874e6941292de8611e619c838e5 Mon Sep 17 00:00:00 2001 From: frmdstryr Date: Fri, 31 Jan 2020 13:02:12 -0500 Subject: [PATCH 55/60] Add support for dependent packages when using build.zig --- lib/std/build.zig | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/lib/std/build.zig b/lib/std/build.zig index 4537d5dd0..66660fc74 100644 --- a/lib/std/build.zig +++ b/lib/std/build.zig @@ -1075,9 +1075,10 @@ pub const CrossTarget = std.Target.Cross; /// Deprecated. Use `std.Target`. pub const Target = std.Target; -const Pkg = struct { +pub const Pkg = struct { name: []const u8, path: []const u8, + dependencies: ?[]Pkg = null, }; const CSourceFile = struct { @@ -1742,6 +1743,10 @@ pub const LibExeObjStep = struct { self.framework_dirs.append(self.builder.dupe(dir_path)) catch unreachable; } + pub fn addPackage(self: *LibExeObjStep, package: Pkg) void { + self.packages.append(package) catch unreachable; + } + pub fn addPackagePath(self: *LibExeObjStep, name: []const u8, pkg_index_path: []const u8) void { self.packages.append(Pkg{ .name = self.builder.dupe(name), @@ -2091,10 +2096,20 @@ pub const LibExeObjStep = struct { }, } for (self.packages.toSliceConst()) |pkg| { - zig_args.append("--pkg-begin") catch unreachable; - zig_args.append(pkg.name) catch unreachable; - zig_args.append(builder.pathFromRoot(pkg.path)) catch unreachable; - zig_args.append("--pkg-end") catch unreachable; + try zig_args.append("--pkg-begin"); + try zig_args.append(pkg.name); + try zig_args.append(builder.pathFromRoot(pkg.path)); + + if (pkg.dependencies) |dependencies| { + for (dependencies) |sub_pkg| { + try zig_args.append("--pkg-begin"); + try zig_args.append(sub_pkg.name); + try zig_args.append(builder.pathFromRoot(sub_pkg.path)); + try zig_args.append("--pkg-end"); + } + } + + try zig_args.append("--pkg-end"); } for (self.include_dirs.toSliceConst()) |include_dir| { From 958f00f1c71f205ce738433d00e9da7dde060f14 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Sat, 1 Feb 2020 23:58:02 +0100 Subject: [PATCH 56/60] Don't generate any type info for void return types Closely matches what the LLVM debug emitter expects, the generated DWARF infos are now standard-compliant. --- src/analyze.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/analyze.cpp b/src/analyze.cpp index 8be23ad82..c15b6b3d5 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -8846,13 +8846,13 @@ static void resolve_llvm_types_fn_type(CodeGen *g, ZigType *fn_type) { ZigType *gen_return_type; if (is_async) { gen_return_type = g->builtin_types.entry_void; - param_di_types.append(get_llvm_di_type(g, gen_return_type)); + param_di_types.append(nullptr); } else if (!type_has_bits(fn_type_id->return_type)) { gen_return_type = g->builtin_types.entry_void; - param_di_types.append(get_llvm_di_type(g, gen_return_type)); + param_di_types.append(nullptr); } else if (first_arg_return) { gen_return_type = g->builtin_types.entry_void; - param_di_types.append(get_llvm_di_type(g, gen_return_type)); + param_di_types.append(nullptr); ZigType *gen_type = get_pointer_to_type(g, fn_type_id->return_type, false); gen_param_types.append(get_llvm_type(g, gen_type)); param_di_types.append(get_llvm_di_type(g, gen_type)); @@ -8955,7 +8955,7 @@ void resolve_llvm_types_fn(CodeGen *g, ZigFn *fn) { ZigList param_di_types = {}; ZigList gen_param_types = {}; // first "parameter" is return value - param_di_types.append(get_llvm_di_type(g, gen_return_type)); + param_di_types.append(nullptr); ZigType *frame_type = get_fn_frame_type(g, fn); ZigType *ptr_type = get_pointer_to_type(g, frame_type, false); From cb2c14e03fa86ad0214e92c821026931f38edd61 Mon Sep 17 00:00:00 2001 From: Jay Petacat Date: Sun, 2 Feb 2020 18:44:50 -0500 Subject: [PATCH 57/60] blake3: Workaround issue #4373 with named types --- lib/std/crypto/blake3.zig | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/lib/std/crypto/blake3.zig b/lib/std/crypto/blake3.zig index 6c00de637..7c79ffcf5 100644 --- a/lib/std/crypto/blake3.zig +++ b/lib/std/crypto/blake3.zig @@ -395,6 +395,20 @@ pub const Blake3 = struct { } }; +// Use named type declarations to workaround crash with anonymous structs (issue #4373). +const ReferenceTest = struct { + key: *const [KEY_LEN]u8, + context_string: []const u8, + cases: []const ReferenceTestCase, +}; + +const ReferenceTestCase = struct { + input_len: usize, + hash: *const [262]u8, + keyed_hash: *const [262]u8, + derive_key: *const [262]u8, +}; + // Each test is an input length and three outputs, one for each of the `hash`, `keyed_hash`, and // `derive_key` modes. The input in each case is filled with a 251-byte-long repeating pattern: // 0, 1, 2, ..., 249, 250, 0, 1, ... The key used with `keyed_hash` is the 32-byte ASCII string @@ -406,15 +420,10 @@ pub const Blake3 = struct { // that the first 32 bytes match their default-length output. // // Source: https://github.com/BLAKE3-team/BLAKE3/blob/92d421dea1a89e2f079f4dbd93b0dab41234b279/test_vectors/test_vectors.json -const reference_test = .{ +const reference_test = ReferenceTest{ .key = "whats the Elvish word for friend", .context_string = "BLAKE3 2019-12-27 16:29:52 test vectors context", - .cases = [_]struct { - input_len: usize, - hash: *const [262]u8, - keyed_hash: *const [262]u8, - derive_key: *const [262]u8, - }{ + .cases = &[_]ReferenceTestCase{ .{ .input_len = 0, .hash = "af1349b9f5f9a1a6a0404dea36dcc9499bcb25c9adc112b7cc9a93cae41f3262e00f03e7b69af26b7faaf09fcd333050338ddfe085b8cc869ca98b206c08243a26f5487789e8f660afe6c99ef9e0c52b92e7393024a80459cf91f476f9ffdbda7001c22e159b402631f277ca96f2defdf1078282314e763699a31c5363165421cce14d", From 9b11e5e1f1e0debd1e5484883b2daad8b2b33cb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Larouche?= Date: Tue, 21 Jan 2020 17:32:00 -0500 Subject: [PATCH 58/60] Add InstallRawStep to Zig build system that does a similar job to llvm-objcopy. To use it, do 'exe.installRaw("kernel.bin");' where exe is a LibExeObjStep Part of #2826 --- lib/std/build.zig | 13 ++ lib/std/build/emit_raw.zig | 255 ++++++++++++++++++++++++++++++++++++ lib/std/debug.zig | 14 +- lib/std/elf.zig | 155 +++++++++++++--------- lib/std/target.zig | 17 +++ src-self-hosted/codegen.zig | 2 +- src-self-hosted/link.zig | 4 +- src-self-hosted/util.zig | 17 --- 8 files changed, 391 insertions(+), 86 deletions(-) create mode 100644 lib/std/build/emit_raw.zig diff --git a/lib/std/build.zig b/lib/std/build.zig index 66660fc74..54e5ea1c4 100644 --- a/lib/std/build.zig +++ b/lib/std/build.zig @@ -21,6 +21,7 @@ pub const TranslateCStep = @import("build/translate_c.zig").TranslateCStep; pub const WriteFileStep = @import("build/write_file.zig").WriteFileStep; pub const RunStep = @import("build/run.zig").RunStep; pub const CheckFileStep = @import("build/check_file.zig").CheckFileStep; +pub const InstallRawStep = @import("build/emit_raw.zig").InstallRawStep; pub const Builder = struct { install_tls: TopLevelStep, @@ -824,6 +825,10 @@ pub const Builder = struct { self.getInstallStep().dependOn(&self.addInstallFileWithDir(src_path, .Lib, dest_rel_path).step); } + pub fn installRaw(self: *Builder, artifact: *LibExeObjStep, dest_filename: []const u8) void { + self.getInstallStep().dependOn(&self.addInstallRaw(artifact, dest_filename).step); + } + ///`dest_rel_path` is relative to install prefix path pub fn addInstallFile(self: *Builder, src_path: []const u8, dest_rel_path: []const u8) *InstallFileStep { return self.addInstallFileWithDir(src_path, .Prefix, dest_rel_path); @@ -839,6 +844,10 @@ pub const Builder = struct { return self.addInstallFileWithDir(src_path, .Lib, dest_rel_path); } + pub fn addInstallRaw(self: *Builder, artifact: *LibExeObjStep, dest_filename: []const u8) *InstallRawStep { + return InstallRawStep.create(self, artifact, dest_filename); + } + pub fn addInstallFileWithDir( self: *Builder, src_path: []const u8, @@ -1407,6 +1416,10 @@ pub const LibExeObjStep = struct { self.builder.installArtifact(self); } + pub fn installRaw(self: *LibExeObjStep, dest_filename: [] const u8) void { + self.builder.installRaw(self, dest_filename); + } + /// Creates a `RunStep` with an executable built with `addExecutable`. /// Add command line arguments with `addArg`. pub fn run(exe: *LibExeObjStep) *RunStep { diff --git a/lib/std/build/emit_raw.zig b/lib/std/build/emit_raw.zig new file mode 100644 index 000000000..54ceae326 --- /dev/null +++ b/lib/std/build/emit_raw.zig @@ -0,0 +1,255 @@ +const std = @import("std"); + +const Allocator = std.mem.Allocator; +const ArenaAllocator = std.heap.ArenaAllocator; +const ArrayList = std.ArrayList; +const Builder = std.build.Builder; +const File = std.fs.File; +const InstallDir = std.build.InstallDir; +const LibExeObjStep = std.build.LibExeObjStep; +const Step = std.build.Step; +const elf = std.elf; +const fs = std.fs; +const io = std.io; +const sort = std.sort; +const warn = std.debug.warn; + +const BinOutStream = io.OutStream(anyerror); +const BinSeekStream = io.SeekableStream(anyerror, anyerror); +const ElfSeekStream = io.SeekableStream(anyerror, anyerror); +const ElfInStream = io.InStream(anyerror); + +const BinaryElfSection = struct { + elfOffset: u64, + binaryOffset: u64, + fileSize: usize, + segment: ?*BinaryElfSegment, +}; + +const BinaryElfSegment = struct { + physicalAddress: u64, + virtualAddress: u64, + elfOffset: u64, + binaryOffset: u64, + fileSize: usize, + firstSection: ?*BinaryElfSection, +}; + +const BinaryElfOutput = struct { + segments: ArrayList(*BinaryElfSegment), + sections: ArrayList(*BinaryElfSection), + + const Self = @This(); + + pub fn init(allocator: *Allocator) Self { + return Self{ + .segments = ArrayList(*BinaryElfSegment).init(allocator), + .sections = ArrayList(*BinaryElfSection).init(allocator), + }; + } + + pub fn deinit(self: *Self) void { + self.sections.deinit(); + self.segments.deinit(); + } + + pub fn parseElf(self: *Self, elfFile: elf.Elf) !void { + const allocator = self.segments.allocator; + + for (elfFile.section_headers) |section, i| { + if (sectionValidForOutput(section)) { + const newSection = try allocator.create(BinaryElfSection); + + newSection.binaryOffset = 0; + newSection.elfOffset = section.sh_offset; + newSection.fileSize = @intCast(usize, section.sh_size); + newSection.segment = null; + + try self.sections.append(newSection); + } + } + + for (elfFile.program_headers) |programHeader, i| { + if (programHeader.p_type == elf.PT_LOAD) { + const newSegment = try allocator.create(BinaryElfSegment); + + newSegment.physicalAddress = if (programHeader.p_paddr != 0) programHeader.p_paddr else programHeader.p_vaddr; + newSegment.virtualAddress = programHeader.p_vaddr; + newSegment.fileSize = @intCast(usize, programHeader.p_filesz); + newSegment.elfOffset = programHeader.p_offset; + newSegment.binaryOffset = 0; + newSegment.firstSection = null; + + for (self.sections.toSlice()) |section| { + if (sectionWithinSegment(section, programHeader)) { + if (section.segment) |sectionSegment| { + if (sectionSegment.elfOffset > newSegment.elfOffset) { + section.segment = newSegment; + } + } else { + section.segment = newSegment; + } + + if (newSegment.firstSection == null) { + newSegment.firstSection = section; + } + } + } + + try self.segments.append(newSegment); + } + } + + sort.sort(*BinaryElfSegment, self.segments.toSlice(), segmentSortCompare); + + if (self.segments.len > 0) { + const firstSegment = self.segments.at(0); + if (firstSegment.firstSection) |firstSection| { + const diff = firstSection.elfOffset - firstSegment.elfOffset; + + firstSegment.elfOffset += diff; + firstSegment.fileSize += diff; + firstSegment.physicalAddress += diff; + + const basePhysicalAddress = firstSegment.physicalAddress; + + for (self.segments.toSlice()) |segment| { + segment.binaryOffset = segment.physicalAddress - basePhysicalAddress; + } + } + } + + for (self.sections.toSlice()) |section| { + if (section.segment) |segment| { + section.binaryOffset = segment.binaryOffset + (section.elfOffset - segment.elfOffset); + } + } + + sort.sort(*BinaryElfSection, self.sections.toSlice(), sectionSortCompare); + } + + fn sectionWithinSegment(section: *BinaryElfSection, segment: elf.ProgramHeader) bool { + return segment.p_offset <= section.elfOffset and (segment.p_offset + segment.p_filesz) >= (section.elfOffset + section.fileSize); + } + + fn sectionValidForOutput(section: elf.SectionHeader) bool { + return section.sh_size > 0 and section.sh_type != elf.SHT_NOBITS and ((section.sh_flags & elf.SHF_ALLOC) == elf.SHF_ALLOC); + } + + fn segmentSortCompare(left: *BinaryElfSegment, right: *BinaryElfSegment) bool { + if (left.physicalAddress < right.physicalAddress) { + return true; + } + if (left.physicalAddress > right.physicalAddress) { + return false; + } + return false; + } + + fn sectionSortCompare(left: *BinaryElfSection, right: *BinaryElfSection) bool { + return left.binaryOffset < right.binaryOffset; + } +}; + +const WriteContext = struct { + inStream: *ElfInStream, + inSeekStream: *ElfSeekStream, + outStream: *BinOutStream, + outSeekStream: *BinSeekStream, +}; + +fn writeBinaryElfSection(allocator: *Allocator, context: WriteContext, section: *BinaryElfSection) !void { + var readBuffer = try allocator.alloc(u8, section.fileSize); + defer allocator.free(readBuffer); + + try context.inSeekStream.seekTo(section.elfOffset); + _ = try context.inStream.read(readBuffer); + + try context.outSeekStream.seekTo(section.binaryOffset); + try context.outStream.write(readBuffer); +} + +fn emit_raw(allocator: *Allocator, elf_path: []const u8, raw_path: []const u8) !void { + var arenaAlloc = ArenaAllocator.init(allocator); + errdefer arenaAlloc.deinit(); + var arena_allocator = &arenaAlloc.allocator; + + const currentDir = fs.cwd(); + + var file = try currentDir.openFile(elf_path, File.OpenFlags{}); + defer file.close(); + + var fileInStream = file.inStream(); + var fileSeekStream = file.seekableStream(); + + var elfFile = try elf.Elf.openStream(allocator, @ptrCast(*ElfSeekStream, &fileSeekStream.stream), @ptrCast(*ElfInStream, &fileInStream.stream)); + defer elfFile.close(); + + var outFile = try currentDir.createFile(raw_path, File.CreateFlags{}); + defer outFile.close(); + + var outFileOutStream = outFile.outStream(); + var outFileSeekStream = outFile.seekableStream(); + + const writeContext = WriteContext{ + .inStream = @ptrCast(*ElfInStream, &fileInStream.stream), + .inSeekStream = @ptrCast(*ElfSeekStream, &fileSeekStream.stream), + .outStream = @ptrCast(*BinOutStream, &outFileOutStream.stream), + .outSeekStream = @ptrCast(*BinSeekStream, &outFileSeekStream.stream), + }; + + var binaryElfOutput = BinaryElfOutput.init(arena_allocator); + defer binaryElfOutput.deinit(); + + try binaryElfOutput.parseElf(elfFile); + + for (binaryElfOutput.sections.toSlice()) |section| { + try writeBinaryElfSection(allocator, writeContext, section); + } +} + +pub const InstallRawStep = struct { + step: Step, + builder: *Builder, + artifact: *LibExeObjStep, + dest_dir: InstallDir, + dest_filename: [] const u8, + + const Self = @This(); + + pub fn create(builder: *Builder, artifact: *LibExeObjStep, dest_filename: [] const u8) *Self { + const self = builder.allocator.create(Self) catch unreachable; + self.* = Self{ + .step = Step.init(builder.fmt("install raw binary {}", .{artifact.step.name}), builder.allocator, make), + .builder = builder, + .artifact = artifact, + .dest_dir = switch (artifact.kind) { + .Obj => unreachable, + .Test => unreachable, + .Exe => .Bin, + .Lib => unreachable, + }, + .dest_filename = dest_filename, + }; + self.step.dependOn(&artifact.step); + + builder.pushInstalledFile(self.dest_dir, dest_filename); + return self; + } + + fn make(step: *Step) !void { + const self = @fieldParentPtr(Self, "step", step); + const builder = self.builder; + + if (self.artifact.target.getObjectFormat() != .elf) { + warn("InstallRawStep only works with ELF format.\n", .{}); + return error.InvalidObjectFormat; + } + + const full_src_path = self.artifact.getOutputPath(); + const full_dest_path = builder.getInstallPath(self.dest_dir, self.dest_filename); + + fs.makePath(builder.allocator, builder.getInstallPath(self.dest_dir, "")) catch unreachable; + try emit_raw(builder.allocator, full_src_path, full_dest_path); + } +}; \ No newline at end of file diff --git a/lib/std/debug.zig b/lib/std/debug.zig index 3af2a5c41..a87dbe292 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -946,8 +946,8 @@ fn readSparseBitVector(stream: var, allocator: *mem.Allocator) ![]usize { fn findDwarfSectionFromElf(elf_file: *elf.Elf, name: []const u8) !?DwarfInfo.Section { const elf_header = (try elf_file.findSection(name)) orelse return null; return DwarfInfo.Section{ - .offset = elf_header.offset, - .size = elf_header.size, + .offset = elf_header.sh_offset, + .size = elf_header.sh_size, }; } @@ -987,12 +987,12 @@ pub fn openElfDebugInfo( var di = DwarfInfo{ .endian = efile.endian, - .debug_info = (data[@intCast(usize, debug_info.offset)..@intCast(usize, debug_info.offset + debug_info.size)]), - .debug_abbrev = (data[@intCast(usize, debug_abbrev.offset)..@intCast(usize, debug_abbrev.offset + debug_abbrev.size)]), - .debug_str = (data[@intCast(usize, debug_str.offset)..@intCast(usize, debug_str.offset + debug_str.size)]), - .debug_line = (data[@intCast(usize, debug_line.offset)..@intCast(usize, debug_line.offset + debug_line.size)]), + .debug_info = (data[@intCast(usize, debug_info.sh_offset)..@intCast(usize, debug_info.sh_offset + debug_info.sh_size)]), + .debug_abbrev = (data[@intCast(usize, debug_abbrev.sh_offset)..@intCast(usize, debug_abbrev.sh_offset + debug_abbrev.sh_size)]), + .debug_str = (data[@intCast(usize, debug_str.sh_offset)..@intCast(usize, debug_str.sh_offset + debug_str.sh_size)]), + .debug_line = (data[@intCast(usize, debug_line.sh_offset)..@intCast(usize, debug_line.sh_offset + debug_line.sh_size)]), .debug_ranges = if (opt_debug_ranges) |debug_ranges| - data[@intCast(usize, debug_ranges.offset)..@intCast(usize, debug_ranges.offset + debug_ranges.size)] + data[@intCast(usize, debug_ranges.sh_offset)..@intCast(usize, debug_ranges.sh_offset + debug_ranges.sh_size)] else null, }; diff --git a/lib/std/elf.zig b/lib/std/elf.zig index dc1638c5c..9e4c1ac5f 100644 --- a/lib/std/elf.zig +++ b/lib/std/elf.zig @@ -330,19 +330,8 @@ pub const ET = extern enum(u16) { pub const HIPROC = 0xffff; }; -/// TODO delete this in favor of Elf64_Shdr -pub const SectionHeader = struct { - name: u32, - sh_type: u32, - flags: u64, - addr: u64, - offset: u64, - size: u64, - link: u32, - info: u32, - addr_align: u64, - ent_size: u64, -}; +pub const SectionHeader = Elf64_Shdr; +pub const ProgramHeader = Elf64_Phdr; pub const Elf = struct { seekable_stream: *io.SeekableStream(anyerror, anyerror), @@ -357,6 +346,7 @@ pub const Elf = struct { string_section_index: usize, string_section: *SectionHeader, section_headers: []SectionHeader, + program_headers: []ProgramHeader, allocator: *mem.Allocator, /// Call close when done. @@ -421,14 +411,24 @@ pub const Elf = struct { try seekable_stream.seekBy(4); const header_size = try in.readInt(u16, elf.endian); - if ((elf.is_64 and header_size != 64) or (!elf.is_64 and header_size != 52)) { + if ((elf.is_64 and header_size != @sizeOf(Elf64_Ehdr)) or (!elf.is_64 and header_size != @sizeOf(Elf32_Ehdr))) { return error.InvalidFormat; } const ph_entry_size = try in.readInt(u16, elf.endian); const ph_entry_count = try in.readInt(u16, elf.endian); + + if ((elf.is_64 and ph_entry_size != @sizeOf(Elf64_Phdr)) or (!elf.is_64 and ph_entry_size != @sizeOf(Elf32_Phdr))) { + return error.InvalidFormat; + } + const sh_entry_size = try in.readInt(u16, elf.endian); const sh_entry_count = try in.readInt(u16, elf.endian); + + if ((elf.is_64 and sh_entry_size != @sizeOf(Elf64_Shdr)) or (!elf.is_64 and sh_entry_size != @sizeOf(Elf32_Shdr))) { + return error.InvalidFormat; + } + elf.string_section_index = @as(usize, try in.readInt(u16, elf.endian)); if (elf.string_section_index >= sh_entry_count) return error.InvalidFormat; @@ -443,47 +443,72 @@ pub const Elf = struct { return error.InvalidFormat; } + try seekable_stream.seekTo(elf.program_header_offset); + + elf.program_headers = try elf.allocator.alloc(ProgramHeader, ph_entry_count); + errdefer elf.allocator.free(elf.program_headers); + + if (elf.is_64) { + for (elf.program_headers) |*elf_program| { + elf_program.p_type = try in.readInt(Elf64_Word, elf.endian); + elf_program.p_flags = try in.readInt(Elf64_Word, elf.endian); + elf_program.p_offset = try in.readInt(Elf64_Off, elf.endian); + elf_program.p_vaddr = try in.readInt(Elf64_Addr, elf.endian); + elf_program.p_paddr = try in.readInt(Elf64_Addr, elf.endian); + elf_program.p_filesz = try in.readInt(Elf64_Xword, elf.endian); + elf_program.p_memsz = try in.readInt(Elf64_Xword, elf.endian); + elf_program.p_align = try in.readInt(Elf64_Xword, elf.endian); + } + } else { + for (elf.program_headers) |*elf_program| { + elf_program.p_type = @as(Elf64_Word, try in.readInt(Elf32_Word, elf.endian)); + elf_program.p_offset = @as(Elf64_Off, try in.readInt(Elf32_Off, elf.endian)); + elf_program.p_vaddr = @as(Elf64_Addr, try in.readInt(Elf32_Addr, elf.endian)); + elf_program.p_paddr = @as(Elf64_Addr, try in.readInt(Elf32_Addr, elf.endian)); + elf_program.p_filesz = @as(Elf64_Word, try in.readInt(Elf32_Word, elf.endian)); + elf_program.p_memsz = @as(Elf64_Word, try in.readInt(Elf32_Word, elf.endian)); + elf_program.p_flags = @as(Elf64_Word, try in.readInt(Elf32_Word, elf.endian)); + elf_program.p_align = @as(Elf64_Word, try in.readInt(Elf32_Word, elf.endian)); + } + } + try seekable_stream.seekTo(elf.section_header_offset); elf.section_headers = try elf.allocator.alloc(SectionHeader, sh_entry_count); errdefer elf.allocator.free(elf.section_headers); if (elf.is_64) { - if (sh_entry_size != 64) return error.InvalidFormat; - for (elf.section_headers) |*elf_section| { - elf_section.name = try in.readInt(u32, elf.endian); + elf_section.sh_name = try in.readInt(u32, elf.endian); elf_section.sh_type = try in.readInt(u32, elf.endian); - elf_section.flags = try in.readInt(u64, elf.endian); - elf_section.addr = try in.readInt(u64, elf.endian); - elf_section.offset = try in.readInt(u64, elf.endian); - elf_section.size = try in.readInt(u64, elf.endian); - elf_section.link = try in.readInt(u32, elf.endian); - elf_section.info = try in.readInt(u32, elf.endian); - elf_section.addr_align = try in.readInt(u64, elf.endian); - elf_section.ent_size = try in.readInt(u64, elf.endian); + elf_section.sh_flags = try in.readInt(u64, elf.endian); + elf_section.sh_addr = try in.readInt(u64, elf.endian); + elf_section.sh_offset = try in.readInt(u64, elf.endian); + elf_section.sh_size = try in.readInt(u64, elf.endian); + elf_section.sh_link = try in.readInt(u32, elf.endian); + elf_section.sh_info = try in.readInt(u32, elf.endian); + elf_section.sh_addralign = try in.readInt(u64, elf.endian); + elf_section.sh_entsize = try in.readInt(u64, elf.endian); } } else { - if (sh_entry_size != 40) return error.InvalidFormat; - for (elf.section_headers) |*elf_section| { // TODO (multiple occurrences) allow implicit cast from %u32 -> %u64 ? - elf_section.name = try in.readInt(u32, elf.endian); + elf_section.sh_name = try in.readInt(u32, elf.endian); elf_section.sh_type = try in.readInt(u32, elf.endian); - elf_section.flags = @as(u64, try in.readInt(u32, elf.endian)); - elf_section.addr = @as(u64, try in.readInt(u32, elf.endian)); - elf_section.offset = @as(u64, try in.readInt(u32, elf.endian)); - elf_section.size = @as(u64, try in.readInt(u32, elf.endian)); - elf_section.link = try in.readInt(u32, elf.endian); - elf_section.info = try in.readInt(u32, elf.endian); - elf_section.addr_align = @as(u64, try in.readInt(u32, elf.endian)); - elf_section.ent_size = @as(u64, try in.readInt(u32, elf.endian)); + elf_section.sh_flags = @as(u64, try in.readInt(u32, elf.endian)); + elf_section.sh_addr = @as(u64, try in.readInt(u32, elf.endian)); + elf_section.sh_offset = @as(u64, try in.readInt(u32, elf.endian)); + elf_section.sh_size = @as(u64, try in.readInt(u32, elf.endian)); + elf_section.sh_link = try in.readInt(u32, elf.endian); + elf_section.sh_info = try in.readInt(u32, elf.endian); + elf_section.sh_addralign = @as(u64, try in.readInt(u32, elf.endian)); + elf_section.sh_entsize = @as(u64, try in.readInt(u32, elf.endian)); } } for (elf.section_headers) |*elf_section| { if (elf_section.sh_type != SHT_NOBITS) { - const file_end_offset = try math.add(u64, elf_section.offset, elf_section.size); + const file_end_offset = try math.add(u64, elf_section.sh_offset, elf_section.sh_size); if (stream_end < file_end_offset) return error.InvalidFormat; } } @@ -499,13 +524,14 @@ pub const Elf = struct { pub fn close(elf: *Elf) void { elf.allocator.free(elf.section_headers); + elf.allocator.free(elf.program_headers); } pub fn findSection(elf: *Elf, name: []const u8) !?*SectionHeader { section_loop: for (elf.section_headers) |*elf_section| { if (elf_section.sh_type == SHT_NULL) continue; - const name_offset = elf.string_section.offset + elf_section.name; + const name_offset = elf.string_section.sh_offset + elf_section.sh_name; try elf.seekable_stream.seekTo(name_offset); for (name) |expected_c| { @@ -523,7 +549,7 @@ pub const Elf = struct { } pub fn seekToSection(elf: *Elf, elf_section: *SectionHeader) !void { - try elf.seekable_stream.seekTo(elf_section.offset); + try elf.seekable_stream.seekTo(elf_section.sh_offset); } }; @@ -578,6 +604,26 @@ pub const Elf64_Ehdr = extern struct { e_shnum: Elf64_Half, e_shstrndx: Elf64_Half, }; +pub const Elf32_Phdr = extern struct { + p_type: Elf32_Word, + p_offset: Elf32_Off, + p_vaddr: Elf32_Addr, + p_paddr: Elf32_Addr, + p_filesz: Elf32_Word, + p_memsz: Elf32_Word, + p_flags: Elf32_Word, + p_align: Elf32_Word, +}; +pub const Elf64_Phdr = extern struct { + p_type: Elf64_Word, + p_flags: Elf64_Word, + p_offset: Elf64_Off, + p_vaddr: Elf64_Addr, + p_paddr: Elf64_Addr, + p_filesz: Elf64_Xword, + p_memsz: Elf64_Xword, + p_align: Elf64_Xword, +}; pub const Elf32_Shdr = extern struct { sh_name: Elf32_Word, sh_type: Elf32_Word, @@ -655,26 +701,6 @@ pub const Elf64_Rela = extern struct { r_info: Elf64_Xword, r_addend: Elf64_Sxword, }; -pub const Elf32_Phdr = extern struct { - p_type: Elf32_Word, - p_offset: Elf32_Off, - p_vaddr: Elf32_Addr, - p_paddr: Elf32_Addr, - p_filesz: Elf32_Word, - p_memsz: Elf32_Word, - p_flags: Elf32_Word, - p_align: Elf32_Word, -}; -pub const Elf64_Phdr = extern struct { - p_type: Elf64_Word, - p_flags: Elf64_Word, - p_offset: Elf64_Off, - p_vaddr: Elf64_Addr, - p_paddr: Elf64_Addr, - p_filesz: Elf64_Xword, - p_memsz: Elf64_Xword, - p_align: Elf64_Xword, -}; pub const Elf32_Dyn = extern struct { d_tag: Elf32_Sword, d_un: extern union { @@ -833,6 +859,17 @@ pub const Elf_MIPS_ABIFlags_v0 = extern struct { flags2: Elf32_Word, }; +comptime { + debug.assert(@sizeOf(Elf32_Ehdr) == 52); + debug.assert(@sizeOf(Elf64_Ehdr) == 64); + + debug.assert(@sizeOf(Elf32_Phdr) == 32); + debug.assert(@sizeOf(Elf64_Phdr) == 56); + + debug.assert(@sizeOf(Elf32_Shdr) == 40); + debug.assert(@sizeOf(Elf64_Shdr) == 64); +} + pub const Auxv = switch (@sizeOf(usize)) { 4 => Elf32_auxv_t, 8 => Elf64_auxv_t, diff --git a/lib/std/target.zig b/lib/std/target.zig index 0b09ebf83..4c86d0c2a 100644 --- a/lib/std/target.zig +++ b/lib/std/target.zig @@ -972,6 +972,23 @@ pub const Target = union(enum) { } } + pub fn getObjectFormat(self: Target) ObjectFormat { + switch (self) { + .Native => return @import("builtin").object_format, + .Cross => blk: { + if (self.isWindows() or self.isUefi()) { + return .coff; + } else if (self.isDarwin()) { + return .macho; + } + if (self.isWasm()) { + return .wasm; + } + return .elf; + }, + } + } + pub fn isMinGW(self: Target) bool { return self.isWindows() and self.isGnu(); } diff --git a/src-self-hosted/codegen.zig b/src-self-hosted/codegen.zig index 11bb83ae1..74eff90dc 100644 --- a/src-self-hosted/codegen.zig +++ b/src-self-hosted/codegen.zig @@ -31,7 +31,7 @@ pub async fn renderToLlvm(comp: *Compilation, fn_val: *Value.Fn, code: *ir.Code) llvm.SetTarget(module, comp.llvm_triple.toSliceConst()); llvm.SetDataLayout(module, comp.target_layout_str); - if (util.getObjectFormat(comp.target) == .coff) { + if (comp.target.getObjectFormat() == .coff) { llvm.AddModuleCodeViewFlag(module); } else { llvm.AddModuleDebugInfoFlag(module); diff --git a/src-self-hosted/link.zig b/src-self-hosted/link.zig index 96e18514e..0a29da477 100644 --- a/src-self-hosted/link.zig +++ b/src-self-hosted/link.zig @@ -76,7 +76,7 @@ pub fn link(comp: *Compilation) !void { std.debug.warn("\n", .{}); } - const extern_ofmt = toExternObjectFormatType(util.getObjectFormat(comp.target)); + const extern_ofmt = toExternObjectFormatType(comp.target.getObjectFormat()); const args_slice = ctx.args.toSlice(); { @@ -128,7 +128,7 @@ fn toExternObjectFormatType(ofmt: ObjectFormat) c.ZigLLVM_ObjectFormatType { } fn constructLinkerArgs(ctx: *Context) !void { - switch (util.getObjectFormat(ctx.comp.target)) { + switch (ctx.comp.target.getObjectFormat()) { .unknown => unreachable, .coff => return constructLinkerArgsCoff(ctx), .elf => return constructLinkerArgsElf(ctx), diff --git a/src-self-hosted/util.zig b/src-self-hosted/util.zig index 85e2fc0e7..95bc72469 100644 --- a/src-self-hosted/util.zig +++ b/src-self-hosted/util.zig @@ -32,23 +32,6 @@ pub fn getFloatAbi(self: Target) FloatAbi { }; } -pub fn getObjectFormat(target: Target) Target.ObjectFormat { - switch (target) { - .Native => return @import("builtin").object_format, - .Cross => blk: { - if (target.isWindows() or target.isUefi()) { - return .coff; - } else if (target.isDarwin()) { - return .macho; - } - if (target.isWasm()) { - return .wasm; - } - return .elf; - }, - } -} - pub fn getDynamicLinkerPath(self: Target) ?[]const u8 { const env = self.getAbi(); const arch = self.getArch(); From db3aea3a0bfce6af04d941003c6a63e86cfdee1a Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Mon, 3 Feb 2020 14:42:32 +0100 Subject: [PATCH 59/60] Change API for binarySearch fn --- lib/std/sort.zig | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/lib/std/sort.zig b/lib/std/sort.zig index c65158568..df9702b32 100644 --- a/lib/std/sort.zig +++ b/lib/std/sort.zig @@ -5,7 +5,7 @@ const mem = std.mem; const math = std.math; const builtin = @import("builtin"); -pub fn binarySearch(comptime T: type, items: []T, comptime compareFn: fn (val: T) math.Order) ?usize { +pub fn binarySearch(comptime T: type, key: T, items: []const T, comptime compareFn: fn (lhs: T, rhs: T) math.Order) ?usize { if (items.len < 1) return null; @@ -15,11 +15,11 @@ pub fn binarySearch(comptime T: type, items: []T, comptime compareFn: fn (val: T while (left <= right) { // Avoid overflowing in the midpoint calculation const mid = left + (right - left) / 2; - // Compare the midpoint element with the key - switch (compareFn(items[mid])) { + // Compare the key with the midpoint element + switch (compareFn(key, items[mid])) { .eq => return mid, - .lt => left = mid + 1, - .gt => right = mid - 1, + .gt => left = mid + 1, + .lt => right = mid - 1, } } @@ -28,41 +28,40 @@ pub fn binarySearch(comptime T: type, items: []T, comptime compareFn: fn (val: T test "std.sort.binarySearch" { const S = struct { - fn makeComparisonPred(comptime T: type, value: T) type { - return struct { - fn pred(v: T) math.Order { - return math.order(v, value); - } - }; + fn order_u32(lhs: u32, rhs: u32) math.Order { + return math.order(lhs, rhs); + } + fn order_i32(lhs: i32, rhs: i32) math.Order { + return math.order(lhs, rhs); } }; testing.expectEqual( @as(?usize, null), - binarySearch(u32, &[_]u32{}, S.makeComparisonPred(u32, 1).pred), + binarySearch(u32, 1, &[_]u32{}, S.order_u32), ); testing.expectEqual( @as(?usize, 0), - binarySearch(u32, &[_]u32{1}, S.makeComparisonPred(u32, 1).pred), + binarySearch(u32, 1, &[_]u32{1}, S.order_u32), ); testing.expectEqual( @as(?usize, null), - binarySearch(u32, &[_]u32{0}, S.makeComparisonPred(u32, 1).pred), + binarySearch(u32, 1, &[_]u32{0}, S.order_u32), ); testing.expectEqual( @as(?usize, 4), - binarySearch(u32, &[_]u32{ 1, 2, 3, 4, 5 }, S.makeComparisonPred(u32, 5).pred), + binarySearch(u32, 5, &[_]u32{ 1, 2, 3, 4, 5 }, S.order_u32), ); testing.expectEqual( @as(?usize, 0), - binarySearch(u32, &[_]u32{ 2, 4, 8, 16, 32, 64 }, S.makeComparisonPred(u32, 2).pred), + binarySearch(u32, 2, &[_]u32{ 2, 4, 8, 16, 32, 64 }, S.order_u32), ); testing.expectEqual( @as(?usize, 1), - binarySearch(i32, &[_]i32{ -7, -4, 0, 9, 10 }, S.makeComparisonPred(i32, -4).pred), + binarySearch(i32, -4, &[_]i32{ -7, -4, 0, 9, 10 }, S.order_i32), ); testing.expectEqual( @as(?usize, 3), - binarySearch(i32, &[_]i32{ -100, -25, 2, 98, 99, 100 }, S.makeComparisonPred(i32, 98).pred), + binarySearch(i32, 98, &[_]i32{ -100, -25, 2, 98, 99, 100 }, S.order_i32), ); } From 1658becb6221f9ffdbfd653c5e295501ac338794 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Mon, 3 Feb 2020 15:24:07 +0100 Subject: [PATCH 60/60] fmt: Fix one more edge case in container formatting --- lib/std/zig/parser_test.zig | 10 ++++++++++ lib/std/zig/render.zig | 2 ++ 2 files changed, 12 insertions(+) diff --git a/lib/std/zig/parser_test.zig b/lib/std/zig/parser_test.zig index 7b75aed28..c31ef9c64 100644 --- a/lib/std/zig/parser_test.zig +++ b/lib/std/zig/parser_test.zig @@ -7,6 +7,16 @@ test "zig fmt: trailing comma in container declaration" { \\const X = struct { foo: i32 align(4) = 1, bar: i32 align(4) = 2 }; \\ ); + try testCanonical( + \\test "" { + \\ comptime { + \\ const X = struct { + \\ x: i32 + \\ }; + \\ } + \\} + \\ + ); try testTransform( \\const X = struct { \\ foo: i32, bar: i8 }; diff --git a/lib/std/zig/render.zig b/lib/std/zig/render.zig index 5fda70048..7dd3d63b0 100644 --- a/lib/std/zig/render.zig +++ b/lib/std/zig/render.zig @@ -1224,6 +1224,8 @@ fn renderExpression( const space_after_decl: Space = if (it.peek() == null) .Newline else .Space; try renderContainerDecl(allocator, stream, tree, new_indent, start_col, decl.*, space_after_decl); } + + try stream.writeByteNTimes(' ', indent); } else { // All the declarations on the same line try renderToken(tree, stream, container_decl.lbrace_token, indent, start_col, .Space); // {