diff options
39 files changed, 4630 insertions, 22 deletions
diff --git a/ChangeLog b/ChangeLog index 743132f7093..d4042baa1e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2001-11-09 Dick Porter <dick@ximian.com> + + * configure.in: Try and get large file support, but it's not fatal + if it's not there (the io-layer just ignores the high word in that + case.) + + Check for windows builds, and only bother to look for pthreads and + large files if we're not building for cygwin or native win32. Not + having pthread support on Posix systems is now a fatal error. + + * autogen.sh: Fix ACLOCAL_FLAGS - it wasn't being passed to + aclocal + 2001-10-15 Dietmar Maurer <dietmar@ximian.com> * mono/tests/Makefile.am: removed JITTESTS, simply run all tests for diff --git a/acconfig.h b/acconfig.h index 63e6592083a..52fff9c0017 100644 --- a/acconfig.h +++ b/acconfig.h @@ -1,2 +1,5 @@ #undef HAVE_PTHREAD #undef HAVE_PTHREAD_MUTEX_TIMEDLOCK +#undef HAVE_LARGE_FILE_SUPPORT +#undef PLATFORM_WIN32 +#undef PLATFORM_WIN32_NATIVE diff --git a/autogen.sh b/autogen.sh index 23b38bb076f..6f5d86a5691 100755 --- a/autogen.sh +++ b/autogen.sh @@ -86,8 +86,8 @@ if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then fi fi -echo "Running aclocal $aclocalinclude ..." -aclocal $aclocalinclude || { +echo "Running aclocal $ACLOCAL_FLAGS ..." +aclocal $ACLOCAL_FLAGS || { echo echo "**Error**: aclocal failed. This may mean that you have not" echo "installed all of the packages you need, or you may need to" diff --git a/configure.in b/configure.in index a50c9ffaba5..2d12e7eb7d6 100644 --- a/configure.in +++ b/configure.in @@ -35,19 +35,101 @@ GMODULE_LIBS=`glib-config --libs gmodule` AC_SUBST(GMODULE_CFLAGS) AC_SUBST(GMODULE_LIBS) -dnl ***************************** -dnl *** Checks for libpthread *** -dnl ***************************** -AC_CHECK_LIB(pthread, pthread_create, [ - THREAD_LIBS=-lpthread +dnl **************************************** +dnl *** Check if we're building on win32 *** +dnl **************************************** +AC_MSG_CHECKING([if building for some Win32 platform]) +case "$host" in + *-*-mingw*|*-*-cygwin*) + platform_win32=yes + AC_DEFINE(PLATFORM_WIN32) + ;; + *) + platform_win32=no + ;; +esac +AC_MSG_RESULT($platform_win32) +AM_CONDITIONAL(PLATFORM_WIN32, test x$platform_win32 = xyes) + +if test x$platform_win32 = xyes; then + AC_MSG_CHECKING([if building for native Win32]) + case "$host" in + *-*-mingw*) + platform_win32_native=yes + AC_DEFINE(PLATFORM_WIN32_NATIVE) + ;; + *) + platform_win32_native=no + ;; + esac + AC_MSG_RESULT($platform_win32_native) + AM_CONDITIONAL(PLATFORM_WIN32_NATIVE, + test x$platform_win32_native = xyes) +fi + + +if test x$platform_win32 = xno; then + dnl ****************************************************************** + dnl *** Check for large file support *** + dnl *** (If we were using autoconf 2.50 we'd use AC_SYS_LARGEFILE) *** + dnl ****************************************************************** + + # Check that off_t can represent 2**63 - 1 correctly, working around + # potential compiler bugs. Defines LARGE_FILE_SUPPORT, adds $1 to + # CFLAGS and sets $large_offt to yes if the test succeeds + large_offt=no + AC_DEFUN(LARGE_FILES, [ + large_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $1" + AC_TRY_RUN([ + #include <sys/types.h> + + #define BIG_OFF_T (((off_t)1<<62)-1+((off_t)1<<62)) + + int main(void) { + int big_off_t=((BIG_OFF_T%2147483629==721) && + (BIG_OFF_T%2147483647==1)); + if(big_off_t) { + exit(0); + } else { + exit(1); + } + } + ], [ + AC_MSG_RESULT(ok) + AC_DEFINE(HAVE_LARGE_FILE_SUPPORT) + CFLAGS="$CFLAGS $1" + large_offt=yes + break + ], [ + AC_MSG_RESULT(no) + ]) + CPPFLAGS=$large_CPPFLAGS + ]) + + AC_MSG_CHECKING(if off_t is 64 bits wide) + LARGE_FILES("") + if test $large_offt = no; then + AC_MSG_CHECKING(if _FILE_OFFSET_BITS=64 gives 64 bit off_t) + LARGE_FILES("-D_FILE_OFFSET_BITS=64") + fi + if test $large_offt = no; then + AC_MSG_WARN([No 64 bit file size support available]) + fi + + + dnl ***************************** + dnl *** Checks for libpthread *** + dnl ***************************** + AC_SEARCH_LIBS(pthread_create, pthread, [ AM_CONDITIONAL(THREADS_PTHREAD, true) AC_DEFINE(HAVE_PTHREAD) # Need pthread_mutex_timedlock pthread_CFLAGS="" orig_CPPFLAGS=$CPPFLAGS - # This is a gcc-specific error, but we already set gcc-specific - # options in CFLAGS :) + # This is a gcc-specific error, but we already set + # gcc-specific options in CFLAGS CPPFLAGS="$CPPFLAGS -Werror-implicit-function-declaration" AC_MSG_CHECKING(for pthread_mutex_timedlock) AC_TRY_COMPILE([ #include <pthread.h>], [ @@ -80,15 +162,10 @@ AC_CHECK_LIB(pthread, pthread_create, [ CPPFLAGS=$orig_CPPFLAGS CFLAGS="$CFLAGS $pthread_CFLAGS" ], [ - AC_MSG_RESULT([Cannot find libpthread]) - # Check for other thread systems here, set THREAD_LIBS to - # whatever is needed, and define - # AM_CONDITIONAL(THREADS_foo, true), and add it to the - # section in mono/metadata/Makefile.am, AC_DEFINE(HAVE_foo), - # add that to acconfig.h, add the section for that in - # mono/metadata/threads.h + AC_MSG_ERROR([libpthread is required on non-win32 hosts]) ]) -AC_SUBST(THREAD_LIBS) +fi + TARGET="unknown" ACCESS_UNALIGNED="yes" @@ -137,6 +214,7 @@ mono/tests/Makefile mono/wrapper/Makefile mono/monoburg/Makefile mono/jit/Makefile +mono/io-layer/Makefile runtime/Makefile doc/Makefile ]) diff --git a/mono/Makefile.am b/mono/Makefile.am index 553a6685f5d..50227f6916b 100644 --- a/mono/Makefile.am +++ b/mono/Makefile.am @@ -1,2 +1,2 @@ -SUBDIRS = monoburg metadata cil dis arch interpreter jit wrapper tests +SUBDIRS = io-layer monoburg metadata cil dis arch interpreter jit wrapper tests diff --git a/mono/interpreter/ChangeLog b/mono/interpreter/ChangeLog index c87b3f82c4e..87a8b7aad2a 100644 --- a/mono/interpreter/ChangeLog +++ b/mono/interpreter/ChangeLog @@ -1,3 +1,7 @@ +2001-11-09 Dick Porter <dick@ximian.com> + + * Makefile.am (mint_LDADD): Don't need THREAD_LIBS any more + 2001-11-07 Miguel de Icaza <miguel@ximian.com> * interp.c: Include stdlib to kill warning. diff --git a/mono/interpreter/Makefile.am b/mono/interpreter/Makefile.am index 8d45d90251b..b1a2df58a93 100644 --- a/mono/interpreter/Makefile.am +++ b/mono/interpreter/Makefile.am @@ -15,7 +15,6 @@ mint_LDADD = \ ../metadata/libmetadata.a \ $(GLIB_LIBS) \ $(GMODULE_LIBS) \ - $(THREAD_LIBS) \ -lm man_MANS = mint.1 diff --git a/mono/io-layer/ChangeLog b/mono/io-layer/ChangeLog new file mode 100644 index 00000000000..d9b79661ee2 --- /dev/null +++ b/mono/io-layer/ChangeLog @@ -0,0 +1,7 @@ +2001-11-08 Dick Porter <dick@ximian.com> + + * Initial checkin. + + This is a library emulating the win32 threading and IO API. + + diff --git a/mono/io-layer/Makefile.am b/mono/io-layer/Makefile.am new file mode 100644 index 00000000000..c6ca5e01742 --- /dev/null +++ b/mono/io-layer/Makefile.am @@ -0,0 +1,71 @@ +lib_LIBRARIES = libwapi.a + +INCLUDES = \ + $(GLIB_CFLAGS) \ + $(GMODULE_CFLAGS) \ + -I$(top_srcdir) \ + # + +libwapiincludedir = $(includedir)/mono/wapi + +OTHER_H = \ + error.h \ + handles.h \ + io.h \ + io-layer.h \ + status.h \ + threads.h \ + uglify.h \ + wait.h \ + wapi.h \ + # + +OTHER_SOURCES = \ + error.c \ + error.h \ + handles.c \ + handles.h \ + handles-private.h \ + io.c \ + io.h \ + io-layer.h \ + pthread-compat.c \ + pthread-compat.h \ + status.h \ + threads.c \ + threads.h \ + timed-thread.c \ + timed-thread.h \ + uglify.h \ + unicode.c \ + unicode.h \ + wait.c \ + wait.h \ + wait-private.h \ + wapi.h \ + wapi-private.h \ + # + +WINDOWS_H = \ + io-layer.h \ + # + +WINDOWS_SOURCES = \ + io-layer.h \ + io-layer-dummy.c \ + # + +if PLATFORM_WIN32 +libwapi_a_SOURCES = $(WINDOWS_SOURCES) +libwapiinclude_HEADERS = $(WINDOWS_H) +else +libwapi_a_SOURCES = $(OTHER_SOURCES) +libwapiinclude_HEADERS = $(OTHER_H) +endif + +EXTRA_DIST = \ + $(WINDOWS_SOURCES) \ + $(OTHER_SOURCES) \ + # + + diff --git a/mono/io-layer/error.c b/mono/io-layer/error.c new file mode 100644 index 00000000000..7c65ad5c7b1 --- /dev/null +++ b/mono/io-layer/error.c @@ -0,0 +1,30 @@ +#include <config.h> +#include <glib.h> +#include <pthread.h> + +#include "mono/io-layer/wapi.h" + + +/** + * GetLastError: + * + * Retrieves the last error that occurred in the calling thread. + * + * Return value: The error code for the last error that happened on + * the calling thread. + */ +guint32 GetLastError(void) +{ + return(0); +} + +/** + * SetLastError: + * @code: The error code. + * + * Sets the error code in the calling thread. + */ +void SetLastError(guint32 code G_GNUC_UNUSED) +{ + /* Set the thread-local error code */ +} diff --git a/mono/io-layer/error.h b/mono/io-layer/error.h new file mode 100644 index 00000000000..f900a7172a3 --- /dev/null +++ b/mono/io-layer/error.h @@ -0,0 +1,1792 @@ +#ifndef _WAPI_ERROR_H_ +#define _WAPI_ERROR_H_ + +typedef enum { + ERROR_SUCCESS = 0, + ERROR_INVALID_FUNCTION = 1, + ERROR_FILE_NOT_FOUND = 2, + ERROR_PATH_NOT_FOUND = 3, + ERROR_TOO_MANY_OPEN_FILES = 4, + ERROR_ACCESS_DENIED = 5, + ERROR_INVALID_HANDLE = 6, + ERROR_ARENA_TRASHED = 7, + ERROR_NOT_ENOUGH_MEMORY = 8, + ERROR_INVALID_BLOCK = 9, + ERROR_BAD_ENVIRONMENT = 10, + ERROR_BAD_FORMAT = 11, + ERROR_INVALID_ACCESS = 12, + ERROR_INVALID_DATA = 13, + ERROR_OUTOFMEMORY = 14, + ERROR_INVALID_DRIVE = 15, + ERROR_CURRENT_DIRECTORY = 16, + ERROR_NOT_SAME_DEVICE = 17, + ERROR_NO_MORE_FILES = 18, + ERROR_WRITE_PROTECT = 19, + ERROR_BAD_UNIT = 20, + ERROR_NOT_READY = 21, + ERROR_BAD_COMMAND = 22, + ERROR_CRC = 23, + ERROR_BAD_LENGTH = 24, + ERROR_SEEK = 25, + ERROR_NOT_DOS_DISK = 26, + ERROR_SECTOR_NOT_FOUND = 27, + ERROR_OUT_OF_PAPER = 28, + ERROR_WRITE_FAULT = 29, + ERROR_READ_FAULT = 30, + ERROR_GEN_FAILURE = 31, + ERROR_SHARING_VIOLATION = 32, + ERROR_LOCK_VIOLATION = 33, + ERROR_WRONG_DISK = 34, + ERROR_SHARING_BUFFER_EXCEEDED = 36, + ERROR_HANDLE_EOF = 38, + ERROR_HANDLE_DISK_FULL = 39, + ERROR_NOT_SUPPORTED = 50, + ERROR_REM_NOT_LIST = 51, + ERROR_DUP_NAME = 52, + ERROR_BAD_NETPATH = 53, + ERROR_NETWORK_BUSY = 54, + ERROR_DEV_NOT_EXIST = 55, + ERROR_TOO_MANY_CMDS = 56, + ERROR_ADAP_HDW_ERR = 57, + ERROR_BAD_NET_RESP = 58, + ERROR_UNEXP_NET_ERR = 59, + ERROR_BAD_REM_ADAP = 60, + ERROR_PRINTQ_FULL = 61, + ERROR_NO_SPOOL_SPACE = 62, + ERROR_PRINT_CANCELLED = 63, + ERROR_NETNAME_DELETED = 64, + ERROR_NETWORK_ACCESS_DENIED = 65, + ERROR_BAD_DEV_TYPE = 66, + ERROR_BAD_NET_NAME = 67, + ERROR_TOO_MANY_NAMES = 68, + ERROR_TOO_MANY_SESS = 69, + ERROR_SHARING_PAUSED = 70, + ERROR_REQ_NOT_ACCEP = 71, + ERROR_REDIR_PAUSED = 72, + ERROR_FILE_EXISTS = 80, + ERROR_CANNOT_MAKE = 82, + ERROR_FAIL_I24 = 83, + ERROR_OUT_OF_STRUCTURES = 84, + ERROR_ALREADY_ASSIGNED = 85, + ERROR_INVALID_PASSWORD = 86, + ERROR_INVALID_PARAMETER = 87, + ERROR_NET_WRITE_FAULT = 88, + ERROR_NO_PROC_SLOTS = 89, + ERROR_TOO_MANY_SEMAPHORES = 100, + ERROR_EXCL_SEM_ALREADY_OWNED = 101, + ERROR_SEM_IS_SET = 102, + ERROR_TOO_MANY_SEM_REQUESTS = 103, + ERROR_INVALID_AT_INTERRUPT_TIME = 104, + ERROR_SEM_OWNER_DIED = 105, + ERROR_SEM_USER_LIMIT = 106, + ERROR_DISK_CHANGE = 107, + ERROR_DRIVE_LOCKED = 108, + ERROR_BROKEN_PIPE = 109, + ERROR_OPEN_FAILED = 110, + ERROR_BUFFER_OVERFLOW = 111, + ERROR_DISK_FULL = 112, + ERROR_NO_MORE_SEARCH_HANDLES = 113, + ERROR_INVALID_TARGET_HANDLE = 114, + ERROR_INVALID_CATEGORY = 117, + ERROR_INVALID_VERIFY_SWITCH = 118, + ERROR_BAD_DRIVER_LEVEL = 119, + ERROR_CALL_NOT_IMPLEMENTED = 120, + ERROR_SEM_TIMEOUT = 121, + ERROR_INSUFFICIENT_BUFFER = 122, + ERROR_INVALID_NAME = 123, + ERROR_INVALID_LEVEL = 124, + ERROR_NO_VOLUME_LABEL = 125, + ERROR_MOD_NOT_FOUND = 126, + ERROR_PROC_NOT_FOUND = 127, + ERROR_WAIT_NO_CHILDREN = 128, + ERROR_CHILD_NOT_COMPLETE = 129, + ERROR_DIRECT_ACCESS_HANDLE = 130, + ERROR_NEGATIVE_SEEK = 131, + ERROR_SEEK_ON_DEVICE = 132, + ERROR_IS_JOIN_TARGET = 133, + ERROR_IS_JOINED = 134, + ERROR_IS_SUBSTED = 135, + ERROR_NOT_JOINED = 136, + ERROR_NOT_SUBSTED = 137, + ERROR_JOIN_TO_JOIN = 138, + ERROR_SUBST_TO_SUBST = 139, + ERROR_JOIN_TO_SUBST = 140, + ERROR_SUBST_TO_JOIN = 141, + ERROR_BUSY_DRIVE = 142, + ERROR_SAME_DRIVE = 143, + ERROR_DIR_NOT_ROOT = 144, + ERROR_DIR_NOT_EMPTY = 145, + ERROR_IS_SUBST_PATH = 146, + ERROR_IS_JOIN_PATH = 147, + ERROR_PATH_BUSY = 148, + ERROR_IS_SUBST_TARGET = 149, + ERROR_SYSTEM_TRACE = 150, + ERROR_INVALID_EVENT_COUNT = 151, + ERROR_TOO_MANY_MUXWAITERS = 152, + ERROR_INVALID_LIST_FORMAT = 153, + ERROR_LABEL_TOO_LONG = 154, + ERROR_TOO_MANY_TCBS = 155, + ERROR_SIGNAL_REFUSED = 156, + ERROR_DISCARDED = 157, + ERROR_NOT_LOCKED = 158, + ERROR_BAD_THREADID_ADDR = 159, + ERROR_BAD_ARGUMENTS = 160, + ERROR_BAD_PATHNAME = 161, + ERROR_SIGNAL_PENDING = 162, + ERROR_MAX_THRDS_REACHED = 164, + ERROR_LOCK_FAILED = 167, + ERROR_BUSY = 170, + ERROR_CANCEL_VIOLATION = 173, + ERROR_ATOMIC_LOCKS_NOT_SUPPORTED = 174, + ERROR_INVALID_SEGMENT_NUMBER = 180, + ERROR_INVALID_ORDINAL = 182, + ERROR_ALREADY_EXISTS = 183, + ERROR_INVALID_FLAG_NUMBER = 186, + ERROR_SEM_NOT_FOUND = 187, + ERROR_INVALID_STARTING_CODESEG = 188, + ERROR_INVALID_STACKSEG = 189, + ERROR_INVALID_MODULETYPE = 190, + ERROR_INVALID_EXE_SIGNATURE = 191, + ERROR_EXE_MARKED_INVALID = 192, + ERROR_BAD_EXE_FORMAT = 193, + ERROR_ITERATED_DATA_EXCEEDS_64k = 194, + ERROR_INVALID_MINALLOCSIZE = 195, + ERROR_DYNLINK_FROM_INVALID_RING = 196, + ERROR_IOPL_NOT_ENABLED = 197, + ERROR_INVALID_SEGDPL = 198, + ERROR_AUTODATASEG_EXCEEDS_64k = 199, + ERROR_RING2SEG_MUST_BE_MOVABLE = 200, + ERROR_RELOC_CHAIN_XEEDS_SEGLIM = 201, + ERROR_INFLOOP_IN_RELOC_CHAIN = 202, + ERROR_ENVVAR_NOT_FOUND = 203, + ERROR_NO_SIGNAL_SENT = 205, + ERROR_FILENAME_EXCED_RANGE = 206, + ERROR_RING2_STACK_IN_USE = 207, + ERROR_META_EXPANSION_TOO_LONG = 208, + ERROR_INVALID_SIGNAL_NUMBER = 209, + ERROR_THREAD_1_INACTIVE = 210, + ERROR_LOCKED = 212, + ERROR_TOO_MANY_MODULES = 214, + ERROR_NESTING_NOT_ALLOWED = 215, + ERROR_EXE_MACHINE_TYPE_MISMATCH = 216, + ERROR_BAD_PIPE = 230, + ERROR_PIPE_BUSY = 231, + ERROR_NO_DATA = 232, + ERROR_PIPE_NOT_CONNECTED = 233, + ERROR_MORE_DATA = 234, + ERROR_VC_DISCONNECTED = 240, + ERROR_INVALID_EA_NAME = 254, + ERROR_EA_LIST_INCONSISTENT = 255, + WAIT_TIMEOUT = 258, + ERROR_NO_MORE_ITEMS = 259, + ERROR_CANNOT_COPY = 266, + ERROR_DIRECTORY = 267, + ERROR_EAS_DIDNT_FIT = 275, + ERROR_EA_FILE_CORRUPT = 276, + ERROR_EA_TABLE_FULL = 277, + ERROR_INVALID_EA_HANDLE = 278, + ERROR_EAS_NOT_SUPPORTED = 282, + ERROR_NOT_OWNER = 288, + ERROR_TOO_MANY_POSTS = 298, + ERROR_PARTIAL_COPY = 299, + ERROR_OPLOCK_NOT_GRANTED = 300, + ERROR_INVALID_OPLOCK_PROTOCOL = 301, + ERROR_DISK_TOO_FRAGMENTED = 302, + ERROR_DELETE_PENDING = 303, + ERROR_MR_MID_NOT_FOUND = 317, + ERROR_INVALID_ADDRESS = 487, + ERROR_ARITHMETIC_OVERFLOW = 534, + ERROR_PIPE_CONNECTED = 535, + ERROR_PIPE_LISTENING = 536, + ERROR_EA_ACCESS_DENIED = 994, + ERROR_OPERATION_ABORTED = 995, + ERROR_IO_INCOMPLETE = 996, + ERROR_IO_PENDING = 997, + ERROR_NOACCESS = 998, + ERROR_SWAPERROR = 999, + ERROR_STACK_OVERFLOW = 1001, + ERROR_INVALID_MESSAGE = 1002, + ERROR_CAN_NOT_COMPLETE = 1003, + ERROR_INVALID_FLAGS = 1004, + ERROR_UNRECOGNIZED_VOLUME = 1005, + ERROR_FILE_INVALID = 1006, + ERROR_FULLSCREEN_MODE = 1007, + ERROR_NO_TOKEN = 1008, + ERROR_BADDB = 1009, + ERROR_BADKEY = 1010, + ERROR_CANTOPEN = 1011, + ERROR_CANTREAD = 1012, + ERROR_CANTWRITE = 1013, + ERROR_REGISTRY_RECOVERED = 1014, + ERROR_REGISTRY_CORRUPT = 1015, + ERROR_REGISTRY_IO_FAILED = 1016, + ERROR_NOT_REGISTRY_FILE = 1017, + ERROR_KEY_DELETED = 1018, + ERROR_NO_LOG_SPACE = 1019, + ERROR_KEY_HAS_CHILDREN = 1020, + ERROR_CHILD_MUST_BE_VOLATILE = 1021, + ERROR_NOTIFY_ENUM_DIR = 1022, + ERROR_DEPENDENT_SERVICES_RUNNING = 1051, + ERROR_INVALID_SERVICE_CONTROL = 1052, + ERROR_SERVICE_REQUEST_TIMEOUT = 1053, + ERROR_SERVICE_NO_THREAD = 1054, + ERROR_SERVICE_DATABASE_LOCKED = 1055, + ERROR_SERVICE_ALREADY_RUNNING = 1056, + ERROR_INVALID_SERVICE_ACCOUNT = 1057, + ERROR_SERVICE_DISABLED = 1058, + ERROR_CIRCULAR_DEPENDENCY = 1059, + ERROR_SERVICE_DOES_NOT_EXIST = 1060, + ERROR_SERVICE_CANNOT_ACCEPT_CTRL = 1061, + ERROR_SERVICE_NOT_ACTIVE = 1062, + ERROR_FAILED_SERVICE_CONTROLLER_CONNECT = 1063, + ERROR_EXCEPTION_IN_SERVICE = 1064, + ERROR_DATABASE_DOES_NOT_EXIST = 1065, + ERROR_SERVICE_SPECIFIC_ERROR = 1066, + ERROR_PROCESS_ABORTED = 1067, + ERROR_SERVICE_DEPENDENCY_FAIL = 1068, + ERROR_SERVICE_LOGON_FAILED = 1069, + ERROR_SERVICE_START_HANG = 1070, + ERROR_INVALID_SERVICE_LOCK = 1071, + ERROR_SERVICE_MARKED_FOR_DELETE = 1072, + ERROR_SERVICE_EXISTS = 1073, + ERROR_ALREADY_RUNNING_LKG = 1074, + ERROR_SERVICE_DEPENDENCY_DELETED = 1075, + ERROR_BOOT_ALREADY_ACCEPTED = 1076, + ERROR_SERVICE_NEVER_STARTED = 1077, + ERROR_DUPLICATE_SERVICE_NAME = 1078, + ERROR_DIFFERENT_SERVICE_ACCOUNT = 1079, + ERROR_CANNOT_DETECT_DRIVER_FAILURE = 1080, + ERROR_CANNOT_DETECT_PROCESS_ABORT = 1081, + ERROR_NO_RECOVERY_PROGRAM = 1082, + ERROR_SERVICE_NOT_IN_EXE = 1083, + ERROR_NOT_SAFEBOOT_SERVICE = 1084, + ERROR_END_OF_MEDIA = 1100, + ERROR_FILEMARK_DETECTED = 1101, + ERROR_BEGINNING_OF_MEDIA = 1102, + ERROR_SETMARK_DETECTED = 1103, + ERROR_NO_DATA_DETECTED = 1104, + ERROR_PARTITION_FAILURE = 1105, + ERROR_INVALID_BLOCK_LENGTH = 1106, + ERROR_DEVICE_NOT_PARTITIONED = 1107, + ERROR_UNABLE_TO_LOCK_MEDIA = 1108, + ERROR_UNABLE_TO_UNLOAD_MEDIA = 1109, + ERROR_MEDIA_CHANGED = 1110, + ERROR_BUS_RESET = 1111, + ERROR_NO_MEDIA_IN_DRIVE = 1112, + ERROR_NO_UNICODE_TRANSLATION = 1113, + ERROR_DLL_INIT_FAILED = 1114, + ERROR_SHUTDOWN_IN_PROGRESS = 1115, + ERROR_NO_SHUTDOWN_IN_PROGRESS = 1116, + ERROR_IO_DEVICE = 1117, + ERROR_SERIAL_NO_DEVICE = 1118, + ERROR_IRQ_BUSY = 1119, + ERROR_MORE_WRITES = 1120, + ERROR_COUNTER_TIMEOUT = 1121, + ERROR_FLOPPY_ID_MARK_NOT_FOUND = 1122, + ERROR_FLOPPY_WRONG_CYLINDER = 1123, + ERROR_FLOPPY_UNKNOWN_ERROR = 1124, + ERROR_FLOPPY_BAD_REGISTERS = 1125, + ERROR_DISK_RECALIBRATE_FAILED = 1126, + ERROR_DISK_OPERATION_FAILED = 1127, + ERROR_DISK_RESET_FAILED = 1128, + ERROR_EOM_OVERFLOW = 1129, + ERROR_NOT_ENOUGH_SERVER_MEMORY = 1130, + ERROR_POSSIBLE_DEADLOCK = 1131, + ERROR_MAPPED_ALIGNMENT = 1132, + ERROR_SET_POWER_STATE_VETOED = 1140, + ERROR_SET_POWER_STATE_FAILED = 1141, + ERROR_TOO_MANY_LINKS = 1142, + ERROR_OLD_WIN_VERSION = 1150, + ERROR_APP_WRONG_OS = 1151, + ERROR_SINGLE_INSTANCE_APP = 1152, + ERROR_RMODE_APP = 1153, + ERROR_INVALID_DLL = 1154, + ERROR_NO_ASSOCIATION = 1155, + ERROR_DDE_FAIL = 1156, + ERROR_DLL_NOT_FOUND = 1157, + ERROR_NO_MORE_USER_HANDLES = 1158, + ERROR_MESSAGE_SYNC_ONLY = 1159, + ERROR_SOURCE_ELEMENT_EMPTY = 1160, + ERROR_DESTINATION_ELEMENT_FULL = 1161, + ERROR_ILLEGAL_ELEMENT_ADDRESS = 1162, + ERROR_MAGAZINE_NOT_PRESENT = 1163, + ERROR_DEVICE_REINITIALIZATION_NEEDED = 1164, + ERROR_DEVICE_REQUIRES_CLEANING = 1165, + ERROR_DEVICE_DOOR_OPEN = 1166, + ERROR_DEVICE_NOT_CONNECTED = 1167, + ERROR_NOT_FOUND = 1168, + ERROR_NO_MATCH = 1169, + ERROR_SET_NOT_FOUND = 1170, + ERROR_POINT_NOT_FOUND = 1171, + ERROR_NO_TRACKING_SERVICE = 1172, + ERROR_NO_VOLUME_ID = 1173, + ERROR_UNABLE_TO_REMOVE_REPLACED = 1175, + ERROR_UNABLE_TO_MOVE_REPLACEMENT = 1176, + ERROR_UNABLE_TO_MOVE_REPLACEMENT_2 = 1177, + ERROR_JOURNAL_DELETE_IN_PROGRESS = 1178, + ERROR_JOURNAL_NOT_ACTIVE = 1179, + ERROR_POTENTIAL_FILE_FOUND = 1180, + ERROR_JOURNAL_ENTRY_DELETED = 1181, + ERROR_BAD_DEVICE = 1200, + ERROR_CONNECTION_UNAVAIL = 1201, + ERROR_DEVICE_ALREADY_REMEMBERED = 1202, + ERROR_NO_NET_OR_BAD_PATH = 1203, + ERROR_BAD_PROVIDER = 1204, + ERROR_CANNOT_OPEN_PROFILE = 1205, + ERROR_BAD_PROFILE = 1206, + ERROR_NOT_CONTAINER = 1207, + ERROR_EXTENDED_ERROR = 1208, + ERROR_INVALID_GROUPNAME = 1209, + ERROR_INVALID_COMPUTERNAME = 1210, + ERROR_INVALID_EVENTNAME = 1211, + ERROR_INVALID_DOMAINNAME = 1212, + ERROR_INVALID_SERVICENAME = 1213, + ERROR_INVALID_NETNAME = 1214, + ERROR_INVALID_SHARENAME = 1215, + ERROR_INVALID_PASSWORDNAME = 1216, + ERROR_INVALID_MESSAGENAME = 1217, + ERROR_INVALID_MESSAGEDEST = 1218, + ERROR_SESSION_CREDENTIAL_CONFLICT = 1219, + ERROR_REMOTE_SESSION_LIMIT_EXCEEDED = 1220, + ERROR_DUP_DOMAINNAME = 1221, + ERROR_NO_NETWORK = 1222, + ERROR_CANCELLED = 1223, + ERROR_USER_MAPPED_FILE = 1224, + ERROR_CONNECTION_REFUSED = 1225, + ERROR_GRACEFUL_DISCONNECT = 1226, + ERROR_ADDRESS_ALREADY_ASSOCIATED = 1227, + ERROR_ADDRESS_NOT_ASSOCIATED = 1228, + ERROR_CONNECTION_INVALID = 1229, + ERROR_CONNECTION_ACTIVE = 1230, + ERROR_NETWORK_UNREACHABLE = 1231, + ERROR_HOST_UNREACHABLE = 1232, + ERROR_PROTOCOL_UNREACHABLE = 1233, + ERROR_PORT_UNREACHABLE = 1234, + ERROR_REQUEST_ABORTED = 1235, + ERROR_CONNECTION_ABORTED = 1236, + ERROR_RETRY = 1237, + ERROR_CONNECTION_COUNT_LIMIT = 1238, + ERROR_LOGIN_TIME_RESTRICTION = 1239, + ERROR_LOGIN_WKSTA_RESTRICTION = 1240, + ERROR_INCORRECT_ADDRESS = 1241, + ERROR_ALREADY_REGISTERED = 1242, + ERROR_SERVICE_NOT_FOUND = 1243, + ERROR_NOT_AUTHENTICATED = 1244, + ERROR_NOT_LOGGED_ON = 1245, + ERROR_CONTINUE = 1246, + ERROR_ALREADY_INITIALIZED = 1247, + ERROR_NO_MORE_DEVICES = 1248, + ERROR_NO_SUCH_SITE = 1249, + ERROR_DOMAIN_CONTROLLER_EXISTS = 1250, + ERROR_ONLY_IF_CONNECTED = 1251, + ERROR_OVERRIDE_NOCHANGES = 1252, + ERROR_BAD_USER_PROFILE = 1253, + ERROR_NOT_SUPPORTED_ON_SBS = 1254, + ERROR_SERVER_SHUTDOWN_IN_PROGRESS = 1255, + ERROR_HOST_DOWN = 1256, + ERROR_NON_ACCOUNT_SID = 1257, + ERROR_NON_DOMAIN_SID = 1258, + ERROR_APPHELP_BLOCK = 1259, + ERROR_ACCESS_DISABLED_BY_POLICY = 1260, + ERROR_REG_NAT_CONSUMPTION = 1261, + ERROR_CSCSHARE_OFFLINE = 1262, + ERROR_PKINIT_FAILURE = 1263, + ERROR_SMARTCARD_SUBSYSTEM_FAILURE = 1264, + ERROR_DOWNGRADE_DETECTED = 1265, + SEC_E_SMARTCARD_CERT_REVOKED = 1266, + SEC_E_ISSUING_CA_UNTRUSTED = 1267, + SEC_E_REVOCATION_OFFLINE_C = 1268, + SEC_E_PKINIT_CLIENT_FAILUR = 1269, + SEC_E_SMARTCARD_CERT_EXPIRED = 1270, + ERROR_MACHINE_LOCKED = 1271, + ERROR_CALLBACK_SUPPLIED_INVALID_DATA = 1273, + ERROR_SYNC_FOREGROUND_REFRESH_REQUIRED = 1274, + ERROR_DRIVER_BLOCKED = 1275, + ERROR_INVALID_IMPORT_OF_NON_DLL = 1276, + ERROR_NOT_ALL_ASSIGNED = 1300, + ERROR_SOME_NOT_MAPPED = 1301, + ERROR_NO_QUOTAS_FOR_ACCOUNT = 1302, + ERROR_LOCAL_USER_SESSION_KEY = 1303, + ERROR_NULL_LM_PASSWORD = 1304, + ERROR_UNKNOWN_REVISION = 1305, + ERROR_REVISION_MISMATCH = 1306, + ERROR_INVALID_OWNER = 1307, + ERROR_INVALID_PRIMARY_GROUP = 1308, + ERROR_NO_IMPERSONATION_TOKEN = 1309, + ERROR_CANT_DISABLE_MANDATORY = 1310, + ERROR_NO_LOGON_SERVERS = 1311, + ERROR_NO_SUCH_LOGON_SESSION = 1312, + ERROR_NO_SUCH_PRIVILEGE = 1313, + ERROR_PRIVILEGE_NOT_HELD = 1314, + ERROR_INVALID_ACCOUNT_NAME = 1315, + ERROR_USER_EXISTS = 1316, + ERROR_NO_SUCH_USER = 1317, + ERROR_GROUP_EXISTS = 1318, + ERROR_NO_SUCH_GROUP = 1319, + ERROR_MEMBER_IN_GROUP = 1320, + ERROR_MEMBER_NOT_IN_GROUP = 1321, + ERROR_LAST_ADMIN = 1322, + ERROR_WRONG_PASSWORD = 1323, + ERROR_ILL_FORMED_PASSWORD = 1324, + ERROR_PASSWORD_RESTRICTION = 1325, + ERROR_LOGON_FAILURE = 1326, + ERROR_ACCOUNT_RESTRICTION = 1327, + ERROR_INVALID_LOGON_HOURS = 1328, + ERROR_INVALID_WORKSTATION = 1329, + ERROR_PASSWORD_EXPIRED = 1330, + ERROR_ACCOUNT_DISABLED = 1331, + ERROR_NONE_MAPPED = 1332, + ERROR_TOO_MANY_LUIDS_REQUESTED = 1333, + ERROR_LUIDS_EXHAUSTED = 1334, + ERROR_INVALID_SUB_AUTHORITY = 1335, + ERROR_INVALID_ACL = 1336, + ERROR_INVALID_SID = 1337, + ERROR_INVALID_SECURITY_DESCR = 1338, + ERROR_BAD_INHERITANCE_ACL = 1340, + ERROR_SERVER_DISABLED = 1341, + ERROR_SERVER_NOT_DISABLED = 1342, + ERROR_INVALID_ID_AUTHORITY = 1343, + ERROR_ALLOTTED_SPACE_EXCEEDED = 1344, + ERROR_INVALID_GROUP_ATTRIBUTES = 1345, + ERROR_BAD_IMPERSONATION_LEVEL = 1346, + ERROR_CANT_OPEN_ANONYMOUS = 1347, + ERROR_BAD_VALIDATION_CLASS = 1348, + ERROR_BAD_TOKEN_TYPE = 1349, + ERROR_NO_SECURITY_ON_OBJECT = 1350, + ERROR_CANT_ACCESS_DOMAIN_INFO = 1351, + ERROR_INVALID_SERVER_STATE = 1352, + ERROR_INVALID_DOMAIN_STATE = 1353, + ERROR_INVALID_DOMAIN_ROLE = 1354, + ERROR_NO_SUCH_DOMAIN = 1355, + ERROR_DOMAIN_EXISTS = 1356, + ERROR_DOMAIN_LIMIT_EXCEEDED = 1357, + ERROR_INTERNAL_DB_CORRUPTION = 1358, + ERROR_INTERNAL_ERROR = 1359, + ERROR_GENERIC_NOT_MAPPED = 1360, + ERROR_BAD_DESCRIPTOR_FORMAT = 1361, + ERROR_NOT_LOGON_PROCESS = 1362, + ERROR_LOGON_SESSION_EXISTS = 1363, + ERROR_NO_SUCH_PACKAGE = 1364, + ERROR_BAD_LOGON_SESSION_STATE = 1365, + ERROR_LOGON_SESSION_COLLISION = 1366, + ERROR_INVALID_LOGON_TYPE = 1367, + ERROR_CANNOT_IMPERSONATE = 1368, + ERROR_RXACT_INVALID_STATE = 1369, + ERROR_RXACT_COMMIT_FAILURE = 1370, + ERROR_SPECIAL_ACCOUNT = 1371, + ERROR_SPECIAL_GROUP = 1372, + ERROR_SPECIAL_USER = 1373, + ERROR_MEMBERS_PRIMARY_GROUP = 1374, + ERROR_TOKEN_ALREADY_IN_USE = 1375, + ERROR_NO_SUCH_ALIAS = 1376, + ERROR_MEMBER_NOT_IN_ALIAS = 1377, + ERROR_MEMBER_IN_ALIAS = 1378, + ERROR_ALIAS_EXISTS = 1379, + ERROR_LOGON_NOT_GRANTED = 1380, + ERROR_TOO_MANY_SECRETS = 1381, + ERROR_SECRET_TOO_LONG = 1382, + ERROR_INTERNAL_DB_ERROR = 1383, + ERROR_TOO_MANY_CONTEXT_IDS = 1384, + ERROR_LOGON_TYPE_NOT_GRANTED = 1385, + ERROR_NT_CROSS_ENCRYPTION_REQUIRED = 1386, + ERROR_NO_SUCH_MEMBER = 1387, + ERROR_INVALID_MEMBER = 1388, + ERROR_TOO_MANY_SIDS = 1389, + ERROR_LM_CROSS_ENCRYPTION_REQUIRED = 1390, + ERROR_NO_INHERITANCE = 1391, + ERROR_FILE_CORRUPT = 1392, + ERROR_DISK_CORRUPT = 1393, + ERROR_NO_USER_SESSION_KEY = 1394, + ERROR_LICENSE_QUOTA_EXCEEDED = 1395, + ERROR_WRONG_TARGET_NAME = 1396, + ERROR_MUTUAL_AUTH_FAILED = 1397, + ERROR_TIME_SKEW = 1398, + ERROR_CURRENT_DOMAIN_NOT_ALLOWED = 1399, + ERROR_INVALID_WINDOW_HANDLE = 1400, + ERROR_INVALID_MENU_HANDLE = 1401, + ERROR_INVALID_CURSOR_HANDLE = 1402, + ERROR_INVALID_ACCEL_HANDLE = 1403, + ERROR_INVALID_HOOK_HANDLE = 1404, + ERROR_INVALID_DWP_HANDLE = 1405, + ERROR_TLW_WITH_WSCHILD = 1406, + ERROR_CANNOT_FIND_WND_CLASS = 1407, + ERROR_WINDOW_OF_OTHER_THREAD = 1408, + ERROR_HOTKEY_ALREADY_REGISTERED = 1409, + ERROR_CLASS_ALREADY_EXISTS = 1410, + ERROR_CLASS_DOES_NOT_EXIST = 1411, + ERROR_CLASS_HAS_WINDOWS = 1412, + ERROR_INVALID_INDEX = 1413, + ERROR_INVALID_ICON_HANDLE = 1414, + ERROR_PRIVATE_DIALOG_INDEX = 1415, + ERROR_LISTBOX_ID_NOT_FOUND = 1416, + ERROR_NO_WILDCARD_CHARACTERS = 1417, + ERROR_CLIPBOARD_NOT_OPEN = 1418, + ERROR_HOTKEY_NOT_REGISTERED = 1419, + ERROR_WINDOW_NOT_DIALOG = 1420, + ERROR_CONTROL_ID_NOT_FOUND = 1421, + ERROR_INVALID_COMBOBOX_MESSAGE = 1422, + ERROR_WINDOW_NOT_COMBOBOX = 1423, + ERROR_INVALID_EDIT_HEIGHT = 1424, + ERROR_DC_NOT_FOUND = 1425, + ERROR_INVALID_HOOK_FILTER = 1426, + ERROR_INVALID_FILTER_PROC = 1427, + ERROR_HOOK_NEEDS_HMOD = 1428, + ERROR_GLOBAL_ONLY_HOOK = 1429, + ERROR_JOURNAL_HOOK_SET = 1430, + ERROR_HOOK_NOT_INSTALLED = 1431, + ERROR_INVALID_LB_MESSAGE = 1432, + ERROR_SETCOUNT_ON_BAD_LB = 1433, + ERROR_LB_WITHOUT_TABSTOPS = 1434, + ERROR_DESTROY_OBJECT_OF_OTHER_THREAD = 1435, + ERROR_CHILD_WINDOW_MENU = 1436, + ERROR_NO_SYSTEM_MENU = 1437, + ERROR_INVALID_MSGBOX_STYLE = 1438, + ERROR_INVALID_SPI_VALUE = 1439, + ERROR_SCREEN_ALREADY_LOCKED = 1440, + ERROR_HWNDS_HAVE_DIFF_PARENT = 1441, + ERROR_NOT_CHILD_WINDOW = 1442, + ERROR_INVALID_GW_COMMAND = 1443, + ERROR_INVALID_THREAD_ID = 1444, + ERROR_NON_MDICHILD_WINDOW = 1445, + ERROR_POPUP_ALREADY_ACTIVE = 1446, + ERROR_NO_SCROLLBARS = 1447, + ERROR_INVALID_SCROLLBAR_RANGE = 1448, + ERROR_INVALID_SHOWWIN_COMMAND = 1449, + ERROR_NO_SYSTEM_RESOURCES = 1450, + ERROR_NONPAGED_SYSTEM_RESOURCES = 1451, + ERROR_PAGED_SYSTEM_RESOURCES = 1452, + ERROR_WORKING_SET_QUOTA = 1453, + ERROR_PAGEFILE_QUOTA = 1454, + ERROR_COMMITMENT_LIMIT = 1455, + ERROR_MENU_ITEM_NOT_FOUND = 1456, + ERROR_INVALID_KEYBOARD_HANDLE = 1457, + ERROR_HOOK_TYPE_NOT_ALLOWED = 1458, + ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION = 1459, + ERROR_TIMEOUT = 1460, + ERROR_INVALID_MONITOR_HANDLE = 1461, + ERROR_EVENTLOG_FILE_CORRUPT = 1500, + ERROR_EVENTLOG_CANT_START = 1501, + ERROR_LOG_FILE_FULL = 1502, + ERROR_EVENTLOG_FILE_CHANGED = 1503, + ERROR_INSTALL_SERVICE_FAILURE = 1601, + ERROR_INSTALL_USEREXIT = 1602, + ERROR_INSTALL_FAILURE = 1603, + ERROR_INSTALL_SUSPEND = 1604, + ERROR_UNKNOWN_PRODUCT = 1605, + ERROR_UNKNOWN_FEATURE = 1606, + ERROR_UNKNOWN_COMPONENT = 1607, + ERROR_UNKNOWN_PROPERTY = 1608, + ERROR_INVALID_HANDLE_STATE = 1609, + ERROR_BAD_CONFIGURATION = 1610, + ERROR_INDEX_ABSENT = 1611, + ERROR_INSTALL_SOURCE_ABSENT = 1612, + ERROR_INSTALL_PACKAGE_VERSION = 1613, + ERROR_PRODUCT_UNINSTALLED = 1614, + ERROR_BAD_QUERY_SYNTAX = 1615, + ERROR_INVALID_FIELD = 1616, + ERROR_DEVICE_REMOVED = 1617, + ERROR_INSTALL_ALREADY_RUNNING = 1618, + ERROR_INSTALL_PACKAGE_OPEN_FAILED = 1619, + ERROR_INSTALL_PACKAGE_INVALID = 1620, + ERROR_INSTALL_UI_FAILURE = 1621, + ERROR_INSTALL_LOG_FAILURE = 1622, + ERROR_INSTALL_LANGUAGE_UNSUPPORTED = 1623, + ERROR_INSTALL_TRANSFORM_FAILURE = 1624, + ERROR_INSTALL_PACKAGE_REJECTED = 1625, + ERROR_FUNCTION_NOT_CALLED = 1626, + ERROR_FUNCTION_FAILED = 1627, + ERROR_INVALID_TABLE = 1628, + ERROR_DATATYPE_MISMATCH = 1629, + ERROR_UNSUPPORTED_TYPE = 1630, + ERROR_CREATE_FAILED = 1631, + ERROR_INSTALL_TEMP_UNWRITABLE = 1632, + ERROR_INSTALL_PLATFORM_UNSUPPORTED = 1633, + ERROR_INSTALL_NOTUSED = 1634, + ERROR_PATCH_PACKAGE_OPEN_FAILED = 1635, + ERROR_PATCH_PACKAGE_INVALID = 1636, + ERROR_PATCH_PACKAGE_UNSUPPORTED = 1637, + ERROR_PRODUCT_VERSION = 1638, + ERROR_INVALID_COMMAND_LINE = 1639, + ERROR_INSTALL_REMOTE_DISALLOWED = 1640, + ERROR_SUCCESS_REBOOT_INITIATED = 1641, + ERROR_PATCH_TARGET_NOT_FOUND = 1642, + ERROR_PATCH_PACKAGE_REJECTED = 1643, + ERROR_INSTALL_TRANSFORM_REJECTED = 1644, + RPC_S_INVALID_STRING_BINDING = 1700, + RPC_S_WRONG_KIND_OF_BINDING = 1701, + RPC_S_INVALID_BINDING = 1702, + RPC_S_PROTSEQ_NOT_SUPPORTED = 1703, + RPC_S_INVALID_RPC_PROTSEQ = 1704, + RPC_S_INVALID_STRING_UUID = 1705, + RPC_S_INVALID_ENDPOINT_FORMAT = 1706, + RPC_S_INVALID_NET_ADDR = 1707, + RPC_S_NO_ENDPOINT_FOUND = 1708, + RPC_S_INVALID_TIMEOUT = 1709, + RPC_S_OBJECT_NOT_FOUND = 1710, + RPC_S_ALREADY_REGISTERED = 1711, + RPC_S_TYPE_ALREADY_REGISTERED = 1712, + RPC_S_ALREADY_LISTENING = 1713, + RPC_S_NO_PROTSEQS_REGISTERED = 1714, + RPC_S_NOT_LISTENING = 1715, + RPC_S_UNKNOWN_MGR_TYPE = 1716, + RPC_S_UNKNOWN_IF = 1717, + RPC_S_NO_BINDINGS = 1718, + RPC_S_NO_PROTSEQS = 1719, + RPC_S_CANT_CREATE_ENDPOINT = 1720, + RPC_S_OUT_OF_RESOURCES = 1721, + RPC_S_SERVER_UNAVAILABLE = 1722, + RPC_S_SERVER_TOO_BUSY = 1723, + RPC_S_INVALID_NETWORK_OPTIONS = 1724, + RPC_S_NO_CALL_ACTIVE = 1725, + RPC_S_CALL_FAILED = 1726, + RPC_S_CALL_FAILED_DNE = 1727, + RPC_S_PROTOCOL_ERROR = 1728, + RPC_S_UNSUPPORTED_TRANS_SYN = 1730, + RPC_S_UNSUPPORTED_TYPE = 1732, + RPC_S_INVALID_TAG = 1733, + RPC_S_INVALID_BOUND = 1734, + RPC_S_NO_ENTRY_NAME = 1735, + RPC_S_INVALID_NAME_SYNTAX = 1736, + RPC_S_UNSUPPORTED_NAME_SYNTAX = 1737, + RPC_S_UUID_NO_ADDRESS = 1739, + RPC_S_DUPLICATE_ENDPOINT = 1740, + RPC_S_UNKNOWN_AUTHN_TYPE = 1741, + RPC_S_MAX_CALLS_TOO_SMALL = 1742, + RPC_S_STRING_TOO_LONG = 1743, + RPC_S_PROTSEQ_NOT_FOUND = 1744, + RPC_S_PROCNUM_OUT_OF_RANGE = 1745, + RPC_S_BINDING_HAS_NO_AUTH = 1746, + RPC_S_UNKNOWN_AUTHN_SERVICE = 1747, + RPC_S_UNKNOWN_AUTHN_LEVEL = 1748, + RPC_S_INVALID_AUTH_IDENTITY = 1749, + RPC_S_UNKNOWN_AUTHZ_SERVICE = 1750, + EPT_S_INVALID_ENTRY = 1751, + EPT_S_CANT_PERFORM_OP = 1752, + EPT_S_NOT_REGISTERED = 1753, + RPC_S_NOTHING_TO_EXPORT = 1754, + RPC_S_INCOMPLETE_NAME = 1755, + RPC_S_INVALID_VERS_OPTION = 1756, + RPC_S_NO_MORE_MEMBERS = 1757, + RPC_S_NOT_ALL_OBJS_UNEXPORTED = 1758, + RPC_S_INTERFACE_NOT_FOUND = 1759, + RPC_S_ENTRY_ALREADY_EXISTS = 1760, + RPC_S_ENTRY_NOT_FOUND = 1761, + RPC_S_NAME_SERVICE_UNAVAILABLE = 1762, + RPC_S_INVALID_NAF_ID = 1763, + RPC_S_CANNOT_SUPPORT = 1764, + RPC_S_NO_CONTEXT_AVAILABLE = 1765, + RPC_S_INTERNAL_ERROR = 1766, + RPC_S_ZERO_DIVIDE = 1767, + RPC_S_ADDRESS_ERROR = 1768, + RPC_S_FP_DIV_ZERO = 1769, + RPC_S_FP_UNDERFLOW = 1770, + RPC_S_FP_OVERFLOW = 1771, + RPC_X_NO_MORE_ENTRIES = 1772, + RPC_X_SS_CHAR_TRANS_OPEN_FAIL = 1773, + RPC_X_SS_CHAR_TRANS_SHORT_FILE = 1774, + RPC_X_SS_IN_NULL_CONTEXT = 1775, + RPC_X_SS_CONTEXT_DAMAGED = 1777, + RPC_X_SS_HANDLES_MISMATCH = 1778, + RPC_X_SS_CANNOT_GET_CALL_HANDLE = 1779, + RPC_X_NULL_REF_POINTER = 1780, + RPC_X_ENUM_VALUE_OUT_OF_RANGE = 1781, + RPC_X_BYTE_COUNT_TOO_SMALL = 1782, + RPC_X_BAD_STUB_DATA = 1783, + ERROR_INVALID_USER_BUFFER = 1784, + ERROR_UNRECOGNIZED_MEDIA = 1785, + ERROR_NO_TRUST_LSA_SECRET = 1786, + ERROR_NO_TRUST_SAM_ACCOUNT = 1787, + ERROR_TRUSTED_DOMAIN_FAILURE = 1788, + ERROR_TRUSTED_RELATIONSHIP_FAILURE = 1789, + ERROR_TRUST_FAILURE = 1790, + RPC_S_CALL_IN_PROGRESS = 1791, + ERROR_NETLOGON_NOT_STARTED = 1792, + ERROR_ACCOUNT_EXPIRED = 1793, + ERROR_REDIRECTOR_HAS_OPEN_HANDLES = 1794, + ERROR_PRINTER_DRIVER_ALREADY_INSTALLED = 1795, + ERROR_UNKNOWN_PORT = 1796, + ERROR_UNKNOWN_PRINTER_DRIVER = 1797, + ERROR_UNKNOWN_PRINTPROCESSOR = 1798, + ERROR_INVALID_SEPARATOR_FILE = 1799, + ERROR_INVALID_PRIORITY = 1800, + ERROR_INVALID_PRINTER_NAME = 1801, + ERROR_PRINTER_ALREADY_EXISTS = 1802, + ERROR_INVALID_PRINTER_COMMAND = 1803, + ERROR_INVALID_DATATYPE = 1804, + ERROR_INVALID_ENVIRONMENT = 1805, + RPC_S_NO_MORE_BINDINGS = 1806, + ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT = 1807, + ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT = 1808, + ERROR_NOLOGON_SERVER_TRUST_ACCOUNT = 1809, + ERROR_DOMAIN_TRUST_INCONSISTENT = 1810, + ERROR_SERVER_HAS_OPEN_HANDLES = 1811, + ERROR_RESOURCE_DATA_NOT_FOUND = 1812, + ERROR_RESOURCE_TYPE_NOT_FOUND = 1813, + ERROR_RESOURCE_NAME_NOT_FOUND = 1814, + ERROR_RESOURCE_LANG_NOT_FOUND = 1815, + ERROR_NOT_ENOUGH_QUOTA = 1816, + RPC_S_NO_INTERFACES = 1817, + RPC_S_CALL_CANCELLED = 1818, + RPC_S_BINDING_INCOMPLETE = 1819, + RPC_S_COMM_FAILURE = 1820, + RPC_S_UNSUPPORTED_AUTHN_LEVEL = 1821, + RPC_S_NO_PRINC_NAME = 1822, + RPC_S_NOT_RPC_ERROR = 1823, + RPC_S_UUID_LOCAL_ONLY = 1824, + RPC_S_SEC_PKG_ERROR = 1825, + RPC_S_NOT_CANCELLED = 1826, + RPC_X_INVALID_ES_ACTION = 1827, + RPC_X_WRONG_ES_VERSION = 1828, + RPC_X_WRONG_STUB_VERSION = 1829, + RPC_X_INVALID_PIPE_OBJECT = 1830, + RPC_X_WRONG_PIPE_ORDER = 1831, + RPC_X_WRONG_PIPE_VERSION = 1832, + RPC_S_GROUP_MEMBER_NOT_FOUND = 1898, + EPT_S_CANT_CREATE = 1899, + RPC_S_INVALID_OBJECT = 1900, + ERROR_INVALID_TIME = 1901, + ERROR_INVALID_FORM_NAME = 1902, + ERROR_INVALID_FORM_SIZE = 1903, + ERROR_ALREADY_WAITING = 1904, + ERROR_PRINTER_DELETED = 1905, + ERROR_INVALID_PRINTER_STATE = 1906, + ERROR_PASSWORD_MUST_CHANGE = 1907, + ERROR_DOMAIN_CONTROLLER_NOT_FOUND = 1908, + ERROR_ACCOUNT_LOCKED_OUT = 1909, + OR_INVALID_OXID = 1910, + OR_INVALID_OID = 1911, + OR_INVALID_SET = 1912, + RPC_S_SEND_INCOMPLETE = 1913, + RPC_S_INVALID_ASYNC_HANDLE = 1914, + RPC_S_INVALID_ASYNC_CALL = 1915, + RPC_X_PIPE_CLOSED = 1916, + RPC_X_PIPE_DISCIPLINE_ERROR = 1917, + RPC_X_PIPE_EMPTY = 1918, + ERROR_NO_SITENAME = 1919, + ERROR_CANT_ACCESS_FILE = 1920, + ERROR_CANT_RESOLVE_FILENAME = 1921, + RPC_S_ENTRY_TYPE_MISMATCH = 1922, + RPC_S_NOT_ALL_OBJS_EXPORTED = 1923, + RPC_S_INTERFACE_NOT_EXPORTED = 1924, + RPC_S_PROFILE_NOT_ADDED = 1925, + RPC_S_PRF_ELT_NOT_ADDED = 1926, + RPC_S_PRF_ELT_NOT_REMOVED = 1927, + RPC_S_GRP_ELT_NOT_ADDED = 1928, + RPC_S_GRP_ELT_NOT_REMOVED = 1929, + ERROR_KM_DRIVER_BLOCKED = 1930, + ERROR_CONTEXT_EXPIRED = 1931, + ERROR_INVALID_PIXEL_FORMAT = 2000, + ERROR_BAD_DRIVER = 2001, + ERROR_INVALID_WINDOW_STYLE = 2002, + ERROR_METAFILE_NOT_SUPPORTED = 2003, + ERROR_TRANSFORM_NOT_SUPPORTED = 2004, + ERROR_CLIPPING_NOT_SUPPORTED = 2005, + ERROR_INVALID_CMM = 2010, + ERROR_INVALID_PROFILE = 2011, + ERROR_TAG_NOT_FOUND = 2012, + ERROR_TAG_NOT_PRESENT = 2013, + ERROR_DUPLICATE_TAG = 2014, + ERROR_PROFILE_NOT_ASSOCIATED_WITH_DEVICE = 2015, + ERROR_PROFILE_NOT_FOUND = 2016, + ERROR_INVALID_COLORSPACE = 2017, + ERROR_ICM_NOT_ENABLED = 2018, + ERROR_DELETING_ICM_XFORM = 2019, + ERROR_INVALID_TRANSFORM = 2020, + ERROR_COLORSPACE_MISMATCH = 2021, + ERROR_INVALID_COLORINDEX = 2022, + ERROR_CONNECTED_OTHER_PASSWORD = 2108, + ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT = 2109, + ERROR_BAD_USERNAME = 2202, + ERROR_NOT_CONNECTED = 2250, + ERROR_OPEN_FILES = 2401, + ERROR_ACTIVE_CONNECTIONS = 2402, + ERROR_DEVICE_IN_USE = 2404, + ERROR_UNKNOWN_PRINT_MONITOR = 3000, + ERROR_PRINTER_DRIVER_IN_USE = 3001, + ERROR_SPOOL_FILE_NOT_FOUND = 3002, + ERROR_SPL_NO_STARTDOC = 3003, + ERROR_SPL_NO_ADDJOB = 3004, + ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED = 3005, + ERROR_PRINT_MONITOR_ALREADY_INSTALLED = 3006, + ERROR_INVALID_PRINT_MONITOR = 3007, + ERROR_PRINT_MONITOR_IN_USE = 3008, + ERROR_PRINTER_HAS_JOBS_QUEUED = 3009, + ERROR_SUCCESS_REBOOT_REQUIRED = 3010, + ERROR_SUCCESS_RESTART_REQUIRED = 3011, + ERROR_PRINTER_NOT_FOUND = 3012, + ERROR_PRINTER_DRIVER_WARNED = 3013, + ERROR_PRINTER_DRIVER_BLOCKED = 3014, + ERROR_WINS_INTERNAL = 4000, + ERROR_CAN_NOT_DEL_LOCAL_WINS = 4001, + ERROR_STATIC_INIT = 4002, + ERROR_INC_BACKUP = 4003, + ERROR_FULL_BACKUP = 4004, + ERROR_REC_NON_EXISTENT = 4005, + ERROR_RPL_NOT_ALLOWED = 4006, + ERROR_DHCP_ADDRESS_CONFLICT = 4100, + ERROR_WMI_GUID_NOT_FOUND = 4200, + ERROR_WMI_INSTANCE_NOT_FOUND = 4201, + ERROR_WMI_ITEMID_NOT_FOUND = 4202, + ERROR_WMI_TRY_AGAIN = 4203, + ERROR_WMI_DP_NOT_FOUND = 4204, + ERROR_WMI_UNRESOLVED_INSTANCE_REF = 4205, + ERROR_WMI_ALREADY_ENABLED = 4206, + ERROR_WMI_GUID_DISCONNECTED = 4207, + ERROR_WMI_SERVER_UNAVAILABLE = 4208, + ERROR_WMI_DP_FAILED = 4209, + ERROR_WMI_INVALID_MOF = 4210, + ERROR_WMI_INVALID_REGINFO = 4211, + ERROR_WMI_ALREADY_DISABLED = 4212, + ERROR_WMI_READ_ONLY = 4213, + ERROR_WMI_SET_FAILURE = 4214, + ERROR_INVALID_MEDIA = 4300, + ERROR_INVALID_LIBRARY = 4301, + ERROR_INVALID_MEDIA_POOL = 4302, + ERROR_DRIVE_MEDIA_MISMATCH = 4303, + ERROR_MEDIA_OFFLINE = 4304, + ERROR_LIBRARY_OFFLINE = 4305, + ERROR_EMPTY = 4306, + ERROR_NOT_EMPTY = 4307, + ERROR_MEDIA_UNAVAILABLE = 4308, + ERROR_RESOURCE_DISABLED = 4309, + ERROR_INVALID_CLEANER = 4310, + ERROR_UNABLE_TO_CLEAN = 4311, + ERROR_OBJECT_NOT_FOUND = 4312, + ERROR_DATABASE_FAILURE = 4313, + ERROR_DATABASE_FULL = 4314, + ERROR_MEDIA_INCOMPATIBLE = 4315, + ERROR_RESOURCE_NOT_PRESENT = 4316, + ERROR_INVALID_OPERATION = 4317, + ERROR_MEDIA_NOT_AVAILABLE = 4318, + ERROR_DEVICE_NOT_AVAILABLE = 4319, + ERROR_REQUEST_REFUSED = 4320, + ERROR_INVALID_DRIVE_OBJECT = 4321, + ERROR_LIBRARY_FULL = 4322, + ERROR_MEDIUM_NOT_ACCESSIBLE = 4323, + ERROR_UNABLE_TO_LOAD_MEDIUM = 4324, + ERROR_UNABLE_TO_INVENTORY_DRIVE = 4325, + ERROR_UNABLE_TO_INVENTORY_SLOT = 4326, + ERROR_UNABLE_TO_INVENTORY_TRANSPORT = 4327, + ERROR_TRANSPORT_FULL = 4328, + ERROR_CONTROLLING_IEPORT = 4329, + ERROR_UNABLE_TO_EJECT_MOUNTED_MEDIA = 4330, + ERROR_CLEANER_SLOT_SET = 4331, + ERROR_CLEANER_SLOT_NOT_SET = 4332, + ERROR_CLEANER_CARTRIDGE_SPENT = 4333, + ERROR_UNEXPECTED_OMID = 4334, + ERROR_CANT_DELETE_LAST_ITEM = 4335, + ERROR_MESSAGE_EXCEEDS_MAX_SIZE = 4336, + ERROR_VOLUME_CONTAINS_SYS_FILES = 4337, + ERROR_INDIGENOUS_TYPE = 4338, + ERROR_NO_SUPPORTING_DRIVES = 4339, + ERROR_CLEANER_CARTRIDGE_INSTALLED = 4340, + ERROR_FILE_OFFLINE = 4350, + ERROR_REMOTE_STORAGE_NOT_ACTIVE = 4351, + ERROR_REMOTE_STORAGE_MEDIA_ERROR = 4352, + ERROR_NOT_A_REPARSE_POINT = 4390, + ERROR_REPARSE_ATTRIBUTE_CONFLICT = 4391, + ERROR_INVALID_REPARSE_DATA = 4392, + ERROR_REPARSE_TAG_INVALID = 4393, + ERROR_REPARSE_TAG_MISMATCH = 4394, + ERROR_VOLUME_NOT_SIS_ENABLED = 4500, + ERROR_DEPENDENT_RESOURCE_EXISTS = 5001, + ERROR_DEPENDENCY_NOT_FOUND = 5002, + ERROR_DEPENDENCY_ALREADY_EXISTS = 5003, + ERROR_RESOURCE_NOT_ONLINE = 5004, + ERROR_HOST_NODE_NOT_AVAILABLE = 5005, + ERROR_RESOURCE_NOT_AVAILABLE = 5006, + ERROR_RESOURCE_NOT_FOUND = 5007, + ERROR_SHUTDOWN_CLUSTER = 5008, + ERROR_CANT_EVICT_ACTIVE_NODE = 5009, + ERROR_OBJECT_ALREADY_EXISTS = 5010, + ERROR_OBJECT_IN_LIST = 5011, + ERROR_GROUP_NOT_AVAILABLE = 5012, + ERROR_GROUP_NOT_FOUND = 5013, + ERROR_GROUP_NOT_ONLINE = 5014, + ERROR_HOST_NODE_NOT_RESOURCE_OWNER = 5015, + ERROR_HOST_NODE_NOT_GROUP_OWNER = 5016, + ERROR_RESMON_CREATE_FAILED = 5017, + ERROR_RESMON_ONLINE_FAILED = 5018, + ERROR_RESOURCE_ONLINE = 5019, + ERROR_QUORUM_RESOURCE = 5020, + ERROR_NOT_QUORUM_CAPABLE = 5021, + ERROR_CLUSTER_SHUTTING_DOWN = 5022, + ERROR_INVALID_STATE = 5023, + ERROR_RESOURCE_PROPERTIES_STORED = 5024, + ERROR_NOT_QUORUM_CLASS = 5025, + ERROR_CORE_RESOURCE = 5026, + ERROR_QUORUM_RESOURCE_ONLINE_FAILED = 5027, + ERROR_QUORUMLOG_OPEN_FAILED = 5028, + ERROR_CLUSTERLOG_CORRUPT = 5029, + ERROR_CLUSTERLOG_RECORD_EXCEEDS_MAXSIZE = 5030, + ERROR_CLUSTERLOG_EXCEEDS_MAXSIZE = 5031, + ERROR_CLUSTERLOG_CHKPOINT_NOT_FOUND = 5032, + ERROR_CLUSTERLOG_NOT_ENOUGH_SPACE = 5033, + ERROR_QUORUM_OWNER_ALIVE = 5034, + ERROR_NETWORK_NOT_AVAILABLE = 5035, + ERROR_NODE_NOT_AVAILABLE = 5036, + ERROR_ALL_NODES_NOT_AVAILABLE = 5037, + ERROR_RESOURCE_FAILED = 5038, + ERROR_CLUSTER_INVALID_NODE = 5039, + ERROR_CLUSTER_NODE_EXISTS = 5040, + ERROR_CLUSTER_JOIN_IN_PROGRESS = 5041, + ERROR_CLUSTER_NODE_NOT_FOUND = 5042, + ERROR_CLUSTER_LOCAL_NODE_NOT_FOUND = 5043, + ERROR_CLUSTER_NETWORK_EXISTS = 5044, + ERROR_CLUSTER_NETWORK_NOT_FOUND = 5045, + ERROR_CLUSTER_NETINTERFACE_EXISTS = 5046, + ERROR_CLUSTER_NETINTERFACE_NOT_FOUND = 5047, + ERROR_CLUSTER_INVALID_REQUEST = 5048, + ERROR_CLUSTER_INVALID_NETWORK_PROVIDER = 5049, + ERROR_CLUSTER_NODE_DOWN = 5050, + ERROR_CLUSTER_NODE_UNREACHABLE = 5051, + ERROR_CLUSTER_NODE_NOT_MEMBER = 5052, + ERROR_CLUSTER_JOIN_NOT_IN_PROGRESS = 5053, + ERROR_CLUSTER_INVALID_NETWORK = 5054, + ERROR_CLUSTER_NODE_UP = 5056, + ERROR_CLUSTER_IPADDR_IN_USE = 5057, + ERROR_CLUSTER_NODE_NOT_PAUSED = 5058, + ERROR_CLUSTER_NO_SECURITY_CONTEXT = 5059, + ERROR_CLUSTER_NETWORK_NOT_INTERNAL = 5060, + ERROR_CLUSTER_NODE_ALREADY_UP = 5061, + ERROR_CLUSTER_NODE_ALREADY_DOWN = 5062, + ERROR_CLUSTER_NETWORK_ALREADY_ONLINE = 5063, + ERROR_CLUSTER_NETWORK_ALREADY_OFFLINE = 5064, + ERROR_CLUSTER_NODE_ALREADY_MEMBER = 5065, + ERROR_CLUSTER_LAST_INTERNAL_NETWORK = 5066, + ERROR_CLUSTER_NETWORK_HAS_DEPENDENTS = 5067, + ERROR_INVALID_OPERATION_ON_QUORUM = 5068, + ERROR_DEPENDENCY_NOT_ALLOWED = 5069, + ERROR_CLUSTER_NODE_PAUSED = 5070, + ERROR_NODE_CANT_HOST_RESOURCE = 5071, + ERROR_CLUSTER_NODE_NOT_READY = 5072, + ERROR_CLUSTER_NODE_SHUTTING_DOWN = 5073, + ERROR_CLUSTER_JOIN_ABORTED = 5074, + ERROR_CLUSTER_INCOMPATIBLE_VERSIONS = 5075, + ERROR_CLUSTER_MAXNUM_OF_RESOURCES_EXCEEDED = 5076, + ERROR_CLUSTER_SYSTEM_CONFIG_CHANGED = 5077, + ERROR_CLUSTER_RESOURCE_TYPE_NOT_FOUND = 5078, + ERROR_CLUSTER_RESTYPE_NOT_SUPPORTED = 5079, + ERROR_CLUSTER_RESNAME_NOT_FOUND = 5080, + ERROR_CLUSTER_NO_RPC_PACKAGES_REGISTERED = 5081, + ERROR_CLUSTER_OWNER_NOT_IN_PREFLIST = 5082, + ERROR_CLUSTER_DATABASE_SEQMISMATCH = 5083, + ERROR_RESMON_INVALID_STATE = 5084, + ERROR_CLUSTER_GUM_NOT_LOCKER = 5085, + ERROR_QUORUM_DISK_NOT_FOUND = 5086, + ERROR_DATABASE_BACKUP_CORRUPT = 5087, + ERROR_CLUSTER_NODE_ALREADY_HAS_DFS_ROOT = 5088, + ERROR_RESOURCE_PROPERTY_UNCHANGEABLE = 5089, + ERROR_CLUSTER_MEMBERSHIP_INVALID_STATE = 5890, + ERROR_CLUSTER_QUORUMLOG_NOT_FOUND = 5891, + ERROR_CLUSTER_MEMBERSHIP_HALT = 5892, + ERROR_CLUSTER_INSTANCE_ID_MISMATCH = 5893, + ERROR_CLUSTER_NETWORK_NOT_FOUND_FOR_IP = 5894, + ERROR_CLUSTER_PROPERTY_DATA_TYPE_MISMATCH = 5895, + ERROR_CLUSTER_EVICT_WITHOUT_CLEANUP = 5896, + ERROR_CLUSTER_PARAMETER_MISMATCH = 5897, + ERROR_NODE_CANNOT_BE_CLUSTERED = 5898, + ERROR_CLUSTER_WRONG_OS_VERSION = 5899, + ERROR_CLUSTER_CANT_CREATE_DUP_CLUSTER_NAME = 5900, + ERROR_ENCRYPTION_FAILED = 6000, + ERROR_DECRYPTION_FAILED = 6001, + ERROR_FILE_ENCRYPTED = 6002, + ERROR_NO_RECOVERY_POLICY = 6003, + ERROR_NO_EFS = 6004, + ERROR_WRONG_EFS = 6005, + ERROR_NO_USER_KEYS = 6006, + ERROR_FILE_NOT_ENCRYPTED = 6007, + ERROR_NOT_EXPORT_FORMAT = 6008, + ERROR_FILE_READ_ONLY = 6009, + ERROR_DIR_EFS_DISALLOWED = 6010, + ERROR_EFS_SERVER_NOT_TRUSTED = 6011, + ERROR_BAD_RECOVERY_POLICY = 6012, + ERROR_EFS_ALG_BLOB_TOO_BIG = 6013, + ERROR_VOLUME_NOT_SUPPORT_EFS = 6014, + ERROR_EFS_DISABLED = 6015, + ERROR_EFS_VERSION_NOT_SUPPORT = 6016, + ERROR_NO_BROWSER_SERVERS_FOUND = 6118, + SCHED_E_SERVICE_NOT_LOCALSYSTEM = 6200, + ERROR_CTX_WINSTATION_NAME_INVALID = 7001, + ERROR_CTX_INVALID_PD = 7002, + ERROR_CTX_PD_NOT_FOUND = 7003, + ERROR_CTX_WD_NOT_FOUND = 7004, + ERROR_CTX_CANNOT_MAKE_EVENTLOG_ENTRY = 7005, + ERROR_CTX_SERVICE_NAME_COLLISION = 7006, + ERROR_CTX_CLOSE_PENDING = 7007, + ERROR_CTX_NO_OUTBUF = 7008, + ERROR_CTX_MODEM_INF_NOT_FOUND = 7009, + ERROR_CTX_INVALID_MODEMNAME = 7010, + ERROR_CTX_MODEM_RESPONSE_ERROR = 7011, + ERROR_CTX_MODEM_RESPONSE_TIMEOUT = 7012, + ERROR_CTX_MODEM_RESPONSE_NO_CARRIER = 7013, + ERROR_CTX_MODEM_RESPONSE_NO_DIALTONE = 7014, + ERROR_CTX_MODEM_RESPONSE_BUSY = 7015, + ERROR_CTX_MODEM_RESPONSE_VOICE = 7016, + ERROR_CTX_TD_ERROR = 7017, + ERROR_CTX_WINSTATION_NOT_FOUND = 7022, + ERROR_CTX_WINSTATION_ALREADY_EXISTS = 7023, + ERROR_CTX_WINSTATION_BUSY = 7024, + ERROR_CTX_BAD_VIDEO_MODE = 7025, + ERROR_CTX_GRAPHICS_INVALID = 7035, + ERROR_CTX_LOGON_DISABLED = 7037, + ERROR_CTX_NOT_CONSOLE = 7038, + ERROR_CTX_CLIENT_QUERY_TIMEOUT = 7040, + ERROR_CTX_CONSOLE_DISCONNECT = 7041, + ERROR_CTX_CONSOLE_CONNECT = 7042, + ERROR_CTX_SHADOW_DENIED = 7044, + ERROR_CTX_WINSTATION_ACCESS_DENIED = 7045, + ERROR_CTX_INVALID_WD = 7049, + ERROR_CTX_SHADOW_INVALID = 7050, + ERROR_CTX_SHADOW_DISABLED = 7051, + ERROR_CTX_CLIENT_LICENSE_IN_USE = 7052, + ERROR_CTX_CLIENT_LICENSE_NOT_SET = 7053, + ERROR_CTX_LICENSE_NOT_AVAILABLE = 7054, + ERROR_CTX_LICENSE_CLIENT_INVALID = 7055, + ERROR_CTX_LICENSE_EXPIRED = 7056, + ERROR_CTX_SHADOW_NOT_RUNNING = 7057, + ERROR_CTX_SHADOW_ENDED_BY_MODE_CHANGE = 7058, + FRS_ERR_INVALID_API_SEQUENCE = 8001, + FRS_ERR_STARTING_SERVICE = 8002, + FRS_ERR_STOPPING_SERVICE = 8003, + FRS_ERR_INTERNAL_API = 8004, + FRS_ERR_INTERNAL = 8005, + FRS_ERR_SERVICE_COMM = 8006, + FRS_ERR_INSUFFICIENT_PRIV = 8007, + FRS_ERR_AUTHENTICATION = 8008, + FRS_ERR_PARENT_INSUFFICIENT_PRIV = 8009, + FRS_ERR_PARENT_AUTHENTICATION = 8010, + FRS_ERR_CHILD_TO_PARENT_COMM = 8011, + FRS_ERR_PARENT_TO_CHILD_COMM = 8012, + FRS_ERR_SYSVOL_POPULATE = 8013, + FRS_ERR_SYSVOL_POPULATE_TIMEOUT = 8014, + FRS_ERR_SYSVOL_IS_BUSY = 8015, + FRS_ERR_SYSVOL_DEMOTE = 8016, + FRS_ERR_INVALID_SERVICE_PARAMETER = 8017, + ERROR_DS_NOT_INSTALLED = 8200, + ERROR_DS_MEMBERSHIP_EVALUATED_LOCALLY = 8201, + ERROR_DS_NO_ATTRIBUTE_OR_VALUE = 8202, + ERROR_DS_INVALID_ATTRIBUTE_SYNTAX = 8203, + ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED = 8204, + ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS = 8205, + ERROR_DS_BUSY = 8206, + ERROR_DS_UNAVAILABLE = 8207, + ERROR_DS_NO_RIDS_ALLOCATED = 8208, + ERROR_DS_NO_MORE_RIDS = 8209, + ERROR_DS_INCORRECT_ROLE_OWNER = 8210, + ERROR_DS_RIDMGR_INIT_ERROR = 8211, + ERROR_DS_OBJ_CLASS_VIOLATION = 8212, + ERROR_DS_CANT_ON_NON_LEAF = 8213, + ERROR_DS_CANT_ON_RDN = 8214, + ERROR_DS_CANT_MOD_OBJ_CLASS = 8215, + ERROR_DS_CROSS_DOM_MOVE_ERROR = 8216, + ERROR_DS_GC_NOT_AVAILABLE = 8217, + ERROR_SHARED_POLICY = 8218, + ERROR_POLICY_OBJECT_NOT_FOUND = 8219, + ERROR_POLICY_ONLY_IN_DS = 8220, + ERROR_PROMOTION_ACTIVE = 8221, + ERROR_NO_PROMOTION_ACTIVE = 8222, + ERROR_DS_OPERATIONS_ERROR = 8224, + ERROR_DS_PROTOCOL_ERROR = 8225, + ERROR_DS_TIMELIMIT_EXCEEDED = 8226, + ERROR_DS_SIZELIMIT_EXCEEDED = 8227, + ERROR_DS_ADMIN_LIMIT_EXCEEDED = 8228, + ERROR_DS_COMPARE_FALSE = 8229, + ERROR_DS_COMPARE_TRUE = 8230, + ERROR_DS_AUTH_METHOD_NOT_SUPPORTED = 8231, + ERROR_DS_STRONG_AUTH_REQUIRED = 8232, + ERROR_DS_INAPPROPRIATE_AUTH = 8233, + ERROR_DS_AUTH_UNKNOWN = 8234, + ERROR_DS_REFERRAL = 8235, + ERROR_DS_UNAVAILABLE_CRIT_EXTENSION = 8236, + ERROR_DS_CONFIDENTIALITY_REQUIRED = 8237, + ERROR_DS_INAPPROPRIATE_MATCHING = 8238, + ERROR_DS_CONSTRAINT_VIOLATION = 8239, + ERROR_DS_NO_SUCH_OBJECT = 8240, + ERROR_DS_ALIAS_PROBLEM = 8241, + ERROR_DS_INVALID_DN_SYNTAX = 8242, + ERROR_DS_IS_LEAF = 8243, + ERROR_DS_ALIAS_DEREF_PROBLEM = 8244, + ERROR_DS_UNWILLING_TO_PERFORM = 8245, + ERROR_DS_LOOP_DETECT = 8246, + ERROR_DS_NAMING_VIOLATION = 8247, + ERROR_DS_OBJECT_RESULTS_TOO_LARGE = 8248, + ERROR_DS_AFFECTS_MULTIPLE_DSAS = 8249, + ERROR_DS_SERVER_DOWN = 8250, + ERROR_DS_LOCAL_ERROR = 8251, + ERROR_DS_ENCODING_ERROR = 8252, + ERROR_DS_DECODING_ERROR = 8253, + ERROR_DS_FILTER_UNKNOWN = 8254, + ERROR_DS_PARAM_ERROR = 8255, + ERROR_DS_NOT_SUPPORTED = 8256, + ERROR_DS_NO_RESULTS_RETURNED = 8257, + ERROR_DS_CONTROL_NOT_FOUND = 8258, + ERROR_DS_CLIENT_LOOP = 8259, + ERROR_DS_REFERRAL_LIMIT_EXCEEDED = 8260, + ERROR_DS_SORT_CONTROL_MISSING = 8261, + ERROR_DS_OFFSET_RANGE_ERROR = 8262, + ERROR_DS_ROOT_MUST_BE_NC = 8301, + ERROR_DS_ADD_REPLICA_INHIBITED = 8302, + ERROR_DS_ATT_NOT_DEF_IN_SCHEMA = 8303, + ERROR_DS_MAX_OBJ_SIZE_EXCEEDED = 8304, + ERROR_DS_OBJ_STRING_NAME_EXISTS = 8305, + ERROR_DS_NO_RDN_DEFINED_IN_SCHEMA = 8306, + ERROR_DS_RDN_DOESNT_MATCH_SCHEMA = 8307, + ERROR_DS_NO_REQUESTED_ATTS_FOUND = 8308, + ERROR_DS_USER_BUFFER_TO_SMALL = 8309, + ERROR_DS_ATT_IS_NOT_ON_OBJ = 8310, + ERROR_DS_ILLEGAL_MOD_OPERATION = 8311, + ERROR_DS_OBJ_TOO_LARGE = 8312, + ERROR_DS_BAD_INSTANCE_TYPE = 8313, + ERROR_DS_MASTERDSA_REQUIRED = 8314, + ERROR_DS_OBJECT_CLASS_REQUIRED = 8315, + ERROR_DS_MISSING_REQUIRED_ATT = 8316, + ERROR_DS_ATT_NOT_DEF_FOR_CLASS = 8317, + ERROR_DS_ATT_ALREADY_EXISTS = 8318, + ERROR_DS_CANT_ADD_ATT_VALUES = 8320, + ERROR_DS_SINGLE_VALUE_CONSTRAINT = 8321, + ERROR_DS_RANGE_CONSTRAINT = 8322, + ERROR_DS_ATT_VAL_ALREADY_EXISTS = 8323, + ERROR_DS_CANT_REM_MISSING_ATT = 8324, + ERROR_DS_CANT_REM_MISSING_ATT_VAL = 8325, + ERROR_DS_ROOT_CANT_BE_SUBREF = 8326, + ERROR_DS_NO_CHAINING = 8327, + ERROR_DS_NO_CHAINED_EVAL = 8328, + ERROR_DS_NO_PARENT_OBJECT = 8329, + ERROR_DS_PARENT_IS_AN_ALIAS = 8330, + ERROR_DS_CANT_MIX_MASTER_AND_REPS = 8331, + ERROR_DS_CHILDREN_EXIST = 8332, + ERROR_DS_OBJ_NOT_FOUND = 8333, + ERROR_DS_ALIASED_OBJ_MISSING = 8334, + ERROR_DS_BAD_NAME_SYNTAX = 8335, + ERROR_DS_ALIAS_POINTS_TO_ALIAS = 8336, + ERROR_DS_CANT_DEREF_ALIAS = 8337, + ERROR_DS_OUT_OF_SCOPE = 8338, + ERROR_DS_OBJECT_BEING_REMOVED = 8339, + ERROR_DS_CANT_DELETE_DSA_OBJ = 8340, + ERROR_DS_GENERIC_ERROR = 8341, + ERROR_DS_DSA_MUST_BE_INT_MASTER = 8342, + ERROR_DS_CLASS_NOT_DSA = 8343, + ERROR_DS_INSUFF_ACCESS_RIGHTS = 8344, + ERROR_DS_ILLEGAL_SUPERIOR = 8345, + ERROR_DS_ATTRIBUTE_OWNED_BY_SAM = 8346, + ERROR_DS_NAME_TOO_MANY_PARTS = 8347, + ERROR_DS_NAME_TOO_LONG = 8348, + ERROR_DS_NAME_VALUE_TOO_LONG = 8349, + ERROR_DS_NAME_UNPARSEABLE = 8350, + ERROR_DS_NAME_TYPE_UNKNOWN = 8351, + ERROR_DS_NOT_AN_OBJECT = 8352, + ERROR_DS_SEC_DESC_TOO_SHORT = 8353, + ERROR_DS_SEC_DESC_INVALID = 8354, + ERROR_DS_NO_DELETED_NAME = 8355, + ERROR_DS_SUBREF_MUST_HAVE_PARENT = 8356, + ERROR_DS_NCNAME_MUST_BE_NC = 8357, + ERROR_DS_CANT_ADD_SYSTEM_ONLY = 8358, + ERROR_DS_CLASS_MUST_BE_CONCRETE = 8359, + ERROR_DS_INVALID_DMD = 8360, + ERROR_DS_OBJ_GUID_EXISTS = 8361, + ERROR_DS_NOT_ON_BACKLINK = 8362, + ERROR_DS_NO_CROSSREF_FOR_NC = 8363, + ERROR_DS_SHUTTING_DOWN = 8364, + ERROR_DS_UNKNOWN_OPERATION = 8365, + ERROR_DS_INVALID_ROLE_OWNER = 8366, + ERROR_DS_COULDNT_CONTACT_FSMO = 8367, + ERROR_DS_CROSS_NC_DN_RENAME = 8368, + ERROR_DS_CANT_MOD_SYSTEM_ONLY = 8369, + ERROR_DS_REPLICATOR_ONLY = 8370, + ERROR_DS_OBJ_CLASS_NOT_DEFINED = 8371, + ERROR_DS_OBJ_CLASS_NOT_SUBCLASS = 8372, + ERROR_DS_NAME_REFERENCE_INVALID = 8373, + ERROR_DS_CROSS_REF_EXISTS = 8374, + ERROR_DS_CANT_DEL_MASTER_CROSSREF = 8375, + ERROR_DS_SUBTREE_NOTIFY_NOT_NC_HEAD = 8376, + ERROR_DS_NOTIFY_FILTER_TOO_COMPLEX = 8377, + ERROR_DS_DUP_RDN = 8378, + ERROR_DS_DUP_OID = 8379, + ERROR_DS_DUP_MAPI_ID = 8380, + ERROR_DS_DUP_SCHEMA_ID_GUID = 8381, + ERROR_DS_DUP_LDAP_DISPLAY_NAME = 8382, + ERROR_DS_SEMANTIC_ATT_TEST = 8383, + ERROR_DS_SYNTAX_MISMATCH = 8384, + ERROR_DS_EXISTS_IN_MUST_HAVE = 8385, + ERROR_DS_EXISTS_IN_MAY_HAVE = 8386, + ERROR_DS_NONEXISTENT_MAY_HAVE = 8387, + ERROR_DS_NONEXISTENT_MUST_HAVE = 8388, + ERROR_DS_AUX_CLS_TEST_FAIL = 8389, + ERROR_DS_NONEXISTENT_POSS_SUP = 8390, + ERROR_DS_SUB_CLS_TEST_FAIL = 8391, + ERROR_DS_BAD_RDN_ATT_ID_SYNTAX = 8392, + ERROR_DS_EXISTS_IN_AUX_CLS = 8393, + ERROR_DS_EXISTS_IN_SUB_CLS = 8394, + ERROR_DS_EXISTS_IN_POSS_SUP = 8395, + ERROR_DS_RECALCSCHEMA_FAILED = 8396, + ERROR_DS_TREE_DELETE_NOT_FINISHED = 8397, + ERROR_DS_CANT_DELETE = 8398, + ERROR_DS_ATT_SCHEMA_REQ_ID = 8399, + ERROR_DS_BAD_ATT_SCHEMA_SYNTAX = 8400, + ERROR_DS_CANT_CACHE_ATT = 8401, + ERROR_DS_CANT_CACHE_CLASS = 8402, + ERROR_DS_CANT_REMOVE_ATT_CACHE = 8403, + ERROR_DS_CANT_REMOVE_CLASS_CACHE = 8404, + ERROR_DS_CANT_RETRIEVE_DN = 8405, + ERROR_DS_MISSING_SUPREF = 8406, + ERROR_DS_CANT_RETRIEVE_INSTANCE = 8407, + ERROR_DS_CODE_INCONSISTENCY = 8408, + ERROR_DS_DATABASE_ERROR = 8409, + ERROR_DS_GOVERNSID_MISSING = 8410, + ERROR_DS_MISSING_EXPECTED_ATT = 8411, + ERROR_DS_NCNAME_MISSING_CR_REF = 8412, + ERROR_DS_SECURITY_CHECKING_ERROR = 8413, + ERROR_DS_SCHEMA_NOT_LOADED = 8414, + ERROR_DS_SCHEMA_ALLOC_FAILED = 8415, + ERROR_DS_ATT_SCHEMA_REQ_SYNTAX = 8416, + ERROR_DS_GCVERIFY_ERROR = 8417, + ERROR_DS_DRA_SCHEMA_MISMATCH = 8418, + ERROR_DS_CANT_FIND_DSA_OBJ = 8419, + ERROR_DS_CANT_FIND_EXPECTED_NC = 8420, + ERROR_DS_CANT_FIND_NC_IN_CACHE = 8421, + ERROR_DS_CANT_RETRIEVE_CHILD = 8422, + ERROR_DS_SECURITY_ILLEGAL_MODIFY = 8423, + ERROR_DS_CANT_REPLACE_HIDDEN_REC = 8424, + ERROR_DS_BAD_HIERARCHY_FILE = 8425, + ERROR_DS_BUILD_HIERARCHY_TABLE_FAILED = 8426, + ERROR_DS_CONFIG_PARAM_MISSING = 8427, + ERROR_DS_COUNTING_AB_INDICES_FAILED = 8428, + ERROR_DS_HIERARCHY_TABLE_MALLOC_FAILED = 8429, + ERROR_DS_INTERNAL_FAILURE = 8430, + ERROR_DS_UNKNOWN_ERROR = 8431, + ERROR_DS_ROOT_REQUIRES_CLASS_TOP = 8432, + ERROR_DS_REFUSING_FSMO_ROLES = 8433, + ERROR_DS_MISSING_FSMO_SETTINGS = 8434, + ERROR_DS_UNABLE_TO_SURRENDER_ROLES = 8435, + ERROR_DS_DRA_GENERIC = 8436, + ERROR_DS_DRA_INVALID_PARAMETER = 8437, + ERROR_DS_DRA_BUSY = 8438, + ERROR_DS_DRA_BAD_DN = 8439, + ERROR_DS_DRA_BAD_NC = 8440, + ERROR_DS_DRA_DN_EXISTS = 8441, + ERROR_DS_DRA_INTERNAL_ERROR = 8442, + ERROR_DS_DRA_INCONSISTENT_DIT = 8443, + ERROR_DS_DRA_CONNECTION_FAILED = 8444, + ERROR_DS_DRA_BAD_INSTANCE_TYPE = 8445, + ERROR_DS_DRA_OUT_OF_MEM = 8446, + ERROR_DS_DRA_MAIL_PROBLEM = 8447, + ERROR_DS_DRA_REF_ALREADY_EXISTS = 8448, + ERROR_DS_DRA_REF_NOT_FOUND = 8449, + ERROR_DS_DRA_OBJ_IS_REP_SOURCE = 8450, + ERROR_DS_DRA_DB_ERROR = 8451, + ERROR_DS_DRA_NO_REPLICA = 8452, + ERROR_DS_DRA_ACCESS_DENIED = 8453, + ERROR_DS_DRA_NOT_SUPPORTED = 8454, + ERROR_DS_DRA_RPC_CANCELLED = 8455, + ERROR_DS_DRA_SOURCE_DISABLED = 8456, + ERROR_DS_DRA_SINK_DISABLED = 8457, + ERROR_DS_DRA_NAME_COLLISION = 8458, + ERROR_DS_DRA_SOURCE_REINSTALLED = 8459, + ERROR_DS_DRA_MISSING_PARENT = 8460, + ERROR_DS_DRA_PREEMPTED = 8461, + ERROR_DS_DRA_ABANDON_SYNC = 8462, + ERROR_DS_DRA_SHUTDOWN = 8463, + ERROR_DS_DRA_INCOMPATIBLE_PARTIAL_SET = 8464, + ERROR_DS_DRA_SOURCE_IS_PARTIAL_REPLICA = 8465, + ERROR_DS_DRA_EXTN_CONNECTION_FAILED = 8466, + ERROR_DS_INSTALL_SCHEMA_MISMATCH = 8467, + ERROR_DS_DUP_LINK_ID = 8468, + ERROR_DS_NAME_ERROR_RESOLVING = 8469, + ERROR_DS_NAME_ERROR_NOT_FOUND = 8470, + ERROR_DS_NAME_ERROR_NOT_UNIQUE = 8471, + ERROR_DS_NAME_ERROR_NO_MAPPING = 8472, + ERROR_DS_NAME_ERROR_DOMAIN_ONLY = 8473, + ERROR_DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING = 8474, + ERROR_DS_CONSTRUCTED_ATT_MOD = 8475, + ERROR_DS_WRONG_OM_OBJ_CLASS = 8476, + ERROR_DS_DRA_REPL_PENDING = 8477, + ERROR_DS_DS_REQUIRED = 8478, + ERROR_DS_INVALID_LDAP_DISPLAY_NAME = 8479, + ERROR_DS_NON_BASE_SEARCH = 8480, + ERROR_DS_CANT_RETRIEVE_ATTS = 8481, + ERROR_DS_BACKLINK_WITHOUT_LINK = 8482, + ERROR_DS_EPOCH_MISMATCH = 8483, + ERROR_DS_SRC_NAME_MISMATCH = 8484, + ERROR_DS_SRC_AND_DST_NC_IDENTICAL = 8485, + ERROR_DS_DST_NC_MISMATCH = 8486, + ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC = 8487, + ERROR_DS_SRC_GUID_MISMATCH = 8488, + ERROR_DS_CANT_MOVE_DELETED_OBJECT = 8489, + ERROR_DS_PDC_OPERATION_IN_PROGRESS = 8490, + ERROR_DS_CROSS_DOMAIN_CLEANUP_REQD = 8491, + ERROR_DS_ILLEGAL_XDOM_MOVE_OPERATION = 8492, + ERROR_DS_CANT_WITH_ACCT_GROUP_MEMBERSHPS = 8493, + ERROR_DS_NC_MUST_HAVE_NC_PARENT = 8494, + ERROR_DS_DST_DOMAIN_NOT_NATIVE = 8496, + ERROR_DS_MISSING_INFRASTRUCTURE_CONTAINER = 8497, + ERROR_DS_CANT_MOVE_ACCOUNT_GROUP = 8498, + ERROR_DS_CANT_MOVE_RESOURCE_GROUP = 8499, + ERROR_DS_INVALID_SEARCH_FLAG = 8500, + ERROR_DS_NO_TREE_DELETE_ABOVE_NC = 8501, + ERROR_DS_COULDNT_LOCK_TREE_FOR_DELETE = 8502, + ERROR_DS_COULDNT_IDENTIFY_OBJECTS_FOR_TREE_DELETE = 8503, + ERROR_DS_SAM_INIT_FAILURE = 8504, + ERROR_DS_SENSITIVE_GROUP_VIOLATION = 8505, + ERROR_DS_CANT_MOD_PRIMARYGROUPID = 8506, + ERROR_DS_ILLEGAL_BASE_SCHEMA_MOD = 8507, + ERROR_DS_NONSAFE_SCHEMA_CHANGE = 8508, + ERROR_DS_SCHEMA_UPDATE_DISALLOWED = 8509, + ERROR_DS_CANT_CREATE_UNDER_SCHEMA = 8510, + ERROR_DS_INSTALL_NO_SRC_SCH_VERSION = 8511, + ERROR_DS_INSTALL_NO_SCH_VERSION_IN_INIFILE = 8512, + ERROR_DS_INVALID_GROUP_TYPE = 8513, + ERROR_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN = 8514, + ERROR_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN = 8515, + ERROR_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER = 8516, + ERROR_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER = 8517, + ERROR_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER = 8518, + ERROR_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER = 8519, + ERROR_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER = 8520, + ERROR_DS_HAVE_PRIMARY_MEMBERS = 8521, + ERROR_DS_STRING_SD_CONVERSION_FAILED = 8522, + ERROR_DS_NAMING_MASTER_GC = 8523, + ERROR_DS_LOOKUP_FAILURE = 8524, + ERROR_DS_COULDNT_UPDATE_SPNS = 8525, + ERROR_DS_CANT_RETRIEVE_SD = 8526, + ERROR_DS_KEY_NOT_UNIQUE = 8527, + ERROR_DS_WRONG_LINKED_ATT_SYNTAX = 8528, + ERROR_DS_SAM_NEED_BOOTKEY_PASSWORD = 8529, + ERROR_DS_SAM_NEED_BOOTKEY_FLOPPY = 8530, + ERROR_DS_CANT_START = 8531, + ERROR_DS_INIT_FAILURE = 8532, + ERROR_DS_NO_PKT_PRIVACY_ON_CONNECTION = 8533, + ERROR_DS_SOURCE_DOMAIN_IN_FOREST = 8534, + ERROR_DS_DESTINATION_DOMAIN_NOT_IN_FOREST = 8535, + ERROR_DS_DESTINATION_AUDITING_NOT_ENABLED = 8536, + ERROR_DS_CANT_FIND_DC_FOR_SRC_DOMAIN = 8537, + ERROR_DS_SRC_OBJ_NOT_GROUP_OR_USER = 8538, + ERROR_DS_SRC_SID_EXISTS_IN_FOREST = 8539, + ERROR_DS_SRC_AND_DST_OBJECT_CLASS_MISMATCH = 8540, + ERROR_SAM_INIT_FAILURE = 8541, + ERROR_DS_DRA_SCHEMA_INFO_SHIP = 8542, + ERROR_DS_DRA_SCHEMA_CONFLICT = 8543, + ERROR_DS_DRA_EARLIER_SCHEMA_CONLICT = 8544, + ERROR_DS_DRA_OBJ_NC_MISMATCH = 8545, + ERROR_DS_NC_STILL_HAS_DSAS = 8546, + ERROR_DS_GC_REQUIRED = 8547, + ERROR_DS_LOCAL_MEMBER_OF_LOCAL_ONLY = 8548, + ERROR_DS_NO_FPO_IN_UNIVERSAL_GROUPS = 8549, + ERROR_DS_CANT_ADD_TO_GC = 8550, + ERROR_DS_NO_CHECKPOINT_WITH_PDC = 8551, + ERROR_DS_SOURCE_AUDITING_NOT_ENABLED = 8552, + ERROR_DS_CANT_CREATE_IN_NONDOMAIN_NC = 8553, + ERROR_DS_INVALID_NAME_FOR_SPN = 8554, + ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS = 8555, + ERROR_DS_UNICODEPWD_NOT_IN_QUOTES = 8556, + ERROR_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED = 8557, + ERROR_DS_MUST_BE_RUN_ON_DST_DC = 8558, + ERROR_DS_SRC_DC_MUST_BE_SP4_OR_GREATER = 8559, + ERROR_DS_CANT_TREE_DELETE_CRITICAL_OBJ = 8560, + ERROR_DS_INIT_FAILURE_CONSOLE = 8561, + ERROR_DS_SAM_INIT_FAILURE_CONSOLE = 8562, + ERROR_DS_FOREST_VERSION_TOO_HIGH = 8563, + ERROR_DS_DOMAIN_VERSION_TOO_HIGH = 8564, + ERROR_DS_FOREST_VERSION_TOO_LOW = 8565, + ERROR_DS_DOMAIN_VERSION_TOO_LOW = 8566, + ERROR_DS_INCOMPATIBLE_VERSION = 8567, + ERROR_DS_LOW_DSA_VERSION = 8568, + ERROR_DS_NO_BEHAVIOR_VERSION_IN_MIXEDDOMAIN = 8569, + ERROR_DS_NOT_SUPPORTED_SORT_ORDER = 8570, + ERROR_DS_NAME_NOT_UNIQUE = 8571, + ERROR_DS_MACHINE_ACCOUNT_CREATED_PRENT4 = 8572, + ERROR_DS_OUT_OF_VERSION_STORE = 8573, + ERROR_DS_INCOMPATIBLE_CONTROLS_USED = 8574, + ERROR_DS_NO_REF_DOMAIN = 8575, + ERROR_DS_RESERVED_LINK_ID = 8576, + ERROR_DS_LINK_ID_NOT_AVAILABLE = 8577, + ERROR_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER = 8578, + ERROR_DS_MODIFYDN_DISALLOWED_BY_INSTANCE_TYPE = 8579, + ERROR_DS_NO_OBJECT_MOVE_IN_SCHEMA_NC = 8580, + ERROR_DS_MODIFYDN_DISALLOWED_BY_FLAG = 8581, + ERROR_DS_MODIFYDN_WRONG_GRANDPARENT = 8582, + ERROR_DS_NAME_ERROR_TRUST_REFERRAL = 8583, + ERROR_NOT_SUPPORTED_ON_STANDARD_SERVER = 8584, + ERROR_DS_CANT_ACCESS_REMOTE_PART_OF_AD = 8585, + ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE = 8586, + ERROR_DS_THREAD_LIMIT_EXCEEDED = 8587, + ERROR_DS_NOT_CLOSEST = 8588, + ERROR_DS_CANT_DERIVE_SPN_WITHOUT_SERVER_REF = 8589, + ERROR_DS_SINGLE_USER_MODE_FAILED = 8590, + ERROR_DS_NTDSCRIPT_SYNTAX_ERROR = 8591, + ERROR_DS_NTDSCRIPT_PROCESS_ERROR = 8592, + ERROR_DS_DIFFERENT_REPL_EPOCHS = 8593, + ERROR_DS_DRS_EXTENSIONS_CHANGED = 8594, + ERROR_DS_REPLICA_SET_CHANGE_NOT_ALLOWED_ON_DISABLED_CR = 8595, + ERROR_DS_NO_MSDS_INTID = 8596, + ERROR_DS_DUP_MSDS_INTID = 8597, + ERROR_DS_EXISTS_IN_RDNATTID = 8598, + ERROR_DS_AUTHORIZATION_FAILED = 8599, + ERROR_DS_INVALID_SCRIPT = 8600, + ERROR_DS_REMOTE_CROSSREF_OP_FAILED = 8601, + DNS_ERROR_RCODE_FORMAT_ERROR = 9001, + DNS_ERROR_RCODE_SERVER_FAILURE = 9002, + DNS_ERROR_RCODE_NAME_ERROR = 9003, + DNS_ERROR_RCODE_NOT_IMPLEMENTED = 9004, + DNS_ERROR_RCODE_REFUSED = 9005, + DNS_ERROR_RCODE_YXDOMAIN = 9006, + DNS_ERROR_RCODE_YXRRSET = 9007, + DNS_ERROR_RCODE_NXRRSET = 9008, + DNS_ERROR_RCODE_NOTAUTH = 9009, + DNS_ERROR_RCODE_NOTZONE = 9010, + DNS_ERROR_RCODE_BADSIG = 9016, + DNS_ERROR_RCODE_BADKEY = 9017, + DNS_ERROR_RCODE_BADTIME = 9018, + DNS_INFO_NO_RECORDS = 9501, + DNS_ERROR_BAD_PACKET = 9502, + DNS_ERROR_NO_PACKET = 9503, + DNS_ERROR_RCODE = 9504, + DNS_ERROR_UNSECURE_PACKET = 9505, + DNS_ERROR_INVALID_TYPE = 9551, + DNS_ERROR_INVALID_IP_ADDRESS = 9552, + DNS_ERROR_INVALID_PROPERTY = 9553, + DNS_ERROR_TRY_AGAIN_LATER = 9554, + DNS_ERROR_NOT_UNIQUE = 9555, + DNS_ERROR_NON_RFC_NAME = 9556, + DNS_STATUS_FQDN = 9557, + DNS_STATUS_DOTTED_NAME = 9558, + DNS_STATUS_SINGLE_PART_NAME = 9559, + DNS_ERROR_INVALID_NAME_CHAR = 9560, + DNS_ERROR_NUMERIC_NAME = 9561, + DNS_ERROR_NOT_ALLOWED_ON_ROOT_SERVER = 9562, + DNS_ERROR_ZONE_DOES_NOT_EXIST = 9601, + DNS_ERROR_NO_ZONE_INFO = 9602, + DNS_ERROR_INVALID_ZONE_OPERATION = 9603, + DNS_ERROR_ZONE_CONFIGURATION_ERROR = 9604, + DNS_ERROR_ZONE_HAS_NO_SOA_RECORD = 9605, + DNS_ERROR_ZONE_HAS_NO_NS_RECORDS = 9606, + DNS_ERROR_ZONE_LOCKED = 9607, + DNS_ERROR_ZONE_CREATION_FAILED = 9608, + DNS_ERROR_ZONE_ALREADY_EXISTS = 9609, + DNS_ERROR_AUTOZONE_ALREADY_EXISTS = 9610, + DNS_ERROR_INVALID_ZONE_TYPE = 9611, + DNS_ERROR_SECONDARY_REQUIRES_MASTER_IP = 9612, + DNS_ERROR_ZONE_NOT_SECONDARY = 9613, + DNS_ERROR_NEED_SECONDARY_ADDRESSES = 9614, + DNS_ERROR_WINS_INIT_FAILED = 9615, + DNS_ERROR_NEED_WINS_SERVERS = 9616, + DNS_ERROR_NBSTAT_INIT_FAILED = 9617, + DNS_ERROR_SOA_DELETE_INVALID = 9618, + DNS_ERROR_FORWARDER_ALREADY_EXISTS = 9619, + DNS_ERROR_ZONE_REQUIRES_MASTER_IP = 9620, + DNS_ERROR_ZONE_IS_SHUTDOWN = 9621, + DNS_ERROR_PRIMARY_REQUIRES_DATAFILE = 9651, + DNS_ERROR_INVALID_DATAFILE_NAME = 9652, + DNS_ERROR_DATAFILE_OPEN_FAILURE = 9653, + DNS_ERROR_FILE_WRITEBACK_FAILED = 9654, + DNS_ERROR_DATAFILE_PARSING = 9655, + DNS_ERROR_RECORD_DOES_NOT_EXIST = 9701, + DNS_ERROR_RECORD_FORMAT = 9702, + DNS_ERROR_NODE_CREATION_FAILED = 9703, + DNS_ERROR_UNKNOWN_RECORD_TYPE = 9704, + DNS_ERROR_RECORD_TIMED_OUT = 9705, + DNS_ERROR_NAME_NOT_IN_ZONE = 9706, + DNS_ERROR_CNAME_LOOP = 9707, + DNS_ERROR_NODE_IS_CNAME = 9708, + DNS_ERROR_CNAME_COLLISION = 9709, + DNS_ERROR_RECORD_ONLY_AT_ZONE_ROOT = 9710, + DNS_ERROR_RECORD_ALREADY_EXISTS = 9711, + DNS_ERROR_SECONDARY_DATA = 9712, + DNS_ERROR_NO_CREATE_CACHE_DATA = 9713, + DNS_ERROR_NAME_DOES_NOT_EXIST = 9714, + DNS_WARNING_PTR_CREATE_FAILED = 9715, + DNS_WARNING_DOMAIN_UNDELETED = 9716, + DNS_ERROR_DS_UNAVAILABLE = 9717, + DNS_ERROR_DS_ZONE_ALREADY_EXISTS = 9718, + DNS_ERROR_NO_BOOTFILE_IF_DS_ZONE = 9719, + DNS_INFO_AXFR_COMPLETE = 9751, + DNS_ERROR_AXFR = 9752, + DNS_INFO_ADDED_LOCAL_WINS = 9753, + DNS_STATUS_CONTINUE_NEEDED = 9801, + DNS_ERROR_NO_TCPIP = 9851, + DNS_ERROR_NO_DNS_SERVERS = 9852, + DNS_ERROR_DP_DOES_NOT_EXIST = 9901, + DNS_ERROR_DP_ALREADY_EXISTS = 9902, + DNS_ERROR_DP_NOT_ENLISTED = 9903, + DNS_ERROR_DP_ALREADY_ENLISTED = 9904, + WSAEINTR = 10004, + WSAEBADF = 10009, + WSAEACCES = 10013, + WSAEFAULT = 10014, + WSAEINVAL = 10022, + WSAEMFILE = 10024, + WSAEWOULDBLOCK = 10035, + WSAEINPROGRESS = 10036, + WSAEALREADY = 10037, + WSAENOTSOCK = 10038, + WSAEDESTADDRREQ = 10039, + WSAEMSGSIZE = 10040, + WSAEPROTOTYPE = 10041, + WSAENOPROTOOPT = 10042, + WSAEPROTONOSUPPORT = 10043, + WSAESOCKTNOSUPPORT = 10044, + WSAEOPNOTSUPP = 10045, + WSAEPFNOSUPPORT = 10046, + WSAEAFNOSUPPORT = 10047, + WSAEADDRINUSE = 10048, + WSAEADDRNOTAVAIL = 10049, + WSAENETDOWN = 10050, + WSAENETUNREACH = 10051, + WSAENETRESET = 10052, + WSAECONNABORTED = 10053, + WSAECONNRESET = 10054, + WSAENOBUFS = 10055, + WSAEISCONN = 10056, + WSAENOTCONN = 10057, + WSAESHUTDOWN = 10058, + WSAETOOMANYREFS = 10059, + WSAETIMEDOUT = 10060, + WSAECONNREFUSED = 10061, + WSAELOOP = 10062, + WSAENAMETOOLONG = 10063, + WSAEHOSTDOWN = 10064, + WSAEHOSTUNREACH = 10065, + WSAENOTEMPTY = 10066, + WSAEPROCLIM = 10067, + WSAEUSERS = 10068, + WSAEDQUOT = 10069, + WSAESTALE = 10070, + WSAEREMOTE = 10071, + WSASYSNOTREADY = 10091, + WSAVERNOTSUPPORTED = 10092, + WSANOTINITIALISED = 10093, + WSAEDISCON = 10101, + WSAENOMORE = 10102, + WSAECANCELLED = 10103, + WSAEINVALIDPROCTABLE = 10104, + WSAEINVALIDPROVIDER = 10105, + WSAEPROVIDERFAILEDINIT = 10106, + WSASYSCALLFAILURE = 10107, + WSASERVICE_NOT_FOUND = 10108, + WSATYPE_NOT_FOUND = 10109, + WSA_E_NO_MORE = 10110, + WSA_E_CANCELLED = 10111, + WSAEREFUSED = 10112, + WSAHOST_NOT_FOUND = 11001, + WSATRY_AGAIN = 11002, + WSANO_RECOVERY = 11003, + WSANO_DATA = 11004, + WSA_QOS_RECEIVERS = 11005, + WSA_QOS_SENDERS = 11006, + WSA_QOS_NO_SENDERS = 11007, + WSA_QOS_NO_RECEIVERS = 11008, + WSA_QOS_REQUEST_CONFIRMED = 11009, + WSA_QOS_ADMISSION_FAILURE = 11010, + WSA_QOS_POLICY_FAILURE = 11011, + WSA_QOS_BAD_STYLE = 11012, + WSA_QOS_BAD_OBJECT = 11013, + WSA_QOS_TRAFFIC_CTRL_ERROR = 11014, + WSA_QOS_GENERIC_ERROR = 11015, + WSA_QOS_ESERVICETYPE = 11016, + WSA_QOS_EFLOWSPEC = 11017, + WSA_QOS_EPROVSPECBUF = 11018, + WSA_QOS_EFILTERSTYLE = 11019, + WSA_QOS_EFILTERTYPE = 11020, + WSA_QOS_EFILTERCOUNT = 11021, + WSA_QOS_EOBJLENGTH = 11022, + WSA_QOS_EFLOWCOUNT = 11023, + WSA_QOS_EUNKNOWNPSOBJ = 11024, + WSA_QOS_EPOLICYOBJ = 11025, + WSA_QOS_EFLOWDESC = 11026, + WSA_QOS_EPSFLOWSPEC = 11027, + WSA_QOS_EPSFILTERSPEC = 11028, + WSA_QOS_ESDMODEOBJ = 11029, + WSA_QOS_ESHAPERATEOBJ = 11030, + WSA_QOS_RESERVED_PETYPE = 11031, + ERROR_IPSEC_QM_POLICY_EXISTS = 13000, + ERROR_IPSEC_QM_POLICY_NOT_FOUND = 13001, + ERROR_IPSEC_QM_POLICY_IN_USE = 13002, + ERROR_IPSEC_MM_POLICY_EXISTS = 13003, + ERROR_IPSEC_MM_POLICY_NOT_FOUND = 13004, + ERROR_IPSEC_MM_POLICY_IN_USE = 13005, + ERROR_IPSEC_MM_FILTER_EXISTS = 13006, + ERROR_IPSEC_MM_FILTER_NOT_FOUND = 13007, + ERROR_IPSEC_TRANSPORT_FILTER_EXISTS = 13008, + ERROR_IPSEC_TRANSPORT_FILTER_NOT_FOUND = 13009, + ERROR_IPSEC_MM_AUTH_EXISTS = 13010, + ERROR_IPSEC_MM_AUTH_NOT_FOUND = 13011, + ERROR_IPSEC_MM_AUTH_IN_USE = 13012, + ERROR_IPSEC_DEFAULT_MM_POLICY_NOT_FOUND = 13013, + ERROR_IPSEC_DEFAULT_MM_AUTH_NOT_FOUND = 13014, + ERROR_IPSEC_DEFAULT_QM_POLICY_NOT_FOUND = 13015, + ERROR_IPSEC_TUNNEL_FILTER_EXISTS = 13016, + ERROR_IPSEC_TUNNEL_FILTER_NOT_FOUND = 13017, + ERROR_IPSEC_MM_FILTER_PENDING_DELETION = 13018, + ERROR_IPSEC_TRANSPORT_FILTER_PENDING_DELETION = 13019, + ERROR_IPSEC_TUNNEL_FILTER_PENDING_DELETION = 13020, + ERROR_IPSEC_MM_POLICY_PENDING_DELETION = 13021, + ERROR_IPSEC_MM_AUTH_PENDING_DELETION = 13022, + ERROR_IPSEC_QM_POLICY_PENDING_DELETION = 13023, + ERROR_IPSEC_IKE_AUTH_FAIL = 13801, + ERROR_IPSEC_IKE_ATTRIB_FAIL = 13802, + ERROR_IPSEC_IKE_NEGOTIATION_PENDING = 13803, + ERROR_IPSEC_IKE_GENERAL_PROCESSING_ERROR = 13804, + ERROR_IPSEC_IKE_TIMED_OUT = 13805, + ERROR_IPSEC_IKE_NO_CERT = 13806, + ERROR_IPSEC_IKE_SA_DELETED = 13807, + ERROR_IPSEC_IKE_SA_REAPED = 13808, + ERROR_IPSEC_IKE_MM_ACQUIRE_DROP = 13809, + ERROR_IPSEC_IKE_QM_ACQUIRE_DROP = 13810, + ERROR_IPSEC_IKE_QUEUE_DROP_MM = 13811, + ERROR_IPSEC_IKE_QUEUE_DROP_NO_MM = 13812, + ERROR_IPSEC_IKE_DROP_NO_RESPONSE = 13813, + ERROR_IPSEC_IKE_MM_DELAY_DROP = 13814, + ERROR_IPSEC_IKE_QM_DELAY_DROP = 13815, + ERROR_IPSEC_IKE_ERROR = 13816, + ERROR_IPSEC_IKE_CRL_FAILED = 13817, + ERROR_IPSEC_IKE_INVALID_KEY_USAGE = 13818, + ERROR_IPSEC_IKE_INVALID_CERT_TYPE = 13819, + ERROR_IPSEC_IKE_NO_PRIVATE_KEY = 13820, + ERROR_IPSEC_IKE_DH_FAIL = 13822, + ERROR_IPSEC_IKE_INVALID_HEADER = 13824, + ERROR_IPSEC_IKE_NO_POLICY = 13825, + ERROR_IPSEC_IKE_INVALID_SIGNATURE = 13826, + ERROR_IPSEC_IKE_KERBEROS_ERROR = 13827, + ERROR_IPSEC_IKE_NO_PUBLIC_KEY = 13828, + ERROR_IPSEC_IKE_PROCESS_ERR = 13829, + ERROR_IPSEC_IKE_PROCESS_ERR_SA = 13830, + ERROR_IPSEC_IKE_PROCESS_ERR_PROP = 13831, + ERROR_IPSEC_IKE_PROCESS_ERR_TRANS = 13832, + ERROR_IPSEC_IKE_PROCESS_ERR_KE = 13833, + ERROR_IPSEC_IKE_PROCESS_ERR_ID = 13834, + ERROR_IPSEC_IKE_PROCESS_ERR_CERT = 13835, + ERROR_IPSEC_IKE_PROCESS_ERR_CERT_REQ = 13836, + ERROR_IPSEC_IKE_PROCESS_ERR_HASH = 13837, + ERROR_IPSEC_IKE_PROCESS_ERR_SIG = 13838, + ERROR_IPSEC_IKE_PROCESS_ERR_NONCE = 13839, + ERROR_IPSEC_IKE_PROCESS_ERR_NOTIFY = 13840, + ERROR_IPSEC_IKE_PROCESS_ERR_DELETE = 13841, + ERROR_IPSEC_IKE_PROCESS_ERR_VENDOR = 13842, + ERROR_IPSEC_IKE_INVALID_PAYLOAD = 13843, + ERROR_IPSEC_IKE_LOAD_SOFT_SA = 13844, + ERROR_IPSEC_IKE_SOFT_SA_TORN_DOWN = 13845, + ERROR_IPSEC_IKE_INVALID_COOKIE = 13846, + ERROR_IPSEC_IKE_NO_PEER_CERT = 13847, + ERROR_IPSEC_IKE_PEER_CRL_FAILED = 13848, + ERROR_IPSEC_IKE_POLICY_CHANGE = 13849, + ERROR_IPSEC_IKE_NO_MM_POLICY = 13850, + ERROR_IPSEC_IKE_NOTCBPRIV = 13851, + ERROR_IPSEC_IKE_SECLOADFAIL = 13852, + ERROR_IPSEC_IKE_FAILSSPINIT = 13853, + ERROR_IPSEC_IKE_FAILQUERYSSP = 13854, + ERROR_IPSEC_IKE_SRVACQFAIL = 13855, + ERROR_IPSEC_IKE_SRVQUERYCRED = 13856, + ERROR_IPSEC_IKE_GETSPIFAIL = 13857, + ERROR_IPSEC_IKE_INVALID_FILTER = 13858, + ERROR_IPSEC_IKE_OUT_OF_MEMORY = 13859, + ERROR_IPSEC_IKE_ADD_UPDATE_KEY_FAILED = 13860, + ERROR_IPSEC_IKE_INVALID_POLICY = 13861, + ERROR_IPSEC_IKE_UNKNOWN_DOI = 13862, + ERROR_IPSEC_IKE_INVALID_SITUATION = 13863, + ERROR_IPSEC_IKE_DH_FAILURE = 13864, + ERROR_IPSEC_IKE_INVALID_GROUP = 13865, + ERROR_IPSEC_IKE_ENCRYPT = 13866, + ERROR_IPSEC_IKE_DECRYPT = 13867, + ERROR_IPSEC_IKE_POLICY_MATCH = 13868, + ERROR_IPSEC_IKE_UNSUPPORTED_ID = 13869, + ERROR_IPSEC_IKE_INVALID_HASH = 13870, + ERROR_IPSEC_IKE_INVALID_HASH_ALG = 13871, + ERROR_IPSEC_IKE_INVALID_HASH_SIZE = 13872, + ERROR_IPSEC_IKE_INVALID_ENCRYPT_ALG = 13873, + ERROR_IPSEC_IKE_INVALID_AUTH_ALG = 13874, + ERROR_IPSEC_IKE_INVALID_SIG = 13875, + ERROR_IPSEC_IKE_LOAD_FAILED = 13876, + ERROR_IPSEC_IKE_RPC_DELETE = 13877, + ERROR_IPSEC_IKE_BENIGN_REINIT = 13878, + ERROR_IPSEC_IKE_INVALID_RESPONDER_LIFETIME_NOTIFY = 13879, + ERROR_IPSEC_IKE_INVALID_CERT_KEYLEN = 13881, + ERROR_IPSEC_IKE_MM_LIMIT = 13882, + ERROR_IPSEC_IKE_NEGOTIATION_DISABLED = 13883, + ERROR_IPSEC_IKE_NEG_STATUS_END = 13884, + ERROR_SXS_SECTION_NOT_FOUND = 14000, + ERROR_SXS_CANT_GEN_ACTCTX = 14001, + ERROR_SXS_INVALID_ACTCTXDATA_FORMAT = 14002, + ERROR_SXS_ASSEMBLY_NOT_FOUND = 14003, + ERROR_SXS_MANIFEST_FORMAT_ERROR = 14004, + ERROR_SXS_MANIFEST_PARSE_ERROR = 14005, + ERROR_SXS_ACTIVATION_CONTEXT_DISABLED = 14006, + ERROR_SXS_KEY_NOT_FOUND = 14007, + ERROR_SXS_VERSION_CONFLICT = 14008, + ERROR_SXS_WRONG_SECTION_TYPE = 14009, + ERROR_SXS_THREAD_QUERIES_DISABLED = 14010, + ERROR_SXS_PROCESS_DEFAULT_ALREADY_SET = 14011, + ERROR_SXS_UNKNOWN_ENCODING_GROUP = 14012, + ERROR_SXS_UNKNOWN_ENCODING = 14013, + ERROR_SXS_INVALID_XML_NAMESPACE_URI = 14014, + ERROR_SXS_ROOT_MANIFEST_DEPENDENCY_NOT_INSTALLED = 14015, + ERROR_SXS_LEAF_MANIFEST_DEPENDENCY_NOT_INSTALLED = 14016, + ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE = 14017, + ERROR_SXS_MANIFEST_MISSING_REQUIRED_DEFAULT_NAMESPACE = 14018, + ERROR_SXS_MANIFEST_INVALID_REQUIRED_DEFAULT_NAMESPACE = 14019, + ERROR_SXS_PRIVATE_MANIFEST_CROSS_PATH_WITH_REPARSE_POINT = 14020, + ERROR_SXS_DUPLICATE_DLL_NAME = 14021, + ERROR_SXS_DUPLICATE_WINDOWCLASS_NAME = 14022, + ERROR_SXS_DUPLICATE_CLSID = 14023, + ERROR_SXS_DUPLICATE_IID = 14024, + ERROR_SXS_DUPLICATE_TLBID = 14025, + ERROR_SXS_DUPLICATE_PROGID = 14026, + ERROR_SXS_DUPLICATE_ASSEMBLY_NAME = 14027, + ERROR_SXS_FILE_HASH_MISMATCH = 14028, + ERROR_SXS_POLICY_PARSE_ERROR = 14029, + ERROR_SXS_XML_E_MISSINGQUOTE = 14030, + ERROR_SXS_XML_E_COMMENTSYNTAX = 14031, + ERROR_SXS_XML_E_BADSTARTNAMECHAR = 14032, + ERROR_SXS_XML_E_BADNAMECHAR = 14033, + ERROR_SXS_XML_E_BADCHARINSTRING = 14034, + ERROR_SXS_XML_E_XMLDECLSYNTAX = 14035, + ERROR_SXS_XML_E_BADCHARDATA = 14036, + ERROR_SXS_XML_E_MISSINGWHITESPACE = 14037, + ERROR_SXS_XML_E_EXPECTINGTAGEND = 14038, + ERROR_SXS_XML_E_MISSINGSEMICOLON = 14039, + ERROR_SXS_XML_E_UNBALANCEDPAREN = 14040, + ERROR_SXS_XML_E_INTERNALERROR = 14041, + ERROR_SXS_XML_E_UNEXPECTED_WHITESPACE = 14042, + ERROR_SXS_XML_E_INCOMPLETE_ENCODING = 14043, + ERROR_SXS_XML_E_MISSING_PAREN = 14044, + ERROR_SXS_XML_E_EXPECTINGCLOSEQUOTE = 14045, + ERROR_SXS_XML_E_MULTIPLE_COLONS = 14046, + ERROR_SXS_XML_E_INVALID_DECIMAL = 14047, + ERROR_SXS_XML_E_INVALID_HEXIDECIMAL = 14048, + ERROR_SXS_XML_E_INVALID_UNICODE = 14049, + ERROR_SXS_XML_E_WHITESPACEORQUESTIONMARK = 14050, + ERROR_SXS_XML_E_UNEXPECTEDENDTAG = 14051, + ERROR_SXS_XML_E_UNCLOSEDTAG = 14052, + ERROR_SXS_XML_E_DUPLICATEATTRIBUTE = 14053, + ERROR_SXS_XML_E_MULTIPLEROOTS = 14054, + ERROR_SXS_XML_E_INVALIDATROOTLEVEL = 14055, + ERROR_SXS_XML_E_BADXMLDECL = 14056, + ERROR_SXS_XML_E_MISSINGROOT = 14057, + ERROR_SXS_XML_E_UNEXPECTEDEOF = 14058, + ERROR_SXS_XML_E_BADPEREFINSUBSET = 14059, + ERROR_SXS_XML_E_UNCLOSEDSTARTTAG = 14060, + ERROR_SXS_XML_E_UNCLOSEDENDTAG = 14061, + ERROR_SXS_XML_E_UNCLOSEDSTRING = 14062, + ERROR_SXS_XML_E_UNCLOSEDCOMMENT = 14063, + ERROR_SXS_XML_E_UNCLOSEDDECL = 14064, + ERROR_SXS_XML_E_UNCLOSEDCDATA = 14065, + ERROR_SXS_XML_E_RESERVEDNAMESPACE = 14066, + ERROR_SXS_XML_E_INVALIDENCODING = 14067, + ERROR_SXS_XML_E_INVALIDSWITCH = 14068, + ERROR_SXS_XML_E_BADXMLCASE = 14069, + ERROR_SXS_XML_E_INVALID_STANDALONE = 14070, + ERROR_SXS_XML_E_UNEXPECTED_STANDALONE = 14071, + ERROR_SXS_XML_E_INVALID_VERSION = 14072, + ERROR_SXS_XML_E_MISSINGEQUALS = 14073, + ERROR_SXS_PROTECTION_RECOVERY_FAILED = 14074, + ERROR_SXS_PROTECTION_PUBLIC_KEY_TOO_SHORT = 14075, + ERROR_SXS_PROTECTION_CATALOG_NOT_VALID = 14076, + ERROR_SXS_UNTRANSLATABLE_HRESULT = 14077, + ERROR_SXS_PROTECTION_CATALOG_FILE_MISSING = 14078, + ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE = 14079, + ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE_NAME = 14080, +} WapiError; + +extern guint32 GetLastError(void); +extern void SetLastError(guint32 code); + +#endif /* _WAPI_ERROR_H_ */ diff --git a/mono/io-layer/handles-private.h b/mono/io-layer/handles-private.h new file mode 100644 index 00000000000..1cf0d068759 --- /dev/null +++ b/mono/io-layer/handles-private.h @@ -0,0 +1,9 @@ +#ifndef _WAPI_HANDLES_PRIVATE_H_ +#define _WAPI_HANDLES_PRIVATE_H_ + +#include <config.h> +#include <glib.h> + +extern guint32 _wapi_handle_count_signalled(GPtrArray *handles); + +#endif /* _WAPI_HANDLES_PRIVATE_H_ */ diff --git a/mono/io-layer/handles.c b/mono/io-layer/handles.c new file mode 100644 index 00000000000..5901544cdc8 --- /dev/null +++ b/mono/io-layer/handles.c @@ -0,0 +1,67 @@ +#include <config.h> +#include <glib.h> + +#include "mono/io-layer/wapi.h" +#include "wapi-private.h" +#include "handles-private.h" + +guint32 _wapi_handle_count_signalled(GPtrArray *handles) +{ + guint32 i, ret=0; + + /* Count how many of the interesting thread handles are signalled */ + for(i=0; i<handles->len; i++) { + WapiHandle *handle; + + handle=(WapiHandle *)g_ptr_array_index(handles, i); +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION ": Checking handle %p", + handle); +#endif + + if(handle->signalled==TRUE) { +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION + ": Thread %p signalled", handle); +#endif + ret++; + } + } + +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION ": %d signalled handles", ret); +#endif + + return(ret); +} + +/** + * CloseHandle: + * @handle: The handle to release + * + * Closes and invalidates @handle, releasing any resources it + * consumes. When the last handle to a temporary or non-persistent + * object is closed, that object can be deleted. Closing the same + * handle twice is an error. + * + * Return value: %TRUE on success, %FALSE otherwise. + */ +gboolean CloseHandle(WapiHandle *handle) +{ + g_return_val_if_fail(handle->ref>0, FALSE); + + handle->ref--; + if(handle->ref==0) { + if(handle->ops->close!=NULL) { + handle->ops->close(handle); + } + + g_free(handle); /* maybe this should be in + * ops, cuurently ops->close() + * is being used to free + * handle data + */ + } + + return(TRUE); +} diff --git a/mono/io-layer/handles.h b/mono/io-layer/handles.h new file mode 100644 index 00000000000..a7f8cd4b222 --- /dev/null +++ b/mono/io-layer/handles.h @@ -0,0 +1,10 @@ +#ifndef _WAPI_HANDLES_H_ +#define _WAPI_HANDLES_H_ + +#define INVALID_HANDLE_VALUE (WapiHandle *)-1 + +typedef struct _WapiHandle WapiHandle; + +extern gboolean CloseHandle(WapiHandle *handle); + +#endif /* _WAPI_HANDLES_H_ */ diff --git a/mono/io-layer/io-layer-dummy.c b/mono/io-layer/io-layer-dummy.c new file mode 100644 index 00000000000..d0d088fa433 --- /dev/null +++ b/mono/io-layer/io-layer-dummy.c @@ -0,0 +1,2 @@ +extern char *_mono_iolayer_dummylib; +char *_mono_iolayer_dummylib="This is a dummy library that isn't needed on Windows"; diff --git a/mono/io-layer/io-layer.h b/mono/io-layer/io-layer.h new file mode 100644 index 00000000000..4dc10ffc494 --- /dev/null +++ b/mono/io-layer/io-layer.h @@ -0,0 +1,21 @@ +#ifndef _MONO_IOLAYER_IOLAYER_H_ +#define _MONO_IOLAYER_IOLAYER_H_ + +#include <config.h> + +#if defined(PLATFORM_WIN32_NATIVE) +/* Native win32 */ +#define UNICODE +#define _UNICODE +#include <windows.h> +#elif defined(PLATFORM_WIN32) +/* Cygwin */ +#define UNICODE +#define _UNICODE +#include <w32api/windows.h> +#else /* EVERYONE ELSE */ +#include "mono/io-layer/wapi.h" +#include "mono/io-layer/uglify.h" +#endif /* PLATFORM_WIN32_NATIVE */ + +#endif /* _MONO_IOLAYER_IOLAYER_H_ */ diff --git a/mono/io-layer/io.c b/mono/io-layer/io.c new file mode 100644 index 00000000000..7c89d7525b2 --- /dev/null +++ b/mono/io-layer/io.c @@ -0,0 +1,820 @@ +#include <config.h> +#include <glib.h> +#include <fcntl.h> +#include <unistd.h> +#include <errno.h> +#include <string.h> +#include <sys/poll.h> +#include <sys/stat.h> + +#include "mono/io-layer/wapi.h" +#include "unicode.h" +#include "wapi-private.h" + +#define DEBUG + +/* Currently used for both FILE and CONSOLE handle types. This may + * have to change in future. + */ +struct _WapiHandle_file +{ + WapiHandle handle; + int fd; + WapiSecurityAttributes *security_attributes; + guint32 fileaccess; + guint32 sharemode; + guint32 attrs; +}; + +static void file_close(WapiHandle *handle); +static WapiFileType file_getfiletype(void); +static gboolean file_read(WapiHandle *handle, gpointer buffer, + guint32 numbytes, guint32 *bytesread, + WapiOverlapped *overlapped); +static gboolean file_write(WapiHandle *handle, gconstpointer buffer, + guint32 numbytes, guint32 *byteswritten, + WapiOverlapped *overlapped); +static guint32 file_seek(WapiHandle *handle, gint32 movedistance, + gint32 *highmovedistance, WapiSeekMethod method); +static gboolean file_setendoffile(WapiHandle *handle); +static guint32 file_getfilesize(WapiHandle *handle, guint32 *highsize); + +/* File handle is only signalled for overlapped IO */ +static struct _WapiHandleOps file_ops = { + file_close, /* close */ + file_getfiletype, /* getfiletype */ + file_read, /* readfile */ + file_write, /* writefile */ + file_seek, /* seek */ + file_setendoffile, /* setendoffile */ + file_getfilesize, /* getfilesize */ + NULL, /* wait */ + NULL, /* wait_multiple */ +}; + +static WapiFileType console_getfiletype(void); + +/* Console is mostly the same as file, except it can block waiting for + * input or output + */ +static struct _WapiHandleOps console_ops = { + file_close, /* close */ + console_getfiletype, /* getfiletype */ + file_read, /* readfile */ + file_write, /* writefile */ + NULL, /* seek */ + NULL, /* setendoffile */ + NULL, /* getfilesize */ + NULL, /* FIXME: wait */ + NULL, /* FIXME: wait_multiple */ +}; + +static void file_close(WapiHandle *handle) +{ + struct _WapiHandle_file *file_handle=(struct _WapiHandle_file *)handle; + +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION ": closing file handle %p with fd %d", + file_handle, file_handle->fd); +#endif + + close(file_handle->fd); +} + +static WapiFileType file_getfiletype(void) +{ + return(FILE_TYPE_DISK); +} + +static gboolean file_read(WapiHandle *handle, gpointer buffer, + guint32 numbytes, guint32 *bytesread, + WapiOverlapped *overlapped G_GNUC_UNUSED) +{ + struct _WapiHandle_file *file_handle=(struct _WapiHandle_file *)handle; + int ret; + + if(bytesread!=NULL) { + *bytesread=0; + } + + if(!(file_handle->fileaccess&GENERIC_READ) && + !(file_handle->fileaccess&GENERIC_ALL)) { +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION ": handle %p fd %d doesn't have GENERIC_READ access: %u", handle, file_handle->fd, file_handle->fileaccess); +#endif + + return(FALSE); + } + + ret=read(file_handle->fd, buffer, numbytes); + if(ret==-1) { +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION + ": read of handle %p fd %d error: %s", handle, + file_handle->fd, strerror(errno)); +#endif + + return(FALSE); + } + + if(bytesread!=NULL) { + *bytesread=ret; + } + + return(TRUE); +} + +static gboolean file_write(WapiHandle *handle, gconstpointer buffer, + guint32 numbytes, guint32 *byteswritten, + WapiOverlapped *overlapped G_GNUC_UNUSED) +{ + struct _WapiHandle_file *file_handle=(struct _WapiHandle_file *)handle; + int ret; + + if(byteswritten!=NULL) { + *byteswritten=0; + } + + if(!(file_handle->fileaccess&GENERIC_WRITE) && + !(file_handle->fileaccess&GENERIC_ALL)) { +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION ": handle %p fd %d doesn't have GENERIC_WRITE access: %u", handle, file_handle->fd, file_handle->fileaccess); +#endif + + return(FALSE); + } + + ret=write(file_handle->fd, buffer, numbytes); + if(ret==-1) { +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION + ": write of handle %p fd %d error: %s", handle, + file_handle->fd, strerror(errno)); +#endif + + return(FALSE); + } + if(byteswritten!=NULL) { + *byteswritten=ret; + } + + return(TRUE); +} + +static guint32 file_seek(WapiHandle *handle, gint32 movedistance, + gint32 *highmovedistance, WapiSeekMethod method) +{ + struct _WapiHandle_file *file_handle=(struct _WapiHandle_file *)handle; + off_t offset, newpos; + int whence; + guint32 ret; + + if(!(file_handle->fileaccess&GENERIC_READ) && + !(file_handle->fileaccess&GENERIC_WRITE) && + !(file_handle->fileaccess&GENERIC_ALL)) { +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION ": handle %p fd %d doesn't have GENERIC_READ or GENERIC_WRITE access: %u", handle, file_handle->fd, file_handle->fileaccess); +#endif + + return(INVALID_SET_FILE_POINTER); + } + + switch(method) { + case FILE_BEGIN: + whence=SEEK_SET; + break; + case FILE_CURRENT: + whence=SEEK_CUR; + break; + case FILE_END: + whence=SEEK_END; + break; + default: +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION ": invalid seek type %d", + method); +#endif + + return(INVALID_SET_FILE_POINTER); + } + +#ifdef HAVE_LARGE_FILE_SUPPORT + if(highmovedistance==NULL) { + offset=movedistance; + } else { + offset=*highmovedistance; + offset<<=32; + offset+=movedistance; + } +#else + offset=movedistance; +#endif + +#ifdef DEBUG +#ifdef HAVE_LARGE_FILE_SUPPORT + g_message(G_GNUC_PRETTY_FUNCTION + ": moving handle %p fd %d by %lld bytes from %d", handle, + file_handle->fd, offset, whence); +#else + g_message(G_GNUC_PRETTY_FUNCTION + ": moving handle %p fd %d by %ld bytes from %d", handle, + file_handle->fd, offset, whence); +#endif +#endif + + newpos=lseek(file_handle->fd, offset, whence); + if(newpos==-1) { +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION + ": lseek on handle %p fd %d returned error %s", + handle, file_handle->fd, strerror(errno)); +#endif + + return(INVALID_SET_FILE_POINTER); + } + +#ifdef DEBUG +#ifdef HAVE_LARGE_FILE_SUPPORT + g_message(G_GNUC_PRETTY_FUNCTION ": lseek returns %lld", newpos); +#else + g_message(G_GNUC_PRETTY_FUNCTION ": lseek returns %ld", newpos); +#endif +#endif + +#ifdef HAVE_LARGE_FILE_SUPPORT + ret=newpos & 0xFFFFFFFF; + if(highmovedistance!=NULL) { + *highmovedistance=newpos>>32; + } +#else + ret=newpos; + if(highmovedistance!=NULL) { + /* Accurate, but potentially dodgy :-) */ + *highmovedistance=0; + } +#endif + +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION + ": move of handle %p fd %d returning %d/%d", handle, + file_handle->fd, ret, + highmovedistance==NULL?0:*highmovedistance); +#endif + + return(ret); +} + +static gboolean file_setendoffile(WapiHandle *handle) +{ + struct _WapiHandle_file *file_handle=(struct _WapiHandle_file *)handle; + struct stat statbuf; + off_t size, pos; + int ret; + + if(!(file_handle->fileaccess&GENERIC_WRITE) && + !(file_handle->fileaccess&GENERIC_ALL)) { +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION ": handle %p fd %d doesn't have GENERIC_WRITE access: %u", handle, file_handle->fd, file_handle->fileaccess); +#endif + + return(FALSE); + } + + /* Find the current file position, and the file length. If + * the file position is greater than the length, write to + * extend the file with a hole. If the file position is less + * than the length, truncate the file. + */ + + ret=fstat(file_handle->fd, &statbuf); + if(ret==-1) { +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION + ": handle %p fd %d fstat failed: %s", handle, + file_handle->fd, strerror(errno)); +#endif + + return(FALSE); + } + size=statbuf.st_size; + + pos=lseek(file_handle->fd, (off_t)0, SEEK_CUR); + if(pos==-1) { +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION + ": handle %p fd %d lseek failed: %s", handle, + file_handle->fd, strerror(errno)); +#endif + + return(FALSE); + } + + if(pos>size) { + /* extend */ + ret=write(file_handle->fd, "", 1); + if(ret==-1) { +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION + ": handle %p fd %d extend write failed: %s", + handle, file_handle->fd, strerror(errno)); +#endif + + return(FALSE); + } + } + + /* always truncate, because the extend write() adds an extra + * byte to the end of the file + */ + ret=ftruncate(file_handle->fd, pos); + if(ret==-1) { +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION + ": handle %p fd %d ftruncate failed: %s", handle, + file_handle->fd, strerror(errno)); +#endif + + return(FALSE); + } + + return(TRUE); +} + +static guint32 file_getfilesize(WapiHandle *handle, guint32 *highsize) +{ + struct _WapiHandle_file *file_handle=(struct _WapiHandle_file *)handle; + struct stat statbuf; + guint32 size; + int ret; + + if(!(file_handle->fileaccess&GENERIC_READ) && + !(file_handle->fileaccess&GENERIC_WRITE) && + !(file_handle->fileaccess&GENERIC_ALL)) { +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION ": handle %p fd %d doesn't have GENERIC_READ or GENERIC_WRITE access: %u", handle, file_handle->fd, file_handle->fileaccess); +#endif + + return(INVALID_FILE_SIZE); + } + + ret=fstat(file_handle->fd, &statbuf); + if(ret==-1) { +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION + ": handle %p fd %d fstat failed: %s", handle, + file_handle->fd, strerror(errno)); +#endif + + return(INVALID_FILE_SIZE); + } + +#ifdef HAVE_LARGE_FILE_SUPPORT + size=statbuf.st_size & 0xFFFFFFFF; + if(highsize!=NULL) { + *highsize=statbuf.st_size>>32; + } +#else + if(highsize!=NULL) { + /* Accurate, but potentially dodgy :-) */ + *highsize=0; + } + size=statbuf.st_size; +#endif + +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION ": Returning size %d/%d", size, + *highsize); +#endif + + return(size); +} + +static WapiFileType console_getfiletype(void) +{ + return(FILE_TYPE_CHAR); +} + +static int convert_flags(guint32 fileaccess, guint32 createmode) +{ + int flags=0; + + switch(fileaccess) { + case GENERIC_READ: + flags=O_RDONLY; + break; + case GENERIC_WRITE: + flags=O_WRONLY; + break; + case GENERIC_READ|GENERIC_WRITE: + flags=O_RDWR; + break; + default: +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION ": Unknown access type 0x%x", + fileaccess); +#endif + break; + } + + switch(createmode) { + case CREATE_NEW: + flags|=O_CREAT|O_EXCL; + break; + case CREATE_ALWAYS: + flags|=O_CREAT|O_TRUNC; + break; + case OPEN_EXISTING: + break; + case OPEN_ALWAYS: + flags|=O_CREAT; + break; + case TRUNCATE_EXISTING: + flags|=O_TRUNC; + break; + default: +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION ": Unknown create mode 0x%x", + createmode); +#endif + break; + } + + return(flags); +} + +static guint32 convert_from_flags(int flags) +{ + guint32 fileaccess=0; + + if(flags&O_RDONLY) { + fileaccess=GENERIC_READ; + } else if (flags&O_WRONLY) { + fileaccess=GENERIC_WRITE; + } else if (flags&O_RDWR) { + fileaccess=GENERIC_READ|GENERIC_WRITE; + } else { +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION + ": Can't figure out flags 0x%x", flags); +#endif + } + + /* Maybe sort out create mode too */ + + return(fileaccess); +} + +static mode_t convert_perms(guint32 sharemode) +{ + mode_t perms=0600; + + if(sharemode&FILE_SHARE_READ) { + perms|=044; + } + if(sharemode&FILE_SHARE_WRITE) { + perms|=022; + } + + return(perms); +} + + +/** + * CreateFile: + * @name: a pointer to a NULL-terminated unicode string, that names + * the file or other object to create. + * @fileaccess: specifies the file access mode + * @sharemode: whether the file should be shared. This parameter is + * currently ignored. + * @security: Ignored for now. + * @createmode: specifies whether to create a new file, whether to + * overwrite an existing file, whether to truncate the file, etc. + * @attrs: specifies file attributes and flags. On win32 attributes + * are characteristics of the file, not the handle, and are ignored + * when an existing file is opened. Flags give the library hints on + * how to process a file to optimise performance. + * @template: the handle of an open %GENERIC_READ file that specifies + * attributes to apply to a newly created file, ignoring @attrs. + * Normally this parameter is NULL. This parameter is ignored when an + * existing file is opened. + * + * Creates a new file handle. This only applies to normal files: + * pipes are handled by CreatePipe(), and console handles are created + * with GetStdHandle(). + * + * Return value: the new handle, or %INVALID_HANDLE_VALUE on error. + */ +WapiHandle *CreateFile(const guchar *name, guint32 fileaccess, + guint32 sharemode, WapiSecurityAttributes *security, + guint32 createmode, guint32 attrs, + WapiHandle *template G_GNUC_UNUSED) +{ + struct _WapiHandle_file *file_handle; + WapiHandle *handle; + int flags=convert_flags(fileaccess, createmode); + mode_t perms=convert_perms(sharemode); + guchar *filename; + int ret; + + if(name==NULL) { +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION ": name is NULL"); +#endif + + return(INVALID_HANDLE_VALUE); + } + + filename=_wapi_unicode_to_utf8(name); +#ifdef ACTUALLY_DO_UNICODE + if(filename==NULL) { +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION + ": unicode conversion returned NULL"); +#endif + + return(INVALID_HANDLE_VALUE); + } +#endif + +#ifdef ACTUALLY_DO_UNICODE + ret=open(filename, flags, perms); +#else + ret=open(name, flags, perms); +#endif + + g_free(filename); + + if(ret==-1) { +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION ": Error opening file: %s", + strerror(errno)); +#endif + return(INVALID_HANDLE_VALUE); + } + + file_handle=g_new0(struct _WapiHandle_file, 1); + handle=(WapiHandle *)file_handle; + + _WAPI_HANDLE_INIT(handle, WAPI_HANDLE_FILE, file_ops); + + file_handle->fd=ret; + file_handle->security_attributes=security; + file_handle->fileaccess=fileaccess; + file_handle->sharemode=sharemode; + file_handle->attrs=attrs; + +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION ": returning handle %p with fd %d", + handle, file_handle->fd); +#endif + + return(handle); +} + +/** + * GetStdHandle: + * @stdhandle: specifies the file descriptor + * + * Returns a handle for stdin, stdout, or stderr. Always returns the + * same handle for the same @stdhandle. + * + * Return value: the handle, or %INVALID_HANDLE_VALUE on error + */ +WapiHandle *GetStdHandle(WapiStdHandle stdhandle) +{ + struct _WapiHandle_file *file_handle; + WapiHandle *handle; + int flags, fd; + + switch(stdhandle) { + case STD_INPUT_HANDLE: + fd=0; + break; + + case STD_OUTPUT_HANDLE: + fd=1; + break; + + case STD_ERROR_HANDLE: + fd=2; + break; + + default: +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION + ": unknown standard handle type"); +#endif + + return(INVALID_HANDLE_VALUE); + } + + /* Check if fd is valid */ + flags=fcntl(fd, F_GETFL); + if(flags==-1) { + /* Invalid fd. Not really much point checking for EBADF + * specifically + */ +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION ": fcntl error on fd %d: %s", + fd, strerror(errno)); +#endif + + return(INVALID_HANDLE_VALUE); + } + + file_handle=g_new0(struct _WapiHandle_file, 1); + handle=(WapiHandle *)file_handle; + + _WAPI_HANDLE_INIT(handle, WAPI_HANDLE_CONSOLE, console_ops); + + file_handle->fd=fd; + file_handle->security_attributes=/*some default*/NULL; + file_handle->fileaccess=convert_from_flags(flags); + file_handle->sharemode=0; + file_handle->attrs=0; + +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION ": returning handle %p with fd %d", + handle, file_handle->fd); +#endif + + return(handle); +} + +/** + * ReadFile: + * @handle: The file handle to read from. The handle must have + * %GENERIC_READ access. + * @buffer: The buffer to store read data in + * @numbytes: The maximum number of bytes to read + * @bytesread: The actual number of bytes read is stored here. This + * value can be zero if the handle is positioned at the end of the + * file. + * @overlapped: points to a required %WapiOverlapped structure if + * @handle has the %FILE_FLAG_OVERLAPPED option set, should be NULL + * otherwise. + * + * If @handle does not have the %FILE_FLAG_OVERLAPPED option set, this + * function reads up to @numbytes bytes from the file from the current + * file position, and stores them in @buffer. If there are not enough + * bytes left in the file, just the amount available will be read. + * The actual number of bytes read is stored in @bytesread. + + * If @handle has the %FILE_FLAG_OVERLAPPED option set, the current + * file position is ignored and the read position is taken from data + * in the @overlapped structure. + * + * Return value: %TRUE if the read succeeds (even if no bytes were + * read due to an attempt to read past the end of the file), %FALSE on + * error. + */ +gboolean ReadFile(WapiHandle *handle, gpointer buffer, guint32 numbytes, + guint32 *bytesread, WapiOverlapped *overlapped) +{ + if(handle->ops->readfile==NULL) { + return(FALSE); + } + + return(handle->ops->readfile(handle, buffer, numbytes, bytesread, + overlapped)); +} + +/** + * WriteFile: + * @handle: The file handle to write to. The handle must have + * %GENERIC_WRITE access. + * @buffer: The buffer to read data from. + * @numbytes: The maximum number of bytes to write. + * @byteswritten: The actual number of bytes written is stored here. + * If the handle is positioned at the file end, the length of the file + * is extended. This parameter may be %NULL. + * @overlapped: points to a required %WapiOverlapped structure if + * @handle has the %FILE_FLAG_OVERLAPPED option set, should be NULL + * otherwise. + * + * If @handle does not have the %FILE_FLAG_OVERLAPPED option set, this + * function writes up to @numbytes bytes from @buffer to the file at + * the current file position. If @handle is positioned at the end of + * the file, the file is extended. The actual number of bytes written + * is stored in @byteswritten. + * + * If @handle has the %FILE_FLAG_OVERLAPPED option set, the current + * file position is ignored and the write position is taken from data + * in the @overlapped structure. + * + * Return value: %TRUE if the write succeeds, %FALSE on error. + */ +gboolean WriteFile(WapiHandle *handle, gconstpointer buffer, guint32 numbytes, + guint32 *byteswritten, WapiOverlapped *overlapped) +{ + if(handle->ops->writefile==NULL) { + return(FALSE); + } + + return(handle->ops->writefile(handle, buffer, numbytes, byteswritten, + overlapped)); +} + +/** + * SetEndOfFile: + * @handle: The file handle to set. The handle must have + * %GENERIC_WRITE access. + * + * Moves the end-of-file position to the current position of the file + * pointer. This function is used to truncate or extend a file. + * + * Return value: %TRUE on success, %FALSE otherwise. + */ +gboolean SetEndOfFile(WapiHandle *handle) +{ + if(handle->ops->setendoffile==NULL) { + return(FALSE); + } + + return(handle->ops->setendoffile(handle)); +} + +/** + * SetFilePointer: + * @handle: The file handle to set. The handle must have + * %GENERIC_READ or %GENERIC_WRITE access. + * @movedistance: Low 32 bits of a signed value that specifies the + * number of bytes to move the file pointer. + * @highmovedistance: Pointer to the high 32 bits of a signed value + * that specifies the number of bytes to move the file pointer, or + * %NULL. + * @method: The starting point for the file pointer move. + * + * Sets the file pointer of an open file. + * + * The distance to move the file pointer is calculated from + * @movedistance and @highmovedistance: If @highmovedistance is %NULL, + * @movedistance is the 32-bit signed value; otherwise, @movedistance + * is the low 32 bits and @highmovedistance a pointer to the high 32 + * bits of a 64 bit signed value. A positive distance moves the file + * pointer forward from the position specified by @method; a negative + * distance moves the file pointer backward. + * + * If the library is compiled without large file support, + * @highmovedistance is ignored and its value is set to zero on a + * successful return. + * + * Return value: On success, the low 32 bits of the new file pointer. + * If @highmovedistance is not %NULL, the high 32 bits of the new file + * pointer are stored there. On failure, %INVALID_SET_FILE_POINTER. + */ +guint32 SetFilePointer(WapiHandle *handle, gint32 movedistance, + gint32 *highmovedistance, WapiSeekMethod method) +{ + if(handle->ops->seek==NULL) { + return(INVALID_SET_FILE_POINTER); + } + + return(handle->ops->seek(handle, movedistance, highmovedistance, + method)); +} + +/** + * GetFileType: + * @handle: The file handle to test. + * + * Finds the type of file @handle. + * + * Return value: %FILE_TYPE_UNKNOWN - the type of the file @handle is + * unknown. %FILE_TYPE_DISK - @handle is a disk file. + * %FILE_TYPE_CHAR - @handle is a character device, such as a console. + * %FILE_TYPE_PIPE - @handle is a named or anonymous pipe. + */ +WapiFileType GetFileType(WapiHandle *handle) +{ + if(handle->ops->getfiletype==NULL) { + return(FILE_TYPE_UNKNOWN); + } + + return(handle->ops->getfiletype()); +} + +/** + * GetFileSize: + * @handle: The file handle to query. The handle must have + * %GENERIC_READ or %GENERIC_WRITE access. + * @highsize: If non-%NULL, the high 32 bits of the file size are + * stored here. + * + * Retrieves the size of the file @handle. + * + * If the library is compiled without large file support, @highsize + * has its value set to zero on a successful return. + * + * Return value: On success, the low 32 bits of the file size. If + * @highsize is non-%NULL then the high 32 bits of the file size are + * stored here. On failure %INVALID_FILE_SIZE is returned. + */ +guint32 GetFileSize(WapiHandle *handle, guint32 *highsize) +{ + if(handle->ops->getfilesize==NULL) { + return(INVALID_FILE_SIZE); + } + + return(handle->ops->getfilesize(handle, highsize)); +} diff --git a/mono/io-layer/io.h b/mono/io-layer/io.h new file mode 100644 index 00000000000..782844f7200 --- /dev/null +++ b/mono/io-layer/io.h @@ -0,0 +1,108 @@ +#ifndef _WAPI_IO_H_ +#define _WAPI_IO_H_ + +#include <stdlib.h> + +#include "mono/io-layer/wapi.h" + +typedef struct _WapiSecurityAttributes WapiSecurityAttributes; + +struct _WapiSecurityAttributes +{ + guint32 nLength; + gpointer lpSecurityDescriptor; + gboolean bInheritHandle; +}; + +typedef struct _WapiOverlapped WapiOverlapped; + +struct _WapiOverlapped +{ + guint32 Internal; + guint32 InternalHigh; + guint32 Offset; + guint32 OffsetHigh; + WapiHandle *hEvent; +}; + +#define GENERIC_READ 0x80000000 +#define GENERIC_WRITE 0x40000000 +#define GENERIC_EXECUTE 0x20000000 +#define GENERIC_ALL 0x10000000 + +#define FILE_SHARE_READ 0x00000001 +#define FILE_SHARE_WRITE 0x00000002 +#define FILE_SHARE_DELETE 0x00000004 + +#define CREATE_NEW 1 +#define CREATE_ALWAYS 2 +#define OPEN_EXISTING 3 +#define OPEN_ALWAYS 4 +#define TRUNCATE_EXISTING 5 + + +#define FILE_ATTRIBUTE_READONLY 0x00000001 +#define FILE_ATTRIBUTE_HIDDEN 0x00000002 +#define FILE_ATTRIBUTE_SYSTEM 0x00000004 +#define FILE_ATTRIBUTE_DIRECTORY 0x00000010 +#define FILE_ATTRIBUTE_ARCHIVE 0x00000020 +#define FILE_ATTRIBUTE_ENCRYPTED 0x00000040 +#define FILE_ATTRIBUTE_NORMAL 0x00000080 +#define FILE_ATTRIBUTE_TEMPORARY 0x00000100 +#define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200 +#define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400 +#define FILE_ATTRIBUTE_COMPRESSED 0x00000800 +#define FILE_ATTRIBUTE_OFFLINE 0x00001000 +#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000 +#define FILE_FLAG_OPEN_NO_RECALL 0x00100000 +#define FILE_FLAG_OPEN_REPARSE_POINT 0x00200000 +#define FILE_FLAG_POSIX_SEMANTICS 0x01000000 +#define FILE_FLAG_BACKUP_SEMANTICS 0x02000000 +#define FILE_FLAG_DELETE_ON_CLOSE 0x04000000 +#define FILE_FLAG_SEQUENTIAL_SCAN 0x08000000 +#define FILE_FLAG_RANDOM_ACCESS 0x10000000 +#define FILE_FLAG_NO_BUFFERING 0x20000000 +#define FILE_FLAG_OVERLAPPED 0x40000000 +#define FILE_FLAG_WRITE_THROUGH 0x80000000 + +typedef enum { + STD_INPUT_HANDLE=-10, + STD_OUTPUT_HANDLE=-11, + STD_ERROR_HANDLE=-12, +} WapiStdHandle; + +typedef enum { + FILE_BEGIN=0, + FILE_CURRENT=1, + FILE_END=2, +} WapiSeekMethod; + +typedef enum { + FILE_TYPE_UNKNOWN=0x0000, + FILE_TYPE_DISK=0x0001, + FILE_TYPE_CHAR=0x0002, + FILE_TYPE_PIPE=0x0003, + FILE_TYPE_REMOTE=0x8000, +} WapiFileType; + +#define INVALID_SET_FILE_POINTER ((guint32)-1) +#define INVALID_FILE_SIZE ((guint32)0xFFFFFFFF) + +extern WapiHandle *CreateFile(const guchar *name, guint32 fileaccess, + guint32 sharemode, + WapiSecurityAttributes *security, + guint32 createmode, + guint32 attrs, WapiHandle *template); +extern WapiHandle *GetStdHandle(WapiStdHandle stdhandle); +extern gboolean ReadFile(WapiHandle *handle, gpointer buffer, guint32 numbytes, + guint32 *bytesread, WapiOverlapped *overlapped); +extern gboolean WriteFile(WapiHandle *handle, gconstpointer buffer, + guint32 numbytes, guint32 *byteswritten, + WapiOverlapped *overlapped); +extern gboolean SetEndOfFile(WapiHandle *handle); +extern guint32 SetFilePointer(WapiHandle *handle, gint32 movedistance, + gint32 *highmovedistance, WapiSeekMethod method); +extern WapiFileType GetFileType(WapiHandle *handle); +extern guint32 GetFileSize(WapiHandle *handle, guint32 *highsize); + +#endif /* _WAPI_IO_H_ */ diff --git a/mono/io-layer/pthread-compat.c b/mono/io-layer/pthread-compat.c new file mode 100644 index 00000000000..11658fcfe89 --- /dev/null +++ b/mono/io-layer/pthread-compat.c @@ -0,0 +1,50 @@ +#include <config.h> +#include <pthread.h> +#include <time.h> + +#include "pthread-compat.h" + +#ifndef HAVE_PTHREAD_MUTEX_TIMEDLOCK +/* + * Implementation of timed mutex locking from the P1003.1d/D14 (July + * 1999) draft spec, figure B-4. + */ +/** + * pthread_mutex_timedlock: + * @mutex: A pointer to a mutex to lock + * @timeout: A pointer to a struct timespec giving an absolute time to + * time out at. + * + * This is a compatibility implementation for C libraries that are + * lacking this function. + * + * Tries to lock @mutex, but times out when the time specified in + * @timeout is reached. + * + * Return value: zero on success, ETIMEDOUT on timeout. + */ +int pthread_mutex_timedlock(pthread_mutex_t *mutex, + const struct timespec *timeout) +{ + struct timeval timenow; + struct timespec sleepytime; + + /* This is just to avoid a completely busy wait */ + sleepytime.tv_sec=0; + sleepytime.tv_nsec=10000; /* 10ms */ + + while(pthread_mutex_trylock(mutex)==EBUSY) { + gettimeofday(&timenow, NULL); + + if(timenow.tv_sec >= timeout->tv_sec && + (timenow.tv_usec * 1000) >= timeout->tv_nsec) { + return(ETIMEDOUT); + } + + nanosleep(&sleepytime, NULL); + } + + return(0); +} +#endif /* !HAVE_PTHREAD_MUTEX_TIMEDLOCK */ + diff --git a/mono/io-layer/pthread-compat.h b/mono/io-layer/pthread-compat.h new file mode 100644 index 00000000000..a562275a017 --- /dev/null +++ b/mono/io-layer/pthread-compat.h @@ -0,0 +1,13 @@ +#ifndef _WAPI_PTHREAD_COMPAT_H_ +#define _WAPI_PTHREAD_COMPAT_H_ + +#include <config.h> +#include <pthread.h> +#include <time.h> + +#ifndef HAVE_PTHREAD_MUTEX_TIMEDLOCK +extern int pthread_mutex_timedlock(pthread_mutex_t *mutex, + const struct timespec *timeout); +#endif /* HAVE_PTHREAD_MUTEX_TIMEDLOCK */ + +#endif /* _WAPI_PTHREAD_COMPAT_H_ */ diff --git a/mono/io-layer/status.h b/mono/io-layer/status.h new file mode 100644 index 00000000000..cbbf12a55f4 --- /dev/null +++ b/mono/io-layer/status.h @@ -0,0 +1,36 @@ +#ifndef _WAPI_STATUS_H_ +#define _WAPI_STATUS_H_ + +typedef enum { + STATUS_WAIT_0 = 0x00000000, + STATUS_ABANDONED_WAIT_0 = 0x00000080, + STATUS_USER_APC = 0x000000C0, + STATUS_TIMEOUT = 0x00000102, + STATUS_PENDING = 0x00000103, + STATUS_SEGMENT_NOTIFICATION = 0x40000005, + STATUS_GUARD_PAGE_VIOLATION = 0x80000001, + STATUS_DATATYPE_MISALIGNMENT = 0x80000002, + STATUS_BREAKPOINT = 0x80000003, + STATUS_SINGLE_STEP = 0x80000004, + STATUS_ACCESS_VIOLATION = 0xC0000005, + STATUS_IN_PAGE_ERROR = 0xC0000006, + STATUS_NO_MEMORY = 0xC0000017, + STATUS_ILLEGAL_INSTRUCTION = 0xC000001D, + STATUS_NONCONTINUABLE_EXCEPTION = 0xC0000025, + STATUS_INVALID_DISPOSITION = 0xC0000026, + STATUS_ARRAY_BOUNDS_EXCEEDED = 0xC000008C, + STATUS_FLOAT_DENORMAL_OPERAND = 0xC000008D, + STATUS_FLOAT_DIVIDE_BY_ZERO = 0xC000008E, + STATUS_FLOAT_INEXACT_RESULT = 0xC000008F, + STATUS_FLOAT_INVALID_OPERATION = 0xC0000090, + STATUS_FLOAT_OVERFLOW = 0xC0000091, + STATUS_FLOAT_STACK_CHECK = 0xC0000092, + STATUS_FLOAT_UNDERFLOW = 0xC0000093, + STATUS_INTEGER_DIVIDE_BY_ZERO = 0xC0000094, + STATUS_INTEGER_UNDERFLOW = 0xC0000095, + STATUS_PRIVILEGED_INSTRUCTION = 0xC0000096, + STATUS_STACK_OVERFLOW = 0xC00000FD, + STATUS_CONTROL_C_EXIT = 0xC000013A, +} WapiStatus; + +#endif /* _WAPI_STATUS_H_ */ diff --git a/mono/io-layer/threads.c b/mono/io-layer/threads.c new file mode 100644 index 00000000000..e3e6c67e594 --- /dev/null +++ b/mono/io-layer/threads.c @@ -0,0 +1,483 @@ +#include <config.h> +#include <glib.h> +#include <string.h> +#include <pthread.h> +#include <sched.h> +#include <sys/time.h> +#include <errno.h> + +#include "mono/io-layer/wapi.h" +#include "wapi-private.h" +#include "timed-thread.h" +#include "wait-private.h" +#include "handles-private.h" + +#include "pthread-compat.h" + +#define DEBUG + +typedef enum { + THREAD_STATE_START, + THREAD_STATE_EXITED, +} WapiThreadState; + +struct _WapiHandle_thread +{ + WapiHandle handle; + WapiThreadState state; + TimedThread *thread; + guint32 exitstatus; +}; + +static pthread_mutex_t thread_signal_mutex = PTHREAD_MUTEX_INITIALIZER; +static pthread_cond_t thread_signal_cond = PTHREAD_COND_INITIALIZER; + +static void thread_close(WapiHandle *handle); +static gboolean thread_wait(WapiHandle *handle, guint32 ms); +static guint32 thread_wait_multiple(gpointer data); + +static struct _WapiHandleOps thread_ops = { + thread_close, /* close */ + NULL, /* getfiletype */ + NULL, /* readfile */ + NULL, /* writefile */ + NULL, /* seek */ + NULL, /* setendoffile */ + NULL, /* getfilesize */ + thread_wait, /* wait */ + thread_wait_multiple, /* wait_multiple */ +}; + +static void thread_close(WapiHandle *handle) +{ + struct _WapiHandle_thread *thread_handle=(struct _WapiHandle_thread *)handle; + +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION + ": closing thread handle %p with thread %p id %ld", + thread_handle, thread_handle->thread, + thread_handle->thread->id); +#endif + + g_free(thread_handle->thread); +} + +static gboolean thread_wait(WapiHandle *handle, guint32 ms) +{ + struct _WapiHandle_thread *thread_handle=(struct _WapiHandle_thread *)handle; + int ret; + + if(handle->signalled) { + /* Already signalled, so return straight away */ +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION ": thread handle %p already signalled, returning now", handle); +#endif + + return(TRUE); + } + +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION + ": waiting for %d ms for thread handle %p with id %ld", ms, + thread_handle, thread_handle->thread->id); +#endif + + if(ms==INFINITE) { + ret=_wapi_timed_thread_join(thread_handle->thread, NULL, NULL); + } else { + struct timespec timeout; + struct timeval now; + div_t divvy; + + divvy=div((int)ms, 1000); + gettimeofday(&now, NULL); + + timeout.tv_sec=now.tv_sec+divvy.quot; + timeout.tv_nsec=(now.tv_usec+divvy.rem)*1000; + + ret=_wapi_timed_thread_join(thread_handle->thread, &timeout, + NULL); + } + + if(ret==0) { + /* Thread joined */ + return(TRUE); + } else { + /* ret might be ETIMEDOUT for timeout, or other for error */ + return(FALSE); + } +} + +static guint32 thread_wait_multiple(gpointer data) +{ + WaitQueueItem *item=(WaitQueueItem *)data; + int ret; + guint32 numhandles, count; + struct timespec timeout; + struct timeval now; + div_t divvy; + + pthread_mutex_lock(&item->mutex); + + numhandles=item->handles[WAPI_HANDLE_THREAD]->len; + +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION + ": waiting on %d thread handles for %d ms", numhandles, + item->timeout); +#endif + + /* First, check if any of the handles are already + * signalled. If waitall is specified we only return if all + * handles have been signalled. + */ + count=_wapi_handle_count_signalled(item->handles[WAPI_HANDLE_THREAD]); + +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION + ": Preliminary check found %d handles signalled", count); +#endif + + if((item->waitall==TRUE && count==numhandles) || + (item->waitall==FALSE && count>0)) { + goto success; + } + + /* OK, we need to wait for some */ + if(item->timeout!=INFINITE) { + divvy=div((int)item->timeout, 1000); + gettimeofday(&now, NULL); + + timeout.tv_sec=now.tv_sec+divvy.quot; + timeout.tv_nsec=(now.tv_usec+divvy.rem)*1000; + } + + /* We can restart from here without resetting the timeout, + * because it is calculated from absolute time, not an offset + */ +again: + pthread_mutex_lock(&thread_signal_mutex); + if(item->timeout==INFINITE) { + ret=pthread_cond_wait(&thread_signal_cond, + &thread_signal_mutex); + } else { + ret=pthread_cond_timedwait(&thread_signal_cond, + &thread_signal_mutex, + &timeout); + } + pthread_mutex_unlock(&thread_signal_mutex); + + if(ret==ETIMEDOUT) { + /* Check signalled state here, just in case a thread + * exited between the first check and the cond wait. + * We return the number of signalled handles, which + * may be fewer than the total. + */ +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION ": Wait timed out"); +#endif + + count=_wapi_handle_count_signalled( + item->handles[WAPI_HANDLE_THREAD]); + goto success; + } + +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION ": Thread exited, checking status"); +#endif + + /* Another thread exited, so see if it was one we are + * interested in + */ + count=_wapi_handle_count_signalled(item->handles[WAPI_HANDLE_THREAD]); + +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION + ": Check after thread exit found %d handles signalled", + count); +#endif + + if((item->waitall==TRUE && count==numhandles) || + (item->waitall==FALSE && count>0)) { + goto success; + } + + /* Either we have waitall set with more handles to wait for, + * or the thread that exited wasn't interesting to us + */ +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION ": Waiting a bit longer"); +#endif + + goto again; + +success: + item->waited[WAPI_HANDLE_THREAD]=TRUE; + pthread_mutex_unlock(&item->mutex); + return(count); +} + +static void thread_exit(guint32 exitstatus, gpointer userdata) +{ + struct _WapiHandle_thread *thread_handle=(struct _WapiHandle_thread *)userdata; + + thread_handle->exitstatus=exitstatus; + thread_handle->state=THREAD_STATE_EXITED; + thread_handle->handle.signalled=TRUE; + +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION + ": Recording thread handle %p status as %d", thread_handle, + exitstatus); +#endif + + /* Signal any thread waiting on thread exit */ + pthread_mutex_lock(&thread_signal_mutex); + pthread_cond_broadcast(&thread_signal_cond); + pthread_mutex_unlock(&thread_signal_mutex); +} + +/** + * CreateThread: + * @security: Ignored for now. + * @stacksize: the size in bytes of the new thread's stack. Use 0 to + * default to the normal stack size. (Ignored for now). + * @start: The function that the new thread should start with + * @param: The parameter to give to @start. + * @create: If 0, the new thread is ready to run immediately. If + * %CREATE_SUSPENDED, the new thread will be in the suspended state, + * requiring a ResumeThread() call to continue running. + * @tid: If non-NULL, the ID of the new thread is stored here. + * + * Creates a new threading handle. + * + * Return value: a new handle, or NULL + */ +WapiHandle *CreateThread(WapiSecurityAttributes *security G_GNUC_UNUSED, guint32 stacksize G_GNUC_UNUSED, + WapiThreadStart start, gpointer param, guint32 create G_GNUC_UNUSED, + guint32 *tid) +{ + struct _WapiHandle_thread *thread_handle; + WapiHandle *handle; + int ret; + + if(start==NULL) { + return(NULL); + } + + thread_handle=(struct _WapiHandle_thread *)g_new0(struct _WapiHandle_thread, 1); + thread_handle->state=THREAD_STATE_START; + + ret=_wapi_timed_thread_create(&thread_handle->thread, NULL, start, + thread_exit, param, thread_handle); + if(ret!=0) { +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION ": Thread create error: %s", + strerror(ret)); +#endif + g_free(thread_handle); + return(NULL); + } + + handle=(WapiHandle *)thread_handle; + _WAPI_HANDLE_INIT(handle, WAPI_HANDLE_THREAD, thread_ops); + +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION + ": Started thread handle %p thread %p ID %ld", thread_handle, + thread_handle->thread, thread_handle->thread->id); +#endif + + if(tid!=NULL) { + *tid=thread_handle->thread->id; + } + + return(handle); +} + +/** + * ExitThread: + * @exitcode: Sets the thread's exit code, which can be read from + * another thread with GetExitCodeThread(). + * + * Terminates the calling thread. A thread can also exit by returning + * from its start function. When the last thread in a process + * terminates, the process itself terminates. + */ +void ExitThread(guint32 exitcode) +{ + _wapi_timed_thread_exit(exitcode); +} + +/** + * GetExitCodeThread: + * @handle: The thread handle to query + * @exitcode: The thread @handle exit code is stored here + * + * Finds the exit code of @handle, and stores it in @exitcode. If the + * thread @handle is still running, the value stored is %STILL_ACTIVE. + * + * Return value: %TRUE, or %FALSE on error. + */ +gboolean GetExitCodeThread(WapiHandle *handle, guint32 *exitcode) +{ + struct _WapiHandle_thread *thread_handle=(struct _WapiHandle_thread *)handle; + +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION + ": Finding exit status for thread handle %p id %ld", handle, + thread_handle->thread->id); +#endif + + if(exitcode==NULL) { +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION + ": Nowhere to store exit code"); +#endif + return(FALSE); + } + + if(thread_handle->state!=THREAD_STATE_EXITED) { +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION + ": Thread still active (state %d, exited is %d)", + thread_handle->state, THREAD_STATE_EXITED); +#endif + *exitcode=STILL_ACTIVE; + return(TRUE); + } + + *exitcode=thread_handle->exitstatus; + + return(TRUE); +} + +/** + * ResumeThread: + * @handle: the thread handle to resume + * + * Decrements the suspend count of thread @handle. A thread can only + * run if its suspend count is zero. + * + * Return value: the previous suspend count, or 0xFFFFFFFF on error. + */ +guint32 ResumeThread(WapiHandle *handle G_GNUC_UNUSED) +{ + return(0xFFFFFFFF); +} + +/** + * SuspendThread: + * @handle: the thread handle to suspend + * + * Increments the suspend count of thread @handle. A thread can only + * run if its suspend count is zero. + * + * Return value: the previous suspend count, or 0xFFFFFFFF on error. + */ +guint32 SuspendThread(WapiHandle *handle G_GNUC_UNUSED) +{ + return(0xFFFFFFFF); +} + +/** + * TlsAlloc: + * + * Allocates a Thread Local Storage (TLS) index. Any thread in the + * same process can use this index to store and retrieve values that + * are local to that thread. + * + * Return value: The index value, or %TLS_OUT_OF_INDEXES if no index + * is available. + */ +guint32 TlsAlloc(void) +{ + return(TLS_OUT_OF_INDEXES); +} + +/** + * TlsFree: + * @idx: The TLS index to free + * + * Releases a TLS index, making it available for reuse. This call + * will delete any TLS data stored under index @idx in all threads. + * + * Return value: %TRUE on success, %FALSE otherwise. + */ +gboolean TlsFree(guint32 idx G_GNUC_UNUSED) +{ + return(FALSE); +} + +/** + * TlsGetValue: + * @idx: The TLS index to retrieve + * + * Retrieves the TLS data stored under index @idx. + * + * Return value: The value stored in the TLS index @idx in the current + * thread, or %NULL on error. As %NULL can be a valid return value, + * in this case GetLastError() returns %ERROR_SUCCESS. + */ +gpointer TlsGetValue(guint32 idx G_GNUC_UNUSED) +{ + return(NULL); +} + +/** + * TlsSetValue: + * @idx: The TLS index to store + * @value: The value to store under index @idx + * + * Stores @value at TLS index @idx. + * + * Return value: %TRUE on success, %FALSE otherwise. + */ +gboolean TlsSetValue(guint32 idx G_GNUC_UNUSED, gpointer value G_GNUC_UNUSED) +{ + return(FALSE); +} + +/** + * Sleep: + * @ms: The time in milliseconds to suspend for + * + * Suspends execution of the current thread for @ms milliseconds. A + * value of zero causes the thread to relinquish its time slice. A + * value of %INFINITE causes an infinite delay. + */ +void Sleep(guint32 ms) +{ + struct timespec req, rem; + div_t divvy; + int ret; + +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION ": Sleeping for %d ms", ms); +#endif + + if(ms==0) { + sched_yield(); + return; + } + + /* FIXME: check for INFINITE and sleep forever */ + divvy=div((int)ms, 1000); + + req.tv_sec=divvy.quot; + req.tv_nsec=divvy.rem*1000; + +again: + ret=nanosleep(&req, &rem); + if(ret==-1) { + /* Sleep interrupted with rem time remaining */ +#ifdef DEBUG + guint32 rems=rem.tv_sec*1000 + rem.tv_nsec/1000; + + g_message(G_GNUC_PRETTY_FUNCTION ": Still got %d ms to go", + rems); +#endif + req=rem; + goto again; + } +} diff --git a/mono/io-layer/threads.h b/mono/io-layer/threads.h new file mode 100644 index 00000000000..29627af115c --- /dev/null +++ b/mono/io-layer/threads.h @@ -0,0 +1,28 @@ +#ifndef _WAPI_THREADS_H_ +#define _WAPI_THREADS_H_ + +#include <glib.h> + +#include "mono/io-layer/handles.h" +#include "mono/io-layer/io.h" +#include "mono/io-layer/status.h" + +#define TLS_MINIMUM_AVAILABLE 64 +#define TLS_OUT_OF_INDEXES 0xFFFFFFFF + +#define STILL_ACTIVE STATUS_PENDING + +typedef guint32 (*WapiThreadStart)(gpointer); + +extern WapiHandle *CreateThread(WapiSecurityAttributes *security, guint32 stacksize, WapiThreadStart start, gpointer param, guint32 create, guint32 *tid); +extern void ExitThread(guint32 exitcode) G_GNUC_NORETURN; +extern gboolean GetExitCodeThread(WapiHandle *handle, guint32 *exitcode); +extern guint32 ResumeThread(WapiHandle *handle); +extern guint32 SuspendThread(WapiHandle *handle); +extern guint32 TlsAlloc(void); +extern gboolean TlsFree(guint32 idx); +extern gpointer TlsGetValue(guint32 idx); +extern gboolean TlsSetValue(guint32 idx, gpointer value); +extern void Sleep(guint32 ms); + +#endif /* _WAPI_THREADS_H_ */ diff --git a/mono/io-layer/timed-thread.c b/mono/io-layer/timed-thread.c new file mode 100644 index 00000000000..7a6fcf228e5 --- /dev/null +++ b/mono/io-layer/timed-thread.c @@ -0,0 +1,139 @@ +#include <config.h> +#include <glib.h> +#include <pthread.h> + +#include "timed-thread.h" + +#define DEBUG + +/* + * Implementation of timed thread joining from the P1003.1d/D14 (July 1999) + * draft spec, figure B-6. + */ + +static pthread_key_t timed_thread_key; +static pthread_once_t timed_thread_once = PTHREAD_ONCE_INIT; + +static void timed_thread_init(void) +{ + pthread_key_create(&timed_thread_key, NULL); +} + +void _wapi_timed_thread_exit(guint32 exitstatus) +{ + TimedThread *thread; + void *specific; + + if((specific = pthread_getspecific(timed_thread_key)) == NULL) { + /* Handle cases which won't happen with correct usage. + */ + pthread_exit(NULL); + } + + thread=(TimedThread *)specific; + + pthread_mutex_lock(&thread->join_mutex); + + /* Tell a joiner that we're exiting. + */ +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION + ": Setting thread %p id %ld exit status to %d", + thread, thread->id, exitstatus); +#endif + + thread->exitstatus=exitstatus; + thread->exiting=TRUE; + + if(thread->exit_routine!=NULL) { + thread->exit_routine(exitstatus, thread->exit_userdata); + } + + pthread_cond_signal(&thread->exit_cond); + pthread_mutex_unlock(&thread->join_mutex); + + /* Call pthread_exit() to call destructors and really exit the + * thread. + */ + pthread_exit(NULL); +} + +/* Routine to establish thread specific data value and run the actual + * thread start routine which was supplied to timed_thread_create() + */ +static void *timed_thread_start_routine(gpointer args) G_GNUC_NORETURN; +static void *timed_thread_start_routine(gpointer args) +{ + TimedThread *thread = (TimedThread *)args; + + pthread_once(&timed_thread_once, timed_thread_init); + pthread_setspecific(timed_thread_key, (void *)thread); + _wapi_timed_thread_exit(thread->start_routine(thread->arg)); +} + +/* Allocate a thread which can be used with timed_thread_join(). + */ +int _wapi_timed_thread_create(TimedThread **threadp, + const pthread_attr_t *attr, + guint32 (*start_routine)(gpointer), + void (*exit_routine)(guint32, gpointer), + gpointer arg, gpointer exit_userdata) +{ + TimedThread *thread; + int result; + + thread=(TimedThread *)g_new0(TimedThread, 1); + + pthread_mutex_init(&thread->join_mutex, NULL); + pthread_cond_init(&thread->exit_cond, NULL); + thread->start_routine = start_routine; + thread->exit_routine = exit_routine; + thread->arg = arg; + thread->exit_userdata = exit_userdata; + thread->exitstatus = 0; + thread->exiting = FALSE; + + *threadp = thread; + + if((result = pthread_create(&thread->id, attr, + timed_thread_start_routine, + (void *)thread)) != 0) { + g_free(thread); + return(result); + } + + pthread_detach(thread->id); + return(0); +} + +int _wapi_timed_thread_join(TimedThread *thread, struct timespec *timeout, + guint32 *exitstatus) +{ + int result; + + pthread_mutex_lock(&thread->join_mutex); + result=0; + + /* Wait until the thread announces that it's exiting, or until + * timeout. + */ + while(result == 0 && !thread->exiting) { + if(timeout == NULL) { + result = pthread_cond_wait(&thread->exit_cond, + &thread->join_mutex); + } else { + result = pthread_cond_timedwait(&thread->exit_cond, + &thread->join_mutex, + timeout); + } + } + + pthread_mutex_unlock(&thread->join_mutex); + if(result == 0 && thread->exiting) { + if(exitstatus!=NULL) { + *exitstatus = thread->exitstatus; + } + } + return(result); +} + diff --git a/mono/io-layer/timed-thread.h b/mono/io-layer/timed-thread.h new file mode 100644 index 00000000000..bb5908058c2 --- /dev/null +++ b/mono/io-layer/timed-thread.h @@ -0,0 +1,31 @@ +#ifndef _WAPI_TIMED_THREAD_H_ +#define _WAPI_TIMED_THREAD_H_ + +#include <config.h> +#include <glib.h> +#include <pthread.h> + +typedef struct +{ + pthread_t id; + pthread_mutex_t join_mutex; + pthread_cond_t exit_cond; + guint32 (*start_routine)(gpointer arg); + void (*exit_routine)(guint32 exitstatus, gpointer userdata); + gpointer arg; + gpointer exit_userdata; + guint32 exitstatus; + gboolean exiting; +} TimedThread; + +extern void _wapi_timed_thread_exit(guint32 exitstatus) G_GNUC_NORETURN; +extern int _wapi_timed_thread_create(TimedThread **threadp, + const pthread_attr_t *attr, + guint32 (*start_routine)(gpointer), + void (*exit_routine)(guint32, gpointer), + gpointer arg, gpointer exit_userdata); +extern int _wapi_timed_thread_join(TimedThread *thread, + struct timespec *timeout, + guint32 *exitstatus); + +#endif /* _WAPI_TIMED_THREAD_H_ */ diff --git a/mono/io-layer/uglify.h b/mono/io-layer/uglify.h new file mode 100644 index 00000000000..6e59bedbebe --- /dev/null +++ b/mono/io-layer/uglify.h @@ -0,0 +1,29 @@ +#ifndef _WAPI_UGLIFY_H_ +#define _WAPI_UGLIFY_H_ + +/* Include this file if you insist on using the nasty Win32 typedefs */ + +#include <stdlib.h> + +#include "mono/io-layer/wapi.h" + +typedef const guchar *LPCTSTR; /* replace this with gunichar */ +typedef guint32 DWORD; +typedef gpointer LPVOID; +typedef gboolean BOOL; +typedef guint32 *LPDWORD; +typedef gint32 LONG; +typedef gint32 *PLONG; + +typedef WapiHandle *HANDLE; +typedef WapiHandle **LPHANDLE; +typedef WapiSecurityAttributes *LPSECURITY_ATTRIBUTES; +typedef WapiOverlapped *LPOVERLAPPED; +typedef WapiThreadStart LPTHREAD_START_ROUTINE; + +#define CONST const +#define VOID void + +#define WINAPI + +#endif /* _WAPI_UGLIFY_H_ */ diff --git a/mono/io-layer/unicode.c b/mono/io-layer/unicode.c new file mode 100644 index 00000000000..c555ab2ae10 --- /dev/null +++ b/mono/io-layer/unicode.c @@ -0,0 +1,124 @@ +#include <config.h> +#include <glib.h> +#include <pthread.h> +#include <iconv.h> +#include <errno.h> + +#include "mono/io-layer/wapi.h" +#include "unicode.h" + +static pthread_key_t unicode_key; +static pthread_once_t unicode_key_once=PTHREAD_ONCE_INIT; + +static void unicode_end(void *buf) +{ + iconv_t cd=(iconv_t)buf; + + iconv_close(cd); +} + +static void unicode_init(void) +{ + pthread_key_create(&unicode_key, unicode_end); +} + +static iconv_t unicode_reset(void) +{ + iconv_t cd; + + pthread_once(&unicode_key_once, unicode_init); + + cd=pthread_getspecific(unicode_key); + if(cd==NULL) { + cd=iconv_open("UTF-8", "UNICODE"); + if(cd==(iconv_t)-1) { + g_message(G_GNUC_PRETTY_FUNCTION ": Can't open iconv descriptor from UTF-8 to UNICODE"); + return(cd); + } + pthread_setspecific(unicode_key, cd); + } + + if(cd==(iconv_t)-1) { + return(cd); + } + + iconv(cd, NULL, NULL, NULL, NULL); + + return(cd); +} + +/* Cut&pasted from glib (switch to g_convert() when glib-2 is out */ +guchar *_wapi_unicode_to_utf8(const guchar *uni) +{ + guchar *str; + guchar *dest; + guchar *outp; + guchar *p; + guint inbytes_remaining; + guint outbytes_remaining; + size_t err; + guint outbuf_size; + gint len; + gboolean have_error = FALSE; + iconv_t converter; + + converter=unicode_reset(); + + g_return_val_if_fail(uni != NULL, NULL); + g_return_val_if_fail(converter != (iconv_t) -1, NULL); + + str = g_strdup(uni); + len = strlen(str); + + p = str; + inbytes_remaining = len; + outbuf_size = len + 1; /* + 1 for nul in case len == 1 */ + + outbytes_remaining = outbuf_size - 1; /* -1 for nul */ + outp = dest = g_malloc(outbuf_size); + +again: + err = iconv(converter, (char **)&p, &inbytes_remaining, (char **)&outp, &outbytes_remaining); + + if(err == (size_t)-1) { + switch(errno) { + case EINVAL: + /* Incomplete text, do not report an error */ + break; + case E2BIG: { + size_t used = outp - dest; + + outbuf_size *= 2; + dest = g_realloc(dest, outbuf_size); + + outp = dest + used; + outbytes_remaining = outbuf_size - used - 1; /* -1 for nul */ + + goto again; + } + case EILSEQ: + have_error = TRUE; + break; + default: + have_error = TRUE; + break; + } + } + + *outp = '\0'; + + if((p - str) != len) { + if(!have_error) { + have_error = TRUE; + } + } + + g_free(str); + + if(have_error) { + g_free (dest); + return NULL; + } else { + return dest; + } +} diff --git a/mono/io-layer/unicode.h b/mono/io-layer/unicode.h new file mode 100644 index 00000000000..55847b9ffdd --- /dev/null +++ b/mono/io-layer/unicode.h @@ -0,0 +1,10 @@ +#ifndef _WAPI_UNICODE_H_ +#define _WAPI_UNICODE_H_ + +/* This is an internal, private header file */ + +#include <glib.h> + +extern guchar *_wapi_unicode_to_utf8(const guchar *uni); + +#endif /* _WAPI_UNICODE_H_ */ diff --git a/mono/io-layer/wait-private.h b/mono/io-layer/wait-private.h new file mode 100644 index 00000000000..3be5e19b11a --- /dev/null +++ b/mono/io-layer/wait-private.h @@ -0,0 +1,32 @@ +#ifndef _WAPI_WAIT_PRIVATE_H_ +#define _WAPI_WAIT_PRIVATE_H_ + +/* This is an internal, private header file */ + +#include <glib.h> +#include <pthread.h> +#include <semaphore.h> + +#include "wapi-private.h" +#include "timed-thread.h" + +typedef enum { + WQ_NEW, + WQ_WAITING, + WQ_SIGNALLED, +} WaitQueueState; + +typedef struct _WaitQueueItem +{ + pthread_mutex_t mutex; + sem_t wait_sem; + WaitQueueState state; + guint32 update, ack; + guint32 timeout; + gboolean waitall; + GPtrArray *handles[WAPI_HANDLE_COUNT]; + TimedThread *thread[WAPI_HANDLE_COUNT]; + gboolean waited[WAPI_HANDLE_COUNT]; +} WaitQueueItem; + +#endif /* _WAPI_WAIT_PRIVATE_H_ */ diff --git a/mono/io-layer/wait.c b/mono/io-layer/wait.c new file mode 100644 index 00000000000..ab642aa2a96 --- /dev/null +++ b/mono/io-layer/wait.c @@ -0,0 +1,490 @@ +#include <config.h> +#include <glib.h> +#include <string.h> + +#include "mono/io-layer/wapi.h" +#include "wait-private.h" +#include "timed-thread.h" +#include "handles-private.h" +#include "wapi-private.h" + +#define DEBUG + +static pthread_once_t wait_once=PTHREAD_ONCE_INIT; + +static GPtrArray *WaitQueue=NULL; + +static pthread_t wait_monitor_thread_id; +static gboolean wait_monitor_thread_running=FALSE; +static pthread_mutex_t wait_monitor_mutex=PTHREAD_MUTEX_INITIALIZER; +static sem_t wait_monitor_sem; + +static void launch_tidy(guint32 exitcode G_GNUC_UNUSED, gpointer user) +{ + WaitQueueItem *item=(WaitQueueItem *)user; + +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION ": Informing monitor thread"); +#endif + + /* Update queue item */ + pthread_mutex_lock(&item->mutex); + item->update++; + pthread_mutex_unlock(&item->mutex); + + /* Signal monitor */ + sem_post(&wait_monitor_sem); +} + +/* This function is called by the monitor thread to launch handle-type + * specific threads to block in particular ways. + * + * The item mutex is held by the monitor thread when this function is + * called. + */ +static void launch_blocker_threads(WaitQueueItem *item) +{ + int i, ret; + +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION ": Launching blocker threads"); +#endif + + for(i=0; i<WAPI_HANDLE_COUNT; i++) { + if(item->handles[i]->len>0) { + WapiHandle *handle; + + handle=g_ptr_array_index(item->handles[i], 0); + g_assert(handle!=NULL); + g_assert(handle->ops->wait_multiple!=NULL); + +#ifdef DEBUG + g_message("Handle type %d active", i); +#endif + item->waited[i]=FALSE; + + ret=_wapi_timed_thread_create( + &item->thread[i], NULL, + handle->ops->wait_multiple, launch_tidy, item, + item); + if(ret!=0) { + g_warning(G_GNUC_PRETTY_FUNCTION + ": Thread create error: %s", + strerror(ret)); + return; + } + } else { + /* Pretend to have already waited for the + * thread; it makes life easier for the + * monitor thread. + */ + item->waited[i]=TRUE; + } + } +} + +static gboolean launch_threads_done(WaitQueueItem *item) +{ + int i; + + for(i=0; i<WAPI_HANDLE_COUNT; i++) { + if(item->waited[i]==FALSE) { + return(FALSE); + } + } + + return(TRUE); +} + +/* This is the main loop for the monitor thread. It waits for a + * signal to check the wait queue, then takes any action necessary on + * any queue items that have indicated readiness. + */ +static void *wait_monitor_thread(void *unused G_GNUC_UNUSED) +{ + guint i; + + /* Signal that the monitor thread is ready */ + wait_monitor_thread_running=TRUE; + + while(TRUE) { + /* Use a semaphore rather than a cond so we dont miss + * any signals + */ + sem_wait(&wait_monitor_sem); + +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION + ": Blocking thread doing stuff"); +#endif + + /* We've been signalled, so scan the wait queue for + * activity. + */ + pthread_mutex_lock(&wait_monitor_mutex); + for(i=0; i<WaitQueue->len; i++) { + WaitQueueItem *item=g_ptr_array_index(WaitQueue, i); + + if(item->update > item->ack) { + /* Something changed */ + pthread_mutex_lock(&item->mutex); + item->ack=item->update; + + switch(item->state) { + case WQ_NEW: + /* Launch a new thread for each type of + * handle to be waited for here. + */ + launch_blocker_threads(item); + + item->state=WQ_WAITING; + break; + + case WQ_WAITING: + /* See if we have waited for + * the last blocker thread. + */ + if(launch_threads_done(item)) { + /* All handles have + * been signalled, so + * signal the waiting + * thread. Let the + * waiting thread + * remove this item + * from the queue, + * because it makes + * the logic a lot + * easier here. + */ + item->state=WQ_SIGNALLED; + sem_post(&item->wait_sem); + } + break; + + case WQ_SIGNALLED: + /* This shouldn't happen. Prod + * the blocking thread again + * just to make sure. + */ + g_warning(G_GNUC_PRETTY_FUNCTION + ": Prodding blocker again"); + sem_post(&item->wait_sem); + break; + } + + pthread_mutex_unlock(&item->mutex); + } + } + + pthread_mutex_unlock(&wait_monitor_mutex); + } + + return(NULL); +} + +static void wait_init(void) +{ + int ret; + +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION ": Starting monitor thread"); +#endif + + WaitQueue=g_ptr_array_new(); + + sem_init(&wait_monitor_sem, 0, 0); + + /* Launch a thread which manages the wait queue, and deals + * with waiting for handles of various types. + */ + ret=pthread_create(&wait_monitor_thread_id, NULL, + wait_monitor_thread, NULL); + if(ret!=0) { + g_warning(G_GNUC_PRETTY_FUNCTION + ": Couldn't start handle monitor thread: %s", + strerror(ret)); + } + + /* Wait for the monitor thread to get going */ + while(wait_monitor_thread_running==FALSE) { + pthread_yield(); + } +} + +static WaitQueueItem *wait_item_new(guint32 timeout, gboolean waitall) +{ + WaitQueueItem *new; + int i; + + new=g_new0(WaitQueueItem, 1); + + pthread_mutex_init(&new->mutex, NULL); + sem_init(&new->wait_sem, 0, 0); + + new->update=1; /* As soon as this item is queued it + * will need attention. + */ + new->state=WQ_NEW; + new->timeout=timeout; + new->waitall=waitall; + + for(i=0; i<WAPI_HANDLE_COUNT; i++) { + new->handles[i]=g_ptr_array_new(); + } + + return(new); +} + +/* Adds our queue item to the work queue, and blocks until the monitor + * thread thinks it's done the work. Returns TRUE for done, FALSE for + * timed out. + */ +static gboolean wait_for_item(WaitQueueItem *item) +{ + gboolean ret; + int i; + + /* Add the wait item to the monitor queue, and signal the + * monitor thread */ + pthread_mutex_lock(&wait_monitor_mutex); + g_ptr_array_add(WaitQueue, item); + sem_post(&wait_monitor_sem); + pthread_mutex_unlock(&wait_monitor_mutex); + + /* Wait for the item to become ready */ + sem_wait(&item->wait_sem); + + pthread_mutex_lock(&item->mutex); + + /* If waitall is TRUE, then the number signalled in each handle type + * must be the length of the handle type array for the wait to be + * successful. Otherwise, any signalled handle is good enough + */ + if(item->waitall==TRUE) { + ret=TRUE; + for(i=0; i<WAPI_HANDLE_COUNT; i++) { + if(_wapi_handle_count_signalled(item->handles[i])!=item->handles[i]->len) { + ret=FALSE; + break; + } + } + } else { + ret=FALSE; + for(i=0; i<WAPI_HANDLE_COUNT; i++) { + if(_wapi_handle_count_signalled(item->handles[i])>0) { + ret=TRUE; + break; + } + } + } + pthread_mutex_unlock(&item->mutex); + + return(ret); +} + +static gboolean wait_dequeue_item(WaitQueueItem *item) +{ + gboolean ret; + + g_assert(WaitQueue!=NULL); + + pthread_mutex_lock(&wait_monitor_mutex); + ret=g_ptr_array_remove_fast(WaitQueue, item); + pthread_mutex_unlock(&wait_monitor_mutex); + + return(ret); +} + +static void wait_item_destroy(WaitQueueItem *item) +{ + int i; + + pthread_mutex_destroy(&item->mutex); + sem_destroy(&item->wait_sem); + + for(i=0; i<WAPI_HANDLE_COUNT; i++) { + if(item->thread[i]!=NULL) { + g_free(item->thread[i]); + } + g_ptr_array_free(item->handles[i], FALSE); + } +} + + +/** + * WaitForSingleObject: + * @handle: an object to wait for + * @timeout: the maximum time in milliseconds to wait for + * + * This function returns when either @handle is signalled, or @timeout + * ms elapses. If @timeout is zero, the object's state is tested and + * the function returns immediately. If @timeout is %INFINITE, the + * function waits forever. + * + * Return value: %WAIT_ABANDONED - @handle is a mutex that was not + * released by the owning thread when it exited. Ownership of the + * mutex object is granted to the calling thread and the mutex is set + * to nonsignalled. %WAIT_OBJECT_0 - The state of @handle is + * signalled. %WAIT_TIMEOUT - The @timeout interval elapsed and + * @handle's state is still not signalled. %WAIT_FAILED - an error + * occurred. + */ +guint32 WaitForSingleObject(WapiHandle *handle, guint32 timeout) +{ + gboolean wait; + + if(handle->ops->wait==NULL) { + return(WAIT_FAILED); + } + + if(timeout==0) { + /* Just poll the object */ +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION ": Polling"); +#endif + + if(handle->signalled==TRUE) { + return(WAIT_OBJECT_0); + } else { + return(WAIT_TIMEOUT); + } + } + + wait=handle->ops->wait(handle, timeout); + if(wait==TRUE) { + /* Object signalled before timeout expired */ +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION ": Object %p signalled", + handle); +#endif + return(WAIT_OBJECT_0); + } else { +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION ": Object %p wait timed out", + handle); +#endif + return(WAIT_TIMEOUT); + } +} + +/** + * WaitForMultipleObjects: + * @numobjects: The number of objects in @handles. The maximum allowed + * is %MAXIMUM_WAIT_OBJECTS. + * @handles: An array of object handles. Duplicates are not allowed. + * @waitall: If %TRUE, this function waits until all of the handles + * are signalled. If %FALSE, this function returns when any object is + * signalled. + * @timeout: The maximum time in milliseconds to wait for. + * + * This function returns when either one or more of @handles is + * signalled, or @timeout ms elapses. If @timeout is zero, the state + * of each item of @handles is tested and the function returns + * immediately. If @timeout is %INFINITE, the function waits forever. + * + * Return value: %WAIT_OBJECT_0 to %WAIT_OBJECT_0 + @numobjects - 1 - + * if @waitall is %TRUE, indicates that all objects are signalled. If + * @waitall is %FALSE, the return value minus %WAIT_OBJECT_0 indicates + * the first index into @handles of the objects that are signalled. + * %WAIT_ABANDONED_0 to %WAIT_ABANDONED_0 + @numobjects - 1 - if + * @waitall is %TRUE, indicates that all objects are signalled, and at + * least one object is an abandoned mutex object (See + * WaitForSingleObject() for a description of abandoned mutexes.) If + * @waitall is %FALSE, the return value minus %WAIT_ABANDONED_0 + * indicates the first index into @handles of an abandoned mutex. + * %WAIT_TIMEOUT - The @timeout interval elapsed and no objects in + * @handles are signalled. %WAIT_FAILED - an error occurred. + */ +guint32 WaitForMultipleObjects(guint32 numobjects, WapiHandle **handles, + gboolean waitall, guint32 timeout) +{ + WaitQueueItem *item; + GHashTable *dups; + gboolean duplicate=FALSE, bogustype=FALSE; + gboolean wait; + guint i; + + pthread_once(&wait_once, wait_init); + + if(numobjects>MAXIMUM_WAIT_OBJECTS) { +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION ": Too many handles: %d", + numobjects); +#endif + + return(WAIT_FAILED); + } + + /* Check for duplicates */ + dups=g_hash_table_new(g_direct_hash, g_direct_equal); + for(i=0; i<numobjects; i++) { + gpointer exists=g_hash_table_lookup(dups, handles[i]); + if(exists!=NULL) { +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION + ": Handle %p duplicated", handles[i]); +#endif + + duplicate=TRUE; + break; + } + + if(handles[i]->ops->wait_multiple==NULL) { +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION + ": Handle %p can't be waited for (type %d)", + handles[i], handles[i]->type); +#endif + + bogustype=TRUE; + } + + g_hash_table_insert(dups, handles[i], handles[i]); + } + g_hash_table_destroy(dups); + + if(duplicate==TRUE) { +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION + ": Returning due to duplicates"); +#endif + + return(WAIT_FAILED); + } + + if(bogustype==TRUE) { +#ifdef DEBUG + g_message(G_GNUC_PRETTY_FUNCTION + ": Returning due to bogus type"); +#endif + + return(WAIT_FAILED); + } + + item=wait_item_new(timeout, waitall); + + /* Sort the handles by type */ + for(i=0; i<numobjects; i++) { + g_ptr_array_add(item->handles[handles[i]->type], handles[i]); + } + + wait=wait_for_item(item); + wait_dequeue_item(item); + wait_item_destroy(item); + + if(wait==FALSE) { + /* Wait timed out */ + return(WAIT_TIMEOUT); + } + + for(i=0; i<numobjects; i++) { + if(handles[i]->signalled==TRUE) { + return(WAIT_OBJECT_0+i); + } + } + + /* Oh dear. Something returned from the wait, but nothing + * appears to be signalled. + */ + return(WAIT_FAILED); +} diff --git a/mono/io-layer/wait.h b/mono/io-layer/wait.h new file mode 100644 index 00000000000..b0218bd93cb --- /dev/null +++ b/mono/io-layer/wait.h @@ -0,0 +1,22 @@ +#ifndef _WAPI_WAIT_H_ +#define _WAPI_WAIT_H_ + +#include "mono/io-layer/status.h" + +#define MAXIMUM_WAIT_OBJECTS 64 + +#define INFINITE 0xFFFFFFFF + +#define WAIT_FAILED 0xFFFFFFFF +#define WAIT_OBJECT_0 ((STATUS_WAIT_0) +0) +#define WAIT_ABANDONED ((STATUS_ABANDONED_WAIT_0) +0) +#define WAIT_ABANDONED_0 ((STATUS_ABANDONED_WAIT_0) +0) + +/* WAIT_TIMEOUT is also defined in error.h. Luckily it's the same value */ +#define WAIT_TIMEOUT STATUS_TIMEOUT +#define WAIT_IO_COMPLETION STATUS_USER_APC + +extern guint32 WaitForSingleObject(WapiHandle *handle, guint32 timeout); +extern guint32 WaitForMultipleObjects(guint32 numobjects, WapiHandle **handles, gboolean waitall, guint32 timeout); + +#endif /* _WAPI_WAIT_H_ */ diff --git a/mono/io-layer/wapi-private.h b/mono/io-layer/wapi-private.h new file mode 100644 index 00000000000..f434555132e --- /dev/null +++ b/mono/io-layer/wapi-private.h @@ -0,0 +1,60 @@ +#ifndef _WAPI_PRIVATE_H_ +#define _WAPI_PRIVATE_H_ + +#include <config.h> +#include <glib.h> + +#include "mono/io-layer/handles.h" + +typedef enum { + WAPI_HANDLE_FILE, + WAPI_HANDLE_CONSOLE, + WAPI_HANDLE_THREAD, + WAPI_HANDLE_COUNT, +} WapiHandleType; + +struct _WapiHandleOps +{ + /* All handle types */ + void (*close)(WapiHandle *handle); + + /* File, console and pipe handles */ + WapiFileType (*getfiletype)(void); + + /* File and console handles */ + gboolean (*readfile)(WapiHandle *handle, gpointer buffer, + guint32 numbytes, guint32 *bytesread, + WapiOverlapped *overlapped); + gboolean (*writefile)(WapiHandle *handle, gconstpointer buffer, + guint32 numbytes, guint32 *byteswritten, + WapiOverlapped *overlapped); + + /* File handles */ + guint32 (*seek)(WapiHandle *handle, gint32 movedistance, + gint32 *highmovedistance, WapiSeekMethod method); + gboolean (*setendoffile)(WapiHandle *handle); + guint32 (*getfilesize)(WapiHandle *handle, guint32 *highsize); + + /* WaitForSingleObject */ + gboolean (*wait)(WapiHandle *handle, guint32 ms); + + /* WaitForMultipleObjects */ + guint32 (*wait_multiple)(gpointer data); +}; + +struct _WapiHandle +{ + WapiHandleType type; + guint ref; + gboolean signalled; + struct _WapiHandleOps *ops; +}; + +#define _WAPI_HANDLE_INIT(_handle, _type, _ops) G_STMT_START {\ + _handle->type=_type;\ + _handle->ref=1;\ + _handle->signalled=FALSE;\ + _handle->ops=&_ops;\ + } G_STMT_END; + +#endif /* _WAPI_PRIVATE_H_ */ diff --git a/mono/io-layer/wapi.h b/mono/io-layer/wapi.h new file mode 100644 index 00000000000..c77af554e87 --- /dev/null +++ b/mono/io-layer/wapi.h @@ -0,0 +1,11 @@ +#ifndef _WAPI_WAPI_H_ +#define _WAPI_WAPI_H_ + +#include <mono/io-layer/error.h> +#include <mono/io-layer/handles.h> +#include <mono/io-layer/io.h> +#include <mono/io-layer/threads.h> +#include <mono/io-layer/status.h> +#include <mono/io-layer/wait.h> + +#endif /* _WAPI_WAPI_H_ */ diff --git a/mono/jit/ChangeLog b/mono/jit/ChangeLog index a23e94fc3e0..29fc9dbbafc 100644 --- a/mono/jit/ChangeLog +++ b/mono/jit/ChangeLog @@ -1,3 +1,7 @@ +2001-11-09 Dick Porter <dick@ximian.com> + + * Makefile.am (testjit_LDADD): Don't need THREAD_LIBS any more + 2001-11-09 Dietmar Maurer <dietmar@ximian.com> * testjit.c (mono_analyze_stack): new BOX impl. diff --git a/mono/jit/Makefile.am b/mono/jit/Makefile.am index 82ccbea58e6..70b017cbcc4 100644 --- a/mono/jit/Makefile.am +++ b/mono/jit/Makefile.am @@ -20,7 +20,6 @@ testjit_LDADD = \ ../metadata/libmetadata.a \ $(GLIB_LIBS) \ $(GMODULE_LIBS) \ - $(THREAD_LIBS) \ -lm codegen-x86.c codegen.h: x86.brg diff --git a/mono/metadata/ChangeLog b/mono/metadata/ChangeLog index 23577a4e963..9218e13e522 100644 --- a/mono/metadata/ChangeLog +++ b/mono/metadata/ChangeLog @@ -1,3 +1,7 @@ +2001-11-09 Dick Porter <dick@ximian.com> + + * Makefile.am (pedump_LDADD): Don't need THREAD_LIBS any more + 2001-11-09 Dietmar Maurer <dietmar@ximian.com> * class.c (mono_class_metadata_init): bug fix: compute the right slot diff --git a/mono/metadata/Makefile.am b/mono/metadata/Makefile.am index 4b978950c85..9925b32db8d 100644 --- a/mono/metadata/Makefile.am +++ b/mono/metadata/Makefile.am @@ -67,6 +67,6 @@ libmetadatainclude_HEADERS = \ pedump_SOURCES = \ pedump.c $(libmetadata_a_SOURCES) -pedump_LDADD = $(GLIB_LIBS) $(GMODULE_LIBS) $(THREAD_LIBS) +pedump_LDADD = $(GLIB_LIBS) $(GMODULE_LIBS) diff --git a/mono/metadata/threads-dummy.c b/mono/metadata/threads-dummy.c index ce5f7482ea5..d197d9297b3 100644 --- a/mono/metadata/threads-dummy.c +++ b/mono/metadata/threads-dummy.c @@ -114,7 +114,7 @@ void mono_thread_init(void) * object? In theory, I guess the whole program should act as * though exit() were called :-) */ - main_thread=mono_new_object(thread_class); + main_thread=mono_object_new(thread_class); } diff --git a/status/class.xml b/status/class.xml index b4b190cbcc0..79332aedfca 100755 --- a/status/class.xml +++ b/status/class.xml @@ -2185,6 +2185,15 @@ <maintainer>miguel@ximian.com</maintainer> </maintainers> </class> + <class name="System.LocalDataStoreSlot"> + <last-activity>Sep-27-2001</last-activity> + <implementation>yes</implementation> + <test-suite>no</test-suite> + <completion>0</completion> + <maintainers> + <maintainer>dick@ximian.com</maintainer> + </maintainers> + </class> <class name="System.Web.HttpCacheability"> <last-activity>Aug-9-2001</last-activity> <implementation>yes</implementation> |