WIN32API

download WIN32API

of 301

description

gddg gdsgsdd ggdss gd g

Transcript of WIN32API

' ------------------------------------------------------------------------'' WIN32API.TXT -- Win32 API Declarations for Visual Basic' ' Copyright (C) 1994-98 Microsoft Corporation'' This file is required for the Visual Basic 6.0 version of the APILoader.' Older versions of this file will not work correctly with the version' 6.0 APILoader. This file is backwards compatible with previous releases' of the APILoader with the exception that Constants are no longer declared' as Global or Public in this file.'' This file contains only the Const, Type,' and Declare statements for Win32 APIs.'' You have a royalty-free right to use, modify, reproduce and distribute' this file (and/or any modified version) in any way you find useful,' provided that you agree that Microsoft has no warranty, obligation or' liability for its contents. Refer to the Microsoft Windows Programmer's' Reference for further information.'' ------------------------------------------------------------------------' Type definitions for Windows' basic types.Const ANYSIZE_ARRAY = 1Type RECT Left As Long Top As Long Right As Long Bottom As LongEnd TypeType RECTL Left As Long Top As Long Right As Long Bottom As LongEnd TypeType POINTAPI x As Long y As LongEnd TypeType POINTL x As Long y As LongEnd TypeType Size cx As Long cy As LongEnd TypeType POINTS x As Integer y As IntegerEnd TypeType MSG hwnd As Long message As Long wParam As Long lParam As Long time As Long pt As POINTAPIEnd TypeConst DELETE = &H10000Const READ_CONTROL = &H20000Const WRITE_DAC = &H40000Const WRITE_OWNER = &H80000Const SYNCHRONIZE = &H100000Const STANDARD_RIGHTS_READ = (READ_CONTROL)Const STANDARD_RIGHTS_WRITE = (READ_CONTROL)Const STANDARD_RIGHTS_EXECUTE = (READ_CONTROL)Const STANDARD_RIGHTS_REQUIRED = &HF0000Const STANDARD_RIGHTS_ALL = &H1F0000Const SPECIFIC_RIGHTS_ALL = &HFFFFType SID_IDENTIFIER_AUTHORITY Value(6) As ByteEnd TypeConst SID_REVISION = (1) ' Current revision levelConst SID_MAX_SUB_AUTHORITIES = (15)Const SID_RECOMMENDED_SUB_AUTHORITIES = (1) ' Will change to around 6 in a future release.Const SidTypeUser = 1Const SidTypeGroup = 2Const SidTypeDomain = 3Const SidTypeAlias = 4Const SidTypeWellKnownGroup = 5Const SidTypeDeletedAccount = 6Const SidTypeInvalid = 7Const SidTypeUnknown = 8Type SID_AND_ATTRIBUTES Sid As Long Attributes As LongEnd Type' ///////////////////////////////////////////////////////////////////////////' //' Universal well-known SIDs //' //' Null SID S-1-0-0 //' World S-1-1-0 //' Local S-1-2-0 //' Creator Owner ID S-1-3-0 //' Creator Group ID S-1-3-1 //' //' (Non-unique IDs) S-1-4 //' //' ///////////////////////////////////////////////////////////////////////////Const SECURITY_NULL_RID = &H0Const SECURITY_WORLD_RID = &H0Const SECURITY_LOCAL_RID = &H0Const SECURITY_CREATOR_OWNER_RID = &H0Const SECURITY_CREATOR_GROUP_RID = &H1' ///////////////////////////////////////////////////////////////////////////' //' NT well-known SIDs //' //' NT Authority S-1-5 //' Dialup S-1-5-1 //' //' Network S-1-5-2 //' Batch S-1-5-3 //' Interactive S-1-5-4 //' Service S-1-5-6 //' AnonymousLogon S-1-5-7 (aka null logon session) //' //' (Logon IDs) S-1-5-5-X-Y //' //' (NT non-unique IDs) S-1-5-0x15-... //' //' (Built-in domain) s-1-5-0x20 //' //' ///////////////////////////////////////////////////////////////////////////Const SECURITY_DIALUP_RID = &H1Const SECURITY_NETWORK_RID = &H2Const SECURITY_BATCH_RID = &H3Const SECURITY_INTERACTIVE_RID = &H4Const SECURITY_SERVICE_RID = &H6Const SECURITY_ANONYMOUS_LOGON_RID = &H7Const SECURITY_LOGON_IDS_RID = &H5Const SECURITY_LOCAL_SYSTEM_RID = &H12Const SECURITY_NT_NON_UNIQUE = &H15Const SECURITY_BUILTIN_DOMAIN_RID = &H20' ///////////////////////////////////////////////////////////////////////////' //' well-known domain relative sub-authority values (RIDs)... //' //' ///////////////////////////////////////////////////////////////////////////Const DOMAIN_USER_RID_ADMIN = &H1F4Const DOMAIN_USER_RID_GUEST = &H1F5Const DOMAIN_GROUP_RID_ADMINS = &H200Const DOMAIN_GROUP_RID_USERS = &H201Const DOMAIN_GROUP_RID_GUESTS = &H202Const DOMAIN_ALIAS_RID_ADMINS = &H220Const DOMAIN_ALIAS_RID_USERS = &H221Const DOMAIN_ALIAS_RID_GUESTS = &H222Const DOMAIN_ALIAS_RID_POWER_USERS = &H223Const DOMAIN_ALIAS_RID_ACCOUNT_OPS = &H224Const DOMAIN_ALIAS_RID_SYSTEM_OPS = &H225Const DOMAIN_ALIAS_RID_PRINT_OPS = &H226Const DOMAIN_ALIAS_RID_BACKUP_OPS = &H227Const DOMAIN_ALIAS_RID_REPLICATOR = &H228' Allocate the System Luid. The first 1000 LUIDs are reserved.' Use #999 here0x3E7 = 999)' end_ntifs' //////////////////////////////////////////////////////////////////////' //' User and Group related SID attributes //' //' //////////////////////////////////////////////////////////////////////' Group attributesConst SE_GROUP_MANDATORY = &H1Const SE_GROUP_ENABLED_BY_DEFAULT = &H2Const SE_GROUP_ENABLED = &H4Const SE_GROUP_OWNER = &H8Const SE_GROUP_LOGON_ID = &HC0000000' User attributes' (None yet defined.)' ----------------' Kernel Section' ----------------Const FILE_BEGIN = 0Const FILE_CURRENT = 1Const FILE_END = 2Const FILE_FLAG_WRITE_THROUGH = &H80000000Const FILE_FLAG_OVERLAPPED = &H40000000Const FILE_FLAG_NO_BUFFERING = &H20000000Const FILE_FLAG_RANDOM_ACCESS = &H10000000Const FILE_FLAG_SEQUENTIAL_SCAN = &H8000000Const FILE_FLAG_DELETE_ON_CLOSE = &H4000000Const FILE_FLAG_BACKUP_SEMANTICS = &H2000000Const FILE_FLAG_POSIX_SEMANTICS = &H1000000Const CREATE_NEW = 1Const CREATE_ALWAYS = 2Const OPEN_EXISTING = 3Const OPEN_ALWAYS = 4Const TRUNCATE_EXISTING = 5' Define the dwOpenMode values for CreateNamedPipeConst PIPE_ACCESS_INBOUND = &H1Const PIPE_ACCESS_OUTBOUND = &H2Const PIPE_ACCESS_DUPLEX = &H3' Define the Named Pipe End flags for GetNamedPipeInfoConst PIPE_CLIENT_END = &H0Const PIPE_SERVER_END = &H1' Define the dwPipeMode values for CreateNamedPipeConst PIPE_WAIT = &H0Const PIPE_NOWAIT = &H1Const PIPE_READMODE_BYTE = &H0Const PIPE_READMODE_MESSAGE = &H2Const PIPE_TYPE_BYTE = &H0Const PIPE_TYPE_MESSAGE = &H4' Define the well known values for CreateNamedPipe nMaxInstancesConst PIPE_UNLIMITED_INSTANCES = 255' Define the Security Quality of Service bits to be passed' into CreateFileConst SECURITY_CONTEXT_TRACKING = &H40000Const SECURITY_EFFECTIVE_ONLY = &H80000Const SECURITY_SQOS_PRESENT = &H100000Const SECURITY_VALID_SQOS_FLAGS = &H1F0000Type OVERLAPPED Internal As Long InternalHigh As Long offset As Long OffsetHigh As Long hEvent As LongEnd TypeType SECURITY_ATTRIBUTES nLength As Long lpSecurityDescriptor As Long bInheritHandle As Long End TypeType PROCESS_INFORMATION hProcess As Long hThread As Long dwProcessId As Long dwThreadId As LongEnd TypeType FILETIME dwLowDateTime As Long dwHighDateTime As LongEnd TypeType SYSTEMTIME wYear As Integer wMonth As Integer wDayOfWeek As Integer wDay As Integer wHour As Integer wMinute As Integer wSecond As Integer wMilliseconds As IntegerEnd Type' Serial provider type.Const SP_SERIALCOMM = &H1&' Provider SubTypesConst PST_UNSPECIFIED = &H0&Const PST_RS232 = &H1&Const PST_PARALLELPORT = &H2&Const PST_RS422 = &H3&Const PST_RS423 = &H4&Const PST_RS449 = &H5&Const PST_FAX = &H21&Const PST_SCANNER = &H22&Const PST_NETWORK_BRIDGE = &H100&Const PST_LAT = &H101&Const PST_TCPIP_TELNET = &H102&Const PST_X25 = &H103&' Provider capabilities flags.Const PCF_DTRDSR = &H1&Const PCF_RTSCTS = &H2&Const PCF_RLSD = &H4&Const PCF_PARITY_CHECK = &H8&Const PCF_XONXOFF = &H10&Const PCF_SETXCHAR = &H20&Const PCF_TOTALTIMEOUTS = &H40&Const PCF_INTTIMEOUTS = &H80&Const PCF_SPECIALCHARS = &H100&Const PCF_16BITMODE = &H200&' Comm provider settable parameters.Const SP_PARITY = &H1&Const SP_BAUD = &H2&Const SP_DATABITS = &H4&Const SP_STOPBITS = &H8&Const SP_HANDSHAKING = &H10&Const SP_PARITY_CHECK = &H20&Const SP_RLSD = &H40&' Settable baud rates in the provider.Const BAUD_075 = &H1&Const BAUD_110 = &H2&Const BAUD_134_5 = &H4&Const BAUD_150 = &H8&Const BAUD_300 = &H10&Const BAUD_600 = &H20&Const BAUD_1200 = &H40&Const BAUD_1800 = &H80&Const BAUD_2400 = &H100&Const BAUD_4800 = &H200&Const BAUD_7200 = &H400&Const BAUD_9600 = &H800&Const BAUD_14400 = &H1000&Const BAUD_19200 = &H2000&Const BAUD_38400 = &H4000&Const BAUD_56K = &H8000&Const BAUD_128K = &H10000Const BAUD_115200 = &H20000Const BAUD_57600 = &H40000Const BAUD_USER = &H10000000' Settable Data BitsConst DATABITS_5 = &H1&Const DATABITS_6 = &H2&Const DATABITS_7 = &H4&Const DATABITS_8 = &H8&Const DATABITS_16 = &H10&Const DATABITS_16X = &H20&' Settable Stop and Parity bits.Const STOPBITS_10 = &H1&Const STOPBITS_15 = &H2&Const STOPBITS_20 = &H4&Const PARITY_NONE = &H100&Const PARITY_ODD = &H200&Const PARITY_EVEN = &H400&Const PARITY_MARK = &H800&Const PARITY_SPACE = &H1000&Type COMMPROP wPacketLength As Integer wPacketVersion As Integer dwServiceMask As Long dwReserved1 As Long dwMaxTxQueue As Long dwMaxRxQueue As Long dwMaxBaud As Long dwProvSubType As Long dwProvCapabilities As Long dwSettableParams As Long dwSettableBaud As Long wSettableData As Integer wSettableStopParity As Integer dwCurrentTxQueue As Long dwCurrentRxQueue As Long dwProvSpec1 As Long dwProvSpec2 As Long wcProvChar(1) As IntegerEnd Type'Type COMSTAT' fCtsHold As Long' fDsrHold As Long' fRlsdHold As Long' fXoffHold As Long' fXoffSent As Long' fEof As Long' fTxim As Long' fReserved As Long' cbInQue As Long' cbOutQue As Long'End TypeType COMSTAT fBitFields As Long 'See Comment in Win32API.Txt cbInQue As Long cbOutQue As LongEnd Type' The eight actual COMSTAT bit-sized data fields within the four bytes of fBitFields can be manipulated by bitwise logical And/Or operations.' FieldName Bit # Description' --------- ----- ---------------------------' fCtsHold 1 Tx waiting for CTS signal' fDsrHold 2 Tx waiting for DSR signal' fRlsdHold 3 Tx waiting for RLSD signal' fXoffHold 4 Tx waiting, XOFF char rec'd' fXoffSent 5 Tx waiting, XOFF char sent' fEof 6 EOF character sent' fTxim 7 character waiting for Tx' fReserved 8 reserved (25 bits)' DTR Control Flow Values.Const DTR_CONTROL_DISABLE = &H0Const DTR_CONTROL_ENABLE = &H1Const DTR_CONTROL_HANDSHAKE = &H2' RTS Control Flow ValuesConst RTS_CONTROL_DISABLE = &H0Const RTS_CONTROL_ENABLE = &H1Const RTS_CONTROL_HANDSHAKE = &H2Const RTS_CONTROL_TOGGLE = &H3'Type DCB' DCBlength As Long' BaudRate As Long' fBinary As Long' fParity As Long' fOutxCtsFlow As Long' fOutxDsrFlow As Long' fDtrControl As Long' fDsrSensitivity As Long' fTXContinueOnXoff As Long' fOutX As Long' fInX As Long' fErrorChar As Long' fNull As Long' fRtsControl As Long' fAbortOnError As Long' fDummy2 As Long' wReserved As Integer' XonLim As Integer' XoffLim As Integer' ByteSize As Byte' Parity As Byte' StopBits As Byte' XonChar As Byte' XoffChar As Byte' ErrorChar As Byte' EofChar As Byte' EvtChar As Byte'End TypeType DCB DCBlength As Long BaudRate As Long fBitFields As Long 'See Comments in Win32API.Txt wReserved As Integer XonLim As Integer XoffLim As Integer ByteSize As Byte Parity As Byte StopBits As Byte XonChar As Byte XoffChar As Byte ErrorChar As Byte EofChar As Byte EvtChar As Byte wReserved1 As Integer 'Reserved; Do Not Use End Type' The fourteen actual DCB bit-sized data fields within the four bytes of fBitFields can be manipulated by bitwise logical And/Or operations.' FieldName Bit # Description' ----------------- ----- ------------------------------' fBinary 1 binary mode, no EOF check' fParity 2 enable parity checking' fOutxCtsFlow 3 CTS output flow control' fOutxDsrFlow 4 DSR output flow control' fDtrControl 5 DTR flow control type (2 bits)' fDsrSensitivity 7 DSR sensitivity' fTXContinueOnXoff 8 XOFF continues Tx' fOutX 9 XON/XOFF out flow control' fInX 10 XON/XOFF in flow control' fErrorChar 11 enable error replacement' fNull 12 enable null stripping' fRtsControl 13 RTS flow control (2 bits)' fAbortOnError 15 abort reads/writes on error' fDummy2 16 reserved Type COMMTIMEOUTS ReadIntervalTimeout As Long ReadTotalTimeoutMultiplier As Long ReadTotalTimeoutConstant As Long WriteTotalTimeoutMultiplier As Long WriteTotalTimeoutConstant As LongEnd TypeType SYSTEM_INFO dwOemID As Long dwPageSize As Long lpMinimumApplicationAddress As Long lpMaximumApplicationAddress As Long dwActiveProcessorMask As Long dwNumberOrfProcessors As Long dwProcessorType As Long dwAllocationGranularity As Long dwReserved As LongEnd Type' Global Memory FlagsConst GMEM_FIXED = &H0Const GMEM_MOVEABLE = &H2Const GMEM_NOCOMPACT = &H10Const GMEM_NODISCARD = &H20Const GMEM_ZEROINIT = &H40Const GMEM_MODIFY = &H80Const GMEM_DISCARDABLE = &H100Const GMEM_NOT_BANKED = &H1000Const GMEM_SHARE = &H2000Const GMEM_DDESHARE = &H2000Const GMEM_NOTIFY = &H4000Const GMEM_LOWER = GMEM_NOT_BANKEDConst GMEM_VALID_FLAGS = &H7F72Const GMEM_INVALID_HANDLE = &H8000Const GHND = (GMEM_MOVEABLE Or GMEM_ZEROINIT)Const GPTR = (GMEM_FIXED Or GMEM_ZEROINIT)' Flags returned by GlobalFlags (in addition to GMEM_DISCARDABLE)Const GMEM_DISCARDED = &H4000Const GMEM_LOCKCOUNT = &HFFType MEMORYSTATUS dwLength As Long dwMemoryLoad As Long dwTotalPhys As Long dwAvailPhys As Long dwTotalPageFile As Long dwAvailPageFile As Long dwTotalVirtual As Long dwAvailVirtual As LongEnd Type' Local Memory FlagsConst LMEM_FIXED = &H0Const LMEM_MOVEABLE = &H2Const LMEM_NOCOMPACT = &H10Const LMEM_NODISCARD = &H20Const LMEM_ZEROINIT = &H40Const LMEM_MODIFY = &H80Const LMEM_DISCARDABLE = &HF00Const LMEM_VALID_FLAGS = &HF72Const LMEM_INVALID_HANDLE = &H8000Const LHND = (LMEM_MOVEABLE + LMEM_ZEROINIT)Const LPTR = (LMEM_FIXED + LMEM_ZEROINIT)Const NONZEROLHND = (LMEM_MOVEABLE)Const NONZEROLPTR = (LMEM_FIXED)' Flags returned by LocalFlags (in addition to LMEM_DISCARDABLE)Const LMEM_DISCARDED = &H4000Const LMEM_LOCKCOUNT = &HFF' dwCreationFlag valuesConst DEBUG_PROCESS = &H1Const DEBUG_ONLY_THIS_PROCESS = &H2Const CREATE_SUSPENDED = &H4Const DETACHED_PROCESS = &H8Const CREATE_NEW_CONSOLE = &H10Const NORMAL_PRIORITY_CLASS = &H20Const IDLE_PRIORITY_CLASS = &H40Const HIGH_PRIORITY_CLASS = &H80Const REALTIME_PRIORITY_CLASS = &H100Const CREATE_NEW_PROCESS_GROUP = &H200Const CREATE_NO_WINDOW = &H8000000Const PROFILE_USER = &H10000000Const PROFILE_KERNEL = &H20000000Const PROFILE_SERVER = &H40000000Const MAXLONG = &H7FFFFFFFConst THREAD_BASE_PRIORITY_MIN = -2Const THREAD_BASE_PRIORITY_MAX = 2Const THREAD_BASE_PRIORITY_LOWRT = 15Const THREAD_BASE_PRIORITY_IDLE = -15Const THREAD_PRIORITY_LOWEST = THREAD_BASE_PRIORITY_MINConst THREAD_PRIORITY_BELOW_NORMAL = (THREAD_PRIORITY_LOWEST + 1)Const THREAD_PRIORITY_NORMAL = 0Const THREAD_PRIORITY_HIGHEST = THREAD_BASE_PRIORITY_MAXConst THREAD_PRIORITY_ABOVE_NORMAL = (THREAD_PRIORITY_HIGHEST - 1)Const THREAD_PRIORITY_ERROR_RETURN = (MAXLONG)Const THREAD_PRIORITY_TIME_CRITICAL = THREAD_BASE_PRIORITY_LOWRTConst THREAD_PRIORITY_IDLE = THREAD_BASE_PRIORITY_IDLE' ++ BUILD Version: 0093 Increment this if a change has global effects' Copyright (c) 1990-1995 Microsoft Corporation' Module Name:' winnt.h' Abstract:' This module defines the 32-Bit Windows types and constants that are' defined by NT, but exposed through the Win32 API.' Revision History:Const APPLICATION_ERROR_MASK = &H20000000Const ERROR_SEVERITY_SUCCESS = &H0Const ERROR_SEVERITY_INFORMATIONAL = &H40000000Const ERROR_SEVERITY_WARNING = &H80000000Const ERROR_SEVERITY_ERROR = &HC0000000Const MINCHAR = &H80Const MAXCHAR = &H7FConst MINSHORT = &H8000Const MAXSHORT = &H7FFFConst MINLONG = &H80000000Const MAXByte = &HFFConst MAXWORD = &HFFFFConst MAXDWORD = &HFFFF'' Calculate the byte offset of a field in a structure of type type.' * Language IDs.' *' * The following two combinations of primary language ID and' * sublanguage ID have special semantics:' *' * Primary Language ID Sublanguage ID Result' * ------------------- --------------- ------------------------' * LANG_NEUTRAL SUBLANG_NEUTRAL Language neutral' * LANG_NEUTRAL SUBLANG_DEFAULT User default language' * LANG_NEUTRAL SUBLANG_SYS_DEFAULT System default language' */'' * Primary language IDs.' */Const LANG_NEUTRAL = &H0Const LANG_BULGARIAN = &H2Const LANG_CHINESE = &H4Const LANG_CROATIAN = &H1AConst LANG_CZECH = &H5Const LANG_DANISH = &H6Const LANG_DUTCH = &H13Const LANG_ENGLISH = &H9Const LANG_FINNISH = &HBConst LANG_FRENCH = &HCConst LANG_GERMAN = &H7Const LANG_GREEK = &H8Const LANG_HUNGARIAN = &HEConst LANG_ICELANDIC = &HFConst LANG_ITALIAN = &H10Const LANG_JAPANESE = &H11Const LANG_KOREAN = &H12Const LANG_NORWEGIAN = &H14Const LANG_POLISH = &H15Const LANG_PORTUGUESE = &H16Const LANG_ROMANIAN = &H18Const LANG_RUSSIAN = &H19Const LANG_SLOVAK = &H1BConst LANG_SLOVENIAN = &H24Const LANG_SPANISH = &HAConst LANG_SWEDISH = &H1DConst LANG_TURKISH = &H1F'' * Sublanguage IDs.' *' * The name immediately following SUBLANG_ dictates which primary' * language ID that sublanguage ID can be combined with to form a' * valid language ID.' */Const SUBLANG_NEUTRAL = &H0 ' language neutralConst SUBLANG_DEFAULT = &H1 ' user defaultConst SUBLANG_SYS_DEFAULT = &H2 ' system defaultConst SUBLANG_CHINESE_TRADITIONAL = &H1 ' Chinese (Taiwan)Const SUBLANG_CHINESE_SIMPLIFIED = &H2 ' Chinese (PR China)Const SUBLANG_CHINESE_HONGKONG = &H3 ' Chinese (Hong Kong)Const SUBLANG_CHINESE_SINGAPORE = &H4 ' Chinese (Singapore)Const SUBLANG_DUTCH = &H1 ' DutchConst SUBLANG_DUTCH_BELGIAN = &H2 ' Dutch (Belgian)Const SUBLANG_ENGLISH_US = &H1 ' English (USA)Const SUBLANG_ENGLISH_UK = &H2 ' English (UK)Const SUBLANG_ENGLISH_AUS = &H3 ' English (Australian)Const SUBLANG_ENGLISH_CAN = &H4 ' English (Canadian)Const SUBLANG_ENGLISH_NZ = &H5 ' English (New Zealand)Const SUBLANG_ENGLISH_EIRE = &H6 ' English (Irish)Const SUBLANG_FRENCH = &H1 ' FrenchConst SUBLANG_FRENCH_BELGIAN = &H2 ' French (Belgian)Const SUBLANG_FRENCH_CANADIAN = &H3 ' French (Canadian)Const SUBLANG_FRENCH_SWISS = &H4 ' French (Swiss)Const SUBLANG_GERMAN = &H1 ' GermanConst SUBLANG_GERMAN_SWISS = &H2 ' German (Swiss)Const SUBLANG_GERMAN_AUSTRIAN = &H3 ' German (Austrian)Const SUBLANG_ITALIAN = &H1 ' ItalianConst SUBLANG_ITALIAN_SWISS = &H2 ' Italian (Swiss)Const SUBLANG_NORWEGIAN_BOKMAL = &H1 ' Norwegian (BokmaConst SUBLANG_NORWEGIAN_NYNORSK = &H2 ' Norwegian (Nynorsk)Const SUBLANG_PORTUGUESE = &H2 ' PortugueseConst SUBLANG_PORTUGUESE_BRAZILIAN = &H1 ' Portuguese (Brazilian)Const SUBLANG_SPANISH = &H1 ' Spanish (Castilian)Const SUBLANG_SPANISH_MEXICAN = &H2 ' Spanish (Mexican)Const SUBLANG_SPANISH_MODERN = &H3 ' Spanish (Modern)'' * Sorting IDs.' *' */Const SORT_DEFAULT = &H0 ' sorting defaultConst SORT_JAPANESE_XJIS = &H0 ' Japanese0xJIS orderConst SORT_JAPANESE_UNICODE = &H1 ' Japanese Unicode orderConst SORT_CHINESE_BIG5 = &H0 ' Chinese BIG5 orderConst SORT_CHINESE_UNICODE = &H1 ' Chinese Unicode orderConst SORT_KOREAN_KSC = &H0 ' Korean KSC orderConst SORT_KOREAN_UNICODE = &H1 ' Korean Unicode order' The FILE_READ_DATA and FILE_WRITE_DATA constants are also defined in' devioctl.h as FILE_READ_ACCESS and FILE_WRITE_ACCESS. The values for these' constants *MUST* always be in sync.' The values are redefined in devioctl.h because they must be available to' both DOS and NT.'Const FILE_READ_DATA = (&H1) ' file pipeConst FILE_LIST_DIRECTORY = (&H1) ' directoryConst FILE_WRITE_DATA = (&H2) ' file pipeConst FILE_ADD_FILE = (&H2) ' directoryConst FILE_APPEND_DATA = (&H4) ' fileConst FILE_ADD_SUBDIRECTORY = (&H4) ' directoryConst FILE_CREATE_PIPE_INSTANCE = (&H4) ' named pipeConst FILE_READ_EA = (&H8) ' file directoryConst FILE_READ_PROPERTIES = FILE_READ_EAConst FILE_WRITE_EA = (&H10) ' file directoryConst FILE_WRITE_PROPERTIES = FILE_WRITE_EAConst FILE_EXECUTE = (&H20) ' fileConst FILE_TRAVERSE = (&H20) ' directoryConst FILE_DELETE_CHILD = (&H40) ' directoryConst FILE_READ_ATTRIBUTES = (&H80) ' allConst FILE_WRITE_ATTRIBUTES = (&H100) ' allConst FILE_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &H1FF)Const FILE_GENERIC_READ = (STANDARD_RIGHTS_READ Or FILE_READ_DATA Or FILE_READ_ATTRIBUTES Or FILE_READ_EA Or SYNCHRONIZE)Const FILE_GENERIC_WRITE = (STANDARD_RIGHTS_WRITE Or FILE_WRITE_DATA Or FILE_WRITE_ATTRIBUTES Or FILE_WRITE_EA Or FILE_APPEND_DATA Or SYNCHRONIZE)Const FILE_GENERIC_EXECUTE = (STANDARD_RIGHTS_EXECUTE Or FILE_READ_ATTRIBUTES Or FILE_EXECUTE Or SYNCHRONIZE)Const FILE_SHARE_READ = &H1Const FILE_SHARE_WRITE = &H2Const FILE_ATTRIBUTE_READONLY = &H1Const FILE_ATTRIBUTE_HIDDEN = &H2Const FILE_ATTRIBUTE_SYSTEM = &H4Const FILE_ATTRIBUTE_DIRECTORY = &H10Const FILE_ATTRIBUTE_ARCHIVE = &H20Const FILE_ATTRIBUTE_NORMAL = &H80Const FILE_ATTRIBUTE_TEMPORARY = &H100Const FILE_ATTRIBUTE_COMPRESSED = &H800Const FILE_NOTIFY_CHANGE_FILE_NAME = &H1Const FILE_NOTIFY_CHANGE_DIR_NAME = &H2Const FILE_NOTIFY_CHANGE_ATTRIBUTES = &H4Const FILE_NOTIFY_CHANGE_SIZE = &H8Const FILE_NOTIFY_CHANGE_LAST_WRITE = &H10Const FILE_NOTIFY_CHANGE_SECURITY = &H100Const MAILSLOT_NO_MESSAGE = (-1)Const MAILSLOT_WAIT_FOREVER = (-1)Const FILE_CASE_SENSITIVE_SEARCH = &H1Const FILE_CASE_PRESERVED_NAMES = &H2Const FILE_UNICODE_ON_DISK = &H4Const FILE_PERSISTENT_ACLS = &H8Const FILE_FILE_COMPRESSION = &H10Const FILE_VOLUME_IS_COMPRESSED = &H8000Const IO_COMPLETION_MODIFY_STATE = &H2Const IO_COMPLETION_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &H3)Const DUPLICATE_CLOSE_SOURCE = &H1Const DUPLICATE_SAME_ACCESS = &H2' //////////////////////////////////////////////////////////////////////' //' ACCESS MASK //' //' //////////////////////////////////////////////////////////////////////'' Define the access mask as a longword sized structure divided up as' follows:' typedef struct _ACCESS_MASK {' WORD SpecificRights;' Byte StandardRights;' Byte AccessSystemAcl : 1;' Byte Reserved : 3;' Byte GenericAll : 1;' Byte GenericExecute : 1;' Byte GenericWrite : 1;' Byte GenericRead : 1;' } ACCESS_MASK;' typedef ACCESS_MASK *PACCESS_MASK;'' but to make life simple for programmer's we'll allow them to specify' a desired access mask by simply OR'ing together mulitple single rights' and treat an access mask as a DWORD. For example'' DesiredAccess = DELETE Or READ_CONTROL'' So we'll declare ACCESS_MASK as DWORD'' begin_ntddk begin_nthal begin_ntifs' //////////////////////////////////////////////////////////////////////' //' ACCESS TYPES //' //' //////////////////////////////////////////////////////////////////////' begin_ntddk begin_nthal begin_ntifs'' The following are masks for the predefined standard access types' AccessSystemAcl access typeConst ACCESS_SYSTEM_SECURITY = &H1000000' MaximumAllowed access typeConst MAXIMUM_ALLOWED = &H2000000' These are the generic rights.Const GENERIC_READ = &H80000000Const GENERIC_WRITE = &H40000000Const GENERIC_EXECUTE = &H20000000Const GENERIC_ALL = &H10000000' Define the generic mapping array. This is used to denote the' mapping of each generic access right to a specific access mask.Type GENERIC_MAPPING GenericRead As Long GenericWrite As Long GenericExecute As Long GenericAll As LongEnd Type' //////////////////////////////////////////////////////////////////////' //' LUID_AND_ATTRIBUTES //' //' //////////////////////////////////////////////////////////////////////'Type LUIDLowPart As LongHighPart As LongEnd TypeType LUID_AND_ATTRIBUTES pLuid As LUID Attributes As LongEnd Type' //////////////////////////////////////////////////////////////////////' //' ACL and ACE //' //' //////////////////////////////////////////////////////////////////////'' Define an ACL and the ACE format. The structure of an ACL header' followed by one or more ACEs. Pictorally the structure of an ACL header' is as follows:'' The current AclRevision is defined to be ACL_REVISION.'' AclSize is the size, in bytes, allocated for the ACL. This includes' the ACL header, ACES, and remaining free space in the buffer.'' AceCount is the number of ACES in the ACL.'' begin_ntddk begin_ntifs' This is the *current* ACL revisionConst ACL_REVISION = (2)' This is the history of ACL revisions. Add a new one whenever' ACL_REVISION is updatedConst ACL_REVISION1 = (1)Const ACL_REVISION2 = (2)Type ACL AclRevision As Byte Sbz1 As Byte AclSize As Integer AceCount As Integer Sbz2 As IntegerEnd Type' typedef ACL *PACL;' end_ntddk' The structure of an ACE is a common ace header followed by ace type' specific data. Pictorally the structure of the common ace header is' as follows:' AceType denotes the type of the ace, there are some predefined ace' types'' AceSize is the size, in bytes, of ace.'' AceFlags are the Ace flags for audit and inheritance, defined Integerly.Type ACE_HEADER AceType As Byte AceFlags As Byte AceSize As LongEnd Type'' The following are the predefined ace types that go into the AceType' field of an Ace header.Const ACCESS_ALLOWED_ACE_TYPE = &H0Const ACCESS_DENIED_ACE_TYPE = &H1Const SYSTEM_AUDIT_ACE_TYPE = &H2Const SYSTEM_ALARM_ACE_TYPE = &H3' The following are the inherit flags that go into the AceFlags field' of an Ace header.Const OBJECT_INHERIT_ACE = &H1Const CONTAINER_INHERIT_ACE = &H2Const NO_PROPAGATE_INHERIT_ACE = &H4Const INHERIT_ONLY_ACE = &H8Const VALID_INHERIT_FLAGS = &HF' The following are the currently defined ACE flags that go into the' AceFlags field of an ACE header. Each ACE type has its own set of' AceFlags.'' SUCCESSFUL_ACCESS_ACE_FLAG - used only with system audit and alarm ACE' types to indicate that a message is generated for successful accesses.'' FAILED_ACCESS_ACE_FLAG - used only with system audit and alarm ACE types' to indicate that a message is generated for failed accesses.' SYSTEM_AUDIT and SYSTEM_ALARM AceFlags'' These control the signaling of audit and alarms for success or failure.Const SUCCESSFUL_ACCESS_ACE_FLAG = &H40Const FAILED_ACCESS_ACE_FLAG = &H80'' We'll define the structure of the predefined ACE types. Pictorally' the structure of the predefined ACE's is as follows:' Mask is the access mask associated with the ACE. This is either the' access allowed, access denied, audit, or alarm mask.'' Sid is the Sid associated with the ACE.'' The following are the four predefined ACE types.' Examine the AceType field in the Header to determine' which structure is appropriate to use for casting.Type ACCESS_ALLOWED_ACE Header As ACE_HEADER Mask As Long SidStart As LongEnd TypeType ACCESS_DENIED_ACE Header As ACE_HEADER Mask As Long SidStart As LongEnd TypeType SYSTEM_AUDIT_ACE Header As ACE_HEADER Mask As Long SidStart As LongEnd TypeType SYSTEM_ALARM_ACE Header As ACE_HEADER Mask As Long SidStart As LongEnd Type' The following declarations are used for setting and querying information' about and ACL. First are the various information classes available to' the user.'Const AclRevisionInformation = 1Const AclSizeInformation = 2'' This record is returned/sent if the user is requesting/setting the' AclRevisionInformation'Type ACL_REVISION_INFORMATION AclRevision As LongEnd Type'' This record is returned if the user is requesting AclSizeInformation'Type ACL_SIZE_INFORMATION AceCount As Long AclBytesInUse As Long AclBytesFree As LongEnd Type' //////////////////////////////////////////////////////////////////////' //' SECURITY_DESCRIPTOR //' //' //////////////////////////////////////////////////////////////////////'' Define the Security Descriptor and related data types.' This is an opaque data structure.'' begin_ntddk begin_ntifs'' Current security descriptor revision value'Const SECURITY_DESCRIPTOR_REVISION = (1)Const SECURITY_DESCRIPTOR_REVISION1 = (1)' end_ntddk'' Minimum length, in bytes, needed to build a security descriptor' (NOTE: This must manually be kept consistent with the)' (sizeof(SECURITY_DESCRIPTOR) )'Const SECURITY_DESCRIPTOR_MIN_LENGTH = (20)Const SE_OWNER_DEFAULTED = &H1Const SE_GROUP_DEFAULTED = &H2Const SE_DACL_PRESENT = &H4Const SE_DACL_DEFAULTED = &H8Const SE_SACL_PRESENT = &H10Const SE_SACL_DEFAULTED = &H20Const SE_SELF_RELATIVE = &H8000'' Where:'' SE_OWNER_DEFAULTED - This boolean flag, when set, indicates that the' SID pointed to by the Owner field was provided by a' defaulting mechanism rather than explicitly provided by the' original provider of the security descriptor. This may' affect the treatment of the SID with respect to inheritence' of an owner.'' SE_GROUP_DEFAULTED - This boolean flag, when set, indicates that the' SID in the Group field was provided by a defaulting mechanism' rather than explicitly provided by the original provider of' the security descriptor. This may affect the treatment of' the SID with respect to inheritence of a primary group.'' SE_DACL_PRESENT - This boolean flag, when set, indicates that the' security descriptor contains a discretionary ACL. If this' flag is set and the Dacl field of the SECURITY_DESCRIPTOR is' null, then a null ACL is explicitly being specified.'' SE_DACL_DEFAULTED - This boolean flag, when set, indicates that the' ACL pointed to by the Dacl field was provided by a defaulting' mechanism rather than explicitly provided by the original' provider of the security descriptor. This may affect the' treatment of the ACL with respect to inheritence of an ACL.' This flag is ignored if the DaclPresent flag is not set.'' SE_SACL_PRESENT - This boolean flag, when set, indicates that the' security descriptor contains a system ACL pointed to by the' Sacl field. If this flag is set and the Sacl field of the' SECURITY_DESCRIPTOR is null, then an empty (but present)' ACL is being specified.'' SE_SACL_DEFAULTED - This boolean flag, when set, indicates that the' ACL pointed to by the Sacl field was provided by a defaulting' mechanism rather than explicitly provided by the original' provider of the security descriptor. This may affect the' treatment of the ACL with respect to inheritence of an ACL.' This flag is ignored if the SaclPresent flag is not set.'' SE_SELF_RELATIVE - This boolean flag, when set, indicates that the' security descriptor is in self-relative form. In this form,' all fields of the security descriptor are contiguous in memory' and all pointer fields are expressed as offsets from the' beginning of the security descriptor. This form is useful' for treating security descriptors as opaque data structures' for transmission in communication protocol or for storage on' secondary media.'''' In general, this data structure should be treated opaquely to ensure future' compatibility.''Type SECURITY_DESCRIPTOR Revision As Byte Sbz1 As Byte Control As Long Owner As Long Group As Long Sacl As ACL Dacl As ACLEnd Type' Where:'' Revision - Contains the revision level of the security' descriptor. This allows this structure to be passed between' systems or stored on disk even though it is expected to' change in the future.'' Control - A set of flags which qualify the meaning of the' security descriptor or individual fields of the security' descriptor.'' Owner - is a pointer to an SID representing an object's owner.' If this field is null, then no owner SID is present in the' security descriptor. If the security descriptor is in' self-relative form, then this field contains an offset to' the SID, rather than a pointer.'' Group - is a pointer to an SID representing an object's primary' group. If this field is null, then no primary group SID is' present in the security descriptor. If the security descriptor' is in self-relative form, then this field contains an offset to' the SID, rather than a pointer.'' Sacl - is a pointer to a system ACL. This field value is only' valid if the DaclPresent control flag is set. If the' SaclPresent flag is set and this field is null, then a null' ACL is specified. If the security descriptor is in' self-relative form, then this field contains an offset to' the ACL, rather than a pointer.'' Dacl - is a pointer to a discretionary ACL. This field value is' only valid if the DaclPresent control flag is set. If the' DaclPresent flag is set and this field is null, then a null' ACL (unconditionally granting access) is specified. If the' security descriptor is in self-relative form, then this field' contains an offset to the ACL, rather than a pointer.'' //////////////////////////////////////////////////////////////////////' //' Privilege Related Data Structures //' //' //////////////////////////////////////////////////////////////////////' Privilege attributes'Const SE_PRIVILEGE_ENABLED_BY_DEFAULT = &H1Const SE_PRIVILEGE_ENABLED = &H2Const SE_PRIVILEGE_USED_FOR_ACCESS = &H80000000'' Privilege Set Control flags'Const PRIVILEGE_SET_ALL_NECESSARY = (1)'' Privilege Set - This is defined for a privilege set of one.' If more than one privilege is needed, then this structure' will need to be allocated with more space.'' Note: don't change this structure without fixing the INITIAL_PRIVILEGE_SET' structure (defined in se.h)'Type PRIVILEGE_SET PrivilegeCount As Long Control As Long Privilege(ANYSIZE_ARRAY) As LUID_AND_ATTRIBUTESEnd Type'//////////////////////////////////////////////////////////////////////' //' NT Defined Privileges //' //' //////////////////////////////////////////////////////////////////////Const SE_CREATE_TOKEN_NAME = "SeCreateTokenPrivilege"Const SE_ASSIGNPRIMARYTOKEN_NAME = "SeAssignPrimaryTokenPrivilege"Const SE_LOCK_MEMORY_NAME = "SeLockMemoryPrivilege"Const SE_INCREASE_QUOTA_NAME = "SeIncreaseQuotaPrivilege"Const SE_UNSOLICITED_INPUT_NAME = "SeUnsolicitedInputPrivilege"Const SE_MACHINE_ACCOUNT_NAME = "SeMachineAccountPrivilege"Const SE_TCB_NAME = "SeTcbPrivilege"Const SE_SECURITY_NAME = "SeSecurityPrivilege"Const SE_TAKE_OWNERSHIP_NAME = "SeTakeOwnershipPrivilege"Const SE_LOAD_DRIVER_NAME = "SeLoadDriverPrivilege"Const SE_SYSTEM_PROFILE_NAME = "SeSystemProfilePrivilege"Const SE_SYSTEMTIME_NAME = "SeSystemtimePrivilege"Const SE_PROF_SINGLE_PROCESS_NAME = "SeProfileSingleProcessPrivilege"Const SE_INC_BASE_PRIORITY_NAME = "SeIncreaseBasePriorityPrivilege"Const SE_CREATE_PAGEFILE_NAME = "SeCreatePagefilePrivilege"Const SE_CREATE_PERMANENT_NAME = "SeCreatePermanentPrivilege"Const SE_BACKUP_NAME = "SeBackupPrivilege"Const SE_RESTORE_NAME = "SeRestorePrivilege"Const SE_SHUTDOWN_NAME = "SeShutdownPrivilege"Const SE_DEBUG_NAME = "SeDebugPrivilege"Const SE_AUDIT_NAME = "SeAuditPrivilege"Const SE_SYSTEM_ENVIRONMENT_NAME = "SeSystemEnvironmentPrivilege"Const SE_CHANGE_NOTIFY_NAME = "SeChangeNotifyPrivilege"Const SE_REMOTE_SHUTDOWN_NAME = "SeRemoteShutdownPrivilege"' //////////////////////////////////////////////////////////////////' //' Security Quality Of Service //' //' //' //////////////////////////////////////////////////////////////////' begin_ntddk begin_nthal begin_ntifs'' Impersonation Level'' Impersonation level is represented by a pair of bits in Windows.' If a new impersonation level is added or lowest value is changed from' 0 to something else, fix the Windows CreateFile call.'Const SecurityAnonymous = 1Const SecurityIdentification = 2'//////////////////////////////////////////////////////////////////////' //' Registry API Constants //' //' //////////////////////////////////////////////////////////////////////' Reg Data Types...Const REG_NONE = 0 ' No value typeConst REG_SZ = 1 ' Unicode nul terminated stringConst REG_EXPAND_SZ = 2 ' Unicode nul terminated stringConst REG_BINARY = 3 ' Free form binaryConst REG_DWORD = 4 ' 32-bit numberConst REG_DWORD_LITTLE_ENDIAN = 4 ' 32-bit number (same as REG_DWORD)Const REG_DWORD_BIG_ENDIAN = 5 ' 32-bit numberConst REG_LINK = 6 ' Symbolic Link (unicode)Const REG_MULTI_SZ = 7 ' Multiple Unicode stringsConst REG_RESOURCE_LIST = 8 ' Resource list in the resource mapConst REG_FULL_RESOURCE_DESCRIPTOR = 9 ' Resource list in the hardware descriptionConst REG_RESOURCE_REQUIREMENTS_LIST = 10Const REG_CREATED_NEW_KEY = &H1 ' New Registry Key createdConst REG_OPENED_EXISTING_KEY = &H2 ' Existing Key openedConst REG_WHOLE_HIVE_VOLATILE = &H1 ' Restore whole hive volatileConst REG_REFRESH_HIVE = &H2 ' Unwind changes to last flushConst REG_NOTIFY_CHANGE_NAME = &H1 ' Create or delete (child)Const REG_NOTIFY_CHANGE_ATTRIBUTES = &H2Const REG_NOTIFY_CHANGE_LAST_SET = &H4 ' Time stampConst REG_NOTIFY_CHANGE_SECURITY = &H8Const REG_LEGAL_CHANGE_FILTER = (REG_NOTIFY_CHANGE_NAME Or REG_NOTIFY_CHANGE_ATTRIBUTES Or REG_NOTIFY_CHANGE_LAST_SET Or REG_NOTIFY_CHANGE_SECURITY)Const REG_LEGAL_OPTION = (REG_OPTION_RESERVED Or REG_OPTION_NON_VOLATILE Or REG_OPTION_VOLATILE Or REG_OPTION_CREATE_LINK Or REG_OPTION_BACKUP_RESTORE)' Reg Create Type Values...Const REG_OPTION_RESERVED = 0 ' Parameter is reservedConst REG_OPTION_NON_VOLATILE = 0 ' Key is preserved when system is rebootedConst REG_OPTION_VOLATILE = 1 ' Key is not preserved when system is rebootedConst REG_OPTION_CREATE_LINK = 2 ' Created key is a symbolic linkConst REG_OPTION_BACKUP_RESTORE = 4 ' open for backup or restore' Reg Key Security Options' Const READ_CONTROL = &H20000Const KEY_QUERY_VALUE = &H1Const KEY_SET_VALUE = &H2Const KEY_CREATE_SUB_KEY = &H4Const KEY_ENUMERATE_SUB_KEYS = &H8Const KEY_NOTIFY = &H10Const KEY_CREATE_LINK = &H20Const KEY_READ = ((STANDARD_RIGHTS_READ Or KEY_QUERY_VALUE Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY) And (Not SYNCHRONIZE))Const KEY_WRITE = ((STANDARD_RIGHTS_WRITE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY) And (Not SYNCHRONIZE))Const KEY_ALL_ACCESS = ((STANDARD_RIGHTS_ALL Or KEY_QUERY_VALUE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY Or KEY_CREATE_LINK) And (Not SYNCHRONIZE))'Const STANDARD_RIGHTS_READ = (READ_CONTROL)'Const STANDARD_RIGHTS_WRITE = (READ_CONTROL)Const KEY_EXECUTE = ((KEY_READ) And (Not SYNCHRONIZE))' end winnt.txt' Debug APIsConst EXCEPTION_DEBUG_EVENT = 1Const CREATE_THREAD_DEBUG_EVENT = 2Const CREATE_PROCESS_DEBUG_EVENT = 3Const EXIT_THREAD_DEBUG_EVENT = 4Const EXIT_PROCESS_DEBUG_EVENT = 5Const LOAD_DLL_DEBUG_EVENT = 6Const UNLOAD_DLL_DEBUG_EVENT = 7Const OUTPUT_DEBUG_STRING_EVENT = 8Const RIP_EVENT = 9Const EXCEPTION_MAXIMUM_PARAMETERS = 15Type EXCEPTION_RECORD ExceptionCode As Long ExceptionFlags As Long pExceptionRecord As Long ' Pointer to an EXCEPTION_RECORD structure ExceptionAddress As Long NumberParameters As Long ExceptionInformation(EXCEPTION_MAXIMUM_PARAMETERS) As LongEnd TypeType EXCEPTION_DEBUG_INFO pExceptionRecord As EXCEPTION_RECORD dwFirstChance As LongEnd TypeType CREATE_THREAD_DEBUG_INFO hThread As Long lpThreadLocalBase As Long lpStartAddress As LongEnd TypeType CREATE_PROCESS_DEBUG_INFO hFile As Long hProcess As Long hThread As Long lpBaseOfImage As Long dwDebugInfoFileOffset As Long nDebugInfoSize As Long lpThreadLocalBase As Long lpStartAddress As Long lpImageName As Long fUnicode As IntegerEnd TypeType EXIT_THREAD_DEBUG_INFO dwExitCode As LongEnd TypeType EXIT_PROCESS_DEBUG_INFO dwExitCode As LongEnd TypeType LOAD_DLL_DEBUG_INFO hFile As Long lpBaseOfDll As Long dwDebugInfoFileOffset As Long nDebugInfoSize As Long lpImageName As Long fUnicode As IntegerEnd TypeType UNLOAD_DLL_DEBUG_INFO lpBaseOfDll As LongEnd TypeType OUTPUT_DEBUG_STRING_INFO lpDebugStringData As String fUnicode As Integer nDebugStringLength As IntegerEnd TypeType RIP_INFO dwError As Long dwType As LongEnd Type' GetDriveType return valuesConst DRIVE_REMOVABLE = 2Const DRIVE_FIXED = 3Const DRIVE_REMOTE = 4Const DRIVE_CDROM = 5Const DRIVE_RAMDISK = 6Const FILE_TYPE_UNKNOWN = &H0Const FILE_TYPE_DISK = &H1Const FILE_TYPE_CHAR = &H2Const FILE_TYPE_PIPE = &H3Const FILE_TYPE_REMOTE = &H8000Const STD_INPUT_HANDLE = -10&Const STD_OUTPUT_HANDLE = -11&Const STD_ERROR_HANDLE = -12&Const NOPARITY = 0Const ODDPARITY = 1Const EVENPARITY = 2Const MARKPARITY = 3Const SPACEPARITY = 4Const ONESTOPBIT = 0Const ONE5STOPBITS = 1Const TWOSTOPBITS = 2Const IGNORE = 0 ' Ignore signalConst INFINITE = &HFFFF ' Infinite timeout' Comm Baud Rate indicesConst CBR_110 = 110Const CBR_300 = 300Const CBR_600 = 600Const CBR_1200 = 1200Const CBR_2400 = 2400Const CBR_4800 = 4800Const CBR_9600 = 9600Const CBR_14400 = 14400Const CBR_19200 = 19200Const CBR_38400 = 38400Const CBR_56000 = 56000Const CBR_57600 = 57600Const CBR_115200 = 115200Const CBR_128000 = 128000Const CBR_256000 = 256000' Error FlagsConst CE_RXOVER = &H1 ' Receive Queue overflowConst CE_OVERRUN = &H2 ' Receive Overrun ErrorConst CE_RXPARITY = &H4 ' Receive Parity ErrorConst CE_FRAME = &H8 ' Receive Framing errorConst CE_BREAK = &H10 ' Break DetectedConst CE_TXFULL = &H100 ' TX Queue is fullConst CE_PTO = &H200 ' LPTx TimeoutConst CE_IOE = &H400 ' LPTx I/O ErrorConst CE_DNS = &H800 ' LPTx Device not selectedConst CE_OOP = &H1000 ' LPTx Out-Of-PaperConst CE_MODE = &H8000 ' Requested mode unsupportedConst IE_BADID = (-1) ' Invalid or unsupported idConst IE_OPEN = (-2) ' Device Already OpenConst IE_NOPEN = (-3) ' Device Not OpenConst IE_MEMORY = (-4) ' Unable to allocate queuesConst IE_DEFAULT = (-5) ' Error in default parametersConst IE_HARDWARE = (-10) ' Hardware Not PresentConst IE_BYTESIZE = (-11) ' Illegal Byte SizeConst IE_BAUDRATE = (-12) ' Unsupported BaudRate' EventsConst EV_RXCHAR = &H1 ' Any Character receivedConst EV_RXFLAG = &H2 ' Received certain characterConst EV_TXEMPTY = &H4 ' Transmitt Queue EmptyConst EV_CTS = &H8 ' CTS changed stateConst EV_DSR = &H10 ' DSR changed stateConst EV_RLSD = &H20 ' RLSD changed stateConst EV_BREAK = &H40 ' BREAK receivedConst EV_ERR = &H80 ' Line status error occurredConst EV_RING = &H100 ' Ring signal detectedConst EV_PERR = &H200 ' Printer error occuredConst EV_RX80FULL = &H400 ' Receive buffer is 80 percent fullConst EV_EVENT1 = &H800 ' Provider specific event 1Const EV_EVENT2 = &H1000 ' Provider specific event 2' Escape FunctionsConst SETXOFF = 1 ' Simulate XOFF receivedConst SETXON = 2 ' Simulate XON receivedConst SETRTS = 3 ' Set RTS highConst CLRRTS = 4 ' Set RTS lowConst SETDTR = 5 ' Set DTR highConst CLRDTR = 6 ' Set DTR lowConst RESETDEV = 7 ' Reset device if possibleConst SETBREAK = 8 'Set the device break lineConst CLRBREAK = 9 ' Clear the device break line' PURGE function flags.Const PURGE_TXABORT = &H1 ' Kill the pending/current writes to the comm port.Const PURGE_RXABORT = &H2 ' Kill the pending/current reads to the comm port.Const PURGE_TXCLEAR = &H4 ' Kill the transmit queue if there.Const PURGE_RXCLEAR = &H8 ' Kill the typeahead buffer if there.Const LPTx = &H80 ' Set if ID is for LPT device' Modem Status FlagsConst MS_CTS_ON = &H10&Const MS_DSR_ON = &H20&Const MS_RING_ON = &H40&Const MS_RLSD_ON = &H80&' WaitSoundState() ConstantsConst S_QUEUEEMPTY = 0Const S_THRESHOLD = 1Const S_ALLTHRESHOLD = 2' Accent ModesConst S_NORMAL = 0Const S_LEGATO = 1Const S_STACCATO = 2' SetSoundNoise() SourcesConst S_PERIOD512 = 0 ' Freq = N/512 high pitch, less coarse hissConst S_PERIOD1024 = 1 ' Freq = N/1024Const S_PERIOD2048 = 2 ' Freq = N/2048 low pitch, more coarse hissConst S_PERIODVOICE = 3 ' Source is frequency from voice channel (3)Const S_WHITE512 = 4 ' Freq = N/512 high pitch, less coarse hissConst S_WHITE1024 = 5 ' Freq = N/1024Const S_WHITE2048 = 6 ' Freq = N/2048 low pitch, more coarse hissConst S_WHITEVOICE = 7 ' Source is frequency from voice channel (3)Const S_SERDVNA = (-1) ' Device not availableConst S_SEROFM = (-2) ' Out of memoryConst S_SERMACT = (-3) ' Music activeConst S_SERQFUL = (-4) ' Queue fullConst S_SERBDNT = (-5) ' Invalid noteConst S_SERDLN = (-6) ' Invalid note lengthConst S_SERDCC = (-7) ' Invalid note countConst S_SERDTP = (-8) ' Invalid tempoConst S_SERDVL = (-9) ' Invalid volumeConst S_SERDMD = (-10) ' Invalid modeConst S_SERDSH = (-11) ' Invalid shapeConst S_SERDPT = (-12) ' Invalid pitchConst S_SERDFQ = (-13) ' Invalid frequencyConst S_SERDDR = (-14) ' Invalid durationConst S_SERDSR = (-15) ' Invalid sourceConst S_SERDST = (-16) ' Invalid stateConst NMPWAIT_WAIT_FOREVER = &HFFFFConst NMPWAIT_NOWAIT = &H1Const NMPWAIT_USE_DEFAULT_WAIT = &H0Const FS_CASE_IS_PRESERVED = FILE_CASE_PRESERVED_NAMESConst FS_CASE_SENSITIVE = FILE_CASE_SENSITIVE_SEARCHConst FS_UNICODE_STORED_ON_DISK = FILE_UNICODE_ON_DISKConst FS_PERSISTENT_ACLS = FILE_PERSISTENT_ACLSConst SECTION_QUERY = &H1Const SECTION_MAP_WRITE = &H2Const SECTION_MAP_READ = &H4Const SECTION_MAP_EXECUTE = &H8Const SECTION_EXTEND_SIZE = &H10Const SECTION_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED Or SECTION_QUERY Or SECTION_MAP_WRITE Or SECTION_MAP_READ Or SECTION_MAP_EXECUTE Or SECTION_EXTEND_SIZEConst FILE_MAP_COPY = SECTION_QUERYConst FILE_MAP_WRITE = SECTION_MAP_WRITEConst FILE_MAP_READ = SECTION_MAP_READConst FILE_MAP_ALL_ACCESS = SECTION_ALL_ACCESS' OpenFile() FlagsConst OF_READ = &H0Const OF_WRITE = &H1Const OF_READWRITE = &H2Const OF_SHARE_COMPAT = &H0Const OF_SHARE_EXCLUSIVE = &H10Const OF_SHARE_DENY_WRITE = &H20Const OF_SHARE_DENY_READ = &H30Const OF_SHARE_DENY_NONE = &H40Const OF_PARSE = &H100Const OF_DELETE = &H200Const OF_VERIFY = &H400Const OF_CANCEL = &H800Const OF_CREATE = &H1000Const OF_PROMPT = &H2000Const OF_EXIST = &H4000Const OF_REOPEN = &H8000Const OFS_MAXPATHNAME = 128' OpenFile() StructureType OFSTRUCT cBytes As Byte fFixedDisk As Byte nErrCode As Integer Reserved1 As Integer Reserved2 As Integer szPathName(OFS_MAXPATHNAME) As ByteEnd TypeDeclare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)Const PROCESSOR_INTEL_386 = 386Const PROCESSOR_INTEL_486 = 486Const PROCESSOR_INTEL_PENTIUM = 586Const PROCESSOR_MIPS_R4000 = 4000Const PROCESSOR_ALPHA_21064 = 21064Const PROCESSOR_ARCHITECTURE_INTEL = 0Const PROCESSOR_ARCHITECTURE_MIPS = 1Const PROCESSOR_ARCHITECTURE_ALPHA = 2Const PROCESSOR_ARCHITECTURE_PPC = 3Const PROCESSOR_ARCHITECTURE_UNKNOWN = &hFFFFDeclare Function GetCurrentTime Lib "kernel32" Alias "GetTickCount" () As Long' Flags for DrawFrameControlConst DFC_CAPTION = 1Const DFC_MENU = 2Const DFC_SCROLL = 3Const DFC_BUTTON = 4Const DFCS_CAPTIONCLOSE = &H0Const DFCS_CAPTIONMIN = &H1Const DFCS_CAPTIONMAX = &H2Const DFCS_CAPTIONRESTORE = &H3Const DFCS_CAPTIONHELP = &H4Const DFCS_MENUARROW = &H0Const DFCS_MENUCHECK = &H1Const DFCS_MENUBULLET = &H2Const DFCS_MENUARROWRIGHT = &H4Const DFCS_SCROLLUP = &H0Const DFCS_SCROLLDOWN = &H1Const DFCS_SCROLLLEFT = &H2Const DFCS_SCROLLRIGHT = &H3Const DFCS_SCROLLCOMBOBOX = &H5Const DFCS_SCROLLSIZEGRIP = &H8Const DFCS_SCROLLSIZEGRIPRIGHT = &H10Const DFCS_BUTTONCHECK = &H0Const DFCS_BUTTONRADIOIMAGE = &H1Const DFCS_BUTTONRADIOMASK = &H2Const DFCS_BUTTONRADIO = &H4Const DFCS_BUTTON3STATE = &H8Const DFCS_BUTTONPUSH = &H10Const DFCS_INACTIVE = &H100Const DFCS_PUSHED = &H200Const DFCS_CHECKED = &H400Const DFCS_ADJUSTRECT = &H2000Const DFCS_FLAT = &H4000Const DFCS_MONO = &H8000Declare Function InterlockedIncrement Lib "kernel32" Alias "InterlockedIncrement" (lpAddend As Long) As LongDeclare Function InterlockedDecrement Lib "kernel32" Alias "InterlockedDecrement" (lpAddend As Long) As LongDeclare Function InterlockedExchange Lib "kernel32" Alias "InterlockedExchange" (Target As Long, ByVal Value As Long) As Long' Loader RoutinesDeclare Function GetModuleFileName Lib "kernel32" Alias "GetModuleFileNameA" (ByVal hModule As Long, ByVal lpFileName As String, ByVal nSize As Long) As LongDeclare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As LongDeclare Function CreateProcess Lib "kernel32" Alias "CreateProcessA" (ByVal lpApplicationName As String, ByVal lpCommandLine As String, lpProcessAttributes As SECURITY_ATTRIBUTES, lpThreadAttributes As SECURITY_ATTRIBUTES, ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, lpEnvironment As Any, ByVal lpCurrentDriectory As String, lpStartupInfo As STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As LongDeclare Function SetProcessShutdownParameters Lib "kernel32" Alias "SetProcessShutdownParameters" (ByVal dwLevel As Long, ByVal dwFlags As Long) As LongDeclare Function GetProcessShutdownParameters Lib "kernel32" Alias "GetProcessShutdownParameters" (lpdwLevel As Long, lpdwFlags As Long) As LongDeclare Sub FatalAppExit Lib "kernel32" Alias "FatalAppExitA" (ByVal uAction As Long, ByVal lpMessageText As String)Declare Sub GetStartupInfo Lib "kernel32" Alias "GetStartupInfoA" (lpStartupInfo As STARTUPINFO)Declare Function GetCommandLine Lib "kernel32" Alias "GetCommandLineA" () As StringDeclare Function GetEnvironmentVariable Lib "kernel32" Alias "GetEnvironmentVariableA" (ByVal lpName As String, ByVal lpBuffer As String, ByVal nSize As Long) As LongDeclare Function SetEnvironmentVariable Lib "kernel32" Alias "SetEnvironmentVariableA" (ByVal lpName As String, ByVal lpValue As String) As LongDeclare Function ExpandEnvironmentStrings Lib "kernel32" Alias "ExpandEnvironmentStringsA" (ByVal lpSrc As String, ByVal lpDst As String, ByVal nSize As Long) As LongDeclare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As LongDeclare Function LoadLibraryEx Lib "kernel32" Alias "LoadLibraryExA" (ByVal lpLibFileName As String, ByVal hFile As Long, ByVal dwFlags As Long) As LongConst DONT_RESOLVE_DLL_REFERENCES = &H1Declare Function LoadModule Lib "kernel32" Alias "LoadModule" (ByVal lpModuleName As String, lpParameterBlock As Any) As LongDeclare Function FreeLibrary Lib "kernel32" Alias "FreeLibrary" (ByVal hLibModule As Long) As LongDeclare Function WinExec Lib "kernel32" Alias "WinExec" (ByVal lpCmdLine As String, ByVal nCmdShow As Long) As LongDeclare Sub DebugBreak Lib "kernel32" Alias "DebugBreak" ()Declare Function ContinueDebugEvent Lib "kernel32" Alias "ContinueDebugEvent" (ByVal dwProcessId As Long, ByVal dwThreadId As Long, ByVal dwContinueStatus As Long) As LongDeclare Function DebugActiveProcess Lib "kernel32" Alias "DebugActiveProcess" (ByVal dwProcessId As Long) As LongType CRITICAL_SECTIONdummy As LongEnd TypeDeclare Sub InitializeCriticalSection Lib "kernel32" Alias "InitializeCriticalSection" (lpCriticalSection As CRITICAL_SECTION)Declare Sub EnterCriticalSection Lib "kernel32" Alias "EnterCriticalSection" (lpCriticalSection As CRITICAL_SECTION)Declare Sub LeaveCriticalSection Lib "kernel32" Alias "LeaveCriticalSection" (lpCriticalSection As CRITICAL_SECTION)Declare Sub DeleteCriticalSection Lib "kernel32" Alias "DeleteCriticalSection" (lpCriticalSection As CRITICAL_SECTION)Declare Function SetEvent Lib "kernel32" Alias "SetEvent" (ByVal hEvent As Long) As LongDeclare Function ResetEvent Lib "kernel32" Alias "ResetEvent" (ByVal hEvent As Long) As LongDeclare Function PulseEvent Lib "kernel32" Alias "PulseEvent" (ByVal hEvent As Long) As LongDeclare Function ReleaseSemaphore Lib "kernel32" Alias "ReleaseSemaphore" (ByVal hSemaphore As Long, ByVal lReleaseCount As Long, lpPreviousCount As Long) As LongDeclare Function ReleaseMutex Lib "kernel32" Alias "ReleaseMutex" (ByVal hMutex As Long) As LongDeclare Function WaitForSingleObject Lib "kernel32" Alias "WaitForSingleObject" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As LongDeclare Function WaitForMultipleObjects Lib "kernel32" Alias "WaitForMultipleObjects" (ByVal nCount As Long, lpHandles As Long, ByVal bWaitAll As Long, ByVal dwMilliseconds As Long) As LongDeclare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)Declare Sub OutputDebugString Lib "kernel32" Alias "OutputDebugStringA" (ByVal lpOutputString As String)Declare Function GetVersion Lib "kernel32" Alias "GetVersion" () As LongDeclare Function OpenFile Lib "kernel32" Alias "OpenFile" (ByVal lpFileName As String, lpReOpenBuff As OFSTRUCT, ByVal wStyle As Long) As Long' GetTempFileName() Flags'Const TF_FORCEDRIVE = &H80Declare Function GetTempFileName Lib "kernel32" Alias "GetTempFileNameA" (ByVal lpszPath As String, ByVal lpPrefixString As String, ByVal wUnique As Long, ByVal lpTempFileName As String) As LongDeclare Function SetHandleCount Lib "kernel32" Alias "SetHandleCount" (ByVal wNumber As Long) As LongDeclare Function GetLogicalDrives Lib "kernel32" Alias "GetLogicalDrives" () As LongDeclare Function LockFile Lib "kernel32" Alias "LockFile" (ByVal hFile As Long, ByVal dwFileOffsetLow As Long, ByVal dwFileOffsetHigh As Long, ByVal nNumberOfBytesToLockLow As Long, ByVal nNumberOfBytesToLockHigh As Long) As LongDeclare Function UnlockFile Lib "kernel32" Alias "UnlockFile" (ByVal hFile As Long, ByVal dwFileOffsetLow As Long, ByVal dwFileOffsetHigh As Long, ByVal nNumberOfBytesToUnlockLow As Long, ByVal nNumberOfBytesToUnlockHigh As Long) As LongDeclare Function LockFileEx Lib "kernel32" Alias "LockFileEx" (ByVal hFile As Long, ByVal dwFlags As Long, ByVal dwReserved As Long, ByVal nNumberOfBytesToLockLow As Long, ByVal nNumberOfBytesToLockHigh As Long, lpOverlapped As OVERLAPPED) As LongConst LOCKFILE_FAIL_IMMEDIATELY = &H1Const LOCKFILE_EXCLUSIVE_LOCK = &H2Declare Function UnlockFileEx Lib "kernel32" Alias "UnlockFileEx" (ByVal hFile As Long, ByVal dwReserved As Long, ByVal nNumberOfBytesToUnlockLow As Long, ByVal nNumberOfBytesToUnlockHigh As Long, lpOverlapped As OVERLAPPED) As LongType BY_HANDLE_FILE_INFORMATION dwFileAttributes As Long ftCreationTime As FILETIME ftLastAccessTime As FILETIME ftLastWriteTime As FILETIME dwVolumeSerialNumber As Long nFileSizeHigh As Long nFileSizeLow As Long nNumberOfLinks As Long nFileIndexHigh As Long nFileIndexLow As LongEnd TypeDeclare Function GetFileInformationByHandle Lib "kernel32" Alias "GetFileInformationByHandle" (ByVal hFile As Long, lpFileInformation As BY_HANDLE_FILE_INFORMATION) As LongDeclare Function GetFileType Lib "kernel32" Alias "GetFileType" (ByVal hFile As Long) As LongDeclare Function GetFileSize Lib "kernel32" Alias "GetFileSize" (ByVal hFile As Long, lpFileSizeHigh As Long) As LongDeclare Function GetStdHandle Lib "kernel32" Alias "GetStdHandle" (ByVal nStdHandle As Long) As LongDeclare Function SetStdHandle Lib "kernel32" Alias "SetStdHandle" (ByVal nStdHandle As Long, ByVal nHandle As Long) As LongDeclare Function WriteFile Lib "kernel32" Alias "WriteFile" (ByVal hFile As Long, lpBuffer As Any, ByVal nNumberOfBytesToWrite As Long, lpNumberOfBytesWritten As Long, lpOverlapped As OVERLAPPED) As LongDeclare Function ReadFile Lib "kernel32" Alias "ReadFile" (ByVal hFile As Long, lpBuffer As Any, ByVal nNumberOfBytesToRead As Long, lpNumberOfBytesRead As Long, lpOverlapped As OVERLAPPED) As LongDeclare Function FlushFileBuffers Lib "kernel32" Alias "FlushFileBuffers" (ByVal hFile As Long) As LongDeclare Function DeviceIoControl Lib "kernel32" Alias "DeviceIoControl" (ByVal hDevice As Long, ByVal dwIoControlCode As Long, lpInBuffer As Any, ByVal nInBufferSize As Long, lpOutBuffer As Any, ByVal nOutBufferSize As Long, lpBytesReturned As Long, lpOverlapped As OVERLAPPED) As LongDeclare Function SetEndOfFile Lib "kernel32" Alias "SetEndOfFile" (ByVal hFile As Long) As LongDeclare Function SetFilePointer Lib "kernel32" Alias "SetFilePointer" (ByVal hFile As Long, ByVal lDistanceToMove As Long, lpDistanceToMoveHigh As Long, ByVal dwMoveMethod As Long) As LongDeclare Function FindClose Lib "kernel32" Alias "FindClose" (ByVal hFindFile As Long) As LongDeclare Function GetFileTime Lib "kernel32" Alias "GetFileTime" (ByVal hFile As Long, lpCreationTime As FILETIME, lpLastAccessTime As FILETIME, lpLastWriteTime As FILETIME) As LongDeclare Function SetFileTime Lib "kernel32" Alias "SetFileTime" (ByVal hFile As Long, lpCreationTime As FILETIME, lpLastAccessTime As FILETIME, lpLastWriteTime As FILETIME) As LongDeclare Function CloseHandle Lib "kernel32" Alias "CloseHandle" (ByVal hObject As Long) As LongDeclare Function DuplicateHandle Lib "kernel32" Alias "DuplicateHandle" (ByVal hSourceProcessHandle As Long, ByVal hSourceHandle As Long, ByVal hTargetProcessHandle As Long, lpTargetHandle As Long, ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwOptions As Long) As LongDeclare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As LongDeclare Function GlobalAlloc Lib "kernel32" Alias "GlobalAlloc" (ByVal wFlags As Long, ByVal dwBytes As Long) As LongDeclare Function GlobalFree Lib "kernel32" Alias "GlobalFree" (ByVal hMem As Long) As LongDeclare Function GlobalHandle Lib "kernel32" Alias "GlobalHandle" (wMem As Any) As LongDeclare Function GlobalLock Lib "kernel32" Alias "GlobalLock" (ByVal hMem As Long) As LongDeclare Function GlobalReAlloc Lib "kernel32" Alias "GlobalReAlloc" (ByVal hMem As Long, ByVal dwBytes As Long, ByVal wFlags As Long) As LongDeclare Function GlobalSize Lib "kernel32" Alias "GlobalSize" (ByVal hMem As Long) As LongDeclare Function GlobalUnlock Lib "kernel32" Alias "GlobalUnlock" (ByVal hMem As Long) As LongDeclare Function GlobalFlags Lib "kernel32" Alias "GlobalFlags" (ByVal hMem As Long) As LongDeclare Sub GlobalMemoryStatus Lib "kernel32" Alias "GlobalMemoryStatus" (lpBuffer As MEMORYSTATUS)Const LNOTIFY_OUTOFMEM = 0Const LNOTIFY_MOVE = 1Const LNOTIFY_DISCARD = 2Declare Function LocalAlloc Lib "kernel32" Alias "LocalAlloc" (ByVal wFlags As Long, ByVal wBytes As Long) As LongDeclare Function LocalFree Lib "kernel32" Alias "LocalFree" (ByVal hMem As Long) As LongDeclare Function LocalHandle Lib "kernel32" Alias "LocalHandle" (wMem As Any) As LongDeclare Function LocalLock Lib "kernel32" Alias "LocalLock" (ByVal hMem As Long) As LongDeclare Function LocalReAlloc Lib "kernel32" Alias "LocalReAlloc" (ByVal hMem As Long, ByVal wBytes As Long, ByVal wFlags As Long) As LongDeclare Function LocalSize Lib "kernel32" Alias "LocalSize" (ByVal hMem As Long) As LongDeclare Function LocalUnlock Lib "kernel32" Alias "LocalUnlock" (ByVal hMem As Long) As LongDeclare Function LocalFlags Lib "kernel32" Alias "LocalFlags" (ByVal hMem As Long) As LongType MEMORY_BASIC_INFORMATION BaseAddress as Long AllocationBase as Long AllocationProtect As Long RegionSize As Long State As Long Protect As Long lType As LongEnd TypeDeclare Function FlushInstructionCache Lib "kernel32" Alias "FlushInstructionCache" (ByVal hProcess As Long, lpBaseAddress As Any, ByVal dwSize As Long) As LongDeclare Function VirtualAlloc Lib "kernel32" Alias "VirtualAlloc" (lpAddress As Any, ByVal dwSize As Long, ByVal flAllocationType As Long, ByVal flProtect As Long) As LongDeclare Function VirtualFree Lib "kernel32" Alias "VirtualFree" (lpAddress As Any, ByVal dwSize As Long, ByVal dwFreeType As Long) As LongDeclare Function VirtualProtect Lib "kernel32" Alias "VirtualProtect" (lpAddress As Any, ByVal dwSize As Long, ByVal flNewProtect As Long, lpflOldProtect As Long) As LongDeclare Function VirtualQuery Lib "kernel32" Alias "VirtualQuery" (lpAddress As Any, lpBuffer As MEMORY_BASIC_INFORMATION, ByVal dwLength As Long) As LongDeclare Function VirtualProtectEx Lib "kernel32" Alias "VirtualProtectEx" (ByVal hProcess As Long, lpAddress As Any, ByVal dwSize As Long, ByVal flNewProtect As Long, lpflOldProtect As Long) As LongDeclare Function VirtualQueryEx Lib "kernel32" Alias "VirtualQueryEx" (ByVal hProcess As Long, lpAddress As Any, lpBuffer As MEMORY_BASIC_INFORMATION, ByVal dwLength As Long) As LongDeclare Function HeapCreate Lib "kernel32" Alias "HeapCreate" (ByVal flOptions As Long, ByVal dwInitialSize As Long, ByVal dwMaximumSize As Long) As LongDeclare Function HeapDestroy Lib "kernel32" Alias "HeapDestroy" (ByVal hHeap As Long) As LongDeclare Function HeapAlloc Lib "kernel32" Alias "HeapAlloc" (ByVal hHeap As Long, ByVal dwFlags As Long, ByVal dwBytes As Long) As LongDeclare Function HeapReAlloc Lib "kernel32" Alias "HeapReAlloc" (ByVal hHeap As Long, ByVal dwFlags As Long, lpMem As Any, ByVal dwBytes As Long) As LongDeclare Function HeapFree Lib "kernel32" Alias "HeapFree" (ByVal hHeap As Long, ByVal dwFlags As Long, lpMem As Any) As LongDeclare Function HeapSize Lib "kernel32" Alias "HeapSize" (ByVal hHeap As Long, ByVal dwFlags As Long, lpMem As Any) As LongDeclare Function GetProcessHeap Lib "kernel32" Alias "GetProcessHeap" () As LongDeclare Function GetProcessTimes Lib "kernel32" Alias "GetProcessTimes" (ByVal hProcess As Long, lpCreationTime As FILETIME, lpExitTime As FILETIME, lpKernelTime As FILETIME, lpUserTime As FILETIME) As LongDeclare Function OpenProcess Lib "kernel32" Alias "OpenProcess" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As LongDeclare Function GetCurrentProcess Lib "kernel32" Alias "GetCurrentProcess" () As LongDeclare Function GetCurrentProcessId Lib "kernel32" Alias "GetCurrentProcessId" () As LongDeclare Sub ExitProcess Lib "kernel32" Alias "ExitProcess" (ByVal uExitCode As Long)Declare Function TerminateProcess Lib "kernel32" Alias "TerminateProcess" (ByVal hProcess As Long, ByVal uExitCode As Long) As LongDeclare Function GetExitCodeProcess Lib "kernel32" Alias "GetExitCodeProcess" (ByVal hProcess As Long, lpExitCode As Long) As LongDeclare Function GetLastError Lib "kernel32" Alias "GetLastError" () As LongDeclare Sub SetLastError Lib "kernel32" Alias "SetLastError" (ByVal dwErrCode As Long)Const SLE_ERROR = &H1Const SLE_MINORERROR = &H2Const SLE_WARNING = &H3Declare Sub SetLastErrorEx Lib "user32" Alias "SetLastErrorEx" (ByVal dwErrCode As Long, ByVal dwType As Long)Declare Function GetOverlappedResult Lib "kernel32" Alias "GetOverlappedResult" (ByVal hFile As Long, lpOverlapped As OVERLAPPED, lpNumberOfBytesTransferred As Long, ByVal bWait As Long) As LongConst SEM_FAILCRITICALERRORS = &H1Const SEM_NOGPFAULTERRORBOX = &H2Const SEM_NOOPENFILEERRORBOX = &H8000Declare Sub SetDebugErrorLevel Lib "user32" Alias "SetDebugErrorLevel" (ByVal dwLevel As Long)Declare Function SetErrorMode Lib "kernel32" Alias "SetErrorMode" (ByVal wMode As Long) As LongDeclare Function ReadProcessMemory Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Long, lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As LongDeclare Function WriteProcessMemory Lib "kernel32" Alias "WriteProcessMemory" (ByVal hProcess As Long, lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As LongDeclare Function GetThreadContext Lib "kernel32" Alias "GetThreadContext" (ByVal hThread As Long, lpContext As CONTEXT) As LongDeclare Function SetThreadContext Lib "kernel32" Alias "SetThreadContext" (ByVal hThread As Long, lpContext As CONTEXT) As LongDeclare Function SuspendThread Lib "kernel32" Alias "SuspendThread" (ByVal hThread As Long) As LongDeclare Function ResumeThread Lib "kernel32" Alias "ResumeThread" (ByVal hThread As Long) As LongDeclare Function FindResource Lib "kernel32" Alias "FindResourceA" (ByVal hInstance As Long, ByVal lpName As String, ByVal lpType As String) As LongDeclare Function FindResourceEx Lib "kernel32" Alias "FindResourceExA" (ByVal hModule As Long, ByVal lpType As String, ByVal lpName As String, ByVal wLanguage As Long) As LongDeclare Function BeginUpdateResource Lib "kernel32" Alias "BeginUpdateResourceA" (ByVal pFileName As String, ByVal bDeleteExistingResources As Long) As LongDeclare Function UpdateResource Lib "kernel32" Alias "UpdateResourceA" (ByVal hUpdate As Long, ByVal lpType As String, ByVal lpName As String, ByVal wLanguage As Long, lpData As Any, ByVal cbData As Long) As LongDeclare Function EndUpdateResource Lib "kernel32" Alias "EndUpdateResourceA" (ByVal hUpdate As Long, ByVal fDiscard As Long) As LongDeclare Function LoadResource Lib "kernel32" Alias "LoadResource" (ByVal hInstance As Long, ByVal hResInfo As Long) As LongDeclare Function LockResource Lib "kernel32" Alias "LockResource" (ByVal hResData As Long) As LongDeclare Function SizeofResource Lib "kernel32" Alias "SizeofResource" (ByVal hInstance As Long, ByVal hResInfo As Long) As Long' Predefined Resource TypesConst RT_CURSOR = 1&Const RT_BITMAP = 2&Const RT_ICON = 3&Const RT_MENU = 4&Const RT_DIALOG = 5&Const RT_STRING = 6&Const RT_FONTDIR = 7&Const RT_FONT = 8&Const RT_ACCELERATOR = 9&Const RT_RCDATA = 10&Declare Function InitAtomTable Lib "kernel32" Alias "InitAtomTable" (ByVal nSize As Long) As LongDeclare Function GlobalAddAtom Lib "kernel32" Alias "GlobalAddAtomA" (ByVal lpString As String) As IntegerDeclare Function GlobalDeleteAtom Lib "kernel32" Alias "GlobalDeleteAtom" (ByVal nAtom As Integer) As IntegerDeclare Function GlobalFindAtom Lib "kernel32" Alias "GlobalFindAtomA" (ByVal lpString As String) As IntegerDeclare Function GlobalGetAtomName Lib "kernel32" Alias "GlobalGetAtomNameA" (ByVal nAtom As Integer, ByVal lpBuffer As String, ByVal nSize As Long) As Long' User Profile Routines' NOTE: The lpKeyName argument for GetProfileString, WriteProfileString,' GetPrivateProfileString, and WritePrivateProfileString can be either' a string or NULL. This is why the argument is defined as "As Any".' For example, to pass a string specify ByVal "wallpaper"' To pass NULL specify ByVal 0&' You can also pass NULL for the lpString argument for WriteProfileString' and WritePrivateProfileStringDeclare Function GetProfileInt Lib "kernel32" Alias "GetProfileIntA" (ByVal lpAppName As String, ByVal lpKeyName As String, ByVal nDefault As Long) As LongDeclare Function GetProfileString Lib "kernel32" Alias "GetProfileStringA" (ByVal lpAppName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long) As LongDeclare Function WriteProfileString Lib "kernel32" Alias "WriteProfileStringA" (ByVal lpszSection As String, ByVal lpszKeyName As String, ByVal lpszString As String) As LongDeclare Function GetProfileSection Lib "kernel32" Alias "GetProfileSectionA" (ByVal lpAppName As String, ByVal lpReturnedString As String, ByVal nSize As Long) As LongDeclare Function WriteProfileSection Lib "kernel32" Alias "WriteProfileSectionA" (ByVal lpAppName As String, ByVal lpString As String) As LongDeclare Function GetPrivateProfileInt Lib "kernel32" Alias "GetPrivateProfileIntA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal nDefault As Long, ByVal lpFileName As String) As LongDeclare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As LongDeclare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As LongDeclare Function GetPrivateProfileSection Lib "kernel32" Alias "GetPrivateProfileSectionA" (ByVal lpAppName As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As LongDeclare Function WritePrivateProfileSection Lib "kernel32" Alias "WritePrivateProfileSectionA" (ByVal lpAppName As String, ByVal lpString As String, ByVal lpFileName As String) As LongDeclare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As LongDeclare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As LongDeclare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As LongDeclare Function SetCurrentDirectory Lib "kernel32" Alias "SetCurrentDirectoryA" (ByVal lpPathName As String) As LongDeclare Function GetCurrentDirectory Lib "kernel32" Alias "GetCurrentDirectory" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As LongDeclare Function GetDiskFreeSpace Lib "kernel32" Alias "GetDiskFreeSpaceA" (ByVal lpRootPathName As String, lpSectorsPerCluster As Long, lpBytesPerSector As Long, lpNumberOfFreeClusters As Long, lpTotalNumberOfClusters As Long) As LongDeclare Function CreateDirectory Lib "kernel32" Alias "CreateDirectoryA" (ByVal lpPathName As String, lpSecurityAttributes As SECURITY_ATTRIBUTES) As LongDeclare Function CreateDirectoryEx Lib "kernel32" Alias "CreateDirectoryExA" (ByVal lpTemplateDirectory As String, ByVal lpNewDirectory As String, lpSecurityAttributes As SECURITY_ATTRIBUTES) As LongDeclare Function RemoveDirectory Lib "kernel32" Alias "RemoveDirectoryA" (ByVal lpPathName As String) As LongDeclare Function GetFullPathName Lib "kernel32" Alias "GetFullPathNameA" (ByVal lpFileName As String, ByVal nBufferLength As Long, ByVal lpBuffer As String, ByVal lpFilePart As String) As LongConst DDD_RAW_TARGET_PATH = &H1Const DDD_REMOVE_DEFINITION = &H2Const DDD_EXACT_MATCH_ON_REMOVE = &H4Const MAX_PATH = 260Declare Function DefineDosDevice Lib "kernel32" Alias "DefineDosDeviceA" (ByVal dwFlags As Long, ByVal lpDeviceName As String, ByVal lpTargetPath As String) As LongDeclare Function QueryDosDevice Lib "kernel32" Alias "QueryDosDeviceA" (ByVal lpDeviceName As String, ByVal lpTargetPath As String, ByVal ucchMax As Long) As LongDeclare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, lpSecurityAttributes As SECURITY_ATTRIBUTES, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As LongDeclare Function SetFileAttributes Lib "kernel32" Alias "SetFileAttributesA" (ByVal lpFileName As String, ByVal dwFileAttributes As Long) As LongDeclare Function GetFileAttributes Lib "kernel32" Alias "GetFileAttributesA" (ByVal lpFileName As String) As LongDeclare Function DeleteFile Lib "kernel32" Alias "DeleteFileA" (ByVal lpFileName As String) As LongDeclare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" (ByVal lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As LongDeclare Function FindNextFile Lib "kernel32" Alias "FindNextFileA" (ByVal hFindFile As Long, lpFindFileData As WIN32_FIND_DATA) As LongDeclare Function SearchPath Lib "kernel32" Alias "SearchPathA" (ByVal lpPath As String, ByVal lpFileName As String, ByVal lpExtension As String, ByVal nBufferLength As Long, ByVal lpBuffer As String, ByVal lpFilePart As String) As LongDeclare Function CopyFile Lib "kernel32" Alias "CopyFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal bFailIfExists As Long) As LongDeclare Function MoveFile Lib "kernel32" Alias "MoveFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String) As LongDeclare Function MoveFileEx Lib "kernel32" Alias "MoveFileExA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal dwFlags As Long) As LongConst MOVEFILE_REPLACE_EXISTING = &H1Const MOVEFILE_COPY_ALLOWED = &H2Const MOVEFILE_DELAY_UNTIL_REBOOT = &H4Type EVENTLOGRECORD Length as Long ' Length of full record Reserved as Long ' Used by the service RecordNumber as Long ' Absolute record number TimeGenerated as Long ' Seconds since 1-1-1970 TimeWritten as Long 'Seconds since 1-1-1970 EventID as Long EventType as Integer NumStrings as Integer EventCategory as Integer ReservedFlags as Integer ' For use with paired events (auditing) ClosingRecordNumber as Long 'For use with paired events (auditing) StringOffset as Long ' Offset from beginning of record UserSidLength as Long UserSidOffset as Long DataLength as Long DataOffset as Long ' Offset from beginning of recordEnd TypeDeclare Function CreateNamedPipe Lib "kernel32" Alias "CreateNamedPipeA" (ByVal lpName As String, ByVal dwOpenMode As Long, ByVal dwPipeMode As Long, ByVal nMaxInstances As Long, ByVal nOutBufferSize As Long, ByVal nInBufferSize As Long, ByVal nDefaultTimeOut As Long, lpSecurityAttributes As SECURITY_ATTRIBUTES) As LongDeclare Function GetNamedPipeHandleState Lib "kernel32" Alias "GetNamedPipeHandleStateA" (ByVal hNamedPipe As Long, lpState As Long, lpCurInstances As Long, lpMaxCollectionCount As Long, lpCollectDataTimeout As Long, ByVal lpUserName As String, ByVal nMaxUserNameSize As Long) As LongDeclare Function CallNamedPipe Lib "kernel32" Alias "CallNamedPipeA" (ByVal lpNamedPipeName As String, lpInBuffer As Any, ByVal nInBufferSize As Long, lpOutBuffer As Any, ByVal nOutBufferSize As Long, lpBytesRead As Long, ByVal nTimeOut As Long) As LongDeclare Function WaitNamedPipe Lib "kernel32" Alias "WaitNamedPipeA" (ByVal lpNamedPipeName As String, ByVal nTimeOut As Long) As LongDeclare Function SetVolumeLabel Lib "kernel32" Alias "SetVolumeLabelA" (ByVal lpRootPathName As String, ByVal lpVolumeName As String) As LongDeclare Sub SetFileApisToOEM Lib "kernel32" Alias "SetFileApisToOEM" ()Declare Function GetVolumeInformation Lib "kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As LongDeclare Function ClearEventLog Lib "advapi32.dll" Alias "ClearEventLogA" (ByVal hEventLog As Long, ByVal lpBackupFileName As String) As LongDeclare Function BackupEventLog Lib "advapi32.dll" Alias "BackupEventLogA" (ByVal hEventLog As Long, ByVal lpBackupFileName As String) As LongDeclare Function CloseEventLog Lib "advapi32.dll" Alias "CloseEventLog" (ByVal hEventLog As Long) As LongDeclare Function DeregisterEventSource Lib "advapi32.dll" Alias "DeregisterEventSource" (ByVal hEventLog As Long) As LongDeclare Function GetNumberOfEventLogRecords Lib "advapi32.dll" Alias "GetNumberOfEventLogRecords" (ByVal hEventLog As Long, NumberOfRecords As Long) As LongDeclare Function GetOldestEventLogRecord Lib "advapi32.dll" Alias "GetOldestEventLogRecord" (ByVal hEventLog As Long, OldestRecord As Long) As LongDeclare Function OpenEventLog Lib "advapi32.dll" Alias "OpenEventLogA" (ByVal lpUNCServerName As String, ByVal lpSourceName As String) As LongDeclare Function RegisterEventSource Lib "advapi32.dll" Alias "RegisterEventSourceA" (ByVal lpUNCServerName As String, ByVal lpSourceName As String) As LongDeclare Function OpenBackupEventLog Lib "advapi32.dll" Alias "OpenBackupEventLogA" (ByVal lpUNCServerName As String, ByVal lpFileName As String) As LongDeclare Function ReadEventLog Lib "advapi32.dll" Alias "ReadEventLogA" (ByVal hEventLog As Long, ByVal dwReadFlags As Long, ByVal dwRecordOffset As Long, lpBuffer As EVENTLOGRECORD, ByVal nNumberOfBytesToRead As Long, pnBytesRead As Long, pnMinNumberOfBytesNeeded As Long) As LongDeclare Function ReportEvent Lib "advapi32.dll" Alias "ReportEventA" (ByVal hEventLog As Long, ByVal wType As Long, ByVal wCategory As Long, ByVal dwEventID As Long, lpUserSid As Any, ByVal wNumStrings As Long, ByVal dwDataSize As Long, ByVal lpStrings As Long, lpRawData As Any) As Long' Security APIsConst TokenUser = 1Const TokenGroups = 2Const TokenPrivileges = 3Const TokenOwner = 4Const TokenPrimaryGroup = 5Const TokenDefaultDacl = 6Const TokenSource = 7Const TokenType = 8Const TokenImpersonationLevel = 9Const TokenStatistics = 10Type TOKEN_GROUPS GroupCount As Long Groups(ANYSIZE_ARRAY) As SID_AND_ATTRIBUTESEnd TypeDeclare Function DuplicateToken Lib "advapi32.dll" Alias "DuplicateToken" (ByVal ExistingTokenHandle As Long, ImpersonationLevel As Integer, DuplicateTokenHandle As Long) As LongDeclare Function GetKernelObjectSecurity Lib "advapi32.dll" Alias "GetKernelObjectSecurity" (ByVal Handle As Long, ByVal RequestedInformation As Long, pSecurityDescriptor As SECURITY_DESCRIPTOR, ByVal nLength As Long, lpnLengthNeeded As Long) As LongDeclare Function ImpersonateNamedPipeClient Lib "advapi32.dll" Alias "ImpersonateNamedPipeClient" (ByVal hNamedPipe As Long) As LongDeclare Function ImpersonateSelf Lib "advapi32.dll" Alias "ImpersonateSelf" (ImpersonationLevel As Integer) As LongDeclare Function RevertToSelf Lib "advapi32.dll" Alias "RevertToSelf" () As LongDeclare Function AccessCheck Lib "advapi32.dll" Alias "AccessCheck" (pSecurityDescriptor As SECURITY_DESCRIPTOR, ByVal ClientToken As Long, ByVal DesiredAccess As Long, GenericMapping As GENERIC_MAPPING, PrivilegeSet As PRIVILEGE_SET, PrivilegeSetLength As Long, GrantedAccess As Long, ByVal Status As Long) As LongType TOKEN_PRIVILEGESPrivilegeCount As LongPrivileges(ANYSIZE_ARRAY) As LUID_AND_ATTRIBUTESEnd TypeDeclare Function OpenProcessToken Lib "advapi32.dll" Alias "OpenProcessToken" (ByVal ProcessHandle As Long, ByVal DesiredAccess As Long, TokenHandle As Long) As LongDeclare Function OpenThreadToken Lib "advapi32.dll" Alias "OpenThreadToken" (ByVal ThreadHandle As Long, ByVal DesiredAccess As Long, ByVal OpenAsSelf As Long, TokenHandle As Long) As LongDeclare Function GetTokenInformation Lib "advapi32.dll" Alias "GetTokenInformation" (ByVal TokenHandle As Long, TokenInformationClass As Integer, TokenInformation As Any, ByVal TokenInformationLength As Long, ReturnLength As Long) As LongDeclare Function SetTokenInformation Lib "advapi32.dll" Alias "SetTokenInformation" (ByVal TokenHandle As Long, TokenInformationClass As Integer, TokenInformation As Any, ByVal TokenInformationLength As Long) As LongDeclare Function AdjustTokenPrivileges Lib "advapi32.dll" Alias "AdjustTokenPrivileges" (ByVal TokenHandle As Long, ByVal DisableAllPrivileges As Long, NewState As TOKEN_PRIVILEGES, ByVal BufferLength As Long, PreviousState As TOKEN_PRIVILEGES, ReturnLength As Long) As LongDeclare Function AdjustTokenGroups Lib "advapi32.dll" Alias "AdjustTokenGroups" (ByVal TokenHandle As Long, ByVal ResetToDefault As Long, NewState As TOKEN_GROUPS, ByVal BufferLength As Long, PreviousState As TOKEN_GROUPS, ReturnLength As Long) As LongDeclare Function PrivilegeCheck Lib "advapi32.dll" Alias "PrivilegeCheck" (ByVal ClientToken As Long, RequiredPrivileges As PRIVILEGE_SET, ByVal pfResult As Long) As LongDeclare Function AccessCheckAndAuditAlarm Lib "advapi32.dll" Alias "AccessCheckAndAuditAlarmA" (ByVal SubsystemName As String, HandleId As Any, ByVal ObjectTypeName As String, ByVal ObjectName As String, SecurityDescriptor As SECURITY_DESCRIPTOR, ByVal DesiredAccess As Long, GenericMapping As GENERIC_MAPPING, ByVal ObjectCreation As Long, GrantedAccess As Long, ByVal AccessStatus As Long, ByVal pfGenerateOnClose As Long) As LongDeclare Function ObjectOpenAuditAlarm Lib "kernel32" Alias "ObjectOpenAuditAlarmA" (ByVal SubsystemName As String, HandleId As Any, ByVal ObjectTypeName As String, ByVal ObjectName As String, pSecurityDescriptor As SECURITY_DESCRIPTOR, ByVal ClientToken As Long, ByVal DesiredAccess As Long, ByVal GrantedAccess As Long, Privileges As PRIVILEGE_SET, ByVal ObjectCreation As Long, ByVal AccessGranted As Long, ByVal GenerateOnClose As Long) As LongDeclare Function ObjectPrivilegeAuditAlarm Lib "advapi32.dll" Alias "ObjectPrivilegeAuditAlarmA" (ByVal SubsystemName As String, HandleId As Any, ByVal ClientToken As Long, ByVal DesiredAccess As Long, Privileges As PRIVILEGE_SET, ByVal AccessGranted As Long) As LongDeclare Function ObjectCloseAuditAlarm Lib "advapi32.dll" Alias "ObjectCloseAuditAlarmA" (ByVal SubsystemName As String, HandleId As Any, ByVal GenerateOnClose As Long) As LongDeclare Function PrivilegedServiceAuditAlarm Lib "advapi32.dll" Alias "PrivilegedServiceAuditAlarmA" (ByVal SubsystemName As String, ByVal ServiceName As String, ByVal ClientToken As Long, Privileges As PRIVILEGE_SET, ByVal AccessGranted As Long) As LongDeclare Function IsValidSid Lib "advapi32.dll" Alias "IsValidSid" (pSid As Any) As LongDeclare Function EqualSid Lib "advapi32.dll" Alias "EqualSid" (pSid1 As Any, pSid2 As Any) As LongDeclare Function EqualPrefixSid Lib "advapi32.dll" Alias "EqualPrefixSid" (pSid1 As Any, pSid2 As Any) As LongDeclare Function GetSidLengthRequired Lib "advapi32.dll" Alias "GetSidLengthRequired" (ByVal nSubAuthorityCount As Byte) As LongDeclare Function AllocateAndInitializeSid Lib "advapi3