package ntdll

import (
	"fmt"
)

type NtStatus uint32

func (s NtStatus) Error() error {
	if s == 0 {
		return nil
	}
	return fmt.Errorf("NtStatus %08x", s)
}

package ntdll

import (
	"fmt"
)

type NtStatus uint32

func (s NtStatus) Error() error {
	if s == 0 {
		return nil
	}
	return fmt.Errorf("NtStatus %08x", s)
}

func (s NtStatus) IsSuccess() bool {
	return 0 <= s && s <= 0x3fffffff
}

func (s NtStatus) IsInofmational() bool {
	return 0x40000000 <= s && s <= 0x7FFFFFFF
}

func (s NtStatus) IsWarning() bool {
	return 0x80000000 <= s && s <= 0xBFFFFFFF
}

func (s NtStatus) IsError() bool {
	return 0xC0000000 <= s && s <= 0xFFFFFFFF
}

// FIXME: This needs to be autogenerated. See
// https://msdn.microsoft.com/en-us/library/cc704588.aspx

// select NTSTATUS codes.
const (
	STATUS_SUCCESS                NtStatus = 0x00000000
	STATUS_BUFFER_OVERFLOW                 = 0x80000005
	STATUS_NO_MORE_ENTRIES                 = 0x8000001A
	STATUS_INVALID_PARAMETER               = 0XC000000D
	STATUS_BUFFER_TOO_SMALL                = 0xC0000023
	STATUS_OBJECT_NAME_INVALID             = 0xC0000033
	STATUS_OBJECT_NAME_NOT_FOUND           = 0xC0000034
	STATUS_OBJECT_NAME_COLLISION           = 0xC0000035
	STATUS_OBJECT_PATH_INVALID             = 0xC0000039
	STATUS_OBJECT_PATH_NOT_FOUND           = 0xC000003A
	STATUS_OBJECT_PATH_SYNTAX_BAD          = 0xC000003B
)

Add NtStatus convenience functions and some select constants
Add NtStatus convenience functions and some select constants
