diff options
Diffstat (limited to 'private/os2/inc')
39 files changed, 17991 insertions, 0 deletions
diff --git a/private/os2/inc/conapi.h b/private/os2/inc/conapi.h new file mode 100644 index 000000000..909e6fb6c --- /dev/null +++ b/private/os2/inc/conapi.h @@ -0,0 +1,404 @@ +#ifndef NOGDI + +typedef struct _CONSOLE_GRAPHICS_BUFFER_INFO { + DWORD dwBitMapInfoLength; + LPBITMAPINFO lpBitMapInfo; + DWORD dwUsage; + HANDLE hMutex; + PVOID lpBitMap; +} CONSOLE_GRAPHICS_BUFFER_INFO, *PCONSOLE_GRAPHICS_BUFFER_INFO; + +#endif // NOGDI + +#define CONSOLE_GRAPHICS_BUFFER 2 + +BOOL +WINAPI +InvalidateConsoleDIBits( + HANDLE hConsoleOutput, + PSMALL_RECT lpRect + ); + +#define SYSTEM_ROOT_CONSOLE_EVENT 3 + +VOID +WINAPI +SetLastConsoleEventActive( VOID ); + +#define VDM_HIDE_WINDOW 1 +#define VDM_IS_ICONIC 2 +#define VDM_CLIENT_RECT 3 +#define VDM_CLIENT_TO_SCREEN 4 +#define VDM_SCREEN_TO_CLIENT 5 + +BOOL +WINAPI +VDMConsoleOperation( + DWORD iFunction, + LPVOID lpData + ); + +typedef struct _CONSOLE_FONT_INFO { + DWORD nFont; + COORD dwFontSize; +} CONSOLE_FONT_INFO, *PCONSOLE_FONT_INFO; + + +BOOL +WINAPI +SetConsoleFont( + HANDLE hConsoleOutput, + DWORD nFont + ); + +BOOL +WINAPI +GetCurrentConsoleFont( + HANDLE hConsoleOutput, + BOOL bMaximumWindow, + PCONSOLE_FONT_INFO lpConsoleCurrentFont + ); + +COORD +WINAPI +GetConsoleFontSize( + HANDLE hConsoleOutput, + DWORD nFont + ); + +DWORD +WINAPI +GetConsoleFontInfo( + HANDLE hConsoleOutput, + BOOL bMaximumWindow, + DWORD nLength, + PCONSOLE_FONT_INFO lpConsoleFontInfo + ); + +DWORD +WINAPI +GetNumberOfConsoleFonts( + VOID + ); + +BOOL +WINAPI +SetConsoleCursor( + HANDLE hConsoleOutput, + HCURSOR hCursor + ); + +int +WINAPI +ShowConsoleCursor( + HANDLE hConsoleOutput, + BOOL bShow + ); + +HMENU +ConsoleMenuControl( + HANDLE hConsoleOutput, + UINT dwCommandIdLow, + UINT dwCommandIdHigh + ); + +BOOL +SetConsolePalette( + HANDLE hConsoleOutput, + HPALETTE hPalette, + UINT dwUsage + ); + +#define CONSOLE_FULLSCREEN_MODE 1 +#define CONSOLE_WINDOWED_MODE 2 + +BOOL +SetConsoleDisplayMode( + HANDLE hConsoleOutput, + DWORD dwFlags, + PCOORD lpNewScreenBufferDimensions + ); + +BOOL +RegisterConsoleVDM( + IN BOOL bRegister, + IN HANDLE hStartHardwareEvent, + IN HANDLE hEndHardwareEvent, + IN LPWSTR lpStateSectionName, + IN DWORD dwStateSectionNameLength, + OUT LPDWORD lpStateLength, + OUT PVOID *lpState, + IN LPWSTR lpVDMBufferSectionName, + IN DWORD dwVDMBufferSectionNameLength, + COORD VDMBufferSize OPTIONAL, + OUT PVOID *lpVDMBuffer + ); + +BOOL +GetConsoleHardwareState( + HANDLE hConsoleOutput, + PCOORD lpResolution, + PCOORD lpFontSize + ); + +BOOL +SetConsoleHardwareState( + HANDLE hConsoleOutput, + COORD dwResolution, + COORD dwFontSize + ); + +#define CONSOLE_FULLSCREEN 1 // fullscreen console +#define CONSOLE_FULLSCREEN_HARDWARE 2 // console owns the hardware + +BOOL +GetConsoleDisplayMode( + LPDWORD lpModeFlags + ); + + + +// +// aliasing apis +// + +BOOL +AddConsoleAliasA( + IN LPSTR Source, + IN LPSTR Target, + IN LPSTR ExeName + ); +BOOL +AddConsoleAliasW( + IN LPWSTR Source, + IN LPWSTR Target, + IN LPWSTR ExeName + ); +#ifdef UNICODE +#define AddConsoleAlias AddConsoleAliasW +#else +#define AddConsoleAlias AddConsoleAliasA +#endif // !UNICODE + +DWORD +GetConsoleAliasA( + IN LPSTR Source, + OUT LPSTR TargetBuffer, + IN DWORD TargetBufferLength, + IN LPSTR ExeName + ); +DWORD +GetConsoleAliasW( + IN LPWSTR Source, + OUT LPWSTR TargetBuffer, + IN DWORD TargetBufferLength, + IN LPWSTR ExeName + ); +#ifdef UNICODE +#define GetConsoleAlias GetConsoleAliasW +#else +#define GetConsoleAlias GetConsoleAliasA +#endif // !UNICODE + +DWORD +GetConsoleAliasesLengthA( + IN LPSTR ExeName + ); +DWORD +GetConsoleAliasesLengthW( + IN LPWSTR ExeName + ); +#ifdef UNICODE +#define GetConsoleAliasesLength GetConsoleAliasesLengthW +#else +#define GetConsoleAliasesLength GetConsoleAliasesLengthA +#endif // !UNICODE + +DWORD +GetConsoleAliasExesLengthA( VOID ); +DWORD +GetConsoleAliasExesLengthW( VOID ); +#ifdef UNICODE +#define GetConsoleAliasExesLength GetConsoleAliasExesLengthW +#else +#define GetConsoleAliasExesLength GetConsoleAliasExesLengthA +#endif // !UNICODE + +DWORD +GetConsoleAliasesA( + OUT LPSTR AliasBuffer, + IN DWORD AliasBufferLength, + IN LPSTR ExeName + ); +DWORD +GetConsoleAliasesW( + OUT LPWSTR AliasBuffer, + IN DWORD AliasBufferLength, + IN LPWSTR ExeName + ); +#ifdef UNICODE +#define GetConsoleAliases GetConsoleAliasesW +#else +#define GetConsoleAliases GetConsoleAliasesA +#endif // !UNICODE + +DWORD +GetConsoleAliasExesA( + OUT LPSTR ExeNameBuffer, + IN DWORD ExeNameBufferLength + ); +DWORD +GetConsoleAliasExesW( + OUT LPWSTR ExeNameBuffer, + IN DWORD ExeNameBufferLength + ); +#ifdef UNICODE +#define GetConsoleAliasExes GetConsoleAliasExesW +#else +#define GetConsoleAliasExes GetConsoleAliasExesA +#endif // !UNICODE + +VOID +ExpungeConsoleCommandHistoryA( + IN LPSTR ExeName + ); +VOID +ExpungeConsoleCommandHistoryW( + IN LPWSTR ExeName + ); +#ifdef UNICODE +#define ExpungeConsoleCommandHistory ExpungeConsoleCommandHistoryW +#else +#define ExpungeConsoleCommandHistory ExpungeConsoleCommandHistoryA +#endif // !UNICODE + +BOOL +SetConsoleNumberOfCommandsA( + IN DWORD Number, + IN LPSTR ExeName + ); +BOOL +SetConsoleNumberOfCommandsW( + IN DWORD Number, + IN LPWSTR ExeName + ); +#ifdef UNICODE +#define SetConsoleNumberOfCommands SetConsoleNumberOfCommandsW +#else +#define SetConsoleNumberOfCommands SetConsoleNumberOfCommandsA +#endif // !UNICODE + +DWORD +GetConsoleCommandHistoryLengthA( + IN LPSTR ExeName + ); +DWORD +GetConsoleCommandHistoryLengthW( + IN LPWSTR ExeName + ); +#ifdef UNICODE +#define GetConsoleCommandHistoryLength GetConsoleCommandHistoryLengthW +#else +#define GetConsoleCommandHistoryLength GetConsoleCommandHistoryLengthA +#endif // !UNICODE + +DWORD +GetConsoleCommandHistoryA( + OUT LPSTR Commands, + IN DWORD CommandBufferLength, + IN LPSTR ExeName + ); +DWORD +GetConsoleCommandHistoryW( + OUT LPWSTR Commands, + IN DWORD CommandBufferLength, + IN LPWSTR ExeName + ); +#ifdef UNICODE +#define GetConsoleCommandHistory GetConsoleCommandHistoryW +#else +#define GetConsoleCommandHistory GetConsoleCommandHistoryA +#endif // !UNICODE + +#define CONSOLE_OVERSTRIKE 1 + +BOOL +SetConsoleCommandHistoryMode( + IN DWORD Flags + ); + +#define CONSOLE_NOSHORTCUTKEY 0 /* no shortcut key */ +#define CONSOLE_ALTTAB 1 /* Alt + Tab */ +#define CONSOLE_ALTESC (1 << 1) /* Alt + Escape */ +#define CONSOLE_ALTSPACE (1 << 2) /* Alt + Space */ +#define CONSOLE_ALTENTER (1 << 3) /* Alt + Enter */ +#define CONSOLE_ALTPRTSC (1 << 4) /* Alt Print screen */ +#define CONSOLE_PRTSC (1 << 5) /* Print screen */ +#define CONSOLE_CTRLESC (1 << 6) /* Ctrl + Escape */ + +typedef struct _APPKEY { + WORD Modifier; + WORD ScanCode; +} APPKEY, *LPAPPKEY; + +#define CONSOLE_MODIFIER_RSHIFT 0x0001 // Right shift key +#define CONSOLE_MODIFIER_LSHIFT 0x0002 // Left shift key +#define CONSOLE_MODIFIER_CONTROL 0x0004 // Either Control shift key +#define CONSOLE_MODIFIER_ALT 0x0008 // Either Alt shift key +#define CONSOLE_MODIFIER_SCRLOCK 0x0010 // Scroll lock active +#define CONSOLE_MODIFIER_NUMLOCK 0x0020 // Num lock active +#define CONSOLE_MODIFIER_CAPSLOCK 0x0040 // Caps lock active +#define CONSOLE_MODIFIER_INSERT 0x0080 // Insert active +#define CONSOLE_MODIFIER_EXTENDED 0x0100 // Extended K/B shift +#define CONSOLE_MODIFIER_HOLD 0x0200 // Ctrl-Num-Lock/Pause active +#define CONSOLE_MODIFIER_LALT 0x0400 // Left Alt key is down +#define CONSOLE_MODIFIER_RALT 0x0800 // Right Alt key is down +#define CONSOLE_MODIFIER_LCTRL 0x1000 // Left Ctrl key is down +#define CONSOLE_MODIFIER_RCTRL 0x2000 // Right Ctrl key is down + +BOOL +SetConsoleKeyShortcuts( + BOOL bSet, + BYTE bReserveKeys, + LPAPPKEY lpAppKeys, + DWORD dwNumAppKeys + ); + +BOOL +SetConsoleMenuClose( + BOOL bEnable + ); + +#define CONSOLE_ADD_SUBST 1 +#define CONSOLE_REMOVE_SUBST 2 +#define CONSOLE_QUERY_SUBST 3 + +BOOL +ConsoleSubst( + IN DWORD dwDriveNumber, + IN DWORD dwFlag, + IN OUT LPWSTR lpPhysicalDriveBuffer, + IN DWORD dwPhysicalDriveBufferLength + ); + +BOOL +WINAPI +WriteConsoleInputVDMA( + HANDLE hConsoleInput, + PINPUT_RECORD lpBuffer, + DWORD nLength, + LPDWORD lpNumberOfEventsWritten + ); +BOOL +WINAPI +WriteConsoleInputVDMW( + HANDLE hConsoleInput, + PINPUT_RECORD lpBuffer, + DWORD nLength, + LPDWORD lpNumberOfEventsWritten + ); +#ifdef UNICODE +#define WriteConsoleInputVDM WriteConsoleInputVDMW +#else +#define WriteConsoleInputVDM WriteConsoleInputVDMA +#endif // !UNICODE diff --git a/private/os2/inc/conrqust.h b/private/os2/inc/conrqust.h new file mode 100644 index 000000000..4f3044834 --- /dev/null +++ b/private/os2/inc/conrqust.h @@ -0,0 +1,162 @@ + +#define NTOS2_ONLY +#include "sesport.h" +#include "os2err.h" + +/* + * Routines defined in conrqust.c to send requests to OS2.EXE + */ + +APIRET +SendCtrlConsoleRequest( + IN OUT PSCREQUESTMSG Request, + IN PCH OutBuffer, + OUT PCH InBuffer, + IN HANDLE hSem + ); + +APIRET +Od2CallRootProcessThruLPC( + IN OUT PSCREQUESTMSG Request, + IN PCH OutBuffer, + OUT PCH InBuffer, + IN HANDLE hSem, + IN ULONG ArgLength + ); + +APIRET +Od2LockCtrlRequestDataBuffer(); + +VOID +Od2UnlockCtrlRequestDataBuffer(); + +APIRET +Od2RemoveConsoleThread(); + +APIRET +Od2RestartConsoleThread(); + +APIRET +Od2AddWin32ChildProcess(); + +APIRET +Od2RemoveWin32ChildProcess(); + +/* + * Routines in "VIO" (vio/kbd/mou) that are called from dllremot.c or + * dllmisc.c(DosDevIOCtl) + */ + +APIRET KbdOpenLogHandle(PHANDLE); +APIRET RemoteCloseHandle(HANDLE Handle); +NTSTATUS CtrlCloseHandle(IN HANDLE hFile); +APIRET KbdRead(IN PFILE_HANDLE hFileRecord, OUT PCH Buffer, IN ULONG Length, + OUT PULONG BytesRead, IN KBDREQUESTNUMBER RequestType); +APIRET VioWrite(IN PFILE_HANDLE hFileRecord, IN PCH Buffer, IN ULONG Length, + OUT PULONG BytesWritten, IN VIOREQUESTNUMBER RequestType); +APIRET DevMouOpen(OUT PHANDLE FileHandle); +APIRET DevMouClose(); +APIRET KbdDupLogHandle( IN HANDLE hKbd); +APIRET OpenLVBsection(VOID); +APIRET Od2WaitForSingleObject(IN HANDLE Handle, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL); + +APIRET DosMonReg( IN ULONG hMon, IN PBYTE pInBuffer, IN PBYTE pOutBuffer, + IN ULONG fPosition, IN ULONG usIndex); +APIRET KbdCharIn(OUT PKBDKEYINFO Info, IN ULONG Wait, IN ULONG hKbd); +APIRET KbdPeek(OUT PKBDKEYINFO Info, IN ULONG hKbd); +APIRET KbdGetFocus( IN ULONG Wait, IN ULONG hKbd); +APIRET MouDrawPtr(IN ULONG hMou); +APIRET MouGetDevStatus(OUT PUSHORT DevStatus, IN ULONG hMou); +APIRET MouGetEventMask(OUT PUSHORT EventMask, IN ULONG hMou); +APIRET MouGetNumButtons(OUT PUSHORT NumButtons, IN ULONG hMou); +APIRET MouGetNumMickeys(OUT PUSHORT NumMickeys, IN ULONG hMou); +APIRET MouGetNumQueEl(OUT PMOUQUEINFO NumQueEl, IN ULONG hMou); +APIRET MouGetPtrPos(OUT PPTRLOC PtrPos, IN ULONG hMou); +APIRET MouGetPtrShape(OUT PBYTE PtrMask, OUT PPTRSHAPE PtrShape, IN ULONG hMou); +APIRET MouGetScaleFact(OUT PSCALEFACT ScaleFact, IN ULONG hMou); +APIRET MouReadEventQue(OUT PMOUEVENTINFO MouEvent, IN PUSHORT Wait, IN ULONG hMou); +APIRET MouRemovePtr(IN PNOPTRRECT Rect, IN ULONG hMou); +APIRET MouSetDevStatus(IN PUSHORT DevStatus, IN ULONG hMou); +APIRET MouSetEventMask(IN PUSHORT EventMask, IN ULONG hMou); +APIRET MouSetPtrPos(IN PPTRLOC PtrPos, IN ULONG hMou); +APIRET MouSetPtrShape(IN PBYTE PtrMask, IN PPTRSHAPE PtrShape, IN ULONG hMou); +APIRET MouSetScaleFact(IN PSCALEFACT ScaleFact, IN ULONG hMou); + +APIRET KbdGetCpId(OUT PUSHORT pIdCodePage, IN ULONG hKbd); +APIRET KbdGetInputMode(OUT PBYTE pInputMode, IN ULONG hKbd); +APIRET KbdGetInterimFlag(OUT PBYTE pInterimFlag, IN ULONG hKbd); +APIRET KbdGetKbdType(OUT PUSHORT pKbdType, IN ULONG hKbd); +APIRET KbdGetHotKey(IN PUSHORT pParm, OUT PBYTE pHotKey, IN ULONG hKbd); +APIRET KbdGetShiftState(OUT PBYTE pvData, IN ULONG hDev); +APIRET KbdSetInputMode(IN BYTE InputMode, IN ULONG hDev); +APIRET KbdSetInterimFlag(IN BYTE InterimFlag, IN ULONG hDev); +APIRET KbdSetShiftState(OUT PBYTE pvData, IN ULONG hDev); +APIRET KbdSetTypamaticRate(IN PBYTE pRateDelay, IN ULONG hDev); +APIRET MouAllowPtrDraw(IN ULONG hMou); +APIRET MouScreenSwitch(IN PBYTE pScreenGroup, IN ULONG hMou); + +/* + * pointer to section of all-session-group parm + */ + +POS2_SES_GROUP_PARMS SesGrp; +ULONG SesGrpId; + +/* + * parameters from os2.exe ports for Vio/Kbd/Mou/Mon/Net APIs + */ + +HANDLE CtrlPortHandle; + +PVOID VioBuff; // LVB buffer for VIO (after got selector) + +extern HANDLE FocusSemaphore; +extern HANDLE CtrlDataSemaphore; +extern HANDLE KbdDataSemaphore; +extern HANDLE MouDataSemaphore; +extern HANDLE PopUpSemaphore; +extern HANDLE ScreenLockSemaphore; +extern HANDLE PauseEvent; +extern HANDLE Od2VioWriteSemHandle; + +USHORT MoniorOpenedForThisProcess; + +#if DBG + +// +// conrqust.c +// + +VOID +AcquireStdHandleLock( + IN PSZ CallingRoutine + ); + +VOID +ReleaseStdHandleLock( + IN PSZ CallingRoutine + ); + +#else +VOID +AcquireStdHandleLock( + ); + +VOID +ReleaseStdHandleLock( + ); +#endif + + +#if DBG +#define UNSUPPORTED_API() \ + DbgPrint("%s Not Implemented Yet\n", FuncName); \ + /* DbgUserBreakPoint(); */ \ + return NO_ERROR; +#else +#define UNSUPPORTED_API() \ + /* DbgUserBreakPoint(); */ \ + return NO_ERROR; +#endif + + diff --git a/private/os2/inc/dllcopy.h b/private/os2/inc/dllcopy.h new file mode 100644 index 000000000..0db2e1431 --- /dev/null +++ b/private/os2/inc/dllcopy.h @@ -0,0 +1,35 @@ +/* + * + * DOSCOPY.H - Header file for the OS/2 DOSCOPY API function + * + * This file contains declarations and definitons for use by + * the DOSCOPY function, its helper functions, and the test + * functions. + * + * NOTES: + * + * 1) The contents of this file are intended for internal use only, + * although it may be appropriate to export parts of it to other + * header files. + * + * Created Oct 88, Danny Glasser (microsoft!dannygl) + */ + +/* Object types */ +#define COT_FILE 1 /* Object is a file */ +#define COT_DIRECTORY 2 /* Object is a directory */ +#define COT_PARENT 3 /* Object does not exist but its parent does + (and is a directory) */ +#define COT_DEVICE 4 /* Object is a character device */ +#define COT_OTHER 5 /* Object is none of the above */ + +/* Info flags for copy_file() - FOR INTERNAL USE ONLY */ +#define CFF_SOURCE_IS_FILE 0x0001 /* Source is a file */ +#define CFF_TARGET_IS_FILE 0x0002 /* Target is a file */ +#define CFF_TARGET_FILE_EXISTS 0x0004 /* Target file already exists */ + +/* Various constants */ +#define CURRENT_DIRECTORY "." /* Shorthand for current + directory */ +#define PARENT_DIRECTORY ".." /* Shorthand for parent + directory */ diff --git a/private/os2/inc/dlldbcs.h b/private/os2/inc/dlldbcs.h new file mode 100644 index 000000000..b0eac98f5 --- /dev/null +++ b/private/os2/inc/dlldbcs.h @@ -0,0 +1,48 @@ +/*++ + +Copyright (c) 1993 Microsoft Corporation + +Module Name: + + dlldbcs.h + +Abstract: + + Prototypes for OS/2 subsystem internal multibyte string functions + +Author: + + Akihiko Sasaki (V-AkihiS) 23-June-1993 + +Revision History: + +--*/ + +#ifdef DBCS + +#include <string.h> + +unsigned char * _CRTAPI1 +Od2MultiByteStrchr( + const unsigned char *, + unsigned short + ); + +unsigned char * _CRTAPI1 +Od2MultiByteStrrchr( + const unsigned char *, + unsigned short + ); + +unsigned char * _CRTAPI1 +Od2MultiByteStrstr( + const unsigned char *, + const unsigned char * + ); + +unsigned char * _CRTAPI1 +Od2MultiByteStrpbrk( + const unsigned char *, + const unsigned char * + ); +#endif diff --git a/private/os2/inc/dllfile.h b/private/os2/inc/dllfile.h new file mode 100644 index 000000000..0a9efe668 --- /dev/null +++ b/private/os2/inc/dllfile.h @@ -0,0 +1,69 @@ +/*++ + +Copyright (c) 1990 Microsoft Corporation + +Module Name: + + dllfile.h + +Abstract: + + This module defines the OS/2 subsystem I/O data structures for the + DLL. + +Author: + + Therese Stowell (thereses) 17-Dec-1989 + +Revision History: + +--*/ + +#include "os2file.h" +// +// File System variables +// +// per-process current directory information for current drive +// +CURRENT_DIRECTORY_INFORMATION Od2CurrentDirectory; + +// per-process default drive + +// BUGBUG in InitDLL, set CurrentDisk to boot disk + +ULONG Od2CurrentDisk; + +// file handle table variables. initially, HandleTable points to +// SmallHandleTable. most processes won't use more than 20 handles. +// if the handle table is full, space in the heap is allocated and the +// SmallHandleTable is copied over. + +PFILE_HANDLE HandleTable; // pointer to handle table + +ULONG HandleTableLength; // number of entries in handle table + +FILE_HANDLE SmallHandleTable[INITIALFILEHANDLES]; // initial handle table + +BOOLEAN VerifyFlag; // variable used by DosSet/QueryVerify + + +// search handle table variables. this size of this table is managed the +// same way as the file handle table, except the table is grown when a search +// handle allocation fails, not when the user specifies it. + +PSEARCH_RECORD *SearchHandleTable; // pointer to search handle table + +ULONG SearchHandleTableLength; // number of entries in search handle table + +PSEARCH_RECORD SmallSearchHandleTable[INITIAL_SEARCH_HANDLES]; // initial search handle table + +// +// the client keeps two tables which include information about the current +// directories on the different drives. +// Od2DirHandles holds for each drive a handle to the current directory. +// Od2DirHandlesIsValid holds for each drive a flag indicating whether the +// current directory on it was initialized or not. +// + +HANDLE Od2DirHandles[MAX_DRIVES]; +BOOLEAN Od2DirHandlesIsValid[MAX_DRIVES]; diff --git a/private/os2/inc/iovector.h b/private/os2/inc/iovector.h new file mode 100644 index 000000000..6af7da38b --- /dev/null +++ b/private/os2/inc/iovector.h @@ -0,0 +1,528 @@ + +/* Type - OPEN - SET - QUERY - CLOSE - DUP_ - READ - WRITE + STATE TYPE HANDLE + ----------------------------------------------------------------- + Nul - X - 1 - DEV - DEV - DEV - X - X + Con - X - 1 - DEV - DEV - DEV - X - SCR + Com - X - 1 - DEV - DEV - DEV - 2 - 2 + Lpt - X - 1 - DEV - DEV - DEV - 2 - 2 + Kbd - X - 1 - DEV - X - X - X - NUL + Mouse - X - 1 - DEV - X - X - 2 - 2 + Clock - X - 1 - DEV - DEV - DEV - 2 - 2 + Screen - X - 1 - DEV - DEV - DEV - NUL - X + Pointer - X - 1 - DEV - DEV - DEV - 2 - 2 + File - X - X - X - X - X - X - X + Pipe - FIL - FIL - FIL - FIL - FIL - FIL - X + Device - FIL - 1 - X - FIL - FIL - FIL - FIL + Remote - - X - X - X - X - X - X + Monitor - - 3 - 3 - 3 - 3 - 2 - 2 + + other: 1 - NonFile, 2 - Tmp, 3 - NoSupp +*/ + + +APIRET +NulOpenRoutine( + OUT PHANDLE FileHandle, + IN ULONG DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes, + IN PIO_STATUS_BLOCK IoStatus, + IN ULONG CreateSize, + OUT PULONG ActionTaken, + IN ULONG FileAttributes, + IN ULONG ShareAccess, + IN ULONG CreateDisposition, + IN ULONG CreateOptions, + IN OUT PEAOP2 ExtendedFileAttr OPTIONAL, + OUT PUSHORT FileType, + OUT PUSHORT DeviceAttribute + ); + +APIRET +ConOpenRoutine( + OUT PHANDLE FileHandle, + IN ULONG DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes, + IN PIO_STATUS_BLOCK IoStatus, + IN ULONG CreateSize, + OUT PULONG ActionTaken, + IN ULONG FileAttributes, + IN ULONG ShareAccess, + IN ULONG CreateDisposition, + IN ULONG CreateOptions, + IN OUT PEAOP2 ExtendedFileAttr OPTIONAL, + OUT PUSHORT FileType, + OUT PUSHORT DeviceAttribute + ); + +APIRET +ComOpenRoutine( + OUT PHANDLE FileHandle, + IN ULONG DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes, + IN PIO_STATUS_BLOCK IoStatus, + IN ULONG CreateSize, + OUT PULONG ActionTaken, + IN ULONG FileAttributes, + IN ULONG ShareAccess, + IN ULONG CreateDisposition, + IN ULONG CreateOptions, + IN OUT PEAOP2 ExtendedFileAttr OPTIONAL, + OUT PUSHORT FileType, + OUT PUSHORT DeviceAttribute + ); + +APIRET +LptOpenRoutine( + OUT PHANDLE FileHandle, + IN ULONG DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes, + IN PIO_STATUS_BLOCK IoStatus, + IN ULONG CreateSize, + OUT PULONG ActionTaken, + IN ULONG FileAttributes, + IN ULONG ShareAccess, + IN ULONG CreateDisposition, + IN ULONG CreateOptions, + IN OUT PEAOP2 ExtendedFileAttr OPTIONAL, + OUT PUSHORT FileType, + OUT PUSHORT DeviceAttribute + ); + +APIRET +KbdOpenRoutine( + OUT PHANDLE FileHandle, + IN ULONG DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes, + IN PIO_STATUS_BLOCK IoStatus, + IN ULONG CreateSize, + OUT PULONG ActionTaken, + IN ULONG FileAttributes, + IN ULONG ShareAccess, + IN ULONG CreateDisposition, + IN ULONG CreateOptions, + IN OUT PEAOP2 ExtendedFileAttr OPTIONAL, + OUT PUSHORT FileType, + OUT PUSHORT DeviceAttribute + ); + +APIRET +MouseOpenRoutine( + OUT PHANDLE FileHandle, + IN ULONG DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes, + IN PIO_STATUS_BLOCK IoStatus, + IN ULONG CreateSize, + OUT PULONG ActionTaken, + IN ULONG FileAttributes, + IN ULONG ShareAccess, + IN ULONG CreateDisposition, + IN ULONG CreateOptions, + IN OUT PEAOP2 ExtendedFileAttr OPTIONAL, + OUT PUSHORT FileType, + OUT PUSHORT DeviceAttribute + ); + +APIRET +ClockOpenRoutine( + OUT PHANDLE FileHandle, + IN ULONG DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes, + IN PIO_STATUS_BLOCK IoStatus, + IN ULONG CreateSize, + OUT PULONG ActionTaken, + IN ULONG FileAttributes, + IN ULONG ShareAccess, + IN ULONG CreateDisposition, + IN ULONG CreateOptions, + IN OUT PEAOP2 ExtendedFileAttr OPTIONAL, + OUT PUSHORT FileType, + OUT PUSHORT DeviceAttribute + ); + +APIRET +ScreenOpenRoutine( + OUT PHANDLE FileHandle, + IN ULONG DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes, + IN PIO_STATUS_BLOCK IoStatus, + IN ULONG CreateSize, + OUT PULONG ActionTaken, + IN ULONG FileAttributes, + IN ULONG ShareAccess, + IN ULONG CreateDisposition, + IN ULONG CreateOptions, + IN OUT PEAOP2 ExtendedFileAttr OPTIONAL, + OUT PUSHORT FileType, + OUT PUSHORT DeviceAttribute + ); + +APIRET +PointerOpenRoutine( + OUT PHANDLE FileHandle, + IN ULONG DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes, + IN PIO_STATUS_BLOCK IoStatus, + IN ULONG CreateSize, + OUT PULONG ActionTaken, + IN ULONG FileAttributes, + IN ULONG ShareAccess, + IN ULONG CreateDisposition, + IN ULONG CreateOptions, + IN OUT PEAOP2 ExtendedFileAttr OPTIONAL, + OUT PUSHORT FileType, + OUT PUSHORT DeviceAttribute + ); + +APIRET +FileOpenRoutine( + OUT PHANDLE FileHandle, + IN ULONG DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes, + IN PIO_STATUS_BLOCK IoStatus, + IN ULONG CreateSize, + OUT PULONG ActionTaken, + IN ULONG FileAttributes, + IN ULONG ShareAccess, + IN ULONG CreateDisposition, + IN ULONG CreateOptions, + IN OUT PEAOP2 ExtendedFileAttr OPTIONAL, + OUT PUSHORT FileType, + OUT PUSHORT DeviceAttribute + ); + +APIRET +NonFileSetHandleStateRoutine( + IN PFILE_HANDLE hFileRecord, + IN ULONG OpenMode + ); + +APIRET +FileSetHandleStateRoutine( + IN PFILE_HANDLE hFileRecord, + IN ULONG OpenMode + ); + +APIRET +RemoteSetHandleStateRoutine( + IN PFILE_HANDLE hFileRecord, + IN ULONG OpenMode + ); + +APIRET +NoSuppSetHandleStateRoutine( + IN PFILE_HANDLE hFileRecord, + IN ULONG OpenMode + ); + +APIRET +FileQueryHTypeRoutine( + IN PFILE_HANDLE hFileRecord, + OUT PULONG HandleType, + OUT PULONG DeviceFlags + ); + +APIRET +DeviceQueryHTypeRoutine( + IN PFILE_HANDLE hFileRecord, + OUT PULONG HandleType, + OUT PULONG DeviceFlags + ); + +APIRET +RemoteQueryHTypeRoutine( + IN PFILE_HANDLE hFileRecord, + OUT PULONG HandleType, + OUT PULONG DeviceFlags + ); + +APIRET +NoSuppQueryHTypeRoutine( + IN PFILE_HANDLE hFileRecord, + OUT PULONG HandleType, + OUT PULONG DeviceFlags + ); + +APIRET +KbdCloseRoutine( + IN PFILE_HANDLE hFileRecord + ); + +APIRET +MouseCloseRoutine( + IN PFILE_HANDLE hFileRecord + ); + +APIRET +FileCloseRoutine( + IN PFILE_HANDLE hFileRecord + ); + +APIRET +DeviceCloseRoutine( + IN PFILE_HANDLE hFileRecord + ); + +APIRET +RemoteCloseRoutine( + IN PFILE_HANDLE hFileRecord + ); + +APIRET +NoSuppCloseRoutine( + IN PFILE_HANDLE hFileRecord + ); + +APIRET +ComCloseRoutine( + IN PFILE_HANDLE hFileRecord + ); + +APIRET +ComDupHandleRoutine( + IN PFILE_HANDLE hOldFileRecord, + IN PFILE_HANDLE hNewFileRecord + ); + +APIRET +KbdDupHandleRoutine( + IN PFILE_HANDLE hOldFileRecord, + IN PFILE_HANDLE hNewFileRecord + ); + +APIRET +MouseDupHandleRoutine( + IN PFILE_HANDLE hOldFileRecord, + IN PFILE_HANDLE hNewFileRecord + ); + +APIRET +FileDupHandleRoutine( + IN PFILE_HANDLE hOldFileRecord, + IN PFILE_HANDLE hNewFileRecord + ); + +APIRET +DeviceDupHandleRoutine( + IN PFILE_HANDLE hOldFileRecord, + IN PFILE_HANDLE hNewFileRecord + ); + +APIRET +RemoteDupHandleRoutine( + IN PFILE_HANDLE hOldFileRecord, + IN PFILE_HANDLE hNewFileRecord + ); + +APIRET +NoSuppDupHandleRoutine( + IN PFILE_HANDLE hOldFileRecord, + IN PFILE_HANDLE hNewFileRecord + ); + +APIRET +NulReadRoutine( + IN PFILE_HANDLE hFileRecord, + OUT PVOID Buffer, + IN ULONG Length, + OUT PULONG BytesRead + ); + +APIRET +ConReadRoutine( + IN PFILE_HANDLE hFileRecord, + OUT PVOID Buffer, + IN ULONG Length, + OUT PULONG BytesRead + ); + +APIRET +KbdReadRoutine( + IN PFILE_HANDLE hFileRecord, + OUT PVOID Buffer, + IN ULONG Length, + OUT PULONG BytesRead + ); + +APIRET +FileReadRoutine( + IN PFILE_HANDLE hFileRecord, + OUT PVOID Buffer, + IN ULONG Length, + OUT PULONG BytesRead + ); + +APIRET +RemoteReadRoutine( + IN PFILE_HANDLE hFileRecord, + OUT PVOID Buffer, + IN ULONG Length, + OUT PULONG BytesRead + ); + +APIRET +TmpReadRoutine( + IN PFILE_HANDLE hFileRecord, + OUT PVOID Buffer, + IN ULONG Length, + OUT PULONG BytesRead + ); + +APIRET +ComReadRoutine( + IN PFILE_HANDLE hFileRecord, + OUT PVOID Buffer, + IN ULONG Length, + OUT PULONG BytesRead + ); + +APIRET +NulWriteRoutine( + IN PFILE_HANDLE hFileRecord, + IN PVOID Buffer, + IN ULONG Length, + OUT PULONG BytesWritten + ); + +APIRET +ScreenWriteRoutine( + IN PFILE_HANDLE hFileRecord, + OUT PVOID Buffer, + IN ULONG Length, + OUT PULONG BytesWritten + ); + +APIRET +FileWriteRoutine( + IN PFILE_HANDLE hFileRecord, + IN PVOID Buffer, + IN ULONG Length, + OUT PULONG BytesWritten + ); + +APIRET +RemoteWriteRoutine( + IN PFILE_HANDLE hFileRecord, + OUT PVOID Buffer, + IN ULONG Length, + OUT PULONG BytesWritten + ); + +APIRET +TmpWriteRoutine( + IN PFILE_HANDLE hFileRecord, + IN PVOID Buffer, + IN ULONG Length, + OUT PULONG BytesWritten + ); + +APIRET +ComWriteRoutine( + IN PFILE_HANDLE hFileRecord, + IN PVOID Buffer, + IN ULONG Length, + OUT PULONG BytesWritten + ); + +// +// This function is called to open an object. +// + +typedef +APIRET +(*POS2OPEN_ROUTINE) ( + OUT PHANDLE FileHandle, + IN ULONG DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes, + IN PIO_STATUS_BLOCK IoStatus, + IN ULONG CreateSize, + OUT PULONG ActionTaken, + IN ULONG FileAttributes, + IN ULONG ShareAccess, + IN ULONG CreateDisposition, + IN ULONG CreateOptions, + IN OUT PEAOP2 ExtendedFileAttr OPTIONAL, + OUT PUSHORT FileType, + OUT PUSHORT DeviceAttribute + ); + +// +// This function is called to set the state of a handle (inherited, +// writethrough, etc) +// + +typedef +APIRET +(*POS2SET_HANDLE_STATE_ROUTINE) ( + IN PFILE_HANDLE hFileRecord, + IN ULONG OpenMode + ); + +// +// This function is called to query the type of a handle (device, file, etc) +// + +typedef +APIRET +(*POS2QUERY_HANDLE_TYPE_ROUTINE) ( + IN PFILE_HANDLE hFileRecord, + OUT PULONG HandleType, + OUT PULONG DeviceFlags + ); + +// +// This function is called to close a handle. it doesn't free the handle. +// + +typedef +APIRET +(*POS2CLOSE_ROUTINE) ( + IN PFILE_HANDLE hFileRecord + ); + +// +// This function is called to do a handle duplicate operation +// + +typedef +APIRET +(*POS2DUP_HANDLE_ROUTINE) ( + IN PFILE_HANDLE hOldFileRecord, + IN PFILE_HANDLE hNewFileRecord + ); + +// +// This function is called to do a read operation +// + +typedef +APIRET +(*POS2READ_ROUTINE) ( + IN PFILE_HANDLE hFileRecord, + OUT PVOID Buffer, + IN ULONG Length, + OUT PULONG BytesRead + ); + +// +// This function is called to do a write operation +// + +typedef +APIRET +(*POS2WRITE_ROUTINE) ( + IN PFILE_HANDLE hFileRecord, + IN PVOID Buffer, + IN ULONG Length, + OUT PULONG BytesWritten + ); + +typedef struct _OS2IO_VECTORS { + POS2OPEN_ROUTINE OpenRoutine; + POS2SET_HANDLE_STATE_ROUTINE SetHandleStateRoutine; + POS2QUERY_HANDLE_TYPE_ROUTINE QueryHandleTypeRoutine; + POS2CLOSE_ROUTINE CloseRoutine; + POS2DUP_HANDLE_ROUTINE DupHandleRoutine; + POS2READ_ROUTINE ReadRoutine; + POS2WRITE_ROUTINE WriteRoutine; +} OS2IO_VECTORS, *POS2IO_VECTORS; diff --git a/private/os2/inc/ldrdbg.h b/private/os2/inc/ldrdbg.h new file mode 100644 index 000000000..58f3765b6 --- /dev/null +++ b/private/os2/inc/ldrdbg.h @@ -0,0 +1,40 @@ +/*++ + +Copyright (c) 1989 Microsoft Corporation + +Module Name: + + ldrdbg.h + +Abstract: + + Debug constants + +Author: + + Beni Lavi (BeniL) 5-Nov-92 + +Revision History: + +--*/ + +#if DBG + +#define OL2_DEBUG_TRACE 0x00000001 +#define OL2_DEBUG_MEMORY 0x00000002 +#define OL2_DEBUG_MTE 0x00000004 +#define OL2_DEBUG_FIXUP 0x00000008 + +ULONG Ol2Debug; +#define IF_OL2_DEBUG( ComponentFlag ) \ + if (Ol2Debug & (OL2_DEBUG_ ## ComponentFlag)) + +#else + +#define IF_OL2_DEBUG( ComponentFlag ) if (FALSE) + +#endif + + + + diff --git a/private/os2/inc/ldrtabs.h b/private/os2/inc/ldrtabs.h new file mode 100644 index 000000000..2d5a972f0 --- /dev/null +++ b/private/os2/inc/ldrtabs.h @@ -0,0 +1,444 @@ +UCHAR acsenttab[]= +{ +0x1,0x1,0x3,0xb8,0x4,0x0,0x0 +}; +UCHAR acsrestab[]= +{ +0x7,0x41,0x43,0x53,0x4e,0x45,0x54,0x42,0x0,0x0,0x7,0x4e,0x45,0x54,0x42,0x49, +0x4f,0x53,0x1,0x0,0x0 +}; +UCHAR acsnrestab[]= +{ +0xb,0x61,0x63,0x73,0x6e,0x65,0x74,0x62,0x2e,0x64,0x6c,0x6c,0x0,0x0,0x0 +}; +UCHAR kbdenttab[]= +{ +0x1,0x1,0x3,0xd0,0x3,0x1,0x0,0x3,0x1,0x3,0xc8,0x3,0x3,0xa8,0x3,0x3,0xcc,0x3, +0x1,0x0,0x8,0x1,0x3,0xe0,0x3,0x3,0xc4,0x3,0x3,0xac,0x3,0x3,0x9c,0x3,0x3, +0xa0,0x3,0x3,0xb0,0x3,0x3,0x98,0x3,0x3,0xd4,0x3,0x1,0x0,0x3,0x1,0x3,0xe4, +0x3,0x3,0xb8,0x3,0x3,0xb4,0x3,0x1,0x0,0x5,0x1,0x3,0xc0,0x3,0x3,0xdc,0x3, +0x3,0xa4,0x3,0x3,0xbc,0x3,0x3,0xd8,0x3,0x0,0x0 +}; +UCHAR kbdrestab[]= +{ +0x8,0x4b,0x42,0x44,0x43,0x41,0x4c,0x4c,0x53,0x0,0x0,0xc,0x4b,0x42,0x44,0x53, +0x45,0x54,0x43,0x55,0x53,0x54,0x58,0x54,0x1,0x0,0x8,0x4b,0x42,0x44,0x47, +0x45,0x54,0x43,0x50,0x3,0x0,0x9,0x4b,0x42,0x44,0x43,0x48,0x41,0x52,0x49, +0x4e,0x4,0x0,0x8,0x4b,0x42,0x44,0x53,0x45,0x54,0x43,0x50,0x5,0x0,0x8, +0x4b,0x42,0x44,0x53,0x59,0x4e,0x43,0x48,0x7,0x0,0xb,0x4b,0x42,0x44,0x52, +0x45,0x47,0x49,0x53,0x54,0x45,0x52,0x8,0x0,0xc,0x4b,0x42,0x44,0x47,0x45, +0x54,0x53,0x54,0x41,0x54,0x55,0x53,0xa,0x0,0xb,0x4b,0x42,0x44,0x53,0x54, +0x52,0x49,0x4e,0x47,0x49,0x4e,0x9,0x0,0xc,0x4b,0x42,0x44,0x53,0x45,0x54, +0x53,0x54,0x41,0x54,0x55,0x53,0xb,0x0,0xb,0x4b,0x42,0x44,0x47,0x45,0x54, +0x46,0x4f,0x43,0x55,0x53,0xc,0x0,0xe,0x4b,0x42,0x44,0x46,0x4c,0x55,0x53, +0x48,0x42,0x55,0x46,0x46,0x45,0x52,0xd,0x0,0x8,0x4b,0x42,0x44,0x58,0x4c, +0x41,0x54,0x45,0xe,0x0,0xc,0x4b,0x42,0x44,0x53,0x48,0x45,0x4c,0x4c,0x49, +0x4e,0x49,0x54,0x10,0x0,0x8,0x4b,0x42,0x44,0x43,0x4c,0x4f,0x53,0x45,0x11, +0x0,0xc,0x4b,0x42,0x44,0x46,0x52,0x45,0x45,0x46,0x4f,0x43,0x55,0x53,0x12, +0x0,0xd,0x4b,0x42,0x44,0x44,0x45,0x52,0x45,0x47,0x49,0x53,0x54,0x45,0x52, +0x14,0x0,0xa,0x4b,0x42,0x44,0x53,0x45,0x54,0x46,0x47,0x4e,0x44,0x15,0x0, +0xa,0x4b,0x42,0x44,0x47,0x45,0x54,0x48,0x57,0x49,0x44,0x18,0x0,0x7,0x4b, +0x42,0x44,0x50,0x45,0x45,0x4b,0x16,0x0,0x7,0x4b,0x42,0x44,0x4f,0x50,0x45, +0x4e,0x17,0x0,0x0 +}; +UCHAR kbdnrestab[]= +{ +0xc,0x6b,0x62,0x64,0x63,0x61,0x6c,0x6c,0x73,0x2e,0x64,0x6c,0x6c,0x0,0x0,0x0 + +}; +UCHAR maienttab[]= +{ +0x6,0x1,0x3,0xd0,0x4,0x3,0xd4,0x4,0x3,0xd8,0x4,0x3,0xe0,0x4,0x3,0xdc,0x4,0x3, +0xe4,0x4,0x0,0x0 +}; +UCHAR mairestab[]= +{ +0x8,0x4d,0x41,0x49,0x4c,0x53,0x4c,0x4f,0x54,0x0,0x0,0xf,0x44,0x4f,0x53,0x4d, +0x41,0x4b,0x45,0x4d,0x41,0x49,0x4c,0x53,0x4c,0x4f,0x54,0x1,0x0,0xf,0x44, +0x4f,0x53,0x50,0x45,0x45,0x4b,0x4d,0x41,0x49,0x4c,0x53,0x4c,0x4f,0x54,0x5, +0x0,0xf,0x44,0x4f,0x53,0x4d,0x41,0x49,0x4c,0x53,0x4c,0x4f,0x54,0x49,0x4e, +0x46,0x4f,0x3,0x0,0x10,0x44,0x4f,0x53,0x57,0x52,0x49,0x54,0x45,0x4d,0x41, +0x49,0x4c,0x53,0x4c,0x4f,0x54,0x6,0x0,0xf,0x44,0x4f,0x53,0x52,0x45,0x41, +0x44,0x4d,0x41,0x49,0x4c,0x53,0x4c,0x4f,0x54,0x4,0x0,0x11,0x44,0x4f,0x53, +0x44,0x45,0x4c,0x45,0x54,0x45,0x4d,0x41,0x49,0x4c,0x53,0x4c,0x4f,0x54,0x2, +0x0,0x0 +}; +UCHAR mainrestab[]= +{ +0xc,0x6d,0x61,0x69,0x6c,0x73,0x6c,0x6f,0x74,0x2e,0x64,0x6c,0x6c,0x0,0x0,0x0 + +}; +UCHAR monenttab[]= +{ +0x5,0x1,0x3,0x50,0x4,0x3,0x48,0x4,0x3,0x44,0x4,0x3,0x40,0x4,0x3,0x4c,0x4,0x0, +0x0 +}; +UCHAR monrestab[]= +{ +0x8,0x4d,0x4f,0x4e,0x43,0x41,0x4c,0x4c,0x53,0x0,0x0,0xb,0x44,0x4f,0x53,0x4d, +0x4f,0x4e,0x57,0x52,0x49,0x54,0x45,0x1,0x0,0xa,0x44,0x4f,0x53,0x4d,0x4f, +0x4e,0x52,0x45,0x41,0x44,0x2,0x0,0xb,0x44,0x4f,0x53,0x4d,0x4f,0x4e,0x43, +0x4c,0x4f,0x53,0x45,0x3,0x0,0xa,0x44,0x4f,0x53,0x4d,0x4f,0x4e,0x4f,0x50, +0x45,0x4e,0x4,0x0,0x9,0x44,0x4f,0x53,0x4d,0x4f,0x4e,0x52,0x45,0x47,0x5, +0x0,0x0 +}; +UCHAR monnrestab[]= +{ +0xc,0x6d,0x6f,0x6e,0x63,0x61,0x6c,0x6c,0x73,0x2e,0x64,0x6c,0x6c,0x0,0x0,0x0 + +}; +UCHAR mouenttab[]= +{ +0x3,0x1,0x3,0x10,0x4,0x3,0x34,0x4,0x3,0x4,0x4,0x2,0x0,0x4,0x1,0x3,0x14,0x4, +0x3,0xf4,0x3,0x3,0x0,0x4,0x3,0xe8,0x3,0x1,0x0,0x1,0x1,0x3,0x38,0x4,0x1, +0x0,0xe,0x1,0x3,0x8,0x4,0x3,0xec,0x3,0x3,0xfc,0x3,0x3,0x2c,0x4,0x3,0x18, +0x4,0x3,0x24,0x4,0x3,0xc,0x4,0x3,0x1c,0x4,0x3,0x30,0x4,0x3,0xf8,0x3,0x3, +0x3c,0x4,0x3,0x20,0x4,0x3,0x28,0x4,0x3,0xf0,0x3,0x0,0x0 +}; +UCHAR mourestab[]= +{ +0x8,0x4d,0x4f,0x55,0x43,0x41,0x4c,0x4c,0x53,0x0,0x0,0xe,0x4d,0x4f,0x55,0x47, +0x45,0x54,0x50,0x54,0x52,0x53,0x48,0x41,0x50,0x45,0x1,0x0,0x10,0x4d,0x4f, +0x55,0x47,0x45,0x54,0x4e,0x55,0x4d,0x4d,0x49,0x43,0x4b,0x45,0x59,0x53,0x3, +0x0,0xe,0x4d,0x4f,0x55,0x53,0x45,0x54,0x50,0x54,0x52,0x53,0x48,0x41,0x50, +0x45,0x2,0x0,0xf,0x4d,0x4f,0x55,0x47,0x45,0x54,0x53,0x43,0x41,0x4c,0x45, +0x46,0x41,0x43,0x54,0x6,0x0,0x10,0x4d,0x4f,0x55,0x47,0x45,0x54,0x4e,0x55, +0x4d,0x42,0x55,0x54,0x54,0x4f,0x4e,0x53,0x8,0x0,0xb,0x4d,0x4f,0x55,0x46, +0x4c,0x55,0x53,0x48,0x51,0x55,0x45,0x7,0x0,0x8,0x4d,0x4f,0x55,0x43,0x4c, +0x4f,0x53,0x45,0x9,0x0,0xf,0x4d,0x4f,0x55,0x53,0x45,0x54,0x53,0x43,0x41, +0x4c,0x45,0x46,0x41,0x43,0x54,0xb,0x0,0xd,0x4d,0x4f,0x55,0x44,0x45,0x52, +0x45,0x47,0x49,0x53,0x54,0x45,0x52,0xe,0x0,0xe,0x4d,0x4f,0x55,0x47,0x45, +0x54,0x4e,0x55,0x4d,0x51,0x55,0x45,0x45,0x4c,0xd,0x0,0xf,0x4d,0x4f,0x55, +0x47,0x45,0x54,0x45,0x56,0x45,0x4e,0x54,0x4d,0x41,0x53,0x4b,0xf,0x0,0xf, +0x4d,0x4f,0x55,0x53,0x45,0x54,0x45,0x56,0x45,0x4e,0x54,0x4d,0x41,0x53,0x4b, +0x10,0x0,0x7,0x4d,0x4f,0x55,0x4f,0x50,0x45,0x4e,0x11,0x0,0xc,0x4d,0x4f, +0x55,0x52,0x45,0x4d,0x4f,0x56,0x45,0x50,0x54,0x52,0x12,0x0,0xc,0x4d,0x4f, +0x55,0x47,0x45,0x54,0x50,0x54,0x52,0x50,0x4f,0x53,0x13,0x0,0xf,0x4d,0x4f, +0x55,0x52,0x45,0x41,0x44,0x45,0x56,0x45,0x4e,0x54,0x51,0x55,0x45,0x14,0x0, +0xc,0x4d,0x4f,0x55,0x53,0x45,0x54,0x50,0x54,0x52,0x50,0x4f,0x53,0x15,0x0, +0xf,0x4d,0x4f,0x55,0x47,0x45,0x54,0x44,0x45,0x56,0x53,0x54,0x41,0x54,0x55, +0x53,0x16,0x0,0x8,0x4d,0x4f,0x55,0x53,0x59,0x4e,0x43,0x48,0x17,0x0,0xb, +0x4d,0x4f,0x55,0x52,0x45,0x47,0x49,0x53,0x54,0x45,0x52,0x18,0x0,0xa,0x4d, +0x4f,0x55,0x44,0x52,0x41,0x57,0x50,0x54,0x52,0x1a,0x0,0xf,0x4d,0x4f,0x55, +0x53,0x45,0x54,0x44,0x45,0x56,0x53,0x54,0x41,0x54,0x55,0x53,0x19,0x0,0x0 + +}; +UCHAR mounrestab[]= +{ +0xc,0x6d,0x6f,0x75,0x63,0x61,0x6c,0x6c,0x73,0x2e,0x64,0x6c,0x6c,0x0,0x0,0x0 + +}; +UCHAR msgenttab[]= +{ +0x3,0x1,0x3,0x5c,0x2,0x3,0x4c,0x2,0x3,0x58,0x2,0x0,0x0 +}; +UCHAR msgrestab[]= +{ +0x3,0x4d,0x53,0x47,0x0,0x0,0xd,0x44,0x4f,0x53,0x50,0x55,0x54,0x4d,0x45,0x53, +0x53,0x41,0x47,0x45,0x1,0x0,0x11,0x44,0x4f,0x53,0x54,0x52,0x55,0x45,0x47, +0x45,0x54,0x4d,0x45,0x53,0x53,0x41,0x47,0x45,0x2,0x0,0xd,0x44,0x4f,0x53, +0x49,0x4e,0x53,0x4d,0x45,0x53,0x53,0x41,0x47,0x45,0x3,0x0,0x0 +}; +UCHAR msgnrestab[]= +{ +0x7,0x6d,0x73,0x67,0x2e,0x64,0x6c,0x6c,0x0,0x0,0x0 +}; +UCHAR namenttab[]= +{ +0xa,0x1,0x3,0x98,0x0,0x3,0xa4,0x0,0x3,0x90,0x0,0x3,0x94,0x0,0x3,0xa0,0x0,0x3, +0xac,0x0,0x3,0x9c,0x0,0x3,0xb8,0x0,0x3,0xb4,0x0,0x3,0x8c,0x0,0x2,0x0,0x2, +0x1,0x3,0xb0,0x0,0x3,0xa8,0x0,0x0,0x0 +}; +UCHAR namrestab[]= +{ +0x8,0x4e,0x41,0x4d,0x50,0x49,0x50,0x45,0x53,0x0,0x0,0x13,0x44,0x4f,0x53,0x44, +0x49,0x53,0x43,0x4f,0x4e,0x4e,0x45,0x43,0x54,0x4e,0x4d,0x50,0x49,0x50,0x45, +0x4,0x0,0x12,0x44,0x4f,0x53,0x53,0x45,0x54,0x4e,0x4d,0x50,0x48,0x41,0x4e, +0x44,0x53,0x54,0x41,0x54,0x45,0x6,0x0,0xd,0x44,0x4f,0x53,0x57,0x41,0x49, +0x54,0x4e,0x4d,0x50,0x49,0x50,0x45,0x8,0x0,0xf,0x44,0x4f,0x53,0x53,0x45, +0x54,0x4e,0x4d,0x50,0x49,0x50,0x45,0x53,0x45,0x4d,0xd,0x0,0x11,0x44,0x4f, +0x53,0x54,0x52,0x41,0x4e,0x53,0x41,0x43,0x54,0x4e,0x4d,0x50,0x49,0x50,0x45, +0x9,0x0,0x10,0x44,0x4f,0x53,0x51,0x4e,0x4d,0x50,0x48,0x41,0x4e,0x44,0x53, +0x54,0x41,0x54,0x45,0x5,0x0,0x12,0x44,0x4f,0x53,0x51,0x4e,0x4d,0x50,0x49, +0x50,0x45,0x53,0x45,0x4d,0x53,0x54,0x41,0x54,0x45,0xe,0x0,0xd,0x44,0x4f, +0x53,0x4d,0x41,0x4b,0x45,0x4e,0x4d,0x50,0x49,0x50,0x45,0x1,0x0,0xe,0x44, +0x4f,0x53,0x51,0x4e,0x4d,0x50,0x49,0x50,0x45,0x49,0x4e,0x46,0x4f,0x2,0x0, +0x10,0x44,0x4f,0x53,0x43,0x4f,0x4e,0x4e,0x45,0x43,0x54,0x4e,0x4d,0x50,0x49, +0x50,0x45,0x3,0x0,0xd,0x44,0x4f,0x53,0x50,0x45,0x45,0x4b,0x4e,0x4d,0x50, +0x49,0x50,0x45,0x7,0x0,0xd,0x44,0x4f,0x53,0x43,0x41,0x4c,0x4c,0x4e,0x4d, +0x50,0x49,0x50,0x45,0xa,0x0,0x0 +}; +UCHAR namnrestab[]= +{ +0xc,0x6e,0x61,0x6d,0x70,0x69,0x70,0x65,0x73,0x2e,0x64,0x6c,0x6c,0x0,0x0,0x0 + +}; +UCHAR apienttab[]= +{ +0x2,0x1,0x3,0x98,0x4,0x3,0xa4,0x4,0x1,0x0,0x2,0x1,0x3,0xa0,0x4,0x3,0x9c,0x4, +0x7,0x0,0x5,0x1,0x3,0xbc,0x4,0x3,0xc0,0x4,0x3,0xc4,0x4,0x3,0xc8,0x4,0x3, +0xcc,0x4,0x24,0x0,0x2,0x1,0x3,0x5c,0x4,0x3,0x64,0x4,0x1,0x0,0x3,0x1,0x3, +0x68,0x4,0x3,0x6c,0x4,0x3,0x74,0x4,0x4,0x0,0x1,0x1,0x3,0xa8,0x4,0x1,0x0, +0x3,0x1,0x3,0xac,0x4,0x3,0x78,0x4,0x3,0x7c,0x4,0x4,0x0,0x4,0x1,0x3,0x80, +0x4,0x3,0x84,0x4,0x3,0x88,0x4,0x3,0x8c,0x4,0x2,0x0,0x1,0x1,0x3,0x90,0x4, +0x1,0x0,0x1,0x1,0x3,0xb0,0x4,0x2,0x0,0x1,0x1,0x3,0x94,0x4,0x1f,0x0,0x1, +0x1,0x3,0x70,0x4,0x39,0x0,0x1,0x1,0x3,0x58,0x4,0xe,0x0,0x1,0x1,0x3,0x54, +0x4,0xff,0x0,0x38,0x0,0x4,0x1,0x3,0xd4,0x4,0x3,0xd8,0x4,0x3,0xd0,0x4,0x3, +0xdc,0x4,0x12,0x0,0x3,0x1,0x3,0xe0,0x4,0x3,0xe4,0x4,0x3,0xb4,0x4,0x2,0x0, +0x1,0x1,0x3,0x60,0x4,0x1,0x0,0xa,0x1,0x3,0x98,0x0,0x3,0x90,0x0,0x3,0x94, +0x0,0x3,0xac,0x0,0x3,0xb8,0x0,0x3,0xb4,0x0,0x3,0xa0,0x0,0x3,0xa4,0x0,0x3, +0x9c,0x0,0x3,0x8c,0x0,0x60,0x0,0x1,0x1,0x3,0xec,0x4,0x0,0x0 +}; +UCHAR apirestab[]= +{ +0x7,0x49,0x4e,0x45,0x54,0x41,0x50,0x49,0x0,0x0,0xf,0x44,0x4f,0x53,0x4d,0x41, +0x4b,0x45,0x4d,0x41,0x49,0x4c,0x53,0x4c,0x4f,0x54,0xf7,0x1,0x13,0x44,0x4f, +0x53,0x44,0x49,0x53,0x43,0x4f,0x4e,0x4e,0x45,0x43,0x54,0x4e,0x4d,0x50,0x49, +0x50,0x45,0x14,0x2,0xb,0x4e,0x45,0x54,0x55,0x53,0x45,0x52,0x45,0x4e,0x55, +0x4d,0x4f,0x0,0x12,0x44,0x4f,0x53,0x53,0x45,0x54,0x4e,0x4d,0x50,0x48,0x41, +0x4e,0x44,0x53,0x54,0x41,0x54,0x45,0x15,0x2,0xb,0x4e,0x45,0x54,0x42,0x49, +0x4f,0x53,0x45,0x4e,0x55,0x4d,0xe,0x0,0xf,0x44,0x4f,0x53,0x50,0x45,0x45, +0x4b,0x4d,0x41,0x49,0x4c,0x53,0x4c,0x4f,0x54,0xf8,0x1,0xd,0x44,0x4f,0x53, +0x57,0x41,0x49,0x54,0x4e,0x4d,0x50,0x49,0x50,0x45,0x16,0x2,0xf,0x4e,0x45, +0x54,0x53,0x48,0x41,0x52,0x45,0x47,0x45,0x54,0x49,0x4e,0x46,0x4f,0x44,0x0, +0xe,0x4e,0x45,0x54,0x53,0x45,0x52,0x56,0x45,0x52,0x45,0x4e,0x55,0x4d,0x32, +0x10,0x2,0x9,0x4e,0x45,0x54,0x55,0x53,0x45,0x41,0x44,0x44,0x49,0x0,0xa, +0x4e,0x45,0x54,0x55,0x53,0x45,0x45,0x4e,0x55,0x4d,0x4b,0x0,0xd,0x4e,0x45, +0x54,0x42,0x49,0x4f,0x53,0x53,0x55,0x42,0x4d,0x49,0x54,0x11,0x0,0xb,0x4e, +0x45,0x54,0x53,0x48,0x41,0x52,0x45,0x41,0x44,0x44,0x40,0x0,0x11,0x4e,0x45, +0x54,0x53,0x45,0x52,0x56,0x49,0x43,0x45,0x49,0x4e,0x53,0x54,0x41,0x4c,0x4c, +0x3b,0x0,0x14,0x4e,0x45,0x54,0x4d,0x45,0x53,0x53,0x41,0x47,0x45,0x42,0x55, +0x46,0x46,0x45,0x52,0x53,0x45,0x4e,0x44,0xd,0x2,0xc,0x4e,0x45,0x54,0x41, +0x43,0x43,0x45,0x53,0x53,0x41,0x44,0x44,0x1,0x0,0xf,0x44,0x4f,0x53,0x4d, +0x41,0x49,0x4c,0x53,0x4c,0x4f,0x54,0x49,0x4e,0x46,0x4f,0xf6,0x1,0x11,0x44, +0x4f,0x53,0x54,0x52,0x41,0x4e,0x53,0x41,0x43,0x54,0x4e,0x4d,0x50,0x49,0x50, +0x45,0x17,0x2,0x9,0x4e,0x45,0x54,0x55,0x53,0x45,0x44,0x45,0x4c,0x4a,0x0, +0xc,0x4e,0x45,0x54,0x53,0x48,0x41,0x52,0x45,0x45,0x4e,0x55,0x4d,0x43,0x0, +0xc,0x4e,0x45,0x54,0x41,0x43,0x43,0x45,0x53,0x53,0x44,0x45,0x4c,0x2,0x0, +0x11,0x4e,0x45,0x54,0x53,0x45,0x52,0x56,0x49,0x43,0x45,0x47,0x45,0x54,0x49, +0x4e,0x46,0x4f,0x74,0x0,0x10,0x4e,0x45,0x54,0x53,0x45,0x52,0x56,0x45,0x52, +0x47,0x45,0x54,0x49,0x4e,0x46,0x4f,0x37,0x0,0xf,0x4e,0x45,0x54,0x57,0x4b, +0x53,0x54,0x41,0x47,0x45,0x54,0x49,0x4e,0x46,0x4f,0x54,0x0,0x10,0x44,0x4f, +0x53,0x51,0x4e,0x4d,0x50,0x48,0x41,0x4e,0x44,0x53,0x54,0x41,0x54,0x45,0x18, +0x2,0xb,0x4e,0x45,0x54,0x53,0x48,0x41,0x52,0x45,0x44,0x45,0x4c,0x42,0x0, +0x11,0x4e,0x45,0x54,0x53,0x45,0x52,0x56,0x45,0x52,0x44,0x49,0x53,0x4b,0x45, +0x4e,0x55,0x4d,0x36,0x0,0xc,0x4e,0x45,0x54,0x42,0x49,0x4f,0x53,0x43,0x4c, +0x4f,0x53,0x45,0xd,0x0,0x11,0x4e,0x45,0x54,0x53,0x45,0x52,0x56,0x49,0x43, +0x45,0x43,0x4f,0x4e,0x54,0x52,0x4f,0x4c,0x39,0x0,0x14,0x4e,0x45,0x54,0x49, +0x57,0x4b,0x53,0x54,0x41,0x47,0x45,0x54,0x55,0x53,0x45,0x52,0x49,0x4e,0x46, +0x4f,0x7c,0x2,0x10,0x4e,0x45,0x54,0x41,0x43,0x43,0x45,0x53,0x53,0x47,0x45, +0x54,0x49,0x4e,0x46,0x4f,0x4,0x0,0xd,0x44,0x4f,0x53,0x4d,0x41,0x4b,0x45, +0x4e,0x4d,0x50,0x49,0x50,0x45,0x12,0x2,0x10,0x4e,0x45,0x54,0x48,0x41,0x4e, +0x44,0x4c,0x45,0x47,0x45,0x54,0x49,0x4e,0x46,0x4f,0xae,0x0,0x10,0x44,0x4f, +0x53,0x57,0x52,0x49,0x54,0x45,0x4d,0x41,0x49,0x4c,0x53,0x4c,0x4f,0x54,0xc, +0x2,0xe,0x44,0x4f,0x53,0x51,0x4e,0x4d,0x50,0x49,0x50,0x45,0x49,0x4e,0x46, +0x4f,0x19,0x2,0xe,0x4e,0x45,0x54,0x53,0x45,0x52,0x56,0x49,0x43,0x45,0x45, +0x4e,0x55,0x4d,0x3a,0x0,0xc,0x4e,0x45,0x54,0x47,0x45,0x54,0x44,0x43,0x4e, +0x41,0x4d,0x45,0xbd,0x0,0x10,0x44,0x4f,0x53,0x43,0x4f,0x4e,0x4e,0x45,0x43, +0x54,0x4e,0x4d,0x50,0x49,0x50,0x45,0x13,0x2,0xd,0x44,0x4f,0x53,0x50,0x45, +0x45,0x4b,0x4e,0x4d,0x50,0x49,0x50,0x45,0x1a,0x2,0xe,0x4e,0x45,0x54,0x55, +0x53,0x45,0x52,0x47,0x45,0x54,0x49,0x4e,0x46,0x4f,0x51,0x0,0xf,0x44,0x4f, +0x53,0x52,0x45,0x41,0x44,0x4d,0x41,0x49,0x4c,0x53,0x4c,0x4f,0x54,0xb,0x2, +0xe,0x4e,0x45,0x54,0x42,0x49,0x4f,0x53,0x47,0x45,0x54,0x49,0x4e,0x46,0x4f, +0xf,0x0,0x10,0x4e,0x45,0x54,0x41,0x43,0x43,0x45,0x53,0x53,0x53,0x45,0x54, +0x49,0x4e,0x46,0x4f,0x5,0x0,0xd,0x44,0x4f,0x53,0x43,0x41,0x4c,0x4c,0x4e, +0x4d,0x50,0x49,0x50,0x45,0x1b,0x2,0xd,0x4e,0x45,0x54,0x55,0x53,0x45,0x47, +0x45,0x54,0x49,0x4e,0x46,0x4f,0x4c,0x0,0x11,0x44,0x4f,0x53,0x44,0x45,0x4c, +0x45,0x54,0x45,0x4d,0x41,0x49,0x4c,0x53,0x4c,0x4f,0x54,0xf5,0x1,0xb,0x4e, +0x45,0x54,0x42,0x49,0x4f,0x53,0x4f,0x50,0x45,0x4e,0x10,0x0,0x0 +}; +UCHAR apinrestab[]= +{ +0xb,0x69,0x6e,0x65,0x74,0x61,0x70,0x69,0x2e,0x64,0x6c,0x6c,0x0,0x0,0x0 +}; +UCHAR oementtab[]= +{ +0x4,0x0,0x1,0x1,0x3,0xb4,0x4,0x5,0x0,0x1,0x1,0x3,0x60,0x4,0x0,0x0 +}; +UCHAR oemrestab[]= +{ +0x6,0x4e,0x45,0x54,0x4f,0x45,0x4d,0x0,0x0,0xe,0x4e,0x45,0x54,0x53,0x45,0x52, +0x56,0x45,0x52,0x45,0x4e,0x55,0x4d,0x32,0xb,0x0,0x14,0x4e,0x45,0x54,0x4d, +0x45,0x53,0x53,0x41,0x47,0x45,0x42,0x55,0x46,0x46,0x45,0x52,0x53,0x45,0x4e, +0x44,0x5,0x0,0x0 +}; +UCHAR oemnrestab[]= +{ +0xa,0x6e,0x65,0x74,0x6f,0x65,0x6d,0x2e,0x64,0x6c,0x6c,0x0,0x0,0x0 +}; +UCHAR nlsenttab[]= +{ +0x4,0x1,0x3,0x34,0x0,0x3,0x38,0x0,0x3,0x2c,0x0,0x3,0x30,0x0,0x0,0x0 +}; +UCHAR nlsrestab[]= +{ +0x3,0x4e,0x4c,0x53,0x0,0x0,0xa,0x44,0x4f,0x53,0x43,0x41,0x53,0x45,0x4d,0x41, +0x50,0x1,0x0,0xd,0x44,0x4f,0x53,0x47,0x45,0x54,0x43,0x4f,0x4c,0x4c,0x41, +0x54,0x45,0x2,0x0,0xe,0x44,0x4f,0x53,0x47,0x45,0x54,0x43,0x54,0x52,0x59, +0x49,0x4e,0x46,0x4f,0x3,0x0,0xc,0x44,0x4f,0x53,0x47,0x45,0x54,0x44,0x42, +0x43,0x53,0x45,0x56,0x4,0x0,0x0 +}; +UCHAR nlsnrestab[]= +{ +0x7,0x6e,0x6c,0x73,0x2e,0x64,0x6c,0x6c,0x0,0x0,0x0 +}; +UCHAR pmsenttab[]= +{ +0x1,0x0,0x6,0x1,0x3,0xcc,0x2,0x3,0xc0,0x2,0x3,0xd4,0x2,0x3,0xc4,0x2,0x3,0xc8, +0x2,0x3,0xd0,0x2,0x0,0x0 +}; +UCHAR pmsrestab[]= +{ +0x7,0x50,0x4d,0x53,0x48,0x41,0x50,0x49,0x0,0x0,0x13,0x57,0x49,0x4e,0x51,0x55, +0x45,0x52,0x59,0x50,0x52,0x4f,0x46,0x49,0x4c,0x45,0x44,0x41,0x54,0x41,0x6, +0x0,0x13,0x57,0x49,0x4e,0x57,0x52,0x49,0x54,0x45,0x50,0x52,0x4f,0x46,0x49, +0x4c,0x45,0x44,0x41,0x54,0x41,0x7,0x0,0x12,0x57,0x49,0x4e,0x51,0x55,0x45, +0x52,0x59,0x50,0x52,0x4f,0x46,0x49,0x4c,0x45,0x49,0x4e,0x54,0x2,0x0,0x13, +0x57,0x49,0x4e,0x51,0x55,0x45,0x52,0x59,0x50,0x52,0x4f,0x46,0x49,0x4c,0x45, +0x53,0x49,0x5a,0x45,0x5,0x0,0x15,0x57,0x49,0x4e,0x51,0x55,0x45,0x52,0x59, +0x50,0x52,0x4f,0x46,0x49,0x4c,0x45,0x53,0x54,0x52,0x49,0x4e,0x47,0x3,0x0, +0x15,0x57,0x49,0x4e,0x57,0x52,0x49,0x54,0x45,0x50,0x52,0x4f,0x46,0x49,0x4c, +0x45,0x53,0x54,0x52,0x49,0x4e,0x47,0x4,0x0,0x0 +}; +UCHAR pmsnrestab[]= +{ +0xb,0x70,0x6d,0x73,0x68,0x61,0x70,0x69,0x2e,0x64,0x6c,0x6c,0x0,0x0,0x0 +}; +UCHAR pmwenttab[]= +{ +0xe0,0x0,0x2,0x1,0x3,0xd8,0x2,0x3,0xdc,0x2,0x1,0x0,0x1,0x1,0x3,0xe0,0x2,0x1, +0x0,0x1,0x1,0x3,0xe4,0x2,0xc,0x0,0x1,0x1,0x3,0xe8,0x2,0x0,0x0 +}; +UCHAR pmwrestab[]= +{ +0x5,0x50,0x4d,0x57,0x49,0x4e,0x0,0x0,0xe,0x57,0x49,0x4e,0x44,0x45,0x53,0x54, +0x52,0x4f,0x59,0x48,0x45,0x41,0x50,0xe2,0x0,0xd,0x57,0x49,0x4e,0x43,0x52, +0x45,0x41,0x54,0x45,0x48,0x45,0x41,0x50,0xe1,0x0,0xf,0x57,0x49,0x4e,0x47, +0x45,0x54,0x4c,0x41,0x53,0x54,0x45,0x52,0x52,0x4f,0x52,0xf3,0x0,0xb,0x57, +0x49,0x4e,0x41,0x4c,0x4c,0x4f,0x43,0x4d,0x45,0x4d,0xe4,0x0,0xa,0x57,0x49, +0x4e,0x46,0x52,0x45,0x45,0x4d,0x45,0x4d,0xe6,0x0,0x0 +}; +UCHAR pmwnrestab[]= +{ +0x9,0x70,0x6d,0x77,0x69,0x6e,0x2e,0x64,0x6c,0x6c,0x0,0x0,0x0 +}; +UCHAR os2enttab[]= +{ +0x2e,0x0,0x1,0x1,0x3,0x84,0x2,0x0,0x0 +}; +UCHAR os2restab[]= +{ +0x5,0x4f,0x53,0x32,0x53,0x4d,0x0,0x0,0x12,0x57,0x49,0x4e,0x53,0x45,0x54,0x54, +0x49,0x54,0x4c,0x45,0x41,0x4e,0x44,0x49,0x43,0x4f,0x4e,0x2f,0x0,0x0 +}; +UCHAR os2nrestab[]= +{ +0x9,0x6f,0x73,0x32,0x73,0x6d,0x2e,0x64,0x6c,0x6c,0x0,0x0,0x0 +}; +UCHAR sesenttab[]= +{ +0x4,0x0,0x1,0x1,0x3,0x7c,0x2,0x2,0x0,0x2,0x1,0x3,0x70,0x2,0x3,0x78,0x2,0x4, +0x0,0x1,0x1,0x3,0x74,0x2,0x2,0x0,0x1,0x1,0x3,0x6c,0x2,0xa,0x0,0x1,0x1, +0x3,0x80,0x2,0x0,0x0 +}; +UCHAR sesrestab[]= +{ +0x6,0x53,0x45,0x53,0x4d,0x47,0x52,0x0,0x0,0xe,0x44,0x4f,0x53,0x53,0x4d,0x50, +0x4d,0x50,0x52,0x45,0x53,0x45,0x4e,0x54,0x1c,0x0,0xd,0x44,0x4f,0x53,0x53, +0x4d,0x53,0x45,0x54,0x54,0x49,0x54,0x4c,0x45,0x5,0x0,0xe,0x44,0x4f,0x53, +0x53,0x54,0x4f,0x50,0x53,0x45,0x53,0x53,0x49,0x4f,0x4e,0x8,0x0,0x10,0x44, +0x4f,0x53,0x53,0x45,0x4c,0x45,0x43,0x54,0x53,0x45,0x53,0x53,0x49,0x4f,0x4e, +0x9,0x0,0xd,0x44,0x4f,0x53,0x53,0x45,0x54,0x53,0x45,0x53,0x53,0x49,0x4f, +0x4e,0xe,0x0,0xf,0x44,0x4f,0x53,0x53,0x54,0x41,0x52,0x54,0x53,0x45,0x53, +0x53,0x49,0x4f,0x4e,0x11,0x0,0x0 +}; +UCHAR sesnrestab[]= +{ +0xa,0x73,0x65,0x73,0x6d,0x67,0x72,0x2e,0x64,0x6c,0x6c,0x0,0x0,0x0 +}; +UCHAR queenttab[]= +{ +0x8,0x1,0x3,0x7c,0x0,0x3,0x80,0x0,0x3,0x74,0x0,0x3,0x84,0x0,0x3,0x78,0x0,0x3, +0x88,0x0,0x3,0x70,0x0,0x3,0x6c,0x0,0x0,0x0 +}; +UCHAR querestab[]= +{ +0x8,0x51,0x55,0x45,0x43,0x41,0x4c,0x4c,0x53,0x0,0x0,0xc,0x44,0x4f,0x53,0x52, +0x45,0x41,0x44,0x51,0x55,0x45,0x55,0x45,0x1,0x0,0xd,0x44,0x4f,0x53,0x50, +0x55,0x52,0x47,0x45,0x51,0x55,0x45,0x55,0x45,0x2,0x0,0xd,0x44,0x4f,0x53, +0x43,0x4c,0x4f,0x53,0x45,0x51,0x55,0x45,0x55,0x45,0x3,0x0,0xd,0x44,0x4f, +0x53,0x51,0x55,0x45,0x52,0x59,0x51,0x55,0x45,0x55,0x45,0x4,0x0,0xd,0x44, +0x4f,0x53,0x57,0x52,0x49,0x54,0x45,0x51,0x55,0x45,0x55,0x45,0x6,0x0,0xc, +0x44,0x4f,0x53,0x50,0x45,0x45,0x4b,0x51,0x55,0x45,0x55,0x45,0x5,0x0,0xc, +0x44,0x4f,0x53,0x4f,0x50,0x45,0x4e,0x51,0x55,0x45,0x55,0x45,0x7,0x0,0xe, +0x44,0x4f,0x53,0x43,0x52,0x45,0x41,0x54,0x45,0x51,0x55,0x45,0x55,0x45,0x8, +0x0,0x0 +}; +UCHAR quenrestab[]= +{ +0xc,0x71,0x75,0x65,0x63,0x61,0x6c,0x6c,0x73,0x2e,0x64,0x6c,0x6c,0x0,0x0,0x0 + +}; +UCHAR vioenttab[]= +{ +0x3,0x1,0x3,0x58,0x3,0x3,0x74,0x3,0x3,0x2c,0x3,0x1,0x0,0x9,0x1,0x3,0x30,0x3, +0x3,0x4c,0x3,0x3,0xec,0x2,0x3,0x90,0x3,0x3,0xf0,0x2,0x3,0x10,0x3,0x3,0x54, +0x3,0x3,0x28,0x3,0x3,0x14,0x3,0x1,0x0,0x1,0x1,0x3,0xf4,0x2,0x2,0x0,0x2, +0x1,0x3,0x8c,0x3,0x3,0xf8,0x2,0x1,0x0,0xd,0x1,0x3,0xfc,0x2,0x3,0x48,0x3, +0x3,0x88,0x3,0x3,0x0,0x3,0x3,0x80,0x3,0x3,0x1c,0x3,0x3,0x40,0x3,0x3,0x84, +0x3,0x3,0x64,0x3,0x3,0x8,0x3,0x3,0x5c,0x3,0x3,0x44,0x3,0x3,0x68,0x3,0x1, +0x0,0x1,0x1,0x3,0x78,0x3,0x1,0x0,0x1,0x1,0x3,0x7c,0x3,0x2,0x0,0x1,0x1, +0x3,0x38,0x3,0x1,0x0,0xc,0x1,0x3,0x3c,0x3,0x3,0x60,0x3,0x3,0x4,0x3,0x3, +0x50,0x3,0x3,0x34,0x3,0x3,0x24,0x3,0x3,0xc,0x3,0x3,0x6c,0x3,0x3,0x94,0x3, +0x3,0x70,0x3,0x3,0x18,0x3,0x3,0x20,0x3,0x0,0x0 +}; +UCHAR viorestab[]= +{ +0x8,0x56,0x49,0x4f,0x43,0x41,0x4c,0x4c,0x53,0x0,0x0,0xb,0x56,0x49,0x4f,0x45, +0x4e,0x44,0x50,0x4f,0x50,0x55,0x50,0x1,0x0,0xd,0x56,0x49,0x4f,0x47,0x45, +0x54,0x50,0x48,0x59,0x53,0x42,0x55,0x46,0x2,0x0,0xa,0x56,0x49,0x4f,0x47, +0x45,0x54,0x41,0x4e,0x53,0x49,0x3,0x0,0xa,0x56,0x49,0x4f,0x53,0x45,0x54, +0x41,0x4e,0x53,0x49,0x5,0x0,0xd,0x56,0x49,0x4f,0x44,0x45,0x52,0x45,0x47, +0x49,0x53,0x54,0x45,0x52,0x6,0x0,0xb,0x56,0x49,0x4f,0x53,0x43,0x52,0x4f, +0x4c,0x4c,0x55,0x50,0x7,0x0,0x8,0x56,0x49,0x4f,0x50,0x52,0x54,0x53,0x43, +0x8,0x0,0xc,0x56,0x49,0x4f,0x47,0x45,0x54,0x43,0x55,0x52,0x50,0x4f,0x53, +0x9,0x0,0xd,0x56,0x49,0x4f,0x57,0x52,0x54,0x43,0x45,0x4c,0x4c,0x53,0x54, +0x52,0xa,0x0,0x8,0x56,0x49,0x4f,0x50,0x4f,0x50,0x55,0x50,0xb,0x0,0xb, +0x56,0x49,0x4f,0x53,0x43,0x52,0x4f,0x4c,0x4c,0x52,0x54,0xc,0x0,0xd,0x56, +0x49,0x4f,0x57,0x52,0x54,0x43,0x48,0x41,0x52,0x53,0x54,0x52,0xd,0x0,0xc, +0x56,0x49,0x4f,0x53,0x45,0x54,0x43,0x55,0x52,0x50,0x4f,0x53,0xf,0x0,0x9, +0x56,0x49,0x4f,0x57,0x52,0x54,0x54,0x54,0x59,0x13,0x0,0xc,0x56,0x49,0x4f, +0x53,0x43,0x52,0x55,0x4e,0x4c,0x4f,0x43,0x4b,0x12,0x0,0xa,0x56,0x49,0x4f, +0x47,0x45,0x54,0x4d,0x4f,0x44,0x45,0x15,0x0,0xa,0x56,0x49,0x4f,0x53,0x45, +0x54,0x4d,0x4f,0x44,0x45,0x16,0x0,0xa,0x56,0x49,0x4f,0x53,0x43,0x52,0x4c, +0x4f,0x43,0x4b,0x17,0x0,0xe,0x56,0x49,0x4f,0x52,0x45,0x41,0x44,0x43,0x45, +0x4c,0x4c,0x53,0x54,0x52,0x18,0x0,0xb,0x56,0x49,0x4f,0x57,0x52,0x54,0x4e, +0x41,0x54,0x54,0x52,0x1a,0x0,0x10,0x56,0x49,0x4f,0x53,0x41,0x56,0x52,0x45, +0x44,0x52,0x41,0x57,0x57,0x41,0x49,0x54,0x19,0x0,0xd,0x56,0x49,0x4f,0x47, +0x45,0x54,0x43,0x55,0x52,0x54,0x59,0x50,0x45,0x1b,0x0,0x10,0x56,0x49,0x4f, +0x53,0x41,0x56,0x52,0x45,0x44,0x52,0x41,0x57,0x55,0x4e,0x44,0x4f,0x1c,0x0, +0xa,0x56,0x49,0x4f,0x47,0x45,0x54,0x46,0x4f,0x4e,0x54,0x1d,0x0,0xe,0x56, +0x49,0x4f,0x52,0x45,0x41,0x44,0x43,0x48,0x41,0x52,0x53,0x54,0x52,0x1e,0x0, +0x9,0x56,0x49,0x4f,0x47,0x45,0x54,0x42,0x55,0x46,0x1f,0x0,0xd,0x56,0x49, +0x4f,0x53,0x45,0x54,0x43,0x55,0x52,0x54,0x59,0x50,0x45,0x20,0x0,0xa,0x56, +0x49,0x4f,0x53,0x45,0x54,0x46,0x4f,0x4e,0x54,0x21,0x0,0xb,0x56,0x49,0x4f, +0x4d,0x4f,0x44,0x45,0x55,0x4e,0x44,0x4f,0x23,0x0,0xb,0x56,0x49,0x4f,0x4d, +0x4f,0x44,0x45,0x57,0x41,0x49,0x54,0x25,0x0,0x8,0x56,0x49,0x4f,0x47,0x45, +0x54,0x43,0x50,0x28,0x0,0x8,0x56,0x49,0x4f,0x53,0x45,0x54,0x43,0x50,0x2a, +0x0,0xa,0x56,0x49,0x4f,0x53,0x48,0x4f,0x57,0x42,0x55,0x46,0x2b,0x0,0xb, +0x56,0x49,0x4f,0x53,0x43,0x52,0x4f,0x4c,0x4c,0x4c,0x46,0x2c,0x0,0xb,0x56, +0x49,0x4f,0x52,0x45,0x47,0x49,0x53,0x54,0x45,0x52,0x2d,0x0,0xc,0x56,0x49, +0x4f,0x47,0x45,0x54,0x43,0x4f,0x4e,0x46,0x49,0x47,0x2e,0x0,0xb,0x56,0x49, +0x4f,0x53,0x43,0x52,0x4f,0x4c,0x4c,0x44,0x4e,0x2f,0x0,0x10,0x56,0x49,0x4f, +0x57,0x52,0x54,0x43,0x48,0x41,0x52,0x53,0x54,0x52,0x41,0x54,0x54,0x30,0x0, +0xb,0x56,0x49,0x4f,0x47,0x45,0x54,0x53,0x54,0x41,0x54,0x45,0x31,0x0,0xe, +0x56,0x49,0x4f,0x50,0x52,0x54,0x53,0x43,0x54,0x4f,0x47,0x47,0x4c,0x45,0x32, +0x0,0xb,0x56,0x49,0x4f,0x53,0x45,0x54,0x53,0x54,0x41,0x54,0x45,0x33,0x0, +0xb,0x56,0x49,0x4f,0x57,0x52,0x54,0x4e,0x43,0x45,0x4c,0x4c,0x34,0x0,0xb, +0x56,0x49,0x4f,0x57,0x52,0x54,0x4e,0x43,0x48,0x41,0x52,0x35,0x0,0x0 +}; +UCHAR vionrestab[]= +{ +0xc,0x76,0x69,0x6f,0x63,0x61,0x6c,0x6c,0x73,0x2e,0x64,0x6c,0x6c,0x0,0x0,0x0 + +}; diff --git a/private/os2/inc/ldrxport.h b/private/os2/inc/ldrxport.h new file mode 100644 index 000000000..4c19cf070 --- /dev/null +++ b/private/os2/inc/ldrxport.h @@ -0,0 +1,75 @@ +/***ET+ ldrrei_t - Structure of exec info for return from LDRNewExe */ + +struct ldrrei_s { + ptr_t ei_startaddr; /* instruction pointer */ + ptr_t ei_stackaddr; /* stack pointer */ + ushort_t ei_ds; /* starting ds only for 16-bit */ + ushort_t ei_dgroupsize; /* size of dgroup */ + ushort_t ei_heapsize; /* size of heap */ + ushort_t ei_loadtype; /* Load type 16-bit or 32-bit */ + SEL ei_envsel; /* Selector to environment */ + ushort_t ei_comoff; /* Offset to command line in env */ + ushort_t ei_stacksize; /* size of stack */ + ushort_t ei_hmod; /* module handle */ +}; + +typedef struct ldrrei_s ldrrei_t; /* Loader return exec info */ + +extern PVOID LDRExecInfo; + +struct ldrlibi_s { + struct ldrlibi_s *link; + ptr_t startaddr; + ptr_t stackaddr; + ushort_t ds; + ushort_t heapsize; + ushort_t handle; +}; + +typedef struct ldrlibi_s ldrlibi_t; + +#define MAX_INIT_RECORDS 64 + +extern ldrlibi_t *pldrLibiRecord; + +extern int _cdecl ldrLibiInit(ldrlibi_t *pldrLibiRecord, ldrrei_t *pexec_info); + +/***LP ldrStop - stop in kernel debugger + * + * If the global ldrErr is TRUE and the mte pointer is not doscalls + * or is null, this routine transfers control to the kernel debugger. + * + * ldrStop (id, pmte) + * + * ENTRY id - identifier of caller (ignored) + * pmte - mte pointer or NULL + * RETURN NONE + * + * CALLS Debug_BreakDM + * + * EFFECTS NONE + */ + +extern void LDRStop(int id, void *pmte); +#if DBG +#define ldrStop(id, pmte) LDRStop(id, pmte) +#else +#define ldrStop(id, pmte) +#endif + +extern void ldrSetDescInfo(SEL selector, ULONG addr, USHORT flags, + USHORT limit); + +extern void ldrstart(ldrrei_t *pexec_info); + +extern PVOID LDRNEHeap; + +extern char *pheaderbuf; /* temp buf to read header */ + +#if PMNT +extern void ldrDumpSegmentTable(); +#endif +#if DBG +extern void ldrDisplaySegmentTable(); +#endif + diff --git a/private/os2/inc/mi.h b/private/os2/inc/mi.h new file mode 100644 index 000000000..575e440e4 --- /dev/null +++ b/private/os2/inc/mi.h @@ -0,0 +1,504 @@ +/*static char *SCCSID = "@(#)mi.h 6.1 90/11/15";*/ +/* + * Machine instruction, flag definitions and character types + * + * SCCSID = @(#)mi.h 13.17 90/09/13 + */ + +// 386 eflags definitions + +#define F_AC 0x00040000 // (A)lignment (C)heck +#define F_VM 0x00020000 // (V)irtual 8086 (M)ode +#define F_RF 0x00010000 // (R)esume (F)lag +#define F_NT 0x00004000 // (N)ested (T)ask +#define F_NTCLEAR (~F_NT) +#define F_IOPL0 0 +#define F_IOPL1 0x00001000 +#define F_IOPL2 0x00002000 +#define F_IOPL3 0x00003000 +#define F_IOPLMASK 0x00003000 // (I)/(O) (P)rivilege (L)evel +#define F_IOPLSYS F_IOPL3 // wide open +#define F_IOPLclear (~F_IOPLMASK) +#define F_OVERFLOW 0x00000800 +#define F_DIRECTION 0x00000400 +#define F_INTERRUPT 0x00000200 +#define F_TRACE 0x00000100 +#define F_SIGN 0x00000080 +#define F_ZERO 0x00000040 +#define F_AUX 0x00000010 +#define F_PARITY 0x00000004 +#define F_CARRY 0x00000001 +#define F_UNDEFINED 0x0000802A + +// CR0 (Machine Status Register) bits + +#define CR0_PE 0x00000001 // (P)rotect (E)nable +#define CR0_MP 0x00000002 // (M)onitor (P)rocessor extension +#define CR0_EM 0x00000004 // (EM)ulate processor extension +#define CR0_TS 0x00000008 // (T)ask (thread) (S)witched +#define CR0_ET 0x00000010 // (E)xtension (T)ype, 0/1=287/387 +#define CR0_NE 0x00000020 // (N)umeric (E)xception 0/1=use 2/10h +#define CR0_WP 0x00010000 // (W)rite (P)rotect in rings 0-2 +#define CR0_AM 0x00040000 // (A)lignment (M)ask, enable EFlags.AC +#define CR0_NW 0x20000000 // (N)o (W)rite-through cache +#define CR0_CD 0x40000000 // (C)ache (D)isable +#define CR0_PG 0x80000000 // (P)a(G)ing enable +#define CR0_RESERVED 0x1ffaffc0 // reserved bits + +/* + * Cache Operating Modes: + * + * CR0_CD CR0_NW Cache Fills Write-Throughs and Invalidates + * ------ ------ ----------- ------------------------------ + * 1 1 disabled disabled + * 1 0 disabled enabled + * 0 1 INVALID combination - CR0 load causes GP fault + * 0 0 enabled enabled (Normal mode) + */ + +// Machine Status Word bits (obsolete) + +#define MSW_PE CR0_PE +#define MSW_MP CR0_MP +#define MSW_EM CR0_EM +#define MSW_TS CR0_TS +#define MSW_ET CR0_ET + +// CR3 (Page Directory Base Register) bits + +#define CR3_WRITETHROUGH 0x00000008 // write-through cache (486 ignores) +#define CR3_CACHEDISABLE 0x00000010 // cache disable +#define CR3_FRAME 0xfffff000 // page directory physical frame number +#define CR3_RESERVED 0x00000fe7 // reserved bits + +// Debug Registers + +#define DR_COUNT 0x4 // number of debug registers + +// DR6 (Debug Registers Status Register) bits + +#define DR6_B0 0x00000001 // breakpoint register 0 triggered +#define DR6_B1 0x00000002 // breakpoint register 1 triggered +#define DR6_B2 0x00000004 // breakpoint register 2 triggered +#define DR6_B3 0x00000008 // breakpoint register 3 triggered +#define DR6_BD 0x00002000 // ICE hardware active +#define DR6_BS_BIT_INDEX 0xe // Single step trap +#define DR6_BS (1 << DR6_BS_BIT_INDEX) +#define DR6_BT 0x00008000 // TSS trap + +#define DR6_VALID (DR6_B0|DR6_B1|DR6_B2|DR6_B3|DR6_BD|DR6_BS|DR6_BT) +#define DR6_RESERVED ~(DR6_VALID) + +// DR7 (Debug Register Control Register) bits + +#define DR7_L0 0x00000001 /* DR0 Local Enable */ +#define DR7_G0 0x00000002 /* DR0 Global Enable */ +#define DR7_L1 0x00000004 /* DR1 Local Enable */ +#define DR7_G1 0x00000008 /* DR1 Global Enable */ +#define DR7_L2 0x00000010 /* DR2 Local Enable */ +#define DR7_G2 0x00000020 /* DR2 Global Enable */ +#define DR7_L3 0x00000040 /* DR3 Local Enable */ +#define DR7_G3 0x00000080 /* DR3 Global Enable */ + +#define DR7_LE 0x00000100 /* Local - Exact Match */ +#define DR7_GE 0x00000200 /* Global - Exact Match */ + +#define DR7_RW0 0x00030000 /* DR0 RW bits */ +#define DR7_LEN0 0x000c0000 /* DR0 Len bits */ +#define DR7_RW1 0x00300000 /* DR1 RW bits */ +#define DR7_LEN1 0x00c00000 /* DR1 Len bits */ +#define DR7_RW2 0x03000000 /* DR2 RW bits */ +#define DR7_LEN2 0x0c000000 /* DR2 Len bits */ +#define DR7_RW3 0x30000000 /* DR3 RW bits */ +#define DR7_LEN3 0xc0000000 /* DR3 Len bits */ + +#define DR7_RESERVED 0x0000fc00 /* DR7 Intel Reserved */ + +#define DR7_EXECUTE 0x0 /* Execute */ +#define DR7_WRITE 0x1 /* Data Write */ +#define DR7_READWRITE 0x3 /* Data Read or Write */ + +#define DR7_LEN_1 0x0 /* Length 1 bits */ +#define DR7_LEN_2 0x1 /* Length 2 */ +#define DR7_LEN_4 0x3 /* Length 4 */ + +// Machine instruction, flag definitions and character types + +#define MI_ARPL 0x63 // ARPL instruction +#define MI_HLT 0xf4 // HLT instruction +#define MI_OPERANDSIZE 0x66 // Operand size override prefix +#define MI_ADDRESSSIZE 0x67 // Address size override prefix +#define MI_TWOBYTEOP 0x0f // Two byte opcode prefix + +#define MI_POP_DS 0x1f +#define MI_POP_ES 0x07 +#define MI_POP_FS 0xA1 // second byte to 0Fh opcode +#define MI_POP_GS 0xA9 // second byte to 0Fh opcode + +#define MI_INT3 0xCC +#define MI_INT 0xCD +#define MI_IRET 0xCF +#define MI_LONG_JMP 0xEA +#define MI_LONG_CALL 0x9A +#define MI_LONG_RET 0xCB +#define MI_LONG_RETn 0xCA +#define MI_NEAR_RET 0xC3 + +#define MI_IN_PORT_AL 0xE4 // Opcode of IN port,AL +#define MI_IN_PORT_AX 0xE5 // Opcode of IN port,AX +#define MI_OUT_PORT_AL 0xE6 // Opcode of OUT port,AL +#define MI_OUT_PORT_AX 0xE7 // Opcode of OUT port,AX +#define MI_IN_DX_AL 0xEC // Opcode of IN DX,AL +#define MI_IN_DX_AX 0xED // Opcode of IN DX,AX +#define MI_OUT_DX_AL 0xEE // Opcode of OUT DX,AL +#define MI_OUT_DX_AX 0xEF // Opcode of OUT DX,AX + +#define MI_GROUP5 0xFF // 5th group of 11-bit opcode inst.s +#define MI_SEGES 0x26 // ES override prefix +#define MI_SEGCS 0x2E // CS override prefix +#define MI_SEGSS 0x36 // SS override prefix +#define MI_SEGDS 0x3E // DS override prefix +#define MI_SEGFS 0x64 // FS override prefix +#define MI_SEGGS 0x65 // GS override prefix + +// ESC opcode prefix and mask + +#define MI_ESCMASK 0xF8 +#define MI_ESC 0xD8 + +// MOD field equates + +#define MI_MODMASK 0xC0 // MOD field mask +#define MI_MODSHIFT 6 // MOD field shift +#define MI_MODNONE 0x00 // MOD = 0 (no displacement) +#define MI_MODBYTE 0x40 // MOD = 1 (byte displacement) +#define MI_MODWORD 0x80 // MOD = 2 (word displacement) +#define MI_MODREG 0xC0 // MOD = 3 (R/M field selects register) + +// REG field equates + +#define MI_REGMASK 0x38 // REG field mask +#define MI_REGSHIFT 3 // REG field shift +#define MI_REGAX 0x00 // REG = 0 (AX/AL) +#define MI_REGCX 0x08 // REG = 1 (CX/CL) +#define MI_REGDX 0x10 // REG = 2 (DX/DL) +#define MI_REGBX 0x18 // REG = 3 (BX/BL) +#define MI_REG3 0x18 // REG = 3 (part of 11-bit opcode) +#define MI_REGSP 0x20 // REG = 4 (SP/AH) +#define MI_REGBP 0x28 // REG = 5 (BP/CH) +#define MI_REGSI 0x30 // REG = 6 (SI/DH) +#define MI_REGDI 0x38 // REG = 7 (DI/BH) + +#define MI_REGES 0x00 // REG = 0 MOV seg,r/m or MOV r/m,seg +#define MI_REGCS 0x08 // REG = 1 +#define MI_REGSS 0x10 // REG = 2 +#define MI_REGDS 0x18 // REG = 3 +#define MI_REGFS 0x20 // REG = 4 +#define MI_REGGS 0x28 // REG = 5 + +// R/M field equates for memory operands (for 16-bit instructions) + +#define MI_RMMASK 0x07 // R/M field mask +#define MI_RMSHIFT 0 // R/M field shift +#define MI_RMBXSI 0x00 // R/M = 0 ([BX+SI]) +#define MI_RMBXDI 0x01 // R/M = 1 ([BX+DI]) +#define MI_RMBPSI 0x02 // R/M = 2 ([BP+SI]) +#define MI_RMBPDI 0x03 // R/M = 3 ([BP+DI]) +#define MI_RMSI 0x04 // R/M = 4 ([SI]) +#define MI_RMDI 0x05 // R/M = 5 ([DI]) +#define MI_RMBP 0x06 // R/M = 6 ([BP]) +#define MI_RMBX 0x07 // R/M = 7 ([BX]) + +// 32 bit instruction equates + +#define MI_SIB_SSMASK 0xc0 +#define MI_SIB_SSSHIFT 0x06 + +#define MI_SIB_INDEXMASK 0x38 +#define MI_SIB_INDEXSHIFT 0x03 +#define MI_SIB_INDEXNONE 0x20 + +#define MI_SIB_BASEMASK 0x07 +#define MI_SIB_BASESHIFT 0x00 +#define MI_SIB_BASEESP 0x04 +#define MI_SIB_BASENONE 0x05 + +#define MI_RMEDX 0x02 +#define MI_RMSIB 0x04 +#define MI_RMDISP 0x05 +#define MI_RMEBP 0x05 + +#define MI_REG6 0x30 +#define MI_REGCR0 0x00 + +// following machine instructions are used in Enable_386_Specific_code +// in virtmgr.asm + +#define MI_PUSH_AX 0x50 // "push ax" instruction +#define MI_PUSH_IMM 0x68 // "push immediate 16/32" instruction +#define MI_MOV_REG_IMM 0xB8 // opcode for "mov reg,immediate" instr +#define MI_MOV_REG_IMMEDIATE 0xB8 // opcode for "mov reg,immediate" instr +#define MI_MOV_REG_REGMEM 0x8B // opcode for "mov reg,r/m 16/32" instr + +// Miscellaneous Opcodes + +#define MI_ADD_AX_IMM 0x05 // Opcode for Add (E)AX,imm(32)16 +#define MI_CALL_NEAR_REL 0xE8 // Opcode for Call NEAR (relative) +#define SIZE_CALL_NEAR_REL 5 // Length of Call NEAR (relative) instr + +#define MI_LMSW_OPCODE 0x01 // LMSW + +#define MI_GET_CRx_OPCODE 0x20 // MOV r32,CRx +#define MI_GET_DRx_OPCODE 0x21 // MOV r32,DRx +#define MI_SET_CRx_OPCODE 0x22 // MOV CRx,r32 +#define MI_SET_DRx_OPCODE 0x23 // MOV DRx,r32 +#define MI_GET_TRx_OPCODE 0x24 // MOV r32,TRx +#define MI_SET_TRx_OPCODE 0x26 // MOV TRx,r32 + +#define MI_MOV_REG8_MEM8 0x8A // MOV reg8,mem8 +#define MI_MOV_SEG_MEM_OPCODE 0x8e // MOV seg,r/m16 + +typedef unsigned long ulong_t; +typedef unsigned short ushort_t; +typedef unsigned char uchar_t; +typedef unsigned long vaddr_t; + +// WORD structure + +struct w_s { + uchar_t lobyte; + uchar_t hibyte; +}; +#define LowByte lobyte +#define HighByte hibyte + +// DWORD structure + +struct dw_s { + ushort_t loword; + ushort_t hiword; +}; +#define LowWord loword +#define HighWord hiword + +// Far pointer structure + +struct FarPtr { + ushort_t Offst; + ushort_t Segmt; +}; + +// Far 32 bit pointer structure + +struct FarPtr32 { + ulong_t Offst32; // 32 bit offset + ushort_t Segmt32; // segment + ushort_t Pad32; // segment pad +}; + +/*** RETF16 - 16 bit RETF frame definition + * + * 16 bit RETF frame structure + */ + +typedef struct retf16_s { + ushort_t retf16_ip; + ushort_t retf16_cs; +} RETF16; + +typedef RETF16 *PRETF16; + +/*** RETF32 - 32 bit RETF frame definition + * + * 32 bit RETF frame structure + */ + +typedef struct retf32_s { + ulong_t retf32_eip; + ushort_t retf32_cs; + ushort_t retf32_padcs; +} RETF32; + +typedef RETF32 *PRETF32; + +/*** IRET16 - 16 bit IRET frame definition + * + * 16 bit IRET frame structure + */ + +typedef struct iret16_s { + ushort_t iret16_ip; + ushort_t iret16_cs; + ushort_t iret16_flag; +} IRET16; + +typedef IRET16 *PIRET16; + +// 16 bit Iret stack frame without privilege level transition + +struct Iret_s { + struct FarPtr I_CSIP; + ushort_t I_FLAGS; +}; + +struct IretFrame { + ushort_t IretIP ; + ushort_t IretCS ; + ushort_t IretFLAGS; +}; + +/* ASM IretCSIP EQU <DWORD PTR IretIP> */ + +/*** IRET32 - 32 bit IRET frame definition + * + * 32 bit IRET frame structure + */ + +typedef struct iret32_s { + ulong_t iret32_eip; + ushort_t iret32_cs; + ushort_t iret32_padcs; + ulong_t iret32_eflag; +} IRET32; + +typedef IRET32 *PIRET32; + +// 32 bit Iret stack frame without privilege level transition + +struct Iret32_s { + struct FarPtr32 I32_CSEIP; + ulong_t I32_EFLAGS; +}; +/* ASM +I32_CS EQU <I32_CSEIP.Segmt32> +I32_EIP EQU <I32_CSEIP.Offst32> +I32_IP EQU <I32_CSEIP.Offst32.loword> +I32_FLAGS EQU <I32_EFLAGS.loword> +*/ + +/*** PLTIRET16 - 16 bit IRET frame definition + * + * 16 bit IRET frame structure with privilege level transtion + */ + +typedef struct pltiret16_s { + ushort_t pltiret16_ip; + ushort_t pltiret16_cs; + ushort_t pltiret16_flag; + ushort_t pltiret16_sp; + ushort_t pltiret16_ss; +} PLTIRET16; + +typedef PLTIRET16 *PPLTIRET16; + +// 16 bit Protected mode iret stack frame with privilege level transition + +struct PLTIret_s { + struct FarPtr PI_CSIP; + ushort_t PI_FLAGS; + struct FarPtr PI_SSSP; +}; + +struct PLTIretFrame { + ushort_t PLTIretIP; + ushort_t PLTIretCS; + ushort_t PLTIretFLAGS; + ushort_t PLTIretSP; + ushort_t PLTIretSS; +}; + +/* ASM +PLTIretCSIP EQU DWORD PTR PLTIretIP +PLTIretSSSP EQU DWORD PTR PLTIretSP +*/ + +/*** PLTIRET32 - 32 bit IRET frame definition + * + * 32 bit IRET frame structure with privilege level transtion + */ + +typedef struct pltiret32_s { + ulong_t pltiret32_eip; + ushort_t pltiret32_cs; + ushort_t pltiret32_padcs; + ulong_t pltiret32_eflag; + ulong_t pltiret32_esp; + ushort_t pltiret32_ss; + ushort_t pltiret32_padss; +} PLTIRET32; + +typedef PLTIRET32 *PPLTIRET32; + +// 32 bit Protected mode iret stack frame with privilege level transition + +struct PLTIret32_s { + struct FarPtr32 PI32_CSEIP; + ulong_t PI32_EFLAGS; + struct FarPtr32 PI32_SSESP; +}; +/* ASM +PI32_CS EQU <PI32_CSEIP.Segmt32> +PI32_EIP EQU <PI32_CSEIP.Offst32> +PI32_SS EQU <PI32_SSESP.Segmt32> +PI32_ESP EQU <PI32_SSESP.Offst32> +PI32_FLAGS EQU <WORD PTR PI32_EFLAGS> +*/ + +// Generic 32-bit pointer structure + +/* XLATOFF */ +union ptr_u { + struct FarPtr ptr_far16; /* 16-bit far pointer */ + ulong_t ptr_flat; /* 32-bit flat pointer */ +}; +typedef union ptr_u ptr_t; /* Generic pointer type */ + +#define ptr_sel ptr_far16.Segmt +#define ptr_off ptr_far16.Offst +/* XLATON */ + +/* ASM +ptr_t STRUC + ptr_flat DD ? +ptr_t ENDS +ptr_off equ <ptr_flat.Offst> +ptr_sel equ <ptr_flat.Segmt> +*/ + + +// PUSHA stack frame + +struct pusha_s { + ushort_t pas_di; + ushort_t pas_si; + ushort_t pas_bp; + ushort_t pas_sp; + ushort_t pas_bx; + ushort_t pas_dx; + ushort_t pas_cx; + ushort_t pas_ax; +}; + +// PUSHAD stack frame + +struct pushad_s { + ulong_t pads_edi; + ulong_t pads_esi; + ulong_t pads_ebp; + ulong_t pads_esp; + ulong_t pads_ebx; + ulong_t pads_edx; + ulong_t pads_ecx; + ulong_t pads_eax; +}; + +/* ASM +pads_di EQU <WORD PTR pads_edi> +pads_si EQU <WORD PTR pads_esi> +pads_bp EQU <WORD PTR pads_ebp> +pads_sp EQU <WORD PTR pads_esp> +pads_bx EQU <WORD PTR pads_ebx> +pads_dx EQU <WORD PTR pads_edx> +pads_cx EQU <WORD PTR pads_ecx> +pads_ax EQU <WORD PTR pads_eax> +*/ diff --git a/private/os2/inc/monitor.h b/private/os2/inc/monitor.h new file mode 100644 index 000000000..a188d508f --- /dev/null +++ b/private/os2/inc/monitor.h @@ -0,0 +1,68 @@ + +#ifndef _MONITOR_ + +#define _MONITOR_ + +#define MONITOR_DEFAULT 0x0000 +#define MONITOR_BEGIN 0x0001 +#define MONITOR_END 0x0002 +#define MONITOR_SPECIEL_DEFAULT 0x0003 +#define MONITOR_SPECIEL_BEGIN 0x0004 +#define MONITOR_SPECIEL_END 0x0005 + +#define MIN_KBD_MON_BUFFER 64 + +#pragma pack(1) + +typedef struct _MONIN /* mnin */ +{ + USHORT cb; + BYTE abReserved[18]; + BYTE abBuffer[108]; +} MONIN, *PMONIN; + +typedef struct _MONOUT /* mnout */ +{ + USHORT cb; + UCHAR buffer[18]; + BYTE abBuf[108]; +} MONOUT, *PMONOUT; + +typedef struct _KBD_MON_PACKAGE +{ + UCHAR MonitorFlag; + UCHAR DeviceFlag; + KBDKEYINFO KeyInfo; + USHORT KeyboardFlag; +} KBD_MON_PACKAGE, *PKBD_MON_PACKAGE; + +typedef struct _MOU_MON_PACKAGE +{ + UCHAR MonitorFlag; + UCHAR DeviceFlag; + MOUEVENTINFO MouInfo; +} MOU_MON_PACKAGE, *PMOU_MON_PACKAGE; + +#pragma pack() + +#define MON_REGISTERMONITOR 0x0040 + +/* + * Monitor Flag + */ + +#define MONITOR_OPEN_PACKAGE 1 +#define MONITOR_CLOSE_PACKAGE 2 +#define MONITOR_FLUSH_PACKAGE 4 + +/* + * KeyboardFlag + */ + +#define KBD_ACCENT_INDICATOR 0x0200 // 0000 0010 0000 0000 +#define KBD_MULTIMAKE 0x0100 // 0000 0001 0000 0000 +#define KBD_SCAN_CODE 0x0080 // 0000 0000 1000 0000 +#define KBD_KEY_BREAK 0x0040 // 0000 0000 0100 0000 +#define KBD_ZERO_USER 0xFC3F // 1111 1100 0011 1111 + +#endif // _MONITOR_ diff --git a/private/os2/inc/nb30p.h b/private/os2/inc/nb30p.h new file mode 100644 index 000000000..bccce431d --- /dev/null +++ b/private/os2/inc/nb30p.h @@ -0,0 +1,83 @@ + +/*++ + +Copyright (c) 1989 Microsoft Corporation + +Module Name: + + nb30p.h + +Abstract: + + Private include file for the NB (NetBIOS) component of the NTOS project. + +Author: + + Colin Watson (ColinW) 09-Dec-1991 + +Revision History: + +--*/ + + +#ifndef _NB30P_ +#define _NB30P_ + +#define NB_DEVICE_NAME L"\\Device\\Netbios" // name of our driver. + +// +// private IOCTLs used by the Netbios routine in the dll to communicate with +// \Device\Netbios +// + +#define IOCTL_NB_BASE FILE_DEVICE_TRANSPORT + +#define _NB_CONTROL_CODE(request,method) \ + CTL_CODE(IOCTL_NB_BASE, request, method, FILE_ANY_ACCESS) + +#define IOCTL_NB_NCB _NB_CONTROL_CODE(20,METHOD_NEITHER) + +// +// MessageId: STATUS_HANGUP_REQUIRED +// +// MessageText: +// +// Warning error for the Netbios driver to the Netbios dll. When receiving this +// status on an NCB completion, the dll will hangup the connection causing the +// connection block to be deleted. This status will never be returned to a user +// application. +// +#define STATUS_HANGUP_REQUIRED ((NTSTATUS)0x80010001L) + +// +// Private extension for XNS to support vtp.exe +// + +#define NCALLNIU 0x74 /* UB special */ + +// +// Private extension to support AsyBEUI +// + +#define NCBQUICKADDNAME 0x75 +#define NCBQUICKADDGRNAME 0x76 + +// Values for transport_id in ACTION_HEADER + +#define MS_ABF "MABF" +#define MS_XNS "MXNS" + +// private OS/2SS stuff + +#define DEFAULT_NET 1 // default NET number for NetBiosSubmit + +#define NB2_INIT 0 +#define NB2_INIT_LANA 1 +#define NB2_LANA 2 + +#define NB2ERR_SUCCESS 0 +#define NB2ERR_INVALID_LANA 1 +#define NB2ERR_INVALID_REQUEST 2 + +#endif // _NB30P_ + diff --git a/private/os2/inc/netb.h b/private/os2/inc/netb.h new file mode 100644 index 000000000..b0866f62e --- /dev/null +++ b/private/os2/inc/netb.h @@ -0,0 +1,133 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + netbios.h + +Abstract: + + This is the main include file for the component of netbios that runs + in the user process. + +Author: + + Colin Watson (ColinW) 24-Jun-91 + +Revision History: + +--*/ + +#include <nt.h> +#include <ntrtl.h> +#include <nturtl.h> +#include <windows.h> +#include <nb30.h> +#include "nb30p.h" + +// +// Internal version of the ncb layout that uses the reserved area to hold +// the list entry when passing ncb's to the worker thread and the IO status +// block used when the ncb is passed to the netbios device driver. +// + +#pragma pack(1) + +// +// Use packing to ensure that the cu union is not forced to word alignment. +// All elements of this structure are naturally aligned. +// + +typedef struct _NCBI { + UCHAR ncb_command; /* command code */ + volatile UCHAR ncb_retcode; /* return code */ + UCHAR ncb_lsn; /* local session number */ + UCHAR ncb_num; /* number of our network name */ + PUCHAR ncb_buffer; /* address of message buffer */ + WORD ncb_length; /* size of message buffer */ + union { + UCHAR ncb_callname[NCBNAMSZ];/* blank-padded name of remote */ + struct _CHAIN_SEND { + WORD ncb_length2; + PUCHAR ncb_buffer2; + } ncb_chain; + } cu; + UCHAR ncb_name[NCBNAMSZ]; /* our blank-padded netname */ + UCHAR ncb_rto; /* rcv timeout/retry count */ + UCHAR ncb_sto; /* send timeout/sys timeout */ + void (CALLBACK *ncb_post)( struct _NCB * ); + /* POST routine address */ + UCHAR ncb_lana_num; /* lana (adapter) number */ + volatile UCHAR ncb_cmd_cplt; /* 0xff => commmand pending */ + + // Make driver specific use of the reserved area of the NCB. + WORD ncb_reserved; /* return to natural alignment */ + union { + LIST_ENTRY ncb_next; /* queued to worker thread */ + IO_STATUS_BLOCK ncb_iosb; /* used for Nt I/O interface */ + } u; + + HANDLE ncb_event; /* HANDLE to Win32 event */ + } NCBI, *PNCBI; + +#pragma pack() + +VOID +QueueToWorker( + IN PNCBI pncb + ); + +DWORD +Worker( + IN LPVOID Parameter + ); + +VOID +SendNcbToDriver( + IN PNCBI pncb + ); + +VOID +PostRoutineCaller( + PVOID Context, + PIO_STATUS_BLOCK Status, + ULONG Reserved + ); + +VOID +ChainSendPostRoutine( + PVOID Context, + PIO_STATUS_BLOCK Status, + ULONG Reserved + ); + +VOID +HangupConnection( + PNCBI pUserNcb + ); + +#if DBG + +VOID +DisplayNcb( + IN PNCBI pncbi + ); + +#define NbPrintf(String) NbPrint String; + +VOID +NbPrint( + char *Format, + ... + ); + +#else + +// Dispose of debug statements in non-debug builds. +#define DisplayNcb( pncb ) {}; + +#define NbPrintf( String ) {}; + +#endif +// End of Debug related definitions diff --git a/private/os2/inc/netrqust.h b/private/os2/inc/netrqust.h new file mode 100644 index 000000000..7bc045eb2 --- /dev/null +++ b/private/os2/inc/netrqust.h @@ -0,0 +1,338 @@ +#ifndef __NETRQUST_H +#define __NETRQUST_H + +#define far +#define near + +#define NEAR near +#ifndef WINAPI +#define WINAPI +#endif +#ifndef CALLBACK +#define CALLBACK +#endif +#ifndef APIENTRY +#define APIENTRY WINAPI +#endif + +typedef unsigned char BYTE; +typedef unsigned short WORD; +typedef unsigned long DWORD; +typedef float FLOAT; +typedef FLOAT *PFLOAT; +typedef char near *PSTR; +typedef char near *NPSTR; +typedef char *LPSTR; +typedef BYTE near *PBYTE; +typedef BYTE far *LPBYTE; +typedef int near *PINT; +typedef int far *LPINT; +typedef WORD near *PWORD; +typedef WORD far *LPWORD; +typedef long far *LPLONG; +typedef DWORD near *PDWORD; +typedef DWORD far *LPDWORD; +typedef void *PVOID; +typedef void far *LPVOID; +// typedef PVOID HANDLE; + +typedef int INT; +typedef unsigned int UINT; +typedef unsigned int *PUINT; + +// +// UNICODE (Wide Character) types +// + +typedef unsigned short WCHAR; // wc, 16-bit UNICODE character +typedef WCHAR *LPWCH, *PWCH; // pwc +typedef WCHAR *LPWSTR, *PWSTR; // pwsz, 0x0000 terminated UNICODE strings only + +// +// Neutral ANSI/UNICODE types and macros +// + +#include <lmcons.h> // LAN Manager common definitions +// #include <lmerr.h> // LAN Manager network error definitions + +#include <lmchdev.h> // Character Device and Handle classes +#include <lmaccess.h> // Access, Domain, Group and User classes +#include <lmshare.h> // Connection, File, Session and Share classes +#include <lmmsg.h> // Message class +#include <lmremutl.h> // Remote Utility class +#include <lmserver.h> // Server class +#include <lmsvc.h> // Service class +#include <lmuse.h> // Use class +#include <lmwksta.h> // Workstation class +#include <lmapibuf.h> // NetApiBuffer class +#include <lmerrlog.h> // NetErrorLog class +#include <lmconfig.h> // NetConfig class +#include <lmstats.h> // NetStats class +#include <lmaudit.h> // NetAudit class +#include <nb30.h> + +/* + The following structures were used to pass messages between client and os2ses regarding Net Apis. + Since 11/30/92, all Net Apis are completely implemented in the client, so this communication is + no longer necessary. These structures are now obsolete. + +typedef struct _NETUSEADD_MSG { + ULONG Level; + ULONG Status; + ULONG AsgType; + ULONG RefCount; + ULONG UseCount; + BOOLEAN PasswordIsNull; +} NETUSEADD_MSG, *PNETUSEADD_MSG; + +typedef struct _NETUSEADD_DATA { + TCHAR Server[UNCLEN]; + TCHAR Local[DEVLEN]; + TCHAR Remote[RMLEN]; + TCHAR Password[PWLEN]; +} NETUSEADD_DATA, *PNETUSEADD_DATA; + +typedef struct _NETUSEDEL_MSG { + ULONG Force; +} NETUSEDEL_MSG, *PNETUSEDEL_MSG; + +typedef struct _NETUSEDEL_DATA { + TCHAR Server[UNCLEN]; + TCHAR UseName[RMLEN]; +} NETUSEDEL_DATA, *PNETUSEDEL_DATA; + +typedef struct _NETUSEENUM_MSG { + ULONG Level; + ULONG ResumeHandle; + ULONG EntriesRead; + ULONG TotalAvail; +} NETUSEENUM_MSG, *PNETUSEENUM_MSG; + +typedef struct _NETUSEENUM_DATA { + TCHAR Server[UNCLEN]; +} NETUSEENUM_DATA, *PNETUSEENUM_DATA; + +typedef struct _NETUSEGETINFO_MSG { + ULONG Level; +} NETUSEGETINFO_MSG, *PNETUSEGETINFO_MSG; + +typedef struct _NETUSEGETINFO_DATA { + TCHAR Server[UNCLEN]; + TCHAR UseName[RMLEN]; +} NETUSEGETINFO_DATA, *PNETUSEGETINFO_DATA; + +typedef struct _NETUSERENUM_MSG { + ULONG Level; + ULONG ResumeHandle; + ULONG EntriesRead; + ULONG TotalAvail; +} NETUSERENUM_MSG, *PNETUSERENUM_MSG; + +typedef struct _NETUSERENUM_DATA { + WCHAR Server[UNCLEN]; +} NETUSERENUM_DATA, *PNETUSERENUM_DATA; + +typedef struct _NETUSERGETINFO_MSG { + ULONG Level; +} NETUSERGETINFO_MSG, *PNETUSERGETINFO_MSG; + +typedef struct _NETUSERGETINFO_DATA { + WCHAR Server[UNCLEN]; + WCHAR UserName[UNLEN]; +} NETUSERGETINFO_DATA, *PNETUSERGETINFO_DATA; + +typedef struct _NETWKSTAGETINFO_MSG { + ULONG Level; +} NETWKSTAGETINFO_MSG, *PNETWKSTAGETINFO_MSG; + +typedef struct _NETWKSTAGETINFO_DATA { + TCHAR Server[UNCLEN]; +} NETWKSTAGETINFO_DATA, *PNETWKSTAGETINFO_DATA; + +typedef struct _NETSHAREENUM_MSG { + ULONG Level; + ULONG ResumeHandle; + ULONG EntriesRead; + ULONG TotalAvail; +} NETSHAREENUM_MSG, *PNETSHAREENUM_MSG; + +typedef struct _NETSHAREENUM_DATA { + TCHAR Server[UNCLEN]; +} NETSHAREENUM_DATA, *PNETSHAREENUM_DATA; + +typedef struct _NETSHAREGETINFO_MSG { + ULONG Level; +} NETSHAREGETINFO_MSG, *PNETSHAREGETINFO_MSG; + +typedef struct _NETSHAREGETINFO_DATA { + TCHAR Server[UNCLEN]; + TCHAR NetName[NNLEN]; +} NETSHAREGETINFO_DATA, *PNETSHAREGETINFO_DATA; + +typedef struct _NETSERVERDISKENUM_MSG { + ULONG Level; + ULONG ResumeHandle; + ULONG EntriesRead; + ULONG TotalAvail; +} NETSERVERDISKENUM_MSG, *PNETSERVERDISKENUM_MSG; + +typedef struct _NETSERVERDISKENUM_DATA { + TCHAR Server[UNCLEN]; +} NETSERVERDISKENUM_DATA, *PNETSERVERDISKENUM_DATA; + +typedef struct _NETSERVERGETINFO_MSG { + ULONG Level; +} NETSERVERGETINFO_MSG, *PNETSERVERGETINFO_MSG; + +typedef struct _NETSERVERGETINFO_DATA { + TCHAR Server[UNCLEN]; + TCHAR Name[CNLEN]; + TCHAR Comment[CNLEN]; +} NETSERVERGETINFO_DATA, *PNETSERVERGETINFO_DATA; + +typedef struct _NETSERVERENUM2_MSG { + ULONG Level; + ULONG ResumeHandle; + ULONG EntriesRead; + ULONG TotalAvail; + ULONG ServerType; +} NETSERVERENUM2_MSG, *PNETSERVERENUM2_MSG; + +typedef struct _NETSERVERENUM2_DATA { + TCHAR Server[UNCLEN]; + TCHAR Domain[CNLEN]; +} NETSERVERENUM_DATA, *PNETSERVERENUM2_DATA; + +typedef struct _NETSERVICECONTROL_MSG { + ULONG OpCode; + ULONG Arg; +} NETSERVICECONTROL_MSG, *PNETSERVICECONTROL_MSG; + +typedef struct _NETSERVICECONTROL_DATA { + TCHAR Server[UNCLEN]; + TCHAR Service[SNLEN]; +} NETSERVICECONTROL_DATA, *PNETSERVICECONTROL_DATA; + +typedef struct _NETSERVICEENUM_MSG { + ULONG Level; + ULONG ResumeHandle; + ULONG EntriesRead; + ULONG TotalAvail; +} NETSERVICEENUM_MSG, *PNETSERVICEENUM_MSG; + +typedef struct _NETSERVICEENUM_DATA { + TCHAR Server[UNCLEN]; +} NETSERVICEENUM_DATA, *PNETSERVICEENUM_DATA; + +typedef struct _NETSERVICEGETINFO_MSG { + ULONG Level; +} NETSERVICEGETINFO_MSG, *PNETSERVICEGETINFO_MSG; + +typedef struct _NETSERVICEGETINFO_DATA { + TCHAR Server[UNCLEN]; + TCHAR Service[SNLEN]; +} NETSERVICEGETINFO_DATA, *PNETSERVICEGETINFO_DATA; + +typedef struct _NETSERVICEINSTALL_MSG { + ULONG Argc; +} NETSERVICEINSTALL_MSG, *PNETSERVICEINSTALL_MSG; + +typedef struct _NETSERVICEINSTALL_DATA { + TCHAR Server[UNCLEN]; + TCHAR Service[SNLEN]; + TCHAR *CmdArgs; +} NETSERVICEINSTALL_DATA, *PNETSERVICEINSTALL_DATA; + +typedef struct _NETGETDCNAME_MSG { + ULONG Dummy; +} NETGETDCNAME_MSG, *PNETGETDCNAME_MSG; + +typedef struct _NETGETDCNAME_DATA { + WCHAR Server[UNCLEN]; + WCHAR Domain[DNLEN]; +} NETGETDCNAME_DATA, *PNETGETDCNAME_DATA; + +typedef struct _NETACCESSADD_MSG { + ULONG Level; +} NETACCESSADD_MSG, *PNETACCESSADD_MSG; + +typedef struct _NETACCESSADD_DATA { + TCHAR Server[UNCLEN]; + ACCESS_INFO_1 AccessInfo; +} NETACCESSADD_DATA, *PNETACCESSADD_DATA; + +typedef struct _NETACCESSSETINFO_MSG { + ULONG Level; + ACCESS_INFO_1002 AccessInfo1002; +} NETACCESSSETINFO_MSG, *PNETACCESSSETINFO_MSG; + +typedef struct _NETACCESSSETINFO_DATA { + TCHAR Server[UNCLEN]; + TCHAR Resource[NNLEN]; + ACCESS_INFO_1 AccessInfo; +} NETACCESSSETINFO_DATA, *PNETACCESSSETINFO_DATA; + +typedef struct _NETACCESSDEL_MSG { + ULONG Dummy; +} NETACCESSDEL_MSG, *PNETACCESSDEL_MSG; + +typedef struct _NETACCESSDEL_DATA { + TCHAR Server[UNCLEN]; + TCHAR Resource[NNLEN]; +} NETACCESSDEL_DATA, *PNETACCESSDEL_DATA; + +typedef struct _NETSHAREADD_MSG { + ULONG Level; +} NETSHAREADD_MSG, *PNETSHAREADD_MSG; + +typedef struct _NETSHAREADD_DATA { + TCHAR Server[UNCLEN]; + SHARE_INFO_2 ShareInfo; +} NETSHAREADD_DATA, *PNETSHAREADD_DATA; + +typedef struct _NETSHAREDEL_MSG { + ULONG Dummy; +} NETSHAREDEL_MSG, *PNETSHAREDEL_MSG; + +typedef struct _NETSHAREDEL_DATA { + TCHAR Server[UNCLEN]; + TCHAR NetName[NNLEN]; +} NETSHAREDEL_DATA, *PNETSHAREDEL_DATA; + +typedef struct _NETBIOS_MSG { + ULONG NCB_Address; +} NETBIOS_MSG, *PNETBIOS_MSG; + +typedef struct _NETBIOS_DATA { + NCB Ncb; +} NETBIOS_DATA, *PNETBIOS_DATA; + +typedef union _NETMSG { + NETUSEADD_MSG NetUseAdd_Msg; + NETUSEDEL_MSG NetUseDel_Msg; + NETUSEENUM_MSG NetUseEnum_Msg; + NETUSEGETINFO_MSG NetUseGetInfo_Msg; + NETUSERENUM_MSG NetUserEnum_Msg; + NETUSERGETINFO_MSG NetUserGetInfo_Msg; + NETWKSTAGETINFO_MSG NetWkstaGetInfo_Msg; + NETSHAREENUM_MSG NetShareEnum_Msg; + NETSHAREGETINFO_MSG NetShareGetInfo_Msg; + NETSERVERDISKENUM_MSG NetServerDiskEnum_Msg; + NETSERVERGETINFO_MSG NetServerGetInfo_Msg; + NETSERVERENUM2_MSG NetServerEnum2_Msg; + NETSERVICECONTROL_MSG NetServiceControl_Msg; + NETSERVICEENUM_MSG NetServiceEnum_Msg; + NETSERVICEGETINFO_MSG NetServiceGetInfo_Msg; + NETSERVICEINSTALL_MSG NetServiceInstall_Msg; + NETGETDCNAME_MSG NetGetDCName_Msg; + NETACCESSADD_MSG NetAccessAdd_Msg; + NETACCESSSETINFO_MSG NetAccessSetInfo_Msg; + NETACCESSDEL_MSG NetAccessDel_Msg; + NETSHAREADD_MSG NetShareAdd_Msg; + NETSHAREDEL_MSG NetShareDel_Msg; + NETBIOS_MSG NetBios_Msg; +} NETMSG, *PNETMSG; + +*/ + +#endif diff --git a/private/os2/inc/os2.h b/private/os2/inc/os2.h new file mode 100644 index 000000000..e92adf5d5 --- /dev/null +++ b/private/os2/inc/os2.h @@ -0,0 +1,98 @@ +/*static char *SCCSID = "@(#)os2.h 13.5 89/06/12";*/ +/****************************** Module Header ******************************\ +* +* Module Name: OS2.H +* +* This is the top level include file that includes all the files necessary +* for writing an OS/2 application. +* +* Copyright (c) 1987 Microsoft Corporation +* Copyright (c) 1987 IBM Corporation +* +\***************************************************************************/ + +#define OS2_INCLUDED +#define OS2_API32 + +#ifdef NO_EXT_KEYS +#define _syscall +#define based +#define near +#define far +#define cdecl +#endif // NO_EXT_KEYS + +/* Common definitions */ + +#include <ntdef.h> + +/* OS/2 Base Include File */ + +#include <os2v20.h> + +/* OS/2 Presentation Manager Include File */ + +// NOT INCLUDED FOR NOW - #include <pm.h> + + +// +// If debugging support enabled, define an ASSERT macro that works. Otherwise +// define the ASSERT macro to expand to an empty expression. +// + +#if DBG +VOID +RtlAssert( + IN PVOID FailedAssertion, + IN PVOID FileName, + IN ULONG LineNumber + ); + +#define ASSERT( exp ) \ + if (!(exp)) \ + RtlAssert( #exp, __FILE__, __LINE__ ) + +#else +#define ASSERT( exp ) +#endif // DBG + + +// +// Fast primitives to zero and move memory +// + +VOID +RtlZeroMemory ( + IN PVOID Destination, + IN ULONG Length + ); + +VOID +RtlMoveMemory ( + IN PVOID Destination, + IN PVOID Source, + IN ULONG Length + ); + + +// +// Debugging support functions. +// + +VOID +RtlCommandLineInterpreter( + PCH Prompt, + PCH DefaultVariableVector[] OPTIONAL, + PCH InitialCommandLine OPTIONAL + ); + +VOID +DbgBreakPoint( + VOID + ); + +VOID +DbgCommand( + PCH Command, + ULONG Parameter + ); diff --git a/private/os2/inc/os2crt.h b/private/os2/inc/os2crt.h new file mode 100644 index 000000000..26eb5882b --- /dev/null +++ b/private/os2/inc/os2crt.h @@ -0,0 +1,23 @@ +/*++ + +Copyright (c) 1989 Microsoft Corporation + +Module Name: + + os2ssrtl.h + +Abstract: + + Redefine names of CRT functions + +--*/ + +#ifndef _OS2_RENAME_RUNTIME +#define _OS2_RENAME_RUNTIME +#define stricmp _stricmp +#define strnicmp _strnicmp +#define strupr _strupr +#define itoa _itoa +#define ltoa _ltoa +#endif // _OS2_RENAME_RUNTIME + diff --git a/private/os2/inc/os2dbg.h b/private/os2/inc/os2dbg.h new file mode 100644 index 000000000..12e4e18ca --- /dev/null +++ b/private/os2/inc/os2dbg.h @@ -0,0 +1,129 @@ +/*++ + +Copyright (c) 1989 Microsoft Corporation + +Module Name: + + os2dbg.h + +Abstract: + + Debug constants + +Author: + + Steve Wood (stevewo) 22-Aug-1989 + +Revision History: + + Yaron Shamir 4-Apr-91 Add profile for ComputeValidDrives. + Beni Lavi 4-Oct-91 Moved debug constants from os2srv.h and os2dll.h + to this file. + Michael Jaruys 3-Jan-93 Move all Debug macro to this file and + make sure be don't have DbgPrint in retail code. +--*/ + + +// +// Define debugging flag as false if not defined already. +// + +#ifndef DBG +#define DBG 0 +#endif + +#if DBG + +#define OS2_DEBUG_TASKING 0x00000001 +#define OS2_DEBUG_FILESYS 0x00000002 +#define OS2_DEBUG_FSD 0x00000004 +#define OS2_DEBUG_MEMORY 0x00000008 +#define OS2_DEBUG_SEMAPHORES 0x00000010 +#define OS2_DEBUG_TIMERS 0x00000020 +#define OS2_DEBUG_LOADER 0x00000040 +#define OS2_DEBUG_NLS 0x00000080 +#define OS2_DEBUG_EXCEPTIONS 0x00000100 +#define OS2_DEBUG_ERRORMSG 0x00000200 +#define OS2_DEBUG_SESSIONMGR 0x00000400 +#define OS2_DEBUG_DEVICE_SUPPORT 0x00000800 +#define OS2_DEBUG_PIPES 0x00001000 +#define OS2_DEBUG_QUEUES 0x00002000 +#define OS2_DEBUG_INIT 0x00004000 +#define OS2_DEBUG_LPC 0x00008000 +#define OS2_DEBUG_CLEANUP 0x00010000 +#define OS2_DEBUG_FILESYSLOCK 0x00020000 +#define OS2_DEBUG_APIS 0x00040000 +#define OS2_DEBUG_BRK 0x00080000 +#define OS2_DEBUG_SIG 0x00100000 +#define OS2_DEBUG_VIO 0x00200000 +#define OS2_DEBUG_KBD 0x00400000 +#define OS2_DEBUG_MOU 0x00800000 +#define OS2_DEBUG_MON 0x01000000 +#define OS2_DEBUG_ALL_VIO 0x02000000 +/* For temporary messages, i.e used for a few debug + sessions. Such printings may be removed by anyone + who sees them. */ +#define OS2_DEBUG_TEMP 0x04000000 +#define OS2_DEBUG_OS2_EXE 0x08000000 +#define OS2_DEBUG_NET 0x10000000 +#define OS2_DEBUG_WIN 0x20000000 +#define OS2_DEBUG_MISC 0x80000000 +#define OS2_DEBUG_ANY 0xFFFFFFFF + +//#define OS2_DEBUG_ALL_VIO ( OS2_DEBUG_VIO | OS2_DEBUG_KBD | OS2_DEBUG_MOU | OS2_DEBUG_MON ) +#define OS2_DEBUG_VIO_FILE ( OS2_DEBUG_VIO | OS2_DEBUG_FILESYS ) +#define OS2_DEBUG_VIO_KBD_FILE ( OS2_DEBUG_VIO | OS2_DEBUG_KBD | OS2_DEBUG_FILESYS ) +#define OS2_DEBUG_KBD_FILE ( OS2_DEBUG_KBD | OS2_DEBUG_FILESYS ) +#define OS2_DEBUG_MOU_FILE ( OS2_DEBUG_MOU | OS2_DEBUG_FILESYS ) + +// +// Define IF_DEBUG macro that can be used to enable debugging code that is +// optimized out if the debugging flag is false. +// + +#define IF_OD2_DEBUG( ComponentFlag ) \ + if (Os2Debug & (OS2_DEBUG_ ## ComponentFlag)) + +#define IF_OD2_DEBUG2( Component1Flag, Component2Flag ) \ + if (Os2Debug & ((OS2_DEBUG_ ## Component1Flag) | (OS2_DEBUG_ ## Component2Flag))) + +#define IF_OD2_DEBUG3( Component1Flag, Component2Flag, Component3Flag ) \ + if (Os2Debug & ((OS2_DEBUG_ ## Component1Flag) | (OS2_DEBUG_ ## Component2Flag) | \ + (OS2_DEBUG_ ## Component3Flag))) + +#define IF_OS2_DEBUG( ComponentFlag ) \ + if (Os2Debug & (OS2_DEBUG_ ## ComponentFlag)) + +#define IF_OS2_DEBUG2( Component1Flag, Component2Flag ) \ + if (Os2Debug & ((OS2_DEBUG_ ## Component1Flag) | (OS2_DEBUG_ ## Component2Flag))) + +#define IF_OS2_DEBUG3( Component1Flag, Component2Flag, Component3Flag ) \ + if (Os2Debug & ((OS2_DEBUG_ ## Component1Flag) | (OS2_DEBUG_ ## Component2Flag) | \ + (OS2_DEBUG_ ## Component3Flag))) + +#else + + + /* + * Make sure be don't have DbgPrint in retail code + */ + +#ifndef PMNT +#ifdef DbgPrint +#undef DbgPrint +#endif // ifdef DbgPrint + +#define DbgPrint(_x_) \ + Or2DbgPrintFunctionNeverExisted(_x_) +#endif // PMNT + +//Dbg_Print_must_be_within_if_DBG_and_cannot_included_in_retail_code + +#define IF_OD2_DEBUG( ComponentFlag ) if (FALSE) +#define IF_OD2_DEBUG2( Component1Flag, Component2Flag ) if (FALSE) +#define IF_OD2_DEBUG3( Component1Flag, Component2Flag, Component3Flag ) if (FALSE) +#define IF_OS2_DEBUG( ComponentFlag ) if (FALSE) +#define IF_OS2_DEBUG2( Component1Flag, Component2Flag ) if (FALSE) +#define IF_OS2_DEBUG3( Component1Flag, Component2Flag, Component3Flag ) if (FALSE) + +#endif // DBG diff --git a/private/os2/inc/os2dev.h b/private/os2/inc/os2dev.h new file mode 100644 index 000000000..bdff65026 --- /dev/null +++ b/private/os2/inc/os2dev.h @@ -0,0 +1,522 @@ +/**************************************************************************\ +* +* Module Name: BSEDEV.H +* +* OS/2 Structures and constants for use with DosDevIOCtl +* +* Copyright (c) 1989-1990, Microsoft Corporation. All rights reserved. +* +\**************************************************************************/ + +#define BSEDEV_INCLUDED + +/* Input and Output Control Categories */ + +#define IOCTL_ASYNC 0x0001 +#define IOCTL_SCR_AND_PTRDRAW 0x0003 +#define IOCTL_KEYBOARD 0x0004 +#define IOCTL_PRINTER 0x0005 +#define IOCTL_LIGHTPEN 0x0006 +#define IOCTL_POINTINGDEVICE 0x0007 +#define IOCTL_DISK 0x0008 +#define IOCTL_PHYSICALDISK 0x0009 +#define IOCTL_MONITOR 0x000A +#define IOCTL_GENERAL 0x000B + +/* Serial-Device Control */ + +#define ASYNC_SETBAUDRATE 0x0041 +#define ASYNC_SETLINECTRL 0x0042 +#define ASYNC_TRANSMITIMM 0x0044 +#define ASYNC_SETBREAKOFF 0x0045 +#define ASYNC_SETMODEMCTRL 0x0046 +#define ASYNC_SETBREAKON 0x004B +#define ASYNC_STOPTRANSMIT 0x0047 +#define ASYNC_STARTTRANSMIT 0x0048 +#define ASYNC_SETDCBINFO 0x0053 +#define ASYNC_GETBAUDRATE 0x0061 +#define ASYNC_GETLINECTRL 0x0062 +#define ASYNC_GETCOMMSTATUS 0x0064 +#define ASYNC_GETLINESTATUS 0x0065 +#define ASYNC_GETMODEMOUTPUT 0x0066 +#define ASYNC_GETMODEMINPUT 0x0067 +#define ASYNC_GETINQUECOUNT 0x0068 +#define ASYNC_GETOUTQUECOUNT 0x0069 +#define ASYNC_GETCOMMERROR 0x006D +#define ASYNC_GETCOMMEVENT 0x0072 +#define ASYNC_GETDCBINFO 0x0073 + +/* Screen/Pointer-Draw Control */ + +#define SCR_ALLOCLDT 0x0070 +#define SCR_DEALLOCLDT 0x0071 +#define PTR_GETPTRDRAWADDRESS 0x0072 +#define SCR_ALLOCLDTOFF 0x0075 + +/* Keyboard Control */ + +#define KBD_SETTRANSTABLE 0x0050 +#define KBD_SETINPUTMODE 0x0051 +#define KBD_SETINTERIMFLAG 0x0052 +#define KBD_SETSHIFTSTATE 0x0053 +#define KBD_SETTYPAMATICRATE 0x0054 +#define KBD_SETFGNDSCREENGRP 0x0055 +#define KBD_SETSESMGRHOTKEY 0x0056 +#define KBD_SETFOCUS 0x0057 +#define KBD_SETKCB 0x0058 +#define KBD_SETNLS 0x005C +#define KBD_CREATE 0x005D +#define KBD_DESTROY 0x005E +#define KBD_GETINPUTMODE 0x0071 +#define KBD_GETINTERIMFLAG 0x0072 +#define KBD_GETSHIFTSTATE 0x0073 +#define KBD_READCHAR 0x0074 +#define KBD_PEEKCHAR 0x0075 +#define KBD_GETSESMGRHOTKEY 0x0076 +#define KBD_GETKEYBDTYPE 0x0077 +#define KBD_GETCODEPAGEID 0x0078 +#define KBD_XLATESCAN 0x0079 +#if PMNT +#define KBD_GETHARDWAREID 0x007A // Called by InitKeyboard(), PMWIN +#define KBD_GETCPANDCOUNTRY 0x007B // Called by InitKeyboard(), PMWIN + // (the name is my invention - PatrickQ) +#endif + +/* Printer Control */ + +#define PRT_SETFRAMECTL 0x0042 +#define PRT_SETINFINITERETRY 0x0044 +#define PRT_INITPRINTER 0x0046 +#define PRT_ACTIVATEFONT 0x0048 +#define PRT_GETFRAMECTL 0x0062 +#define PRT_GETINFINITERETRY 0x0064 +#define PRT_GETPRINTERSTATUS 0x0066 +#define PRT_QUERYACTIVEFONT 0x0069 +#define PRT_VERIFYFONT 0x006A + +/* Pointing-Device (Mouse) Control */ + +#define MOU_ALLOWPTRDRAW 0x0050 +#define MOU_UPDATEDISPLAYMODE 0x0051 +#define MOU_SCREENSWITCH 0x0052 +#define MOU_SETSCALEFACTORS 0x0053 +#define MOU_SETEVENTMASK 0x0054 +#define MOU_SETHOTKEYBUTTON 0x0055 +#define MOU_SETPTRSHAPE 0x0056 +#define MOU_DRAWPTR 0x0057 +#define MOU_REMOVEPTR 0x0058 +#define MOU_SETPTRPOS 0x0059 +#define MOU_SETPROTDRAWADDRESS 0x005A +#define MOU_SETREALDRAWADDRESS 0x005B +#define MOU_SETMOUSTATUS 0x005C +#define MOU_DISPLAYMODECHANGE 0x005D +#define MOU_GETBUTTONCOUNT 0x0060 +#define MOU_GETMICKEYCOUNT 0x0061 +#define MOU_GETMOUSTATUS 0x0062 +#define MOU_READEVENTQUE 0x0063 +#define MOU_GETQUESTATUS 0x0064 +#define MOU_GETEVENTMASK 0x0065 +#define MOU_GETSCALEFACTORS 0x0066 +#define MOU_GETPTRPOS 0x0067 +#define MOU_GETPTRSHAPE 0x0068 +#define MOU_GETHOTKEYBUTTON 0x0069 +#define MOU_VER 0x006A + +/* Disk/Diskette Control */ + +#define DSK_LOCKDRIVE 0x0000 +#define DSK_UNLOCKDRIVE 0x0001 +#define DSK_REDETERMINEMEDIA 0x0002 +#define DSK_SETLOGICALMAP 0x0003 +#define DSK_BLOCKREMOVABLE 0x0020 +#define DSK_GETLOGICALMAP 0x0021 +#define DSK_SETDEVICEPARAMS 0x0043 +#define DSK_WRITETRACK 0x0044 +#define DSK_FORMATVERIFY 0x0045 +#define DSK_GETDEVICEPARAMS 0x0063 +#define DSK_READTRACK 0x0064 +#define DSK_VERIFYTRACK 0x0065 + +/* Physical-Disk Control */ + +#define PDSK_LOCKPHYSDRIVE 0x0000 +#define PDSK_UNLOCKPHYSDRIVE 0x0001 +#define PDSK_WRITEPHYSTRACK 0x0044 +#define PDSK_GETPHYSDEVICEPARAMS 0x0063 +#define PDSK_READPHYSTRACK 0x0064 +#define PDSK_VERIFYPHYSTRACK 0x0065 + +/* Character-Monitor Control */ + +#define MON_REGISTERMONITOR 0x0040 + +/* General Device Control */ + +#define DEV_FLUSHINPUT 0x0001 +#define DEV_FLUSHOUTPUT 0x0002 +#define DEV_QUERYMONSUPPORT 0x0060 + + +/* ASYNC_GETCOMMERROR, ASYNC_SETBREAKOFF, ASYNC_SETBREAKON, + * ASYNC_SETMODEMCTRL + */ + +#define RX_QUE_OVERRUN 0x0001 +#define RX_HARDWARE_OVERRUN 0x0002 +#define PARITY_ERROR 0x0004 +#define FRAMING_ERROR 0x0008 + +/* ASYNC_GETCOMMEVENT */ + +#define CHAR_RECEIVED 0x0001 +#define LAST_CHAR_SENT 0x0004 +#define CTS_CHANGED 0x0008 +#define DSR_CHANGED 0x0010 +#define DCD_CHANGED 0x0020 +#define BREAK_DETECTED 0x0040 +#define ERROR_OCCURRED 0x0080 +#define RI_DETECTED 0x0100 + +/* ASYNC_GETCOMMSTATUS */ + +#define TX_WAITING_FOR_CTS 0x0001 +#define TX_WAITING_FOR_DSR 0x0002 +#define TX_WAITING_FOR_DCD 0x0004 +#define TX_WAITING_FOR_XON 0x0008 +#define TX_WAITING_TO_SEND_XON 0x0010 +#define TX_WAITING_WHILE_BREAK_ON 0x0020 +#define TX_WAITING_TO_SEND_IMM 0x0040 +#define RX_WAITING_FOR_DSR 0x0080 + +/* ASYNC_GETLINESTATUS */ + +#define WRITE_REQUEST_QUEUED 0x0001 +#define DATA_IN_TX_QUE 0x0002 +#define HARDWARE_TRANSMITTING 0x0004 +#define CHAR_READY_TO_SEND_IMM 0x0008 +#define WAITING_TO_SEND_XON 0x0010 +#define WAITING_TO_SEND_XOFF 0x0020 + +/* ASYNC_GETMODEMINPUT */ + +#define CTS_ON 0x10 +#define DSR_ON 0x20 +#define RI_ON 0x40 +#define DCD_ON 0x80 + +/* DSK_SETDEVICEPARAMS */ + +#define BUILD_BPB_FROM_MEDIUM 0x00 +#define REPLACE_BPB_FOR_DEVICE 0x01 +#define REPLACE_BPB_FOR_MEDIUM 0x02 + +/* KBD_GETINPUTMODE, KBD_PEEKCHAR, KBD_SETINPUTMODE*/ + +#define ASCII_MODE 0x00 +#define BINARY_MODE 0x80 + +/* KBD_GETINTERIMFLAG */ + +#define CONVERSION_REQUEST 0x20 +#define INTERIM_CHAR 0x80 + +/* KBD_GETSESMGRHOTKEY */ + +#define HOTKEY_MAX_COUNT 0x0000 +#define HOTKEY_CURRENT_COUNT 0x0001 + +/* KBD_PEEKCHAR */ + +#define KBD_DATA_RECEIVED 0x0001 +#define KBD_DATA_BINARY 0x8000 + +/* KBD_READCHAR */ + +#define KBD_READ_WAIT 0x0000 +#define KBD_READ_NOWAIT 0x8000 + +/* KBD_SETINPUTMODE */ + +#define SHIFT_REPORT_MODE 0x01 + +#ifndef INCL_MOU + +#define MOUSE_MOTION 0x0001 +#define MOUSE_MOTION_WITH_BN1_DOWN 0x0002 +#define MOUSE_BN1_DOWN 0x0004 +#define MOUSE_MOTION_WITH_BN2_DOWN 0x0008 +#define MOUSE_BN2_DOWN 0x0010 +#define MOUSE_MOTION_WITH_BN3_DOWN 0x0020 +#define MOUSE_BN3_DOWN 0x0040 + +#define MHK_BUTTON1 0x0001 +#define MHK_BUTTON2 0x0002 +#define MHK_BUTTON3 0x0004 + +#ifndef MOU_NOWAIT +#define MOU_NOWAIT 0x0000 +#endif +#ifndef MOU_WAIT +#define MOU_WAIT 0x0001 +#endif + +#endif /* #ifndef INCL_MOU */ + +/* MOU_GETHOTKEYBUTTON, MOU_SETHOTKEYBUTTON */ + +#define MHK_NO_HOTKEY 0x0000 + +/* MOU_GETMOUSTATUS */ + +#define MOUSE_QUEUEBUSY 0x0001 +#define MOUSE_BLOCKREAD 0x0002 +#define MOUSE_FLUSH 0x0004 +#define MOUSE_UNSUPPORTED_MODE 0x0008 +#define MOUSE_DISABLED 0x0100 +#define MOUSE_MICKEYS 0x0200 + +/* PRT_GETPRINTERSTATUS */ + +#define PRINTER_TIMEOUT 0x0001 +#define PRINTER_IO_ERROR 0x0008 +#define PRINTER_SELECTED 0x0010 +#define PRINTER_OUT_OF_PAPER 0x0020 +#define PRINTER_ACKNOWLEDGED 0x0040 +#define PRINTER_NOT_BUSY 0x0080 + +/* fbCtlHndShake */ + +#define MODE_DTR_CONTROL 0x01 +#define MODE_DTR_HANDSHAKE 0x02 +#define MODE_CTS_HANDSHAKE 0x08 +#define MODE_DSR_HANDSHAKE 0x10 +#define MODE_DCD_HANDSHAKE 0x20 +#define MODE_DSR_SENSITIVITY 0x40 + +/* fbFlowReplace */ + +#define MODE_AUTO_TRANSMIT 0x01 +#define MODE_AUTO_RECEIVE 0x02 +#define MODE_ERROR_CHAR 0x04 +#define MODE_NULL_STRIPPING 0x08 +#define MODE_BREAK_CHAR 0x10 +#define MODE_RTS_CONTROL 0x40 +#define MODE_RTS_HANDSHAKE 0x80 +#define MODE_TRANSMIT_TOGGLE 0xC0 + +/* fbTimeout */ + +#define MODE_NO_WRITE_TIMEOUT 0x01 +#define MODE_READ_TIMEOUT 0x02 +#define MODE_WAIT_READ_TIMEOUT 0x04 +#define MODE_NOWAIT_READ_TIMEOUT 0x06 + +#pragma pack(1) + +typedef struct _DCBINFO { /* dcbinf */ + USHORT usWriteTimeout; + USHORT usReadTimeout; + BYTE fbCtlHndShake; + BYTE fbFlowReplace; + BYTE fbTimeout; + BYTE bErrorReplacementChar; + BYTE bBreakReplacementChar; + BYTE bXONChar; + BYTE bXOFFChar; +} DCBINFO, *PDCBINFO; + +typedef struct _TRACKLAYOUT { /* trckl */ + BYTE bCommand; + USHORT usHead; + USHORT usCylinder; + USHORT usFirstSector; + USHORT cSectors; + struct { + USHORT usSectorNumber; + USHORT usSectorSize; + } TrackTable[1]; +} TRACKLAYOUT, *PTRACKLAYOUT; + +#define DEVTYPE_48TPI 0x0000 +#define DEVTYPE_96TPI 0x0001 +#define DEVTYPE_35 0x0002 +#define DEVTYPE_8SD 0x0003 +#define DEVTYPE_8DD 0x0004 +#define DEVTYPE_FIXED 0x0005 +#define DEVTYPE_TAPE 0x0006 +#define DEVTYPE_UNKNOWN 0x0007 + +typedef struct _BIOSPARAMETERBLOCK { /* bspblk */ + USHORT usBytesPerSector; + BYTE bSectorsPerCluster; + USHORT usReservedSectors; + BYTE cFATs; + USHORT cRootEntries; + USHORT cSectors; + BYTE bMedia; + USHORT usSectorsPerFAT; + USHORT usSectorsPerTrack; + USHORT cHeads; + ULONG cHiddenSectors; + ULONG cLargeSectors; + BYTE abReserved[6]; + USHORT cCylinders; + BYTE bDeviceType; + USHORT fsDeviceAttr; +} BIOSPARAMETERBLOCK, *PBIOSPARAMETERBLOCK; + +typedef struct _SCREENGROUP { /* scrgrp */ + USHORT idScreenGrp; + USHORT fTerminate; +} SCREENGROUP, *PSCREENGROUP; + +typedef struct _FRAME { /* frm */ + BYTE bCharsPerLine; + BYTE bLinesPerInch; +} FRAME, *PFRAME; + +typedef struct _KBDTYPE { /* kbdtyp */ + USHORT usType; + USHORT reserved1; + USHORT reserved2; +} KBDTYPE, *PKBDTYPE; + +typedef struct _LINECONTROL { /* lnctl */ + BYTE bDataBits; + BYTE bParity; + BYTE bStopBits; + BYTE fTransBreak; +} LINECONTROL, *PLINECONTROL; + +/* MODEMSTATUS.fbModemOn, ASYNC_GETMODEMOUTPUT */ + +#define DTR_ON 0x01 +#define RTS_ON 0x02 + +/* MODEMSTATUS.fbModemOff */ + +#define DTR_OFF 0xFE +#define RTS_OFF 0xFD + +typedef struct _MODEMSTATUS { /* mdmst */ + BYTE fbModemOn; + BYTE fbModemOff; +} MODEMSTATUS, *PMODEMSTATUS; + +typedef struct _TRACKFORMAT { /* trckfmt */ + BYTE bCommand; + USHORT usHead; + USHORT usCylinder; + USHORT usReserved; + USHORT cSectors; + struct { + BYTE bCylinder; + BYTE bHead; + BYTE idSector; + BYTE bBytesSector; + } FormatTable[1]; +} TRACKFORMAT, *PTRACKFORMAT; + +typedef struct _RXQUEUE { /* rxq */ + USHORT cch; + USHORT cb; +} RXQUEUE, *PRXQUEUE; + +typedef struct _DEVICEPARAMETERBLOCK { /* dvpblck */ + USHORT reserved1; + USHORT cCylinders; + USHORT cHeads; + USHORT cSectorsPerTrack; + USHORT reserved2; + USHORT reserved3; + USHORT reserved4; + USHORT reserved5; +} DEVICEPARAMETERBLOCK, *PDEVICEPARAMETERBLOCK; + +#ifndef PFN +typedef int (*PFN)(); +#endif + +typedef struct _PTRDRAWFUNCTION { /* ptrdfnc */ + USHORT usReturnCode; + PFN pfnDraw; + CHAR* pchDataSeg; +} PTRDRAWFUNCTION, *PPTRDRAWFUNCTION; + +typedef struct _PTRDRAWADDRESS { /* ptrdaddr */ + USHORT reserved; + PTRDRAWFUNCTION ptrdfnc; +} PTRDRAWADDRESS, *PPTRDRAWADDRESS; + +typedef struct _SHIFTSTATE { /* shftst */ + USHORT fsState; + BYTE fNLS; +} SHIFTSTATE, *PSHIFTSTATE; + +/* HOTKEY.fsHotKey/SHIFTSTATE.fsState */ + +//#define RIGHTSHIFT 0x0001 +//#define LEFTSHIFT 0x0002 +//#define CONTROL 0x0004 +//#define ALT 0x0008 +//#define SCROLLLOCK_ON 0x0010 +//#define NUMLOCK_ON 0x0020 +//#define CAPSLOCK_ON 0x0040 +//#define INSERT_ON 0x0080 +//#define LEFTCONTROL 0x0100 +//#define LEFTALT 0x0200 +//#define RIGHTCONTROL 0x0400 +//#define RIGHTALT 0x0800 +//#define SCROLLLOCK 0x1000 +//#define NUMLOCK 0x2000 +//#define CAPSLOCK 0x4000 +//#define SYSREQ 0x8000 + +typedef struct _HOTKEY { /* htky */ + USHORT fsHotKey; + UCHAR uchScancodeMake; + UCHAR uchScancodeBreak; + USHORT idHotKey; +} HOTKEY, *PHOTKEY; + +typedef struct _MONITORPOSITION { /* mnpos */ + USHORT fPosition; + USHORT index; + ULONG pbInBuf; + USHORT offOutBuf; +} MONITORPOSITION, *PMONITORPOSITION; + +typedef struct _RATEDELAY { /* rtdly */ + USHORT usDelay; + USHORT usRate; +} RATEDELAY, *PRATEDELAY; + +typedef struct _CODEPAGEINFO { /* cpi */ + PBYTE pbTransTable; + USHORT idCodePage; + USHORT idTable; +} CODEPAGEINFO, *PCODEPAGEINFO; + +typedef struct _CPID { /* cpid */ + USHORT idCodePage; + USHORT Reserved; +} CPID, *PCPID; + +typedef struct _LDTADDRINFO { /* ldtaddr */ + PULONG pulPhysAddr; + USHORT cb; +} LDTADDRINFO, *PLDTADDRINFO; + +typedef struct _PTRDRAWDATA { /* ptrdd */ + USHORT cb; + USHORT usConfig; + USHORT usFlag; +} PTRDRAWDATA, *PPTRDRAWDATA; + +typedef struct _FONTINFO { + USHORT idCodePage; + USHORT idFont; +} FONTINFO, *PFONTINFO; + +#pragma pack() + diff --git a/private/os2/inc/os2dll.h b/private/os2/inc/os2dll.h new file mode 100644 index 000000000..b290f13fa --- /dev/null +++ b/private/os2/inc/os2dll.h @@ -0,0 +1,1202 @@ +/*++ + +Copyright (c) 1989 Microsoft Corporation + +Module Name: + + os2dll.h + +Abstract: + + Main include file for OS/2 Subsystem Client DLL + +Author: + + Steve Wood (stevewo) 22-Aug-1989 + +Revision History: + +--*/ + +// +// Include OS/2 SubSystem Runtime Definitions. Includes NT Definitions +// OS/2 V2.0 Definitions and Debug definitions. +// + +#include "os2ssrtl.h" + +#if DBG +extern ULONG Os2Debug; +#endif + +// +// Include definitions of API Calls exported by the OS/2 Subsystem Server +// (i.e. the stub procedure definitions). +// +#include "dllfile.h" +#include "os2ssmsg.h" + + +// +// Common Types and Definitions +// + +// +// OD2_HEAP_MEMORY_SIZE defines how much address space should be +// reserved for the OS/2 Client heap. This heap is used to store all +// data structures maintained by the OS/2 Client DLL. +// + +#define OD2_HEAP_MEMORY_SIZE (64*1024) + + +// +// OD2_PORT_MEMORY_SIZE defines how much address space should be +// reserved for passing data to the OS/2 Server. The memory is visible +// to both the client and server processes. +// + +#define OD2_PORT_MEMORY_SIZE 0x10000 + + +// +// OD2_SEMAPHORE and its related types are the client represenation of OS/2 +// shared semaphores and the entire representation of private OS/2 semaphores. +// + +typedef enum _OD2_SEMAPHORE_TYPE { + Od2EventSem = 1, + Od2MutexSem, + Od2MuxWaitSem +} OD2_SEMAPHORE_TYPE; + +typedef struct _OD2_MUTEX_SEMAPHORE { + HANDLE MutantHandle; + ULONG OwnerRequestLevel; + TID OwnerTid; +} OD2_MUTEX_SEMAPHORE, *POD2_MUTEX_SEMAPHORE; + +typedef struct _OD2_MUXWAIT_RECORD { + HSEM SemHandle; + ULONG UserKey; + struct _OD2_SEMAPHORE *Semaphore; +} OD2_MUXWAIT_RECORD, *POD2_MUXWAIT_RECORD; + +typedef struct _OD2_MUXWAIT_SEMAPHORE { + USHORT CountMuxWaitRecords; + USHORT Type : 2; + USHORT WaitAll : 1; + USHORT Reserved : 13; + OD2_MUXWAIT_RECORD MuxWaitRecords[ DCMW_MAX_SEMRECORDS ]; +} OD2_MUXWAIT_SEMAPHORE, *POD2_MUXWAIT_SEMAPHORE; + +typedef struct _OD2_SEMAPHORE { + USHORT PointerCount : 13; + USHORT Type : 2; + USHORT Shared : 1; + USHORT OpenCount; + union { + PVOID Value; + HANDLE EventHandle; + POD2_MUTEX_SEMAPHORE Mutex; + POD2_MUXWAIT_SEMAPHORE MuxWait; + } u; +} OD2_SEMAPHORE, *POD2_SEMAPHORE; + +typedef struct _OD2_QUEUE { + ULONG OpenCount; + PID OwnerProcessId; +} OD2_QUEUE, *POD2_QUEUE; + +// +// The OD2_PROCESS and OD2_THREAD data structures describe the OS/2 Client +// process. Both data structures are allocated from the Od2Heap. +// + +typedef struct _OD2_PROCESS { + HANDLE TaskLock; + RTL_RESOURCE FileLock; + LIST_ENTRY ThreadList; + LIST_ENTRY ExitList; + RESULTCODES ResultCodes; // Valid if PS_EXITLIST is set in Pib.Status + ULONG ErrorAction; + ULONG VerifyFlag; + ULONG MaximumFileHandles; + ULONG DefaultDisk; + BOOLEAN BoundApp; + POR2_HANDLE_TABLE PrivateSemaphoreTable; + POR2_HANDLE_TABLE SharedSemaphoreTable; + POR2_QHANDLE_TABLE QueueTable; + LIST_ENTRY MsgFileList; + UCHAR ApplName[OS2_PROCESS_MAX_APPL_NAME]; + PIB Pib; // Make this the last field in the + // the structure so client cant inadvertantly + // muck with the other fields in OD2_PROCESS +} OD2_PROCESS, *POD2_PROCESS; + + + + +#define OD2_ENABLE_HARD_ERROR_POPUP 0x1 +#define OD2_ENABLE_ACCESS_VIO_POPUP 0x2 + +typedef struct _OD2_THREAD { + LIST_ENTRY Link; + PFNTHREAD StartAddress; // Used to pass startup information + ULONG Parameter; // ... to Od2UserThreadStartup + POD2_SEMAPHORE WaitingForSemaphore; + ULONG Saved32Esp; + ULONG ApiIndex; + HANDLE ThreadHandle; + HANDLE Event; // DosCreateThread use this event to get + // notification from the thread that it has + // be created and initialized + // DosSuspendThread use it to suspend thread in + // 32 bit + ULONG Flags; // Parameter of DosCreateThread + APIRET rc; // Return code of the thread during startup + // to DosCreateThread + OS2_TIB Os2Tib; // OS2 specific part of the TIB + // (subsystem portable part is in TEB) + // Make this the last field in the + // the structure so client can't inadvertantly + // muck with the other fields in OD2_THREAD +} OD2_THREAD, *POD2_THREAD; + + +typedef struct _OS2_EXITLISTENTRY { + LIST_ENTRY Link; + ULONG Order; + PFNEXITLIST ExitRoutine; + ULONG flag; +} OD2_EXITLISTENTRY, *POS2_EXITLISTENTRY; + +typedef struct _OD2_CONTEXT_SAVE_AREA { + LOCALINFOSEG TebBlock; + ULONG Saved16Stack; + BOOLEAN SignalHandlingInProgress; + USHORT SegEs; + USHORT SegDs; +} OD2_CONTEXT_SAVE_AREA, *POD2_CONTEXT_SAVE_AREA; + +#define Od2CurrentThreadId() \ + ( \ + ((POD2_THREAD)(NtCurrentTeb()->EnvironmentPointer)) ? \ + (((POD2_THREAD)(NtCurrentTeb()->EnvironmentPointer))->Os2Tib.ThreadId) : \ + 0 \ + ) + + +// +// The Lock field in an OS/2 Process object protects the fields of the process +// data structure. This includes the list of thread objects attached +// to the process object and the list of exit procedures. +// +// +// If the process is dieing, and there is only thread 1, there is no +// need for the lock, and we should not try it incase we terminated +// a thread inside (Acquire .. Release) block. +// +/* +#define AcquireTaskLock() \ + if ((!Od2SigHandlingInProgress) || ((Od2CurrentThreadId()) != 1)) \ + RtlEnterCriticalSection( &Od2Process->TaskLock ) +#define ReleaseTaskLock() \ + if ((!Od2SigHandlingInProgress) || ((Od2CurrentThreadId()) != 1)) \ + RtlLeaveCriticalSection( &Od2Process->TaskLock ) +*/ + +NTSTATUS AcquireTaskLock(VOID); +NTSTATUS ReleaseTaskLock(VOID); + +#if DBG +// +// dllutil.c +// + +VOID +AcquireFileLockShared( + IN PSZ CallingRoutine + ); + +VOID +ReleaseFileLockShared( + IN PSZ CallingRoutine + ); + +VOID +PromoteFileLocktoExclusive( + IN PSZ CallingRoutine + ); + +VOID +AcquireFileLockExclusive( + IN PSZ CallingRoutine + ); + +VOID +ReleaseFileLockExclusive( + IN PSZ CallingRoutine + ); + +#else +#define PromoteFileLocktoExclusive(x) RtlConvertSharedToExclusive( &Od2Process->FileLock ) + +VOID +AcquireFileLockShared( VOID ); + +VOID +ReleaseFileLockShared( VOID ); + +VOID +AcquireFileLockExclusive( VOID ); + +VOID +ReleaseFileLockExclusive( VOID ); + +#endif + +// +// Global data accessed by Client DLL +// + +// +// dllnls.c +// + +#define Od2ProcessCodePage Or2ProcessCodePage +#define Od2CurrentCodePageIsOem Or2CurrentCodePageIsOem + +#define Od2InitMBString Or2InitMBString +#define Od2MBStringToUnicodeString Or2MBStringToUnicodeString +#define Od2CreateUnicodeStringFromMBz Or2CreateUnicodeStringFromMBz +#define Od2UnicodeStringToMBString Or2UnicodeStringToMBString +#define Od2FreeMBString Or2FreeMBString + +// +// The Od2NtSysInfo global variable contains NT specific constants of +// interest, such as page size, allocation granularity, etc. It is filled +// in once during process initialization. +// + +extern SYSTEM_BASIC_INFORMATION Od2NtSysInfo; + +#define ROUND_UP_TO_PAGES(SIZE) (((ULONG)(SIZE) + Od2NtSysInfo.PageSize - 1) & ~(Od2NtSysInfo.PageSize - 1)) +#define ROUND_DOWN_TO_PAGES(SIZE) (((ULONG)(SIZE)) & ~(Od2NtSysInfo.PageSize - 1)) + +// +// The Od2DebugFlag is non-zero if the OS/2 Client Application was invoked +// with the Debug option. +// + +extern ULONG Od2DebugFlag; + + +// +// The Od2Heap global variable describes a single heap used by the Client DLL +// for process wide storage management. The process data structure, thread +// data structures, file handle table, current directory structures, etc. are +// all allocated out of this heap. +// + +extern PVOID Od2Heap; + + +// +// The Od2Environment variable points to a block of memory that contains the +// OS/2 Environment block. Od2EnvSize describes how much virtual address space +// is reserved at this location. +// + +extern PVOID Od2Environment; +extern ULONG Od2EnvSize; + + +// +// The Od2BootDrive and Od2SystemDrive define the meaning of \BootDevice and +// \SystemDisk respectively. +// + +extern ULONG Od2BootDrive; +extern ULONG Od2SystemDrive; + + +// +// The connection to the OS/2 Emulation Subsystem is described by the +// Od2PortHandle global variable. The connection is established during +// process initialization by Od2ProcessStartup. +// + +extern HANDLE Od2PortHandle; + + +// +// In order to pass large arguments to the OS/2 Emulation Subsystem (e.g. +// path name arguments) the Od2PortHeap global variable describes a +// heap that is visible to both the OS/2 Client process and the OS/2 +// Emulation Subsystem. +// + +extern PVOID Od2PortHeap; +extern ULONG Od2PortMemoryRemoteDelta; + +// +// The Od2Process global variable points to the OD2_PROCESS structure for +// the client process. It is allocated out of Od2Heap. +// + +extern POD2_PROCESS Od2Process; + + +// +// The Od2Thread1 global variable points to the first thread structure for +// the client process. It is allocated out of Od2Heap. +// + +extern POD2_THREAD Od2Thread1; + + +// +// The Od2DllHandle global variable contains the DLL handle for the OS2DLL +// client stubs executable. +// + +extern HMODULE Od2DllHandle; + + +// +// The Od2DeviceDirecotory global variable contains the handle to the +// \OS2SS\DEVICES directory in the object name space. +// + +extern HANDLE Od2DeviceDirectory; + +// +// Od2NtLibPath replaces what in Os2 1.X is kept in the kernel +// The DLl get's it from the subsystem +// +extern PSZ Od2NtLibPath; +extern USHORT Od2NtLibPathLength; + +// +// Od2LibPath holds the search path for the loader to load +// the OS/2 specific DLLs. This search path may be different than the +// NT LibPath since some OS/2 thunk DLLs conflict in name with NT DLLs +// (like netapi.dll) +// +extern PSZ Od2LibPath; +extern USHORT Od2LibPathLength; + +// +// +// Od2DllInitialize does the OS/2 Client DLL initialization of all of +// the above global variables. It is a DLL Initialization routine. +// + +BOOLEAN +Od2DllInitialize( + IN PVOID DllHandle, + IN ULONG Reason, + IN PCONTEXT Context OPTIONAL + ); + + +// +// +// Od2ProcessStartup is the modified start address for OS/2 applications. +// The DLL Initialization procedure makes this the new start address if +// it successfully initializes the client process. This function in turns +// calls the application entry point with the OS/2 defined process startup +// parameters. +// + +VOID +Od2ProcessStartup( + IN PPEB Peb + ); + + +// +// The Od2InitializeTask procedure is called by the Od2ProcessStartup code +// to initialize the tasking component of the OS/2 Client DLL. +// + +NTSTATUS +Od2InitializeTask( VOID ); + + +NTSTATUS +Od2InitializeThread( + IN POD2_THREAD Thread + ); + + +VOID +Od2UserThreadStartup( + IN POD2_THREAD Thread + ); + +// +// Common Exec Message formatter used by DosExecPgm and DosStartSession +// + +APIRET +Od2FormatExecPgmMessage( + OUT POS2_DOSEXECPGM_MSG a, + OUT POS2_CAPTURE_HEADER *CaptureBuffer, + OUT PNTSTATUS Od2IsConsoleTypeReturnStatus, +#if PMNT + OUT PULONG IsPMApp, +#endif // PMNT + IN PSZ ErrorText, + IN LONG MaximumErrorTextLength, + IN ULONG Flags, + IN OUT PSZ *VariablesBuffer, + IN OUT PSZ *ArgumentBuffer, + IN PSZ *ImageFileName + ); + +NTSTATUS +Od2IsFileConsoleType( + PSTRING NtImagePathName +#if PMNT + , + PULONG IsPMApp +#endif // PMNT + ); + +// +// routines defined in dllinit.c +// + +extern PUCHAR Od2SystemRoot; + +ULONG +Od2ProcessException( + IN PEXCEPTION_POINTERS ExceptionInfo, + OUT PEXCEPTION_RECORD ExceptionRecord + ); + +VOID +Od2ExceptionHandler( + IN PEXCEPTION_RECORD ExceptionRecord + ); + +// +// Routines defined in dllsem.c +// + +// +// The following bit masks define the fields within a 32 bit semaphore +// handle. +// + +#define SEM_SHARED 0x80000000 +#define SEM_HANDLESIG 0x00010000 // 32-bit handle signature +#define SEM_SIGBITS 0x7FFF0000 // Isolates 32-bit signature bits +#define SEM_INDEX 0x0000FFFF + +APIRET +Od2CaptureSemaphoreName( + IN PSZ ObjectName, + IN ULONG ExtraCaptureBufferLength OPTIONAL, + OUT POS2_CAPTURE_HEADER *CaptureBuffer, + OUT PSTRING CapturedObjectName + ); + + +POR2_HANDLE_TABLE +Od2GetSemaphoreTable( + BOOLEAN SharedSem, + BOOLEAN CreateOkay + ); + + +HSEM +Od2ConstructSemaphoreHandle( + IN BOOLEAN SharedSem, + IN ULONG Index + ); + + +APIRET +Od2ValidateSemaphoreHandle( + IN HSEM SemaphoreHandle, + OUT PBOOLEAN SharedSem, + OUT PULONG Index + ); + +POD2_SEMAPHORE +Od2ReferenceSemaphore( + IN POD2_SEMAPHORE Semaphore + ); + +VOID +Od2DereferenceSemaphore( + IN POD2_SEMAPHORE Semaphore + ); + +VOID +Od2ThreadWaitingOnSemaphore( + IN POR2_HANDLE_TABLE SemaphoreTable, + IN POD2_SEMAPHORE Semaphore, + IN BOOLEAN AboutToWait + ); + +POD2_THREAD +Od2SearchForWaitingThread( + IN POD2_SEMAPHORE Semaphore + ); + +VOID +Od2SemaphoreDestroyProcedure( + IN POD2_SEMAPHORE Semaphore, + IN ULONG HandleIndex + ); + +VOID +Od2CloseAllSemaphores( VOID ); + + +#if DBG + +VOID +Od2SemaphoreDumpProcedure( + IN POD2_SEMAPHORE Semaphore, + IN ULONG HandleIndex, + IN PVOID DumpParameter + ); + +VOID +Od2DumpAllSemaphores( + IN PCHAR Title + ); + +#endif // DBG + + +// +// Routines defined in dllmuxwt.c +// + +APIRET +Od2AddMuxWait( + IN POD2_MUXWAIT_SEMAPHORE MuxWait, + IN PSEMRECORD MuxWaitEntry + ); + + +APIRET +Od2DeleteMuxWait( + IN POD2_MUXWAIT_SEMAPHORE MuxWait, + IN ULONG MuxWaitEntryIndex, + IN HSEM MuxWaitEntrySem OPTIONAL + ); + + +// +// Routines defined in dlltimer.c +// + +NTSTATUS +Od2InitializeTimers(VOID); + +VOID +Od2CloseAllTimers(VOID); + + +// +// Definitions for dllflopy.c +// + +VOID +Od2DiskIOInitialize( + VOID + ); + +VOID +Od2DiskIOTerminate( + VOID + ); + + +// +// Routines defined in dllname.c +// + +APIRET +Od2Canonicalize( + IN PSZ Path, + IN ULONG ExpectedType, + OUT PSTRING OutputString, + OUT PHANDLE OutputDirectory OPTIONAL, + OUT PULONG ParseFlags OPTIONAL, + OUT PULONG FileType OPTIONAL + ); + +// +// Valid values for ExpectedType parameter +// + +#define CANONICALIZE_FILE_DEV_OR_PIPE 0x00000000 +#define CANONICALIZE_FILE_OR_DEV 0x00000001 +#define CANONICALIZE_SHARED_MEMORY 0x00000002 +#define CANONICALIZE_SEMAPHORE 0x00000003 +#define CANONICALIZE_QUEUE 0x00000004 +#define CANONICALIZE_MAILSLOT 0x00000005 + +// +// Flag definitions returned via the ParseFlags parameter +// + +#define CANONICALIZE_META_CHARS_FOUND 0x00000001 +#define CANONICALIZE_IS_ROOT_DIRECTORY 0x00000002 + +// +// Maximum length of NT specific prefix that is placed at the beginning +// of the canonical output string. +// + +#define CANONICALIZE_MAX_PREFIX_LENGTH 32 +#define IS_OBJ_NAME_PATH_SEPARATOR(ch) ((ch == '\\') || (ch == '\0')) + +BOOLEAN +Od2IsAbsolutePath( + IN PSZ Path + ); + + +// +// Routines defined in dllque.c +// + +POR2_QHANDLE_TABLE +Od2GetQueueTable( + BOOLEAN CreateOkay + ); + +APIRET +Od2ValidateQueueSemaphore( + IN HSEM EventHandle, + IN PULONG HandleIndex + ); + +VOID +Od2CloseAllQueues( VOID ); + +VOID +Od2QueueDestroyProcedure( + IN POD2_QUEUE Semaphore, + IN ULONG HandleIndex + ); + +// +// Routines defined in dllutil.c +// + +APIRET +Od2CallSubsystem( + IN OUT POS2_API_MSG m, + IN OUT POS2_CAPTURE_HEADER CaptureBuffer OPTIONAL, + IN OS2_API_NUMBER ApiNumber, + IN ULONG ArgLength + ); + +POS2_CAPTURE_HEADER +Od2AllocateCaptureBuffer( + IN ULONG CountMessagePointers, + IN ULONG CountCapturePointers, + IN ULONG Size + ); + +VOID +Od2FreeCaptureBuffer( + IN POS2_CAPTURE_HEADER CaptureBuffer + ); + +ULONG +Od2AllocateMessagePointer( + IN OUT POS2_CAPTURE_HEADER CaptureBuffer, + IN ULONG Length, + OUT PVOID *Pointer + ); + +ULONG +Od2AllocateCapturePointer( + IN OUT POS2_CAPTURE_HEADER CaptureBuffer, + IN ULONG Length, + OUT PVOID *Pointer + ); + +VOID +Od2CaptureMessageString( + IN OUT POS2_CAPTURE_HEADER CaptureBuffer, + IN PCHAR String, + IN ULONG Length, + IN ULONG MaximumLength, + OUT PSTRING CapturedString + ); + +void +Od2StartTimeout( + PLARGE_INTEGER StartTimeStamp + ); + +NTSTATUS +Od2ContinueTimeout( + PLARGE_INTEGER StartTimeStamp, + PLARGE_INTEGER Timeout + ); + +PLARGE_INTEGER +Od2CaptureTimeout( + IN ULONG Milliseconds, + OUT PLARGE_INTEGER Timeout + ); + +VOID +Od2ProbeForWrite( + IN PVOID Address, + IN ULONG Length, + IN ULONG Alignment + ); + +VOID +Od2ProbeForRead( + IN PVOID Address, + IN ULONG Length, + IN ULONG Alignment + ); + +APIRET +Od2CaptureObjectName( + IN PSZ ObjectName, + IN ULONG ObjectType, + IN ULONG ExtraCaptureBufferLength OPTIONAL, + OUT POS2_CAPTURE_HEADER *CaptureBuffer, + OUT PSTRING CapturedObjectName + ); + +PWSTR +Od2CopyStrToWstr( + IN OUT PWSTR wstr OPTIONAL, + IN PSZ str + ); + +int +Od2WstrSize( + IN PWSTR pwstr + ); + +PSZ +Od2CopyWstrToStr( + IN OUT PSZ str OPTIONAL, + IN PWSTR wstr + ); + +PSZ Od2nCopyWstrToStr( + IN OUT PSZ str OPTIONAL, + IN PWSTR wstr, + IN int n + ); + +APIRET Od2FixFEA2List( + IN FEA2LIST *fpFEA2List); + +VOID +Od2ExitGP(); + +BOOLEAN +RetryIO( + IN NTSTATUS Status, + IN HANDLE Handle + ); + +BOOLEAN +RetryCreateOpen( + IN NTSTATUS Status, + IN POBJECT_ATTRIBUTES pObja + ); + +// +// Routines defined in dlltask.c +// + +VOID +Od2ProcessCleanup( VOID ); + + +VOID +Od2DosExit( + ULONG ExitAction, + ULONG ExitResult, + ULONG ExitReason); + +// +// Routines defined in dllxcpt.c +// + +APIRET +Od2AcknowledgeSignalException( + IN ULONG SignalNumber + ); + +VOID +_Od2VectorHander( VOID ); + +// +// Routines defined in dllthunk.s +// + +VOID +_Od2ExitListDispatcher( VOID ); + +VOID +Od2JumpToExitRoutine( + IN PFNEXITLIST ExitRoutine, + IN ULONG ExitReason + ); + +VOID +_Od2SignalDeliverer( + IN PCONTEXT pContext, + IN int Signal + ); + +VOID +_Od2ProcessSignal16( + IN POS2_REGISTER16_SIGNAL pa + ); + +VOID +_Od2FreezeThread( + IN PCONTEXT pContext + ); + +VOID +_Od2UnfreezeThread( + IN PCONTEXT pContext + ); + +// +// Routines defined in dllhandl.c +// + +APIRET +OpenCreatePath( + OUT PHANDLE FileHandle, + IN ULONG DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes, + IN PIO_STATUS_BLOCK IoStatus, + IN ULONG CreateSize, + IN ULONG FileAttributes, + IN ULONG ShareAccess, + IN ULONG CreateDisposition, + IN ULONG CreateOptions, + IN OUT PEAOP2 ExtendedFileAttr OPTIONAL, + OUT PUSHORT FileType, + OUT PUSHORT DeviceAttributes, + IN BOOLEAN OpenDirectory + ); + +APIRET +MapFileType( + IN HANDLE FileHandle, + OUT PBOOLEAN Directory OPTIONAL, + OUT PUSHORT FileType, + OUT PUSHORT DeviceAttribute + ); + +BOOLEAN +CheckFileType( + IN HANDLE FileHandle, + IN USHORT FileTypes + ); + +APIRET +AllocateHandle( + OUT PHFILE FileHandle + ); + +APIRET +FreeHandle( + IN HFILE FileHandle + ); + +APIRET +DereferenceFileHandle( + IN HFILE FileHandle, + OUT PFILE_HANDLE *hFileRecord + ); + +PFILE_HANDLE +DereferenceFileHandleNoCheck( + IN HFILE FileHandle + ); + +VOID +InvalidateHandle( + IN PFILE_HANDLE hFileRecord + ); + +VOID +ValidateHandle( + IN PFILE_HANDLE hFileRecord + ); + + +// +// Routines defined in fileinit.c +// + +APIRET +Od2InitializeFileSystemForExec( + IN ULONG ParentTableLength, // number of entries in handle table + IN ULONG CurrentDrive // current drive in parent process + ); + +APIRET +Od2InitializeFileSystemForSM( + IN ULONG DefaultDrive, // default drive for this session + IN HANDLE StandardInput, + IN HANDLE StandardOutput, + IN HANDLE StandardError + ); + +APIRET +Od2InitializeFileSystemForChildSM( + IN ULONG ParentTableLength, // number of entries in handle table + IN ULONG CurrentDrive // current drive in parent process + ); + +APIRET +Od2InitCurrentDir( + IN ULONG CurrentDisk + ); + +// +// Routines defined in name.c +// + +APIRET +Canonicalize( + IN PSZ Name, + IN ULONG Flags, + OUT PHANDLE Handle, + OUT PSTRING CanonicalString, + OUT PUSHORT FileType, + OUT PBOOLEAN MetaCharacters, + OUT PBOOLEAN RootDirectory + ); + +PSZ +FindLastComponent( + IN PSZ String + ); + +// +// Routines defined in dllea.c +// + +BOOLEAN +NtTimeToFatTimeAndDate ( + OUT PFTIME FatTime, + OUT PFDATE FatDate, + IN LARGE_INTEGER NtTime + ); + +APIRET +GetEaListLength( + IN HANDLE NtHandle, + OUT PULONG EaListSize +); + +APIRET +GetGEAList( + IN HANDLE NtHandle, + OUT PBYTE UserBuffer, + IN ULONG Length +); + +// +// Routines defined in dllea.c +// + +VOID +MapAttributesToOs2( + IN ULONG NtAttributes, + OUT PUSHORT Os2Attributes + ); + +APIRET +MapEaListToNt( + IN OUT PBYTE UserBuffer, + IN ULONG Length, + OUT PVOID *Buffer, + OUT PULONG ListLength, + OUT PULONG BufferLength +); + + +// +// Routines defined in dlldir.c +// + +APIRET +Od2GetCurrentDirectory( + IN ULONG DiskNumber, + OUT PSTRING *CurrentDirectoryString, + OUT PHANDLE CurrentDirectoryHandle, + IN OUT PULONG DirectoryNameLength, + IN BOOLEAN Verify + ); + +// +// Routines defined in coninit.c +// + +NTSTATUS Od2InitializeSessionPort(OUT PBOOLEAN RootProcessInSession); + +// +// Routines defined in dllmsg.c +// + + +#define COMP_ID_LEN 3 // length of component ID + + +// +// header for a 16 bit (OS/2 1.X) message segment +// + +typedef struct _MSGSEGMENT_HEADER16 { + BYTE Signature[10]; // "\xffMKMSGSEG" + USHORT Version; // should be 1 + USHORT Reserved; + USHORT FileTableOffset; +} MSGSEGMENT_HEADER16, *PMSGSEGMENT_HEADER16; + + +typedef struct _OD2_MSGFILE { + LIST_ENTRY Link; + HANDLE SectionHandle; + PVOID BaseAddress; + ULONG Size; + ULONG Type; + STRING FileName; +} OD2_MSGFILE, *POD2_MSGFILE; + +#define MSG_FILE_TYPE_OS2_20 0 +#define MSG_FILE_TYPE_OS2_1x 1 + +typedef struct _OD2_MSGFILE_HEADER { + ULONG HeaderLength; + CHAR Signature[ 8 ]; + CHAR Component[ COMP_ID_LEN ]; + CHAR Reserved[ 5 ]; + ULONG CountOfMessages; + ULONG BaseMessageId; + ULONG MessageOffsets[ 1 ]; +} OD2_MSGFILE_HEADER, *POD2_MSGFILE_HEADER; + +APIRET +Od2FindMessageFile( + IN PSZ MessageFileName, + OUT POD2_MSGFILE *ReturnedMsgFile + ); + +// +// OD2_MESSAGE_RESOURCE_FILENAME defines the file +// string, that if specified as the MessageFileName parameter to DosGetMessage +// or DosQueryMessageCP, will cause the function to access the data in +// the OS/2 system message file. +// + +#define OD2_MESSAGE_RESOURCE_FILENAME "OSO001.MSG" + + +// +// Od2MsgFile variable points to an OD2_MSGFILE structure that represents the +// OSO001.MSG resource contained in the OS/2 DLL image file. +// + +extern POD2_MSGFILE Od2MsgFile; + +// +// This function will initialize the Od2MsgFile variable. +// + +NTSTATUS +Od2InitializeMessageFile( VOID ); + +// Signal numbers +// these are also defined in os2srv.h, so if the values change be sure +// to change them there + +#define SIGNAL_TO_FLAG(Signal) (1 << (Signal - 1)) + +#define SIGAPTERM 8 // Asynchronous PTERM +#define SIGPTERM 9 // Synchronous PTERM + +// Signal flags + +#define SIGINTRF (1 << (XCPT_SIG_INTR - 1)) // Ctrl-C +#define SIGTERMF (1 << (XCPT_SIG_KILLPROC - 1)) // program termination +#define SIGBREAKF (1 << (XCPT_SIG_BREAK - 1)) // Ctrl-Break +#define SIGAPTERMF (1 << (SIGAPTERM - 1)) // Asyncronous PTERM + +/* Vector exception handlers */ + +#define VECTOR_DIVIDE_BY_ZERO 0x0000 +#define VECTOR_OVERFLOW 0x0004 +#define VECTOR_OUTOFBOUNDS 0x0005 +#define VECTOR_INVALIDOPCODE 0x0006 +#define VECTOR_NO_EXTENSION 0x0007 +#define VECTOR_EXTENSION_ERROR 0x0010 + +typedef struct _OD2_VEC_HANDLER_REC { + ULONG VecHandler[6]; + ULONG doscallssel; +} OD2_VEC_HANDLER_REC, *POD2_VEC_HANDLER_REC; + +#define FIELD_SIZE(type, field) (sizeof( ((type *)0)->field )) + +// +// Support for mapping c:\config.sys +// to the OS/2 SS directory +// + +BOOLEAN +Od2FileIsConfigSys( + IN OUT PANSI_STRING FileName_A, + IN ULONG AccessMode, + OUT PNTSTATUS ResultStatus + ); + +// +// routines in dllnb.c +// + + +VOID +Od2NetbiosInitialize( + VOID + ); + +VOID +Od2NetbiosDelete( + VOID + ); + + +/* Fix for a C8 compilation warning */ +#undef TRUE +#define TRUE (BOOLEAN)1 + +#undef FALSE +#define FALSE (BOOLEAN)0 + +#ifndef MAX +#define MAX(a,b) (((a)>(b))? (a):(b)) +#endif + diff --git a/private/os2/inc/os2dll16.h b/private/os2/inc/os2dll16.h new file mode 100644 index 000000000..b24b96723 --- /dev/null +++ b/private/os2/inc/os2dll16.h @@ -0,0 +1,322 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + os2dll16.h + +Abstract: + + Main include file for OS/2 Subsystem Client 16 bit API support + +Author: + + Yaron Shamir (YaronS) 15-Apr-1991 + +Revision History: + + add SEG_SIZABLE (NirM) 7-jan-1993 + +--*/ + + +/* Segment attribute flags (used with DosAllocSeg) */ + +#define SEG_NONSHARED 0x0000 +#define SEG_GIVEABLE 0x0001 +#define SEG_GETTABLE 0x0002 +#define SEG_DISCARDABLE 0x0004 +#define SEG_SIZEABLE 0x0008 + +// +// Support for Huge Segments: we keep, per client, a linked +// list of HugeSegRecord records, each containing the info on +// base selector, maximum selectors for reallocation and link +// forward. This is used by DosFreeSeg to free up all the memory +// and selectors involved, and by DosReallocHuge to adhere to +// 1.X sematics for Huge Segments +// + +typedef struct _HUGE_SEG_RECORD { + struct HUGE_SEG_RECORD *Next; + ULONG MaxNumSeg; + ULONG cNumSeg; + ULONG BaseSelector; + ULONG PartialSeg; + BOOLEAN fShared; + BOOLEAN fSizeable; +} HUGE_SEG_RECORD, *PHUGE_SEG_RECORD; + +PHUGE_SEG_RECORD pHugeSegHead; + +#define SEL_RPL3 0x3 // Rpl Ring 3 +#define SEL_RPLCLR 0xfffc // Non RPL bits mask + +/* LDT Descriptor (as defined by the NT support routines) */ + +typedef enum _I386DESCRIPTOR_TYPE { + INVALID, EXECUTE_CODE, EXECUTE_READ_CODE, READ_DATA, READ_WRITE_DATA +} I386DESCRIPTOR_TYPE; +typedef struct _I386DESCRIPTOR { + ULONG BaseAddress; + ULONG Limit; + I386DESCRIPTOR_TYPE Type; +} I386DESCRIPTOR; + +// +// A high-level routine profile for LDT support. NT supports HW-like API +// +NTSTATUS +Nt386SetDescriptorLDT + ( + HANDLE LDT, + ULONG Sel, + I386DESCRIPTOR Desc + ); + +#include "os2tile.h" + + +typedef unsigned short SEL; + +typedef SEL *PSEL; + +typedef unsigned short SHANDLE; +typedef void *LHANDLE; + +//typedef LHANDLE HSYSSEM; + +//typedef HSYSSEM *PHSYSSEM; + +typedef USHORT PID16; + +typedef PID16 *PPID16; + +typedef USHORT TID16; + +typedef TID16 *PTID16; + +#pragma pack(1) +typedef struct _PIDINFO16 { + PID16 pid; + TID16 tid; + PID16 pidParent; +} PIDINFO16, *PPIDINFO16; +#pragma pack() + +#define INCL_16 +#define INCL_DOS +#define FAR +#define PASCAL +#define BOOL BOOLEAN +#define INCL_NOXLATE_DOS16 +// #include "bsedos16.h" +#include "os2v12.h" + + +typedef struct _FILEFINDBUF1 { /* findbuf for DosFindFirst */ + FDATE fdateCreation; + FTIME ftimeCreation; + FDATE fdateLastAccess; + FTIME ftimeLastAccess; + FDATE fdateLastWrite; + FTIME ftimeLastWrite; + ULONG cbFile; + ULONG cbFileAlloc; + USHORT attrFile; + UCHAR cchName; + CHAR achName[13]; +} FILEFINDBUF1; +typedef FILEFINDBUF1 FAR *PFILEFINDBUF1; + +// +// OS2 1.X Sempahore types +// +// We simulate the multi-semantic OS2 1.x Semaphore by two +// object, an event and a mutex. +// Clear - clear them both (Release, Post) +// + + +typedef struct _OS21X_SEM { + PVOID pMyself; // Myself makes RAM and SYS semaphore + // Handles to look the same (both becomes + // a pointer to an OS21X_SEM sempahore + // + HSEM Mutex; + TID OwnerThread; + USHORT RequestCount; + UCHAR FlagsByte; + UCHAR SysSemCount; + HSEM Event; + union { + ULONG SharedRamSignature; // in use for Ram Sem. + PCHAR SysSemName; // in use for System Sem. (its name) + } u; + struct OS21X_SEM *Next; // Per process list for cleanup +} OS21X_SEM, *POS21X_SEM; + +#define SYSSEM_QUEUE 4 +#define SYSSEM_PRIVATE 2 +#define SYSSEM_PUBLIC 1 + + + // + // per process Semaphore list head + // + +struct OS21X_SEM *Od2Sem16ListHead; + + // + // FSRAM Semaphores (Fast Safe RAM) + // +#pragma pack(1) +typedef struct _DOSFSRSEM16 { + USHORT cb; + PID16 pid; + TID16 tid; + USHORT cUsage; + USHORT client; + ULONG sem; +} DOSFRSEM16, *PDOSFSRSEM16; +#pragma pack() + +BOOLEAN Od2ExitListInProgress; + +typedef struct _OS21X_CS { + SEL selCS; + struct OS21X_CS *Next; +} OS21X_CS, *POS21X_CS; + +typedef struct _OS21X_CSALIAS { + SEL selDS; + POS21X_CS pCSList; + HANDLE SectionHandle; + struct OS21X_CSALIAS *Next; +} OS21X_CSALIAS, *POS21X_CSALIAS; + +struct OS21X_CSALIAS *Od2CSAliasListHead; + +#pragma pack(1) +typedef struct _OD2_MSGFILE_HEADER16 { + UCHAR HeaderMsgFF; + CHAR Signature[ 7 ]; + CHAR Component[ 3 ]; + USHORT CountOfMessages; + USHORT BaseMessageId; + CHAR Reserved[ 16 ]; + USHORT MessageOffsets[ 1 ]; +} OD2_MSGFILE_HEADER16, *POD2_MSGFILE_HEADER16; + +typedef struct _OD2_MSGFILE_HEADER_SYS16 { + UCHAR HeaderMsgFF; + CHAR Signature[ 7 ]; + CHAR Component[ 3 ]; + USHORT CountOfMessages; + USHORT BaseMessageId; + CHAR Reserved[ 16 ]; + ULONG MessageOffsets[ 1 ]; +} OD2_MSGFILE_HEADER_SYS16, *POD2_MSGFILE_HEADER_SYS16; + +typedef struct _COUNTRYCODE16 { + USHORT country; + USHORT codepage; +} COUNTRYCODE16, *PCOUNTRYCODE16; + +typedef struct _COUNTRYINFO16 { + USHORT country; + USHORT codepage; + USHORT fsDateFmt; + CHAR szCurrency[5]; + CHAR szThousandsSeparator[2]; + CHAR szDecimal[2]; + CHAR szDateSeparator[2]; + CHAR szTimeSeparator[2]; + UCHAR fsCurrencyFmt; + UCHAR cDecimalPlace; + UCHAR fsTimeFmt; + USHORT abReserved1[2]; + CHAR szDataSeparator[2]; + USHORT abReserved2[5]; +} COUNTRYINFO16, *PCOUNTRYINFO16; +#pragma pack() + + +// +// 16B Prototypes (for use by other OS2 16B APIs +// + +APIRET +DosSemClear( + HSEM Sem); + +APIRET +DosCloseSem( + IN HSEM hsem + ); + +APIRET +DosFreeSeg( + SEL Sel); +APIRET +DosAllocSeg( + IN USHORT cbSize, + OUT PSEL pSel, + IN USHORT fsAlloc); +APIRET +DosSizeSeg( + IN SEL sel, + PULONG pcbSize + ); +APIRET +LDRGetProcAddr( + USHORT hmte, + PSZ pchname, + PULONG paddress); + +APIRET +LDRGetModName( + ULONG hMod, + ULONG cbBuf, + PCHAR pchBuf); + +APIRET +LDRGetModHandle( + PSZ pszModName, + ULONG len, + PULONG phMode); + +APIRET +LDRQAppType( + IN PSZ pszAppName, + OUT PUSHORT pusType + ); + +APIRET +Od2GetSemNtEvent( + HSEM hsem, + PHANDLE pNtHandle + ); +VOID +Od2JumpTo16ExitRoutine( + PFNEXITLIST ExitRoutine, + ULONG ExitReason); + +#define SEM_FROM_SET 0 +#define SEM_FROM_REQUESTWAIT 1 +#define SEM_FROM_CLEAR 2 + +POS21X_SEM +Od2LookupOrCreateSem ( + HSEM hsem, + PBOOLEAN firsttime, + ULONG source + ); + +#pragma pack(1) +typedef struct _R2StackEntry { + USHORT R2StackSize; + USHORT R2StackSel; +} R2StackEntry, *PR2StackEntry; +#pragma pack() diff --git a/private/os2/inc/os2err.h b/private/os2/inc/os2err.h new file mode 100644 index 000000000..0ddee9e64 --- /dev/null +++ b/private/os2/inc/os2err.h @@ -0,0 +1,631 @@ +/*++ + +Copyright (c) 1989 Microsoft Corporation + +Module Name: + + os2err.h + +Abstract: + + This file contains the OS/2 return codes (ERROR_ ... ) + +Author: + + Michael Jarus (mjarus) 20-Nov-1991 + +Parameters: + + +Revision History: + +--*/ + +#ifndef _OS2V20_ERRORS_ + +#define _OS2V20_ERRORS_ + +#define NO_ERROR 0 + +#define ERROR_INVALID_FUNCTION 1 +#define ERROR_FILE_NOT_FOUND 2 +#define ERROR_PATH_NOT_FOUND 3 +#define ERROR_TOO_MANY_OPEN_FILES 4 +#define ERROR_ACCESS_DENIED 5 +#define ERROR_INVALID_HANDLE 6 +#define ERROR_ARENA_TRASHED 7 +#define ERROR_NOT_ENOUGH_MEMORY 8 +#define ERROR_INVALID_BLOCK 9 +#define ERROR_BAD_ENVIRONMENT 10 +#define ERROR_BAD_FORMAT 11 +#define ERROR_INVALID_ACCESS 12 +#define ERROR_INVALID_DATA 13 + +#define ERROR_INVALID_DRIVE 15 +#define ERROR_CURRENT_DIRECTORY 16 +#define ERROR_NOT_SAME_DEVICE 17 +#define ERROR_NO_MORE_FILES 18 +#define ERROR_WRITE_PROTECT 19 +#define ERROR_BAD_UNIT 20 +#define ERROR_NOT_READY 21 +#define ERROR_BAD_COMMAND 22 +#define ERROR_CRC 23 +#define ERROR_BAD_LENGTH 24 +#define ERROR_SEEK 25 +#define ERROR_NOT_DOS_DISK 26 +#define ERROR_SECTOR_NOT_FOUND 27 +#define ERROR_OUT_OF_PAPER 28 +#define ERROR_WRITE_FAULT 29 +#define ERROR_READ_FAULT 30 +#define ERROR_GEN_FAILURE 31 +#define ERROR_SHARING_VIOLATION 32 +#define ERROR_LOCK_VIOLATION 33 +#define ERROR_WRONG_DISK 34 +#define ERROR_FCB_UNAVAILABLE 35 +#define ERROR_SHARING_BUFFER_EXCEEDED 36 +#define ERROR_CODE_PAGE_MISMATCHED 37 +#define ERROR_HANDLE_EOF 38 +#define ERROR_HANDLE_DISK_FULL 39 +#define ERROR_NOT_SUPPORTED 50 +#define ERROR_REM_NOT_LIST 51 +#define ERROR_DUP_NAME 52 +#define ERROR_BAD_NETPATH 53 +#define ERROR_NETWORK_BUSY 54 +#define ERROR_DEV_NOT_EXIST 55 +#define ERROR_TOO_MANY_CMDS 56 +#define ERROR_ADAP_HDW_ERR 57 +#define ERROR_BAD_NET_RESP 58 +#define ERROR_UNEXP_NET_ERR 59 +#define ERROR_BAD_REM_ADAP 60 +#define ERROR_PRINTQ_FULL 61 +#define ERROR_NO_SPOOL_SPACE 62 +#define ERROR_PRINT_CANCELLED 63 +#define ERROR_NETNAME_DELETED 64 +#define ERROR_NETWORK_ACCESS_DENIED 65 +#define ERROR_BAD_DEV_TYPE 66 +#define ERROR_BAD_NET_NAME 67 +#define ERROR_TOO_MANY_NAMES 68 +#define ERROR_TOO_MANY_SESS 69 +#define ERROR_SHARING_PAUSED 70 +#define ERROR_REQ_NOT_ACCEP 71 +#define ERROR_REDIR_PAUSED 72 + +#define ERROR_FILE_EXISTS 80 +#define ERROR_DUP_FCB 81 +#define ERROR_CANNOT_MAKE 82 +#define ERROR_FAIL_I24 83 +#define ERROR_OUT_OF_STRUCTURES 84 +#define ERROR_ALREADY_ASSIGNED 85 +#define ERROR_INVALID_PASSWORD 86 +#define ERROR_INVALID_PARAMETER 87 +#define ERROR_NET_WRITE_FAULT 88 +#define ERROR_NO_PROC_SLOTS 89 +#define ERROR_NOT_FROZEN 90 +#define ERROR_SYS_COMP_NOT_LOADED ERROR_NOT_FROZEN +#define ERROR_TSTOVFL 91 +#define ERROR_TSTDUP 92 +#define ERROR_NO_ITEMS 93 +#define ERROR_INTERRUPT 95 +#define ERROR_DEVICE_IN_USE 99 +#define ERROR_TOO_MANY_SEMAPHORES 100 +#define ERROR_EXCL_SEM_ALREADY_OWNED 101 +#define ERROR_SEM_IS_SET 102 +#define ERROR_TOO_MANY_SEM_REQUESTS 103 +#define ERROR_INVALID_AT_INTERRUPT_TIME 104 +#define ERROR_SEM_OWNER_DIED 105 +#define ERROR_SEM_USER_LIMIT 106 +#define ERROR_DISK_CHANGE 107 +#define ERROR_DRIVE_LOCKED 108 +#define ERROR_BROKEN_PIPE 109 +#define ERROR_OPEN_FAILED 110 +#define ERROR_BUFFER_OVERFLOW 111 +#define ERROR_DISK_FULL 112 +#define ERROR_NO_MORE_SEARCH_HANDLES 113 +#define ERROR_INVALID_TARGET_HANDLE 114 +#define ERROR_PROTECTION_VIOLATION 115 +#define ERROR_VIOKBD_REQUEST 116 +#define ERROR_INVALID_CATEGORY 117 +#define ERROR_INVALID_VERIFY_SWITCH 118 +#define ERROR_BAD_DRIVER_LEVEL 119 +#define ERROR_CALL_NOT_IMPLEMENTED 120 +#define ERROR_SEM_TIMEOUT 121 +#define ERROR_INSUFFICIENT_BUFFER 122 +#define ERROR_INVALID_NAME 123 +#define ERROR_INVALID_LEVEL 124 +#define ERROR_NO_VOLUME_LABEL 125 +#define ERROR_MOD_NOT_FOUND 126 +#define ERROR_PROC_NOT_FOUND 127 +#define ERROR_WAIT_NO_CHILDREN 128 +#define ERROR_CHILD_NOT_COMPLETE 129 +#define ERROR_DIRECT_ACCESS_HANDLE 130 +#define ERROR_NEGATIVE_SEEK 131 +#define ERROR_SEEK_ON_DEVICE 132 +#define ERROR_IS_JOIN_TARGET 133 +#define ERROR_IS_JOINED 134 +#define ERROR_IS_SUBSTED 135 +#define ERROR_NOT_JOINED 136 +#define ERROR_NOT_SUBSTED 137 +#define ERROR_JOIN_TO_JOIN 138 +#define ERROR_SUBST_TO_SUBST 139 +#define ERROR_JOIN_TO_SUBST 140 +#define ERROR_SUBST_TO_JOIN 141 +#define ERROR_BUSY_DRIVE 142 +#define ERROR_SAME_DRIVE 143 +#define ERROR_DIR_NOT_ROOT 144 +#define ERROR_DIR_NOT_EMPTY 145 +#define ERROR_IS_SUBST_PATH 146 +#define ERROR_IS_JOIN_PATH 147 +#define ERROR_PATH_BUSY 148 +#define ERROR_IS_SUBST_TARGET 149 +#define ERROR_SYSTEM_TRACE 150 +#define ERROR_INVALID_EVENT_COUNT 151 +#define ERROR_TOO_MANY_MUXWAITERS 152 +#define ERROR_INVALID_LIST_FORMAT 153 +#define ERROR_LABEL_TOO_LONG 154 +#define ERROR_TOO_MANY_TCBS 155 +#define ERROR_SIGNAL_REFUSED 156 +#define ERROR_DISCARDED 157 +#define ERROR_NOT_LOCKED 158 +#define ERROR_BAD_THREADID_ADDR 159 +#define ERROR_BAD_ARGUMENTS 160 +#define ERROR_BAD_PATHNAME 161 +#define ERROR_SIGNAL_PENDING 162 +#define ERROR_UNCERTAIN_MEDIA 163 +#define ERROR_MAX_THRDS_REACHED 164 +#define ERROR_MONITORS_NOT_SUPPORTED 165 +#define ERROR_UNC_DRIVER_NOT_INSTALLED 166 +#define ERROR_LOCK_FAILED 167 +#define ERROR_SWAPIO_FAILED 168 +#define ERROR_SWAPIN_FAILED 169 +#define ERROR_BUSY 170 + +#define ERROR_INVALID_SEGMENT_NUMBER 180 +#define ERROR_INVALID_CALLGATE 181 +#define ERROR_INVALID_ORDINAL 182 +#define ERROR_ALREADY_EXISTS 183 +#define ERROR_NO_CHILD_PROCESS 184 +#define ERROR_CHILD_ALIVE_NOWAIT 185 +#define ERROR_INVALID_FLAG_NUMBER 186 +#define ERROR_SEM_NOT_FOUND 187 +#define ERROR_INVALID_STARTING_CODESEG 188 +#define ERROR_INVALID_STACKSEG 189 +#define ERROR_INVALID_MODULETYPE 190 +#define ERROR_INVALID_EXE_SIGNATURE 191 +#define ERROR_EXE_MARKED_INVALID 192 +#define ERROR_BAD_EXE_FORMAT 193 +#define ERROR_ITERATED_DATA_EXCEEDS_64K 194 +#define ERROR_INVALID_MINALLOCSIZE 195 +#define ERROR_DYNLINK_FROM_INVALID_RING 196 +#define ERROR_IOPL_NOT_ENABLED 197 +#define ERROR_INVALID_SEGDPL 198 +#define ERROR_AUTODATASEG_EXCEEDS_64K 199 +#define ERROR_RING2SEG_MUST_BE_MOVABLE 200 +#define ERROR_RELOC_CHAIN_XEEDS_SEGLIM 201 +#define ERROR_INFLOOP_IN_RELOC_CHAIN 202 +#define ERROR_ENVVAR_NOT_FOUND 203 +#define ERROR_NOT_CURRENT_CTRY 204 +#define ERROR_NO_SIGNAL_SENT 205 +#define ERROR_FILENAME_EXCED_RANGE 206 +#define ERROR_RING2_STACK_IN_USE 207 +#define ERROR_META_EXPANSION_TOO_LONG 208 +#define ERROR_INVALID_SIGNAL_NUMBER 209 +#define ERROR_THREAD_1_INACTIVE 210 +#define ERROR_INFO_NOT_AVAIL 211 +#define ERROR_LOCKED 212 +#define ERROR_BAD_DYNALINK 213 +#define ERROR_TOO_MANY_MODULES 214 +#define ERROR_NESTING_NOT_ALLOWED 215 +#define ERROR_CANNOT_SHRINK 216 +#define ERROR_ZOMBIE_PROCESS 217 +#define ERROR_STACK_IN_HIGH_MEMORY 218 +#define ERROR_INVALID_EXITROUTINE_RING 219 +#define ERROR_GETBUF_FAILED 220 +#define ERROR_FLUSHBUF_FAILED 221 +#define ERROR_TRANSFER_TOO_LONG 222 +#define ERROR_FORCENOSWAP_FAILED 223 +#define ERROR_NO_CHILDREN 228 +#define ERROR_INVALID_SCREEN_GROUP 229 + +#define ERROR_BAD_PIPE 230 +#define ERROR_PIPE_BUSY 231 +#define ERROR_NO_DATA 232 +#define ERROR_PIPE_NOT_CONNECTED 233 +#define ERROR_MORE_DATA 234 + +#define ERROR_VC_DISCONNECTED 240 + +#define ERROR_CIRCULARITY_REQUESTED 250 +#define ERROR_DIRECTORY_IN_CDS 251 +#define ERROR_INVALID_FSD_NAME 252 +#define ERROR_INVALID_PATH 253 +#define ERROR_INVALID_EA_NAME 254 +#define ERROR_EA_LIST_INCONSISTENT 255 +#define ERROR_EA_LIST_TOO_LONG 256 +#define ERROR_NO_META_MATCH 257 +#define ERROR_FINDNOTIFY_TIMEOUT 258 +#define ERROR_NO_MORE_ITEMS 259 +#define ERROR_SEARCH_STRUC_REUSED 260 +#define ERROR_CHAR_NOT_FOUND 261 +#define ERROR_TOO_MUCH_STACK 262 +#define ERROR_INVALID_ATTR 263 +#define ERROR_INVALID_STARTING_RING 264 +#define ERROR_INVALID_DLL_INIT_RING 265 +#define ERROR_CANNOT_COPY 266 +#define ERROR_DIRECTORY 267 +#define ERROR_OPLOCKED_FILE 268 +#define ERROR_OPLOCK_THREAD_EXISTS 269 +#define ERROR_VOLUME_CHANGED 270 +#define ERROR_FINDNOTIFY_HANDLE_IN_USE 271 +#define ERROR_FINDNOTIFY_HANDLE_CLOSED 272 +#define ERROR_NOTIFY_OBJECT_REMOVED 273 +#define ERROR_ALREADY_SHUTDOWN 274 +#define ERROR_EAS_DIDNT_FIT 275 +#define ERROR_EA_FILE_CORRUPT 276 +#define ERROR_EA_TABLE_FULL 277 +#define ERROR_INVALID_EA_HANDLE 278 +#define ERROR_NO_CLUSTER 279 +#define ERROR_CREATE_EA_FILE 280 +#define ERROR_CANNOT_OPEN_EA_FILE 281 +#define ERROR_EAS_NOT_SUPPORTED 282 +#define ERROR_NEED_EAS_FOUND 283 +#define ERROR_DUPLICATE_HANDLE 284 +#define ERROR_DUPLICATE_NAME 285 +#define ERROR_EMPTY_MUXWAIT 286 +#define ERROR_MUTEX_OWNED 287 +#define ERROR_NOT_OWNER 288 +#define ERROR_PARAM_TOO_SMALL 289 +#define ERROR_TOO_MANY_HANDLES 290 +#define ERROR_TOO_MANY_OPENS 291 +#define ERROR_WRONG_TYPE 292 +#define ERROR_INVALID_TID 293 +#define ERROR_THREAD_NOT_TERMINATED 294 +#define ERROR_INIT_ROUTINE_FAILED 295 +#define ERROR_MODULE_IN_USE 296 +#define ERROR_NOT_ENOUGH_WATCHPOINTS 297 +#define ERROR_TOO_MANY_POSTS 298 +#define ERROR_ALREADY_POSTED 299 +#define ERROR_ALREADY_RESET 300 +#define ERROR_SEM_BUSY 301 + +#define ERROR_INVALID_PROCID 303 +#define ERROR_INVALID_PDELTA 304 +#define ERROR_NOT_DESCENDANT 305 +#define ERROR_NOT_SESSION_MANAGER 306 +#define ERROR_INVALID_PCLASS 307 +#define ERROR_INVALID_SCOPE 308 +#define ERROR_INVALID_THREADID 309 +#define ERROR_DOSSUB_SHRINK 310 +#define ERROR_DOSSUB_NOMEM 311 +#define ERROR_DOSSUB_OVERLAP 312 +#define ERROR_DOSSUB_BADSIZE 313 +#define ERROR_DOSSUB_BADFLAG 314 +#define ERROR_DOSSUB_BADSELECTOR 315 +#define ERROR_MR_MSG_TOO_LONG 316 +#define ERROR_MR_MID_NOT_FOUND 317 +#define ERROR_MR_UN_ACC_MSGF 318 +#define ERROR_MR_INV_MSGF_FORMAT 319 +#define ERROR_MR_INV_IVCOUNT 320 +#define ERROR_MR_UN_PERFORM 321 +#define ERROR_TS_WAKEUP 322 +#define ERROR_TS_SEMHANDLE 323 +#define ERROR_TS_NOTIMER 324 +#define ERROR_TS_HANDLE 326 +#define ERROR_TS_DATETIME 327 +#define ERROR_SYS_INTERNAL 328 +#define ERROR_QUE_CURRENT_NAME 329 +#define ERROR_QUE_PROC_NOT_OWNED 330 +#define ERROR_QUE_PROC_OWNED 331 +#define ERROR_QUE_DUPLICATE 332 +#define ERROR_QUE_ELEMENT_NOT_EXIST 333 +#define ERROR_QUE_NO_MEMORY 334 +#define ERROR_QUE_INVALID_NAME 335 +#define ERROR_QUE_INVALID_PRIORITY 336 +#define ERROR_QUE_INVALID_HANDLE 337 +#define ERROR_QUE_LINK_NOT_FOUND 338 +#define ERROR_QUE_MEMORY_ERROR 339 +#define ERROR_QUE_PREV_AT_END 340 +#define ERROR_QUE_PROC_NO_ACCESS 341 +#define ERROR_QUE_EMPTY 342 +#define ERROR_QUE_NAME_NOT_EXIST 343 +#define ERROR_QUE_NOT_INITIALIZED 344 +#define ERROR_QUE_UNABLE_TO_ACCESS 345 +#define ERROR_QUE_UNABLE_TO_ADD 346 +#define ERROR_QUE_UNABLE_TO_INIT 347 +#define ERROR_VIO_INVALID_MASK 349 +#define ERROR_VIO_PTR 350 +#define ERROR_VIO_APTR 351 +#define ERROR_VIO_RPTR 352 +#define ERROR_VIO_CPTR 353 +#define ERROR_VIO_LPTR 354 +#define ERROR_VIO_MODE 355 +#define ERROR_VIO_WIDTH 356 +#define ERROR_VIO_ATTR 357 +#define ERROR_VIO_ROW 358 +#define ERROR_VIO_COL 359 +#define ERROR_VIO_TOPROW 360 +#define ERROR_VIO_BOTROW 361 +#define ERROR_VIO_RIGHTCOL 362 +#define ERROR_VIO_LEFTCOL 363 +#define ERROR_SCS_CALL 364 +#define ERROR_SCS_VALUE 365 +#define ERROR_VIO_WAIT_FLAG 366 +#define ERROR_VIO_UNLOCK 367 +#define ERROR_SGS_NOT_SESSION_MGR 368 +#define ERROR_SMG_INVALID_SGID 369 +#define ERROR_SMG_INVALID_SESSION_ID 369 +#define ERROR_SMG_NOSG 370 +#define ERROR_SMG_NO_SESSIONS 370 +#define ERROR_SMG_GRP_NOT_FOUND 371 +#define ERROR_SMG_SESSION_NOT_FOUND 371 +#define ERROR_SMG_SET_TITLE 372 +#define ERROR_KBD_PARAMETER 373 +#define ERROR_KBD_NO_DEVICE 374 +#define ERROR_KBD_INVALID_IOWAIT 375 +#define ERROR_KBD_INVALID_LENGTH 376 +#define ERROR_KBD_INVALID_ECHO_MASK 377 +#define ERROR_KBD_INVALID_INPUT_MASK 378 +#define ERROR_MON_INVALID_PARMS 379 +#define ERROR_MON_INVALID_DEVNAME 380 +#define ERROR_MON_INVALID_HANDLE 381 +#define ERROR_MON_BUFFER_TOO_SMALL 382 +#define ERROR_MON_BUFFER_EMPTY 383 +#define ERROR_MON_DATA_TOO_LARGE 384 +#define ERROR_MOUSE_NO_DEVICE 385 +#define ERROR_MOUSE_INV_HANDLE 386 +#define ERROR_MOUSE_INV_PARMS 387 +#define ERROR_MOUSE_CANT_RESET 388 +#define ERROR_MOUSE_DISPLAY_PARMS 389 +#define ERROR_MOUSE_INV_MODULE 390 +#define ERROR_MOUSE_INV_ENTRY_PT 391 +#define ERROR_MOUSE_INV_MASK 392 +#define ERROR_MOUSE_NO_DATA 393 +#define ERROR_MOUSE_PTR_DRAWN 394 +#define ERROR_INVALID_FREQUENCY 395 +#define ERROR_NLS_NO_COUNTRY_FILE 396 +#define ERROR_NLS_OPEN_FAILED 397 +#define ERROR_NLS_NO_CTRY_CODE 398 +#define ERROR_NO_COUNTRY_OR_CODEPAGE 398 +#define ERROR_NLS_TABLE_TRUNCATED 399 +#define ERROR_NLS_BAD_TYPE 400 +#define ERROR_NLS_TYPE_NOT_FOUND 401 +#define ERROR_VIO_SMG_ONLY 402 +#define ERROR_VIO_INVALID_ASCIIZ 403 +#define ERROR_VIO_DEREGISTER 404 +#define ERROR_VIO_NO_POPUP 405 +#define ERROR_VIO_EXISTING_POPUP 406 +#define ERROR_KBD_SMG_ONLY 407 +#define ERROR_KBD_INVALID_ASCIIZ 408 +#define ERROR_KBD_INVALID_MASK 409 +#define ERROR_KBD_REGISTER 410 +#define ERROR_KBD_DEREGISTER 411 +#define ERROR_MOUSE_SMG_ONLY 412 +#define ERROR_MOUSE_INVALID_ASCIIZ 413 +#define ERROR_MOUSE_INVALID_MASK 414 +#define ERROR_MOUSE_REGISTER 415 +#define ERROR_MOUSE_DEREGISTER 416 +#define ERROR_SMG_BAD_ACTION 417 +#define ERROR_SMG_INVALID_CALL 418 +#define ERROR_SCS_SG_NOTFOUND 419 +#define ERROR_SCS_NOT_SHELL 420 +#define ERROR_VIO_INVALID_PARMS 421 +#define ERROR_VIO_FUNCTION_OWNED 422 +#define ERROR_VIO_RETURN 423 +#define ERROR_SCS_INVALID_FUNCTION 424 +#define ERROR_SCS_NOT_SESSION_MGR 425 +#define ERROR_VIO_REGISTER 426 +#define ERROR_VIO_NO_MODE_THREAD 427 +#define ERROR_VIO_NO_SAVE_RESTORE_THD 428 +#define ERROR_VIO_IN_BG 429 +#define ERROR_VIO_ILLEGAL_DURING_POPUP 430 +#define ERROR_SMG_NOT_BASESHELL 431 +#define ERROR_SMG_BAD_STATUSREQ 432 +#define ERROR_QUE_INVALID_WAIT 433 +#define ERROR_VIO_LOCK 434 +#define ERROR_MOUSE_INVALID_IOWAIT 435 +#define ERROR_VIO_INVALID_HANDLE 436 +#define ERROR_VIO_ILLEGAL_DURING_LOCK 437 +#define ERROR_VIO_INVALID_LENGTH 438 +#define ERROR_KBD_INVALID_HANDLE 439 +#define ERROR_KBD_NO_MORE_HANDLE 440 +#define ERROR_KBD_CANNOT_CREATE_KCB 441 +#define ERROR_KBD_CODEPAGE_LOAD_INCOMPL 442 +#define ERROR_KBD_INVALID_CODEPAGE_ID 443 +#define ERROR_KBD_NO_CODEPAGE_SUPPORT 444 +#define ERROR_KBD_FOCUS_REQUIRED 445 +#define ERROR_KBD_FOCUS_ALREADY_ACTIVE 446 +#define ERROR_KBD_KEYBOARD_BUSY 447 +#define ERROR_KBD_INVALID_CODEPAGE 448 +#define ERROR_KBD_UNABLE_TO_FOCUS 449 +#define ERROR_SMG_SESSION_NON_SELECT 450 +#define ERROR_SMG_SESSION_NOT_FOREGRND 451 +#define ERROR_SMG_SESSION_NOT_PARENT 452 +#define ERROR_SMG_INVALID_START_MODE 453 +#define ERROR_SMG_INVALID_RELATED_OPT 454 +#define ERROR_SMG_INVALID_BOND_OPTION 455 +#define ERROR_SMG_INVALID_SELECT_OPT 456 +#define ERROR_SMG_START_IN_BACKGROUND 457 +#define ERROR_SMG_INVALID_STOP_OPTION 458 +#define ERROR_SMG_BAD_RESERVE 459 +#define ERROR_SMG_PROCESS_NOT_PARENT 460 +#define ERROR_SMG_INVALID_DATA_LENGTH 461 +#define ERROR_SMG_NOT_BOUND 462 +#define ERROR_SMG_RETRY_SUB_ALLOC 463 +#define ERROR_KBD_DETACHED 464 +#define ERROR_VIO_DETACHED 465 +#define ERROR_MOU_DETACHED 466 +#define ERROR_VIO_FONT 467 +#define ERROR_VIO_USER_FONT 468 +#define ERROR_VIO_BAD_CP 469 +#define ERROR_VIO_NO_CP 470 +#define ERROR_VIO_NA_CP 471 +#define ERROR_INVALID_CODE_PAGE 472 +#define ERROR_CPLIST_TOO_SMALL 473 +#define ERROR_CP_NOT_MOVED 474 +#define ERROR_MODE_SWITCH_INIT 475 +#define ERROR_CODE_PAGE_NOT_FOUND 476 +#define ERROR_UNEXPECTED_SLOT_RETURNED 477 +#define ERROR_SMG_INVALID_TRACE_OPTION 478 +#define ERROR_VIO_INTERNAL_RESOURCE 479 +#define ERROR_VIO_SHELL_INIT 480 +#define ERROR_SMG_NO_HARD_ERRORS 481 +#define ERROR_CP_SWITCH_INCOMPLETE 482 +#define ERROR_VIO_TRANSPARENT_POPUP 483 +#define ERROR_CRITSEC_OVERFLOW 484 +#define ERROR_CRITSEC_UNDERFLOW 485 +#define ERROR_VIO_BAD_RESERVE 486 +#define ERROR_INVALID_ADDRESS 487 +#define ERROR_ZERO_SELECTORS_REQUESTED 488 +#define ERROR_NOT_ENOUGH_SELECTORS_AVA 489 +#define ERROR_INVALID_SELECTOR 490 +#define ERROR_SMG_INVALID_PROGRAM_TYPE 491 +#define ERROR_SMG_INVALID_PGM_CONTROL 492 +#define ERROR_SMG_INVALID_INHERIT_OPT 493 +#define ERROR_VIO_EXTENDED_SG 494 +#define ERROR_VIO_NOT_PRES_MGR_SG 495 +#define ERROR_VIO_SHIELD_OWNED 496 +#define ERROR_VIO_NO_MORE_HANDLES 497 +#define ERROR_VIO_SEE_ERROR_LOG 498 +#define ERROR_VIO_ASSOCIATED_DC 499 +#define ERROR_KBD_NO_CONSOLE 500 +#define ERROR_MOUSE_NO_CONSOLE 501 +#define ERROR_MOUSE_INVALID_HANDLE 502 +#define ERROR_SMG_INVALID_DEBUG_PARMS 503 +#define ERROR_KBD_EXTENDED_SG 504 +#define ERROR_MOU_EXTENDED_SG 505 +#define ERROR_SMG_INVALID_ICON_FILE 506 + +/* New Equates For OS/2 1.2 */ +#define ERROR_TRC_PID_NON_EXISTENT 507 +#define ERROR_TRC_COUNT_ACTIVE 508 +#define ERROR_TRC_SUSPENDED_BY_COUNT 509 +#define ERROR_TRC_COUNT_INACTIVE 510 +#define ERROR_TRC_COUNT_REACHED 511 +#define ERROR_NO_MC_TRACE 512 +#define ERROR_MC_TRACE 513 +#define ERROR_TRC_COUNT_ZERO 514 +#define ERROR_SMG_TOO_MANY_DDS 515 +#define ERROR_SMG_INVALID_NOTIFICATION 516 +#define ERROR_LF_INVALID_FUNCTION 517 +#define ERROR_LF_NOT_AVAIL 518 +#define ERROR_LF_SUSPENDED 519 +#define ERROR_LF_BUF_TOO_SMALL 520 +#define ERROR_LF_BUFFER_CORRUPTED 521 +#define ERROR_LF_INVALID_DAEMON 522 +#define ERROR_LF_INVALID_TEMPL 523 +#define ERROR_LF_GENERAL_FAILURE 524 +#define ERROR_LF_INVALID_ID 525 +#define ERROR_LF_INVALID_HANDLE 526 +#define ERROR_LF_NO_ID_AVAIL 527 +#define ERROR_LF_TEMPLATE_AREA_FULL 528 +#define ERROR_LF_ID_IN_USE 529 +#define ERROR_MOU_NOT_INITIALIZED 530 +#define ERROR_MOUINITREAL_DONE 531 + +/* now more 2.0 stuff */ +#define ERROR_DOSSUB_CORRUPTED 532 +#define ERROR_MOUSE_CALLER_NOT_SUBSYS 533 +#define ERROR_ARITHMETIC_OVERFLOW 534 + +/* TMR device */ + +#define ERROR_TMR_NO_DEVICE 535 +#define ERROR_TMR_INVALID_TIME 536 + +/* Perfview */ + +#define ERROR_PVW_INVALID_ENTITY 537 +#define ERROR_PVW_INVALID_ENTITY_TYPE 538 +#define ERROR_PVW_INVALID_SPEC 539 +#define ERROR_PVW_INVALID_RANGE_TYPE 540 +#define ERROR_PVW_INVALID_COUNTER_BLK 541 +#define ERROR_PVW_INVALID_TEXT_BLK 542 + +/* PROFILER */ + +#define ERROR_PRF_NOT_INITIALIZED 543 +#define ERROR_PRF_ALREADY_INITIALIZED 544 +#define ERROR_PRF_NOT_STARTED 545 +#define ERROR_PRF_ALREADY_STARTED 546 +#define ERROR_PRF_TIMER_OUT_OF_RANGE 547 +#define ERROR_PRF_TIMER_RESET 548 + +#define ERROR_TIMEOUT 640 +#define ERROR_VDM_DOWN 641 +#define ERROR_VDM_LIMIT 642 +#define ERROR_VDD_NOT_FOUND 643 +#define ERROR_INVALID_CALLER 644 +#define ERROR_PID_MISMATCH 645 +#define ERROR_INVALID_VDD_HANDLE 646 +#define ERROR_VLPT_NO_SPOOLER 647 +#define ERROR_VCOM_DEVICE_BUSY 648 +#define ERROR_VLPT_DEVICE_BUSY 649 +#define ERROR_NESTING_TOO_DEEP 650 + +#define ERROR_SWAPPER_NOT_ACTIVE 32768 +#define ERROR_INVALID_SWAPID 32769 +#define ERROR_IOERR_SWAP_FILE 32770 +#define ERROR_SWAP_TABLE_FULL 32771 +#define ERROR_SWAP_FILE_FULL 32772 +#define ERROR_CANT_INIT_SWAPPER 32773 +#define ERROR_SWAPPER_ALREADY_INIT 32774 +#define ERROR_PMM_INSUFFICIENT_MEMORY 32775 +#define ERROR_PMM_INVALID_FLAGS 32776 +#define ERROR_PMM_INVALID_ADDRESS 32777 +#define ERROR_PMM_LOCK_FAILED 32778 +#define ERROR_PMM_UNLOCK_FAILED 32779 +#define ERROR_PMM_MOVE_INCOMPLETE 32780 +#define ERROR_UCOM_DRIVE_RENAMED 32781 +#define ERROR_UCOM_FILENAME_TRUNCATED 32782 +#define ERROR_UCOM_BUFFER_LENGTH 32783 +#define ERROR_MON_CHAIN_HANDLE 32784 +#define ERROR_MON_NOT_REGISTERED 32785 +#define ERROR_SMG_ALREADY_TOP 32786 +#define ERROR_PMM_ARENA_MODIFIED 32787 +#define ERROR_SMG_PRINTER_OPEN 32788 +#define ERROR_PMM_SET_FLAGS_FAILED 32789 +#define ERROR_INVALID_DOS_DD 32790 +#define ERROR_BLOCKED 32791 +#define ERROR_NOBLOCK 32792 +#define ERROR_INSTANCE_SHARED 32793 +#define ERROR_NO_OBJECT 32794 +#define ERROR_PARTIAL_ATTACH 32795 +#define ERROR_INCACHE 32796 +#define ERROR_SWAP_IO_PROBLEMS 32797 +#define ERROR_CROSSES_OBJECT_BOUNDARY 32798 +#define ERROR_LONGLOCK 32799 +#define ERROR_SHORTLOCK 32800 +#define ERROR_UVIRTLOCK 32801 +#define ERROR_ALIASLOCK 32802 +#define ERROR_ALIAS 32803 +#define ERROR_NO_MORE_HANDLES 32804 +#define ERROR_SCAN_TERMINATED 32805 +#define ERROR_TERMINATOR_NOT_FOUND 32806 +#define ERROR_NOT_DIRECT_CHILD 32807 +#define ERROR_DELAY_FREE 32808 +#define ERROR_GUARDPAGE 32809 +#define ERROR_SWAPERROR 32900 +#define ERROR_LDRERROR 32901 +#define ERROR_NOMEMORY 32902 +#define ERROR_NOACCESS 32903 +#define ERROR_CPSIO_CODE_PAGE_INVALID 65026 +#define ERROR_CPSIO_NO_SPOOLER 65027 +#define ERROR_CPSIO_FONT_ID_INVALID 65028 +#define ERROR_CPSIO_INTERNAL_ERROR 65033 +#define ERROR_CPSIO_INVALID_PTR_NAME 65034 +#define ERROR_CPSIO_NOT_ACTIVE 65037 +#define ERROR_CPSIO_PID_FULL 65039 +#define ERROR_CPSIO_PID_NOT_FOUND 65040 +#define ERROR_CPSIO_READ_CTL_SEQ 65043 +#define ERROR_CPSIO_READ_FNT_DEF 65045 +#define ERROR_CPSIO_WRITE_ERROR 65047 +#define ERROR_CPSIO_WRITE_FULL_ERROR 65048 +#define ERROR_CPSIO_WRITE_HANDLE_BAD 65049 +#define ERROR_CPSIO_SWIT_LOAD 65074 +#define ERROR_CPSIO_INV_COMMAND 65077 +#define ERROR_CPSIO_NO_FONT_SWIT 65078 +#define ERROR_ENTRY_IS_CALLGATE 65079 + +#define ERROR_USER_DEFINED_BASE 0xFF00 + +#endif // _OS2V20_ERRORS_ + diff --git a/private/os2/inc/os2file.h b/private/os2/inc/os2file.h new file mode 100644 index 000000000..ec1a46c66 --- /dev/null +++ b/private/os2/inc/os2file.h @@ -0,0 +1,442 @@ +/*++ + +Copyright (c) 1990 Microsoft Corporation + +Module Name: + + os2file.h + +Abstract: + + This module defines the OS/2 subsystem I/O data types for both the + DLL and server. + +Author: + + Therese Stowell (thereses) 17-Dec-1989 + +Revision History: + +--*/ + + +// +// there is one of these records per drive letter, per process. the CurDir +// contains the current directory string, beginning with the drive letter +// in the first subdirectory. for example, if the current directory for +// drive a: is "a:\bin\test", "a:\bin\test" is the CurDir string. However, +// if the current directory is the root, the pCurDir is NULL. +// + +typedef struct _CURRENT_DIRECTORY_STRING { + USHORT RefCount; /* number of processes which has this string as a curdir */ + STRING CurDirString; /* current directory string */ +} CURRENT_DIRECTORY_STRING, *PCURRENT_DIRECTORY_STRING; + +// each element in the array is in the form: + +typedef struct _CURRENT_DIRECTORY_INFORMATION { + HANDLE NtHandle; /* handle to open current directory */ + PCURRENT_DIRECTORY_STRING pCurDir; /* pointer to current directory string and ref count. */ + BOOLEAN CurrentDirectoryIsValid; /* Indicates whether the current directory was explicity set */ +} CURRENT_DIRECTORY_INFORMATION, *PCURRENT_DIRECTORY_INFORMATION; + +//BUGBUG this typedef belongs in iovector.h + + +typedef enum _IO_VECTOR_TYPE { + NulVectorType, + ConVectorType, +// AuxVectorType, as ComVectorType + ComVectorType, +// PrnVectorType, as LptVectorType + LptVectorType, + KbdVectorType, + MouseVectorType, + ClockVectorType, + ScreenVectorType, + PointerVectorType, + FileVectorType, + PipeVectorType, + DeviceVectorType, + RemoteVectorType, + MonitorVectorType +} IO_VECTOR_TYPE; + +typedef struct _FILE_HANDLE { + HANDLE NtHandle; // NT or pipe or OS2.EXE (for Screen, Kbd, Mouse, Con & Monitor) handle + HANDLE NtAsyncReadEvent; // These handles are used for Asynchronous IO + HANDLE NtAsyncWriteEvent; // Operations. At present, they are used only + HANDLE NtAsyncIOCtlEvent; // for the COM devices + USHORT FileType; // file, pipe, device, unc + USHORT DeviceAttribute; // device flags, if char device + ULONG Flags; // free or allocated, plus DosQueryFHState flags + // inherit, write-through, fail-error, cache + // access and sharing mode + IO_VECTOR_TYPE IoVectorType; // which IO routines to call +} FILE_HANDLE, *PFILE_HANDLE; + +#include "iovector.h" + +typedef ULONG FILE_HANDLE_NUMBER, *PFILE_HANDLE_NUMBER; // handle returned to user (index into array) + +// the following three values are chosen to not conflict with the bits accessible +// through DosQueryFHState. An allocated file handle is reserved, but +// uninitialized. A valid file handle is allocated and initialized. + +#define FILE_HANDLE_FREE 0x00000100 /* ---- -001 ---- ---- */ +#define FILE_HANDLE_ALLOCATED 0x00000200 /* ---- -010 ---- ---- */ +#define FILE_HANDLE_VALID 0x00000400 /* ---- -100 ---- ---- */ + +/* + + device attributes + + 15 14 13 12 11 9 8 7 6 5 4 3 2 1 0 + + C C I O G C N S K + H O B P LEVEL I L U C B + R N M N O K L R D + + since OS/2 doesn't return the device header for block devices via + DosQueryHType, we don't need to worry about the bits that describe + block devices: DEVICE_ATTRIBUTE_NONIBM and DEVICE_ATTRIBUTE_OPEN for + block devices. + + FYI: + + DEVICE_ATTRIBUTE_NONIBM describes how the system builds the BPB from the + medium. if this bit is set, there is no boot sector on the disk. in NT, + this bit is meaningless and is always set. + + BuildBPB: + get free buffer + If (ibm block format) + Read first sector of first fat into buffer + call device driver build bpb passing in buffer + +*/ + +#define DEVICE_ATTRIBUTE_STDIN 0x0001 /* ---- ---- ---- 0001 */ +#define DEVICE_ATTRIBUTE_STDOUT 0x0002 /* ---- ---- ---- 0010 */ +#define DEVICE_ATTRIBUTE_NUL 0x0004 /* ---- ---- ---- 0100 */ +#define DEVICE_ATTRIBUTE_CLOCK 0x0008 /* ---- ---- ---- 1000 */ +#define DEVICE_ATTRIBUTE_GENIOCTL 0x0040 /* ---- ---- 0100 ---- */ +#define DEVICE_ATTRIBUTE_NTLEVEL 0x0380 /* ---- --11 1000 ---- */ +#define DEVICE_ATTRIBUTE_OPEN 0x0800 /* ---- 1000 ---- ---- */ +#define DEVICE_ATTRIBUTE_REM_MEDIA 0x0800 /* ---- 1000 ---- ---- */ +#define DEVICE_ATTRIBUTE_NONIBM 0x2000 /* 0010 ---- ---- ---- */ +#define DEVICE_ATTRIBUTE_CONSOLE 0x4000 /* 0100 ---- ---- ---- */ +#define DEVICE_ATTRIBUTE_CHAR 0x8000 /* 1000 ---- ---- ---- */ +#define DEVICE_ATTRIBUTE_BLOCK 0x8000 /* 1000 ---- ---- ---- */ + +#define DEVICE_ATTRIBUTE_DEFAULT (DEVICE_ATTRIBUTE_NTLEVEL | DEVICE_ATTRIBUTE_OPEN) +#define DEVICE_ATTRIBUTE_DEFAULT_CHAR (DEVICE_ATTRIBUTE_DEFAULT | DEVICE_ATTRIBUTE_CHAR | DEVICE_ATTRIBUTE_GENIOCTL) + +#define MapDeviceAction(CreateDisposition) (CreateDisposition == FILE_CREATE ? FILE_CREATED : FILE_EXISTED) + +typedef enum _SHARE_OPERATION { + AddShare, + DupShare, + RemoveShare +} SHARE_OPERATION; + +#define NUMBER_OF_DEVICES (PointerVectorType+1) +#define MAXIMUM_DEVICE_VECTOR_TYPE PointerVectorType + +typedef struct _SHARE_ACCESS { + ULONG OpenCount; + ULONG Readers; + ULONG Writers; + ULONG Deleters; + ULONG SharedRead; + ULONG SharedWrite; + ULONG SharedDelete; +} SHARE_ACCESS, *PSHARE_ACCESS; + +// +// FindFirst/Next search record. if FindBuffer == NULL, the search doesn't +// need to be rewound and RewindEntry is meaningless. +// + +typedef struct _SEARCH_RECORD { + HANDLE NtHandle; // NT directory handle + ULONG Attributes; // attributes associated with search + ULONG InformationLevel; // what type of info to return + PVOID FindBuffer; // buffer filled by NtQueryDirectoryFile + ULONG BufferLength; // length of FindBuffer + PFILE_DIRECTORY_INFORMATION RewindEntry; // pointer to entry in buffer to begin search from +} SEARCH_RECORD, *PSEARCH_RECORD; + +// the following value is specially defined. the search handle table does +// not have an allocated field, it is an array of heap addresses that point +// to search records. since zero is never an invalid heap address (per +// SteveWo, 1/4/90), we use it to indicate a free handle. + +#define SEARCH_HANDLE_FREE 0x0000 +#define INITIAL_SEARCH_HANDLES 5 // initial number of search handles +#define SEARCH_TABLE_HANDLE_INCREMENT 10 // number of handles table grows by + +/* takes zero-based drive number and returns ascii drive char */ + +#define CONVERTTOASCII(drivenumber) ((char)(drivenumber+(int)'A')) + +#define ISSLASH(ch) ((ch == '\\') || (ch == '/')) +#define ISPATHSEP(ch) ((ch == '\\') || (ch == '/') || (ch == '\0')) + +/* !!! when changing update os2ses\os2.c */ + +#define FILE_TYPE_FILE 0x0000 +#define FILE_TYPE_DEV 0x0001 +#define FILE_TYPE_PIPE 0x0002 +#define FILE_TYPE_NMPIPE 0x0004 +#define FILE_TYPE_UNC 0x0008 +#define FILE_TYPE_PSDEV 0x0010 +#define FILE_TYPE_MAILSLOT 0x0020 +#define FILE_TYPE_COM 0x0040 + +#define MAX_DRIVES 26 +#define DRIVE_EXISTS 1 + +#define FILE_PREFIX_LENGTH 14 // "\OS2SS\DRIVES\" +#define DEV_PREFIX_LENGTH 12 // "\DosDevices\" +#define NMPIPE_PREFIX_LENGTH 12 // "\OS2SS\PIPE\" +#define UNC_PREFIX_LENGTH 11 // "\OS2SS\UNC\" +#define PSDEV_PREFIX_LENGTH 2 // "@n" +#define MAILSLOT_PREFIX_LENGTH 16 // "\OS2SS\MAILSLOT\" +#define COM_PREFIX_LENGTH 12 // "\DosDevices\" + +#define ROOTDIRLENGTH 3 +#define DRIVE_LETTER 0 +#define COLON 1 +#define FIRST_SLASH 2 +#define DRIVE_LETTER_SIZE ROOTDIRLENGTH // size of "d:\" + +#define INITIALFILEHANDLES 20 + +#define MINFEALISTSIZE 4 // minimum FEA list size +#define MINFEAVALUESIZE 1 // minimum length of ea value +#define MINFEANAMESIZE 2 // minimum length of ea name (including NUL) + +typedef struct _OLDFEA { + BYTE fEA; /* flags */ + BYTE cbName; /* name length not including NULL */ + USHORT cbValue; /* value length */ + CHAR szName[1]; /* attribute name */ +} OLDFEA, *POLDFEA; + +// +// maximum EA buffer to allocate. this figures out the maximum number of +// packed EAs that will fit in 64K-1, then calculates the amount of memory +// necessary to hold them in NT form. then we're guaranteed that all the EAs +// for a file will fit in a buffer this size. +// + +// +// this equated defines the maximum size of an unaligned EA. it is the +// maximum size of an unaligned EA list minus the size of the cblist. +// + +#define MAX_UNALIGNED_EA_LIST_SIZE 0xFFFF +#define MAX_UNALIGNED_EA_SIZE (MAX_UNALIGNED_EA_LIST_SIZE - MINFEALISTSIZE) + +// +// this equated defines the maximum size of an aligned EA. it is the +// maximum size of an unaligned EA plus the size of the NextEntryOffset field. +// + +#define MAX_EA_SIZE (MAX_UNALIGNED_EA_SIZE + sizeof(ULONG)) + +// +// maximum EA buffer to allocate. this figures out the maximum number of +// packed EAs that will fit in 64K-1, then calculates the amount of memory +// necessary to hold them in NT form. then we're guaranteed that all the EAs +// for a file will fit in a buffer this size. +// + +#define SMALLEST_UNALIGNED_EA (sizeof(OLDFEA) + MINFEAVALUESIZE + MINFEANAMESIZE) +#define MAXIMUM_NUMBER_OF_EAS ((MAX_UNALIGNED_EA_LIST_SIZE-MINFEALISTSIZE) / SMALLEST_UNALIGNED_EA) +#define SMALLEST_NT_EA (RoundUpToUlong(FIELD_OFFSET( FILE_FULL_EA_INFORMATION, EaName ) + MINFEAVALUESIZE + MINFEANAMESIZE)) +#define MAX_ALIGNED_EA_LIST_SIZE (MAXIMUM_NUMBER_OF_EAS * SMALLEST_NT_EA) + +#define DENA1_sizeof(fea) (FIELD_OFFSET (DENA1,szName) + (fea)->cbName+1) +#define DENA1_oNextEntryOffset(fea) (RoundUpToUlong(DENA1_sizeof(fea))) + +#define BLOCK_SIZE 512L +#define BLOCK_SHIFT 9L + +//++ +// +// ULONG +// BYTES_TO_BLOCKS ( +// IN ULONG SIZE +// ) +// +// Routine Description: +// +// +// The BYTES_TO_BLOCKS macro takes the size in bytes and calculates the number +// of 512-byte blocks required to contain the bytes. +// +// +// Arguments: +// +// SIZE - Size in bytes. +// +// Return Value: +// +// Returns the number of blocks required to contain the specified size. +// +// adapted from BYTES_TO_PAGES +// +//-- + +#define BYTES_TO_BLOCKS(SIZE) (((ULONG)SIZE + BLOCK_SIZE - 1) >> BLOCK_SHIFT) + +//++ +// +// ULONG +// BYTES_TO_OFFSET ( +// IN ULONG SIZE +// ) +// +// Routine Description: +// +// +// The BYTES_TO_OFFSET macro takes the size in bytes and calculates BYTES MOD +// BLOCKSIZE in order to determine the number of bytes in the last block. +// +// +// Arguments: +// +// SIZE - Size in bytes. +// +// Return Value: +// +// Returns the number of blocks required to contain the specified size. +// +//-- + +#define BYTES_TO_OFFSET(SIZE) ((ULONG)SIZE & (BLOCK_SIZE - 1)) + +//++ +// +// ULONG +// BLOCKS_TO_BYTES ( +// IN ULONG BLOCKS +// IN ULONG OFFSET +// ) +// +// Routine Description: +// +// +// The BLOCKS_TO_BYTES macro takes the size in blocks and offset and calculates +// BLOCKS * BLOCK_SIZE + OFFSET in order to determine the number of bytes in +// the file. +// +// Arguments: +// +// SIZE - Size in bytes. +// +// Return Value: +// +// Returns the number of blocks required to contain the specified size. +// +//-- + +#define BLOCKS_TO_BYTES(BLOCKS,OFFSET) ((BLOCKS << BLOCK_SHIFT) + OFFSET) + + +// used in exec call to initialize file system + +typedef struct _OS2_FILE_SYSTEM_PARAMETERS { + PFILE_HANDLE ParentHandleTable; // address of parent handle table + ULONG ParentTableLength; // number of entries in parent table + ULONG CurrentDrive; // process's current drive +} OS2_FILE_SYSTEM_PARAMETERS, *POS2_FILE_SYSTEM_PARAMETERS; + +// passed to Os2SetProcessContext which passes it to Od2ProcessStartup +// because the file system needs to know whether to set up stdin, etc. +// and initialize the file handle table or to copy the file handle table from +// the parent. + +#define CALLED_BY_EXEC 1 +#define CALLED_BY_SESMGR 2 + +typedef struct _PIPE_HEADER { + ULONG PipeSize; // pipe size, not including header + ULONG RefCount; // number of references to pipe + ULONG ReadCount; // count of readers + ULONG WriteCount; // count of writers + ULONG First; // ptr to base of circular buffer + ULONG In; // ptr to next free byte + ULONG Out; // ptr to next byte of data + ULONG Last; // ptr to end+1 of buffer + HANDLE ReadNeedMoreData; // wait on this if out of data to read + HANDLE WriteBufferFull; // wait on this if out of space to write + RTL_CRITICAL_SECTION LockForRead; // serialize reads using this + RTL_CRITICAL_SECTION LockForWrite; // serialize writes using this +} PIPE_HEADER, *PPIPE_HEADER; + +#define PIPE_READ_HANDLE OPEN_ACCESS_READONLY +#define PIPE_WRITE_HANDLE OPEN_ACCESS_WRITEONLY +#define DEFAULT_PIPE_SIZE 512 + + +// the size of the information for one directory entry for the various +// FindFirst/Next infolevels, assuming a 1 byte name. + +#define FIND_LEVEL_ONE_INFO_SIZE (sizeof(FILEFINDBUF3) - CCHMAXPATHCOMP + 2) +#define FIND_LEVEL_TWO_INFO_SIZE (sizeof(FILEFINDBUF4) - CCHMAXPATHCOMP + 2) + +#define ATTR_IGNORE (FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_ARCHIVE) + +// BUGBUG does this work correctly (aligned)? + +#define ATTR_SIZE3 (FIELD_OFFSET(FILEFINDBUF3,cchName)) +#define ATTR_SIZE4 (FIELD_OFFSET(FILEFINDBUF4,cchName)) + +// +// The following are the flags passed to Canonicalize +// + +#define FULL_PATH_REQUIRED 0x0001 // full canonical path needed + +#define PIPE_DIR_OK 0x0002 // "d:\pipe" is ok as file + +#define PIPE_DIR_SIZE 6 // length of "\PIPE\" + +// +// The DBCS macro determines whether a character is DBCS +// +// BUGBUG make DBCS macro do something + +#ifdef DBCS +// MSKK Sep.27.1993 V-AkihiS +#define IsDbcs(pChar) Ow2NlsIsDBCSLeadByte(*pChar, SesGrp->DosCP) +#else +//#define DBCS(pChar) FALSE +#define IsDbcs(pChar) FALSE // MSKK fix for NON-DBCS build break +#endif + +#define UCase(Char) (((Char >= 'a') && (Char <= 'z')) ? (Char - ('a' - 'A')) : (Char)) + + +// +// The CharsEqual macro determines whether two characters are equal and is +// DBCS-correct +// BUGBUG what if DBCS chars aren't aligned? +// + +// MSKK fix for NON-DBCS build break +/* +#define CharsEqual(pChar1,pChar2) ((DBCS(pChar1)) ? ((*(PUSHORT)(pChar1)) == (*(PUSHORT)(pChar1))) : \ + (UCase(*pChar1) == UCase(*pChar2))) +*/ +#define CharsEqual(pChar1,pChar2) ((IsDbcs(pChar1)) ? ((*(PUSHORT)(pChar1)) == (*(PUSHORT)(pChar2))) : \ + (UCase(*pChar1) == UCase(*pChar2))) +// +// sectors in NT are always 512 bytes +// + +#define BYTES_PER_SECTOR 512 diff --git a/private/os2/inc/os2flopy.h b/private/os2/inc/os2flopy.h new file mode 100644 index 000000000..c727069b0 --- /dev/null +++ b/private/os2/inc/os2flopy.h @@ -0,0 +1,83 @@ +/*++ + +Copyright (c) 1990 Microsoft Corporation + +Module Name: + + os2flopy.h + +Abstract: + + Definitions file for the floppy disk module (dllflopy.c). + +Author: + + Ofer Porat (oferp) 6-23-93 + +Revision History: + +--*/ + +#ifndef __OS2FLOPY_H +#define __OS2FLOPY_H + +// +// os2dev.h must be included for this file to be valid +// + +#define READ_TRACK_CMD 0 +#define WRITE_TRACK_CMD 1 +#define VERIFY_TRACK_CMD 2 +#define TRACK_CMD_LIMIT 3 + + +APIRET +Od2IdentifyDiskDrive( + IN HANDLE NtHandle, + IN PULONG pDriveNumberPermanentStorageLocation, + OUT PULONG pDriveNumber + ); + +APIRET +Od2AcquireDeviceBPB( + IN ULONG DriveNumber, + IN HANDLE NtHandle, + IN BOOLEAN Validate, + IN BOOLEAN UseDefault, + IN OUT PBIOSPARAMETERBLOCK pBpb OPTIONAL + ); + +APIRET +Od2AcquireMediaBPB( + IN ULONG DriveNumber, + IN HANDLE NtHandle, + IN BOOLEAN Validate, + IN BOOLEAN UseDefault, + IN BOOLEAN EnforceFakeGeometry, + IN OUT PBIOSPARAMETERBLOCK pBpb OPTIONAL, + OUT PMEDIA_TYPE pMediaType OPTIONAL, + OUT PDISK_GEOMETRY pTrueMediaGeometry OPTIONAL + ); + +APIRET +Od2ReadWriteVerifyTrack( + IN HANDLE NtHandle, + IN ULONG Command, + IN PTRACKLAYOUT TrackLayout, + IN PBYTE pData OPTIONAL, + IN ULONG CountSectors, + IN PBIOSPARAMETERBLOCK pBpb, + IN PDISK_GEOMETRY pTrueGeometry + ); + +APIRET +Od2FormatTrack( + IN HANDLE NtHandle, + IN PTRACKFORMAT TrackFormat, + IN ULONG CountSectors, + IN BYTE FormatSectorSizeType, + IN PBIOSPARAMETERBLOCK pBpb, + IN MEDIA_TYPE MediaType + ); + +#endif diff --git a/private/os2/inc/os2ldr.h b/private/os2/inc/os2ldr.h new file mode 100644 index 000000000..13c5cace4 --- /dev/null +++ b/private/os2/inc/os2ldr.h @@ -0,0 +1,67 @@ +/*++ + +Copyright (c) 1989 Microsoft Corporation + +Module Name: + + os2ldr.h + +Abstract: + + Main include file for OS/2 Subsystem Loader + +Author: + + Beni Lavi (BeniL) 5-Nov-1992 + +Revision History: + +--*/ + +#include <ldrdbg.h> + +BOOLEAN +ldrInit( + VOID +); + +APIRET +Allocate16BHandle( + OUT PUSHORT pusHandle, + IN ULONG h32bHandle +); + +BOOLEAN +ldrCreateSelBitmap(); + +VOID +ldrMarkAllocatedSel( + IN ULONG NumberOfSel, + IN BOOLEAN MarkFronTop +); + +ULONG +ldrAllocateSel( + IN ULONG NumberOfSel, + IN BOOLEAN TopDownAllocation +); + +VOID +ldrFreeSel( + IN ULONG StartSel, + IN ULONG NumberOfSel +); + +BOOLEAN +ldrCreateCallGateBitmap(); + +VOID +ldrMarkAllocatedCallGates(ULONG NumberOfCallGates); + +ULONG +ldrAllocateCallGate(); + +VOID +ldrDeallocateCallGate( + ULONG CallGate +); diff --git a/private/os2/inc/os2net16.h b/private/os2/inc/os2net16.h new file mode 100644 index 000000000..fd0468966 --- /dev/null +++ b/private/os2/inc/os2net16.h @@ -0,0 +1,974 @@ +/*++ + +Copyright (c) 1992 Microsoft Corporation + +Module Name: + + os2net16.h + +Abstract: + + This module implements 32 equivalents of OS/2 V1.21 + LANMAN API Calls. + The APIs are called from 16->32 thunks (i386\doscalls.asm). + +Author: + + Beni Lavi (BeniL) 15-Jan-1992 + +Revision History: + +--*/ + +#define DEVLEN_LM20 8 +#define CNLEN_LM20 15 /* Computer name length */ +#define UNLEN_LM20 20 /* Maximum user name length */ +#define ENCRYPTED_PWLEN_LM20 16 +#define NNLEN_LM20 12 /* 8.3 Net name length */ +#define SHPWLEN_LM20 8 /* Share password length */ +#define SNLEN_LM20 15 /* Service name length */ +#define STXTLEN_LM20 63 /* Service text length */ + +#pragma pack(1) + +struct use_info_0 { + char ui0_local[DEVLEN_LM20+1]; + char ui0_pad_1; + char *ui0_remote; +}; /* use_info_0 */ + +struct use_info_1 { + char ui1_local[DEVLEN_LM20+1]; + char ui1_pad_1; + char * ui1_remote; + char * ui1_password; + unsigned short ui1_status; + short ui1_asg_type; + unsigned short ui1_refcount; + unsigned short ui1_usecount; +}; /* use_info_1 */ + +struct wksta_info_0 { + unsigned short wki0_reserved_1; + unsigned long wki0_reserved_2; + char far * wki0_root; + char far * wki0_computername; + char far * wki0_username; + char far * wki0_langroup; + unsigned char wki0_ver_major; + unsigned char wki0_ver_minor; + unsigned long wki0_reserved_3; + unsigned short wki0_charwait; + unsigned long wki0_chartime; + unsigned short wki0_charcount; + unsigned short wki0_reserved_4; + unsigned short wki0_reserved_5; + unsigned short wki0_keepconn; + unsigned short wki0_keepsearch; + unsigned short wki0_maxthreads; + unsigned short wki0_maxcmds; + unsigned short wki0_reserved_6; + unsigned short wki0_numworkbuf; + unsigned short wki0_sizworkbuf; + unsigned short wki0_maxwrkcache; + unsigned short wki0_sesstimeout; + unsigned short wki0_sizerror; + unsigned short wki0_numalerts; + unsigned short wki0_numservices; + unsigned short wki0_errlogsz; + unsigned short wki0_printbuftime; + unsigned short wki0_numcharbuf; + unsigned short wki0_sizcharbuf; + char far * wki0_logon_server; + char far * wki0_wrkheuristics; + unsigned short wki0_mailslots; +}; /* wksta_info_0 */ + +struct wksta_info_1 { + unsigned short wki1_reserved_1; + unsigned long wki1_reserved_2; + char far * wki1_root; + char far * wki1_computername; + char far * wki1_username; + char far * wki1_langroup; + unsigned char wki1_ver_major; + unsigned char wki1_ver_minor; + unsigned long wki1_reserved_3; + unsigned short wki1_charwait; + unsigned long wki1_chartime; + unsigned short wki1_charcount; + unsigned short wki1_reserved_4; + unsigned short wki1_reserved_5; + unsigned short wki1_keepconn; + unsigned short wki1_keepsearch; + unsigned short wki1_maxthreads; + unsigned short wki1_maxcmds; + unsigned short wki1_reserved_6; + unsigned short wki1_numworkbuf; + unsigned short wki1_sizworkbuf; + unsigned short wki1_maxwrkcache; + unsigned short wki1_sesstimeout; + unsigned short wki1_sizerror; + unsigned short wki1_numalerts; + unsigned short wki1_numservices; + unsigned short wki1_errlogsz; + unsigned short wki1_printbuftime; + unsigned short wki1_numcharbuf; + unsigned short wki1_sizcharbuf; + char far * wki1_logon_server; + char far * wki1_wrkheuristics; + unsigned short wki1_mailslots; + char far * wki1_logon_domain; + char far * wki1_oth_domains; + unsigned short wki1_numdgrambuf; +}; /* wksta_info_1 */ + +struct wksta_info_10 { + char far * wki10_computername; + char far * wki10_username; + char far * wki10_langroup; + unsigned char wki10_ver_major; + unsigned char wki10_ver_minor; + char far * wki10_logon_domain; + char far * wki10_oth_domains; +}; /* wksta_info_10 */ + +struct server_info_0 { + char sv0_name[CNLEN_LM20 + 1]; /* Server name */ +}; /* server_info_0 */ + + +struct server_info_1 { + char sv1_name[CNLEN_LM20 + 1]; + unsigned char sv1_version_major; /* Major version # of net */ + unsigned char sv1_version_minor; /* Minor version # of net */ + unsigned long sv1_type; /* Server type */ + char far * sv1_comment; /* Exported server comment */ +}; /* server_info_1 */ + + +struct server_info_2 { + char sv2_name[CNLEN_LM20 + 1]; + unsigned char sv2_version_major; + unsigned char sv2_version_minor; + unsigned long sv2_type; + char far * sv2_comment; + unsigned long sv2_ulist_mtime; /* User list, last modification time */ + unsigned long sv2_glist_mtime; /* Group list, last modification time */ + unsigned long sv2_alist_mtime; /* Access list, last modification time */ + unsigned short sv2_users; /* max number of users allowed */ + unsigned short sv2_disc; /* auto-disconnect timeout(in minutes) */ + char far * sv2_alerts; /* alert names (semicolon separated) */ + unsigned short sv2_security; /* SV_USERSECURITY or SV_SHARESECURITY */ + unsigned short sv2_auditing; /* 0 = no auditing; nonzero = auditing */ + + unsigned short sv2_numadmin; /* max number of administrators allowed */ + unsigned short sv2_lanmask; /* bit mask representing the srv'd nets */ + unsigned short sv2_hidden; /* 0 = visible; nonzero = hidden */ + unsigned short sv2_announce; /* visible server announce rate (sec) */ + unsigned short sv2_anndelta; /* announce randomize interval (sec) */ + /* name of guest account */ + char sv2_guestacct[UNLEN_LM20 + 1]; + unsigned char sv2_pad1; /* Word alignment pad byte */ + char far * sv2_userpath; /* ASCIIZ path to user directories */ + unsigned short sv2_chdevs; /* max # shared character devices */ + unsigned short sv2_chdevq; /* max # character device queues */ + unsigned short sv2_chdevjobs; /* max # character device jobs */ + unsigned short sv2_connections; /* max # of connections */ + unsigned short sv2_shares; /* max # of shares */ + unsigned short sv2_openfiles; /* max # of open files */ + unsigned short sv2_sessopens; /* max # of open files per session */ + unsigned short sv2_sessvcs; /* max # of virtual circuits per client */ + unsigned short sv2_sessreqs; /* max # of simul. reqs. from a client */ + unsigned short sv2_opensearch; /* max # of open searches */ + unsigned short sv2_activelocks; /* max # of active file locks */ + unsigned short sv2_numreqbuf; /* number of server (standard) buffers */ + unsigned short sv2_sizreqbuf; /* size of svr (standard) bufs (bytes) */ + unsigned short sv2_numbigbuf; /* number of big (64K) buffers */ + unsigned short sv2_numfiletasks;/* number of file worker processes */ + unsigned short sv2_alertsched; /* alert counting interval (minutes) */ + unsigned short sv2_erroralert; /* error log alerting threshold */ + unsigned short sv2_logonalert; /* logon violation alerting threshold */ + unsigned short sv2_accessalert; /* access violation alerting threshold */ + unsigned short sv2_diskalert; /* low disk space alert threshold (KB) */ + unsigned short sv2_netioalert; /* net I/O error ratio alert threshold */ + /* (tenths of a percent) */ + unsigned short sv2_maxauditsz; /* Maximum audit file size (KB) */ + char far * sv2_srvheuristics;/* performance related server switches */ +}; /* server_info_2 */ + + +struct server_info_3 { + char sv3_name[CNLEN_LM20 + 1]; + unsigned char sv3_version_major; + unsigned char sv3_version_minor; + unsigned long sv3_type; + char far * sv3_comment; + unsigned long sv3_ulist_mtime; /* User list, last modification time */ + unsigned long sv3_glist_mtime; /* Group list, last modification time */ + unsigned long sv3_alist_mtime; /* Access list, last modification time */ + unsigned short sv3_users; /* max number of users allowed */ + unsigned short sv3_disc; /* auto-disconnect timeout(in minutes) */ + char far * sv3_alerts; /* alert names (semicolon separated) */ + unsigned short sv3_security; /* SV_USERSECURITY or SV_SHARESECURITY */ + unsigned short sv3_auditing; /* 0 = no auditing; nonzero = auditing */ + + unsigned short sv3_numadmin; /* max number of administrators allowed */ + unsigned short sv3_lanmask; /* bit mask representing the srv'd nets */ + unsigned short sv3_hidden; /* 0 = visible; nonzero = hidden */ + unsigned short sv3_announce; /* visible server announce rate (sec) */ + unsigned short sv3_anndelta; /* announce randomize interval (sec) */ + /* name of guest account */ + char sv3_guestacct[UNLEN_LM20 + 1]; + unsigned char sv3_pad1; /* Word alignment pad byte */ + char far * sv3_userpath; /* ASCIIZ path to user directories */ + unsigned short sv3_chdevs; /* max # shared character devices */ + unsigned short sv3_chdevq; /* max # character device queues */ + unsigned short sv3_chdevjobs; /* max # character device jobs */ + unsigned short sv3_connections; /* max # of connections */ + unsigned short sv3_shares; /* max # of shares */ + unsigned short sv3_openfiles; /* max # of open files */ + unsigned short sv3_sessopens; /* max # of open files per session */ + unsigned short sv3_sessvcs; /* max # of virtual circuits per client */ + unsigned short sv3_sessreqs; /* max # of simul. reqs. from a client */ + unsigned short sv3_opensearch; /* max # of open searches */ + unsigned short sv3_activelocks; /* max # of active file locks */ + unsigned short sv3_numreqbuf; /* number of server (standard) buffers */ + unsigned short sv3_sizreqbuf; /* size of svr (standard) bufs (bytes) */ + unsigned short sv3_numbigbuf; /* number of big (64K) buffers */ + unsigned short sv3_numfiletasks;/* number of file worker processes */ + unsigned short sv3_alertsched; /* alert counting interval (minutes) */ + unsigned short sv3_erroralert; /* error log alerting threshold */ + unsigned short sv3_logonalert; /* logon violation alerting threshold */ + unsigned short sv3_accessalert; /* access violation alerting threshold */ + unsigned short sv3_diskalert; /* low disk space alert threshold (KB) */ + unsigned short sv3_netioalert; /* net I/O error ratio alert threshold */ + /* (tenths of a percent) */ + unsigned short sv3_maxauditsz; /* Maximum audit file size (KB) */ + char far * sv3_srvheuristics; /* performance related server switches*/ + unsigned long sv3_auditedevents; /* Audit event control mask */ + unsigned short sv3_autoprofile; /* (0,1,2,3) = (NONE,LOAD,SAVE,or BOTH) */ + char far * sv3_autopath; /* file pathname (where to load & save) */ +}; /* server_info_3 */ + +/**************************************************************** + * * + * Data structure templates - USER * + * * + ****************************************************************/ + +struct user_info_0 { + char usri0_name[UNLEN_LM20+1]; +}; /* user_info_0 */ + +struct user_info_1 { + char usri1_name[UNLEN_LM20+1]; + char usri1_pad_1; + char usri1_password[ENCRYPTED_PWLEN_LM20];/* See note below */ + long usri1_password_age; + unsigned short usri1_priv; /* See values below */ + char far * usri1_home_dir; + char far * usri1_comment; + unsigned short usri1_flags; /* See values below */ + char far * usri1_script_path; +}; /* user_info_1 */ + +/* + * NOTE: The maximum length of a user password is PWLEN. The + * field usri1_password contains extra room for transporting + * the encrypted form of the password over the network. When + * setting the user's password, check length vs. PWLEN, not + * the size of this field. PWLEN is defined in NETCONS.H. + */ + + + +struct user_info_2 { + char usri2_name[UNLEN_LM20+1]; + char usri2_pad_1; + char usri2_password[ENCRYPTED_PWLEN_LM20]; + long usri2_password_age; + unsigned short usri2_priv; + char far * usri2_home_dir; + char far * usri2_comment; + unsigned short usri2_flags; + char far * usri2_script_path; + unsigned long usri2_auth_flags; + char far * usri2_full_name; + char far * usri2_usr_comment; + char far * usri2_parms; + char far * usri2_workstations; + long usri2_last_logon; + long usri2_last_logoff; + long usri2_acct_expires; + unsigned long usri2_max_storage; + unsigned short usri2_units_per_week; + unsigned char far*usri2_logon_hours; + unsigned short usri2_bad_pw_count; + unsigned short usri2_num_logons; + char far * usri2_logon_server; + unsigned short usri2_country_code; + unsigned short usri2_code_page; +}; /* user_info_2 */ + + +struct user_info_10 { + char usri10_name[UNLEN_LM20+1]; + char usri10_pad_1; + char far * usri10_comment; + char far * usri10_usr_comment; + char far * usri10_full_name; +}; /* user_info_10 */ + +struct user_info_11 { + char usri11_name[UNLEN_LM20+1]; + char usri11_pad_1; + char far * usri11_comment; + char far * usri11_usr_comment; + char far * usri11_full_name; + unsigned short usri11_priv; + unsigned long usri11_auth_flags; + long usri11_password_age; + char far * usri11_home_dir; + char far * usri11_parms; + long usri11_last_logon; + long usri11_last_logoff; + unsigned short usri11_bad_pw_count; + unsigned short usri11_num_logons; + char far * usri11_logon_server; + unsigned short usri11_country_code; + char far * usri11_workstations; + unsigned long usri11_max_storage; + unsigned short usri11_units_per_week; + unsigned char far*usri11_logon_hours; + unsigned short usri11_code_page; +}; /* user_info_11 */ + +/**************************************************************** + * * + * Data structure templates - HANDLE * + * * + ****************************************************************/ + +struct handle_info_1 { + unsigned long hdli1_chartime; /* time in msec to wait before send */ + unsigned short hdli1_charcount; /* max size of send buffer */ +}; /* handle_info_1 */ + +struct handle_info_2 { + char far * hdli2_username; /* owner of name-pipe handle */ +}; /* handle_info_2 */ + +/**************************************************************** + * * + * Data structure templates - SHARE * + * * + ****************************************************************/ + +struct share_info_0 { + char shi0_netname[NNLEN_LM20+1]; +}; /* share_info_0 */ + +struct share_info_1 { + char shi1_netname[NNLEN_LM20+1]; + char shi1_pad1; + unsigned short shi1_type; + char far * shi1_remark; +}; /* share_info_1 */ + +struct share_info_2 { + char shi2_netname[NNLEN_LM20+1]; + char shi2_pad1; + unsigned short shi2_type; + char far * shi2_remark; + unsigned short shi2_permissions; + unsigned short shi2_max_uses; + unsigned short shi2_current_uses; + char far * shi2_path; + char shi2_passwd[SHPWLEN_LM20+1]; + char shi2_pad2; +}; /* share_info_2 */ + +/**************************************************************** + * * + * Data structure templates * + * * + ****************************************************************/ + + +struct service_info_0 { + char svci0_name[SNLEN_LM20+1]; +}; /* service_info_0 */ + +struct service_info_1 { + char svci1_name[SNLEN_LM20+1]; /* service name */ + unsigned short svci1_status; /* See status values below */ + unsigned long svci1_code; /* install code of service */ + unsigned short svci1_pid; /* pid of service program */ +}; /* service_info_1 */ + +struct service_info_2 { + char svci2_name[SNLEN_LM20+1]; /* service name */ + unsigned short svci2_status; /* See status values below */ + unsigned long svci2_code; /* install code of service */ + unsigned short svci2_pid; /* pid of service program */ + char svci2_text[STXTLEN_LM20+1];/* text area for use by services */ +}; /* service_info_2 */ + +struct service_status { + unsigned short svcs_status; /* See status values below */ + unsigned long svcs_code; /* install code of service */ + unsigned short svcs_pid; /* pid of service program */ + char svcs_text[STXTLEN_LM20+1]; /* text area for use by services */ +}; /* service_status */ + +/**************************************************************** + * * + * Data structure templates - ACCESS * + * * + ****************************************************************/ + +struct access_list { + char acl_ugname[UNLEN_LM20+1]; + char acl_ugname_pad_1; + short acl_access; +}; /* access_list */ + +struct access_info_0 { + char far * acc0_resource_name; +}; /* access_info_0 */ + +struct access_info_1 { + char far * acc1_resource_name; + short acc1_attr; /* See values below */ + short acc1_count; +}; /* access_info_1 */ + +/**************************************************************** + * * + * Special values and constants - ACCESS * + * * + ****************************************************************/ + +/* + * Maximum number of permission entries for each resource. + */ + +#define MAXPERMENTRIES 64 + + +/**************************************************************** + * * + * Data structure templates - NETBIOS * + * * + ****************************************************************/ + + +struct netbios_info_0 { + char nb0_net_name[NETBIOS_NAME_LEN+1]; +}; /* netbios_info_0 */ + +struct netbios_info_1 { + char nb1_net_name[NETBIOS_NAME_LEN+1]; + char nb1_driver_name[DEVLEN_LM20+1];/* OS/2 device driver name */ + unsigned char nb1_lana_num; /* LAN adapter number of this net */ + char nb1_pad_1; + unsigned short nb1_driver_type; + unsigned short nb1_net_status; + unsigned long nb1_net_bandwidth; /* Network bandwidth, bits/second */ + unsigned short nb1_max_sess; /* Max number of sessions */ + unsigned short nb1_max_ncbs; /* Max number of outstanding NCBs */ + unsigned short nb1_max_names; /* Max number of names */ +}; /* netbios_info_1 */ + + +/**************************************************************** + * * + * Special values and constants - NETBIOS * + * * + ****************************************************************/ + + +/* + * Driver types (nb1_driver_type). + */ + +#define NB_TYPE_NCB 1 +#define NB_TYPE_MCB 2 + +/* + * Bits defined in nb1_net_status. + */ + +#define NB_LAN_FLAGS_MASK 0x3FFF /* Mask for LAN Flags */ +#define NB_LAN_MANAGED 0x0001 /* LAN is managed by redirector */ +#define NB_LAN_LOOPBACK 0x0002 /* LAN is a loopback driver */ +#define NB_LAN_SENDNOACK 0x0004 /* LAN allows SendNoAck NCBs */ +#define NB_LAN_LMEXT 0x0008 /* LAN supports LAN Manager extended NCBs */ +#define NB_LAN_INTNCB 0x0010 /* LAN allows NCB submission at */ + /* interrupt time (from NCBDone) */ +#define NB_LAN_16M 0x0020 /* LAN can support phys addr > 16M */ + +#define NB_LAN_LM10PLUS 0x0080 /* Transport supports extensions to */ + /* LM10 to work with Netbios$ drvr */ +#define NB_LAN_NONETBIND 0x0100 /* Driver can not netbind on bootup */ + + +#define NB_OPEN_MODE_MASK 0xC000 /* Mask for NetBios Open Modes */ +#define NB_OPEN_REGULAR 0x4000 /* NetBios opened in Regular mode */ +#define NB_OPEN_PRIVILEGED 0x8000 /* NetBios opened in Privileged mode */ +#define NB_OPEN_EXCLUSIVE 0xC000 /* NetBios opened in Exclusive mode */ + +/* + * Open modes for NetBiosOpen. + */ + +#define NB_REGULAR 1 +#define NB_PRIVILEGED 2 +#define NB_EXCLUSIVE 3 + +#pragma pack() + +#define NERR_Success 0 + +/*** NERR_BASE is the base of error codes from network utilities, + * chosen to avoid conflict with OS/2 and redirector error codes. + * 2100 is a value that has been assigned to us by OS/2. + */ +#define NERR_BASE 2100 + + + +/* UNUSED BASE+0 */ +/* UNUSED BASE+1 */ +#define NERR_NetNotStarted (NERR_BASE+2) /* The workstation driver (NETWKSTA.SYS on OS/2 workstations, NETWKSTA.EXE on DOS workstations) isn't installed. */ +#define NERR_UnknownServer (NERR_BASE+3) /* The server cannot be located. */ +#define NERR_ShareMem (NERR_BASE+4) /* An internal error occurred. The network cannot access a shared memory segment. */ +#define NERR_NoNetworkResource (NERR_BASE+5) /* A network resource shortage occurred . */ +#define NERR_RemoteOnly (NERR_BASE+6) /* This operation is not supported on workstations. */ +#define NERR_DevNotRedirected (NERR_BASE+7) /* The device is not connected. */ +/* UNUSED BASE+8 */ +/* UNUSED BASE+9 */ +/* UNUSED BASE+10 */ +/* UNUSED BASE+11 */ +/* UNUSED BASE+12 */ +/* UNUSED BASE+13 */ +#define NERR_ServerNotStarted (NERR_BASE+14) /* The Server service isn't started. */ +#define NERR_ItemNotFound (NERR_BASE+15) /* The queue is empty. */ +#define NERR_UnknownDevDir (NERR_BASE+16) /* The device or directory does not exist. */ +#define NERR_RedirectedPath (NERR_BASE+17) /* The operation is invalid on a redirected resource. */ +#define NERR_DuplicateShare (NERR_BASE+18) /* The name has already been shared. */ +#define NERR_NoRoom (NERR_BASE+19) /* The server is currently out of the requested resource. */ +/* UNUSED BASE+20 */ +#define NERR_TooManyItems (NERR_BASE+21) /* Requested add of item exceeds maximum allowed. */ +#define NERR_InvalidMaxUsers (NERR_BASE+22) /* The Peer service supports only two simultaneous users. */ +#define NERR_BufTooSmall (NERR_BASE+23) /* The API return buffer is too small. */ +/* UNUSED BASE+24 */ +/* UNUSED BASE+25 */ +/* UNUSED BASE+26 */ +#define NERR_RemoteErr (NERR_BASE+27) /* A remote API error occurred. */ +/* UNUSED BASE+28 */ +/* UNUSED BASE+29 */ +/* UNUSED BASE+30 */ +#define NERR_LanmanIniError (NERR_BASE+31) /* An error occurred when opening or reading LANMAN.INI. */ +/* UNUSED BASE+32 */ +/* UNUSED BASE+33 */ +#define NERR_OS2IoctlError (NERR_BASE+34) /* An internal error occurred when calling the workstation driver. */ +/* UNUSED BASE+35 */ +#define NERR_NetworkError (NERR_BASE+36) /* A general network error occurred. */ +/* UNUSED BASE+37 */ +#define NERR_WkstaNotStarted (NERR_BASE+38) /* The Workstation service has not been started. */ +#define NERR_BrowserNotStarted (NERR_BASE+39) /* The requested information is not available. */ +#define NERR_InternalError (NERR_BASE+40) /* An internal LAN Manager error occurred.*/ +#define NERR_BadTransactConfig (NERR_BASE+41) /* The server is not configured for transactions. */ +#define NERR_InvalidAPI (NERR_BASE+42) /* The requested API isn't supported on the remote server. */ +#define NERR_BadEventName (NERR_BASE+43) /* The event name is invalid. */ +/* UNUSED BASE+44 */ + +/* + * Config API related + * Error codes from BASE+45 to BASE+49 + */ + +/* UNUSED BASE+45 */ +#define NERR_CfgCompNotFound (NERR_BASE+46) /* Could not find the specified component in LANMAN.INI. */ +#define NERR_CfgParamNotFound (NERR_BASE+47) /* Could not find the specified parameter in LANMAN.INI. */ +#define NERR_LineTooLong (NERR_BASE+49) /* A line in LANMAN.INI is too long. */ + +/* + * Spooler API related + * Error codes from BASE+50 to BASE+79 + */ + +#define NERR_QNotFound (NERR_BASE+50) /* The printer queue does not exist. */ +#define NERR_JobNotFound (NERR_BASE+51) /* The print job does not exist. */ +#define NERR_DestNotFound (NERR_BASE+52) /* The printer destination cannot be found. */ +#define NERR_DestExists (NERR_BASE+53) /* The printer destination already exists. */ +#define NERR_QExists (NERR_BASE+54) /* The printer queue already exists. */ +#define NERR_QNoRoom (NERR_BASE+55) /* No more printer queues can be added. */ +#define NERR_JobNoRoom (NERR_BASE+56) /* No more print jobs can be added. */ +#define NERR_DestNoRoom (NERR_BASE+57) /* No more printer destinations can be added. */ +#define NERR_DestIdle (NERR_BASE+58) /* This printer destination is idle and cannot accept control operations. */ +#define NERR_DestInvalidOp (NERR_BASE+59) /* This printer destination request contains an invalid control function. */ +#define NERR_ProcNoRespond (NERR_BASE+60) /* The printer processor is not responding. */ +#define NERR_SpoolerNotLoaded (NERR_BASE+61) /* The spooler is not running. */ +#define NERR_DestInvalidState (NERR_BASE+62) /* This operation cannot be performed on the print destination in its current state. */ +#define NERR_QInvalidState (NERR_BASE+63) /* This operation cannot be performed on the printer queue in its current state. */ +#define NERR_JobInvalidState (NERR_BASE+64) /* This operation cannot be performed on the print job in its current state. */ +#define NERR_SpoolNoMemory (NERR_BASE+65) /* A spooler memory allocation failure occurred. */ +#define NERR_DriverNotFound (NERR_BASE+66) /* The device driver does not exist. */ +#define NERR_DataTypeInvalid (NERR_BASE+67) /* The datatype is not supported by the processor. */ +#define NERR_ProcNotFound (NERR_BASE+68) /* The print processor is not installed. */ + +/* + * Service API related + * Error codes from BASE+80 to BASE+99 + */ + +#define NERR_ServiceTableLocked (NERR_BASE+80) /* The service does not respond to control actions. */ +#define NERR_ServiceTableFull (NERR_BASE+81) /* The service table is full. */ +#define NERR_ServiceInstalled (NERR_BASE+82) /* The requested service has already been started. */ +#define NERR_ServiceEntryLocked (NERR_BASE+83) /* The service does not respond to control actions. */ +#define NERR_ServiceNotInstalled (NERR_BASE+84) /* The service has not been started. */ +#define NERR_BadServiceName (NERR_BASE+85) /* The service name is invalid. */ +#define NERR_ServiceCtlTimeout (NERR_BASE+86) /* The service is not responding to the control function. */ +#define NERR_ServiceCtlBusy (NERR_BASE+87) /* The service control is busy. */ +#define NERR_BadServiceProgName (NERR_BASE+88) /* LANMAN.INI contains an invalid service program name. */ +#define NERR_ServiceNotCtrl (NERR_BASE+89) /* The service cannot be controlled in its present state. */ +#define NERR_ServiceKillProc (NERR_BASE+90) /* The service ended abnormally. */ +#define NERR_ServiceCtlNotValid (NERR_BASE+91) /* The requested pause or stop is not valid for this service. */ + +/* + * Wksta and Logon API related + * Error codes from BASE+100 to BASE+118 + */ + +#define NERR_AlreadyLoggedOn (NERR_BASE+100) /* This workstation is already logged on to the local-area network. */ +#define NERR_NotLoggedOn (NERR_BASE+101) /* The workstation isn't logged on to the local-area network. */ +#define NERR_BadUsername (NERR_BASE+102) /* The username or groupname parameter is invalid. */ +#define NERR_BadPassword (NERR_BASE+103) /* The password parameter is invalid. */ +#define NERR_UnableToAddName_W (NERR_BASE+104) /* @W The logon processor did not add the message alias. */ +#define NERR_UnableToAddName_F (NERR_BASE+105) /* The logon processor did not add the message alias. */ +#define NERR_UnableToDelName_W (NERR_BASE+106) /* @W The logoff processor did not delete the message alias. */ +#define NERR_UnableToDelName_F (NERR_BASE+107) /* The logoff processor did not delete the message alias. */ +/* UNUSED BASE+108 */ +#define NERR_LogonsPaused (NERR_BASE+109) /* Network logons are paused. */ +#define NERR_LogonServerConflict (NERR_BASE+110)/* A centralized logon-server conflict occurred. */ +#define NERR_LogonNoUserPath (NERR_BASE+111) /* The server is configured without a valid user path. */ +#define NERR_LogonScriptError (NERR_BASE+112) /* An error occurred while loading or running the logon script. */ +/* UNUSED BASE+113 */ +#define NERR_StandaloneLogon (NERR_BASE+114) /* The logon server was not specified. Your computer will be logged on as STANDALONE. */ +#define NERR_LogonServerNotFound (NERR_BASE+115) /* The logon server cannot be found. */ +#define NERR_LogonDomainExists (NERR_BASE+116) /* There is already a logon domain for this computer. */ +#define NERR_NonValidatedLogon (NERR_BASE+117) /* The logon server could not validate the logon. */ + +/* + * ACF API related (access, user, group) + * Error codes from BASE+119 to BASE+149 + */ + +#define NERR_ACFNotFound (NERR_BASE+119) /* The accounts file NET.ACC cannot be found. */ +#define NERR_GroupNotFound (NERR_BASE+120) /* The groupname cannot be found. */ +#define NERR_UserNotFound (NERR_BASE+121) /* The username cannot be found. */ +#define NERR_ResourceNotFound (NERR_BASE+122) /* The resource name cannot be found. */ +#define NERR_GroupExists (NERR_BASE+123) /* The group already exists. */ +#define NERR_UserExists (NERR_BASE+124) /* The user account already exists. */ +#define NERR_ResourceExists (NERR_BASE+125) /* The resource permission list already exists. */ +#define NERR_NotPrimary (NERR_BASE+126) /* The UAS database is replicant and will not allow updates. */ +#define NERR_ACFNotLoaded (NERR_BASE+127) /* The user account system has not been started. */ +#define NERR_ACFNoRoom (NERR_BASE+128) /* There are too many names in the user account system. */ +#define NERR_ACFFileIOFail (NERR_BASE+129) /* A disk I/O failure occurred.*/ +#define NERR_ACFTooManyLists (NERR_BASE+130) /* The limit of 64 entries per resource was exceeded. */ +#define NERR_UserLogon (NERR_BASE+131) /* Deleting a user with a session is not allowed. */ +#define NERR_ACFNoParent (NERR_BASE+132) /* The parent directory cannot be located. */ +#define NERR_CanNotGrowSegment (NERR_BASE+133) /* Unable to grow UAS session cache segment. */ +#define NERR_SpeGroupOp (NERR_BASE+134) /* This operation is not allowed on this special group. */ +#define NERR_NotInCache (NERR_BASE+135) /* This user is not cached in UAS session cache. */ +#define NERR_UserInGroup (NERR_BASE+136) /* The user already belongs to this group. */ +#define NERR_UserNotInGroup (NERR_BASE+137) /* The user does not belong to this group. */ +#define NERR_AccountUndefined (NERR_BASE+138) /* This user account is undefined. */ +#define NERR_AccountExpired (NERR_BASE+139) /* This user account has expired. */ +#define NERR_InvalidWorkstation (NERR_BASE+140) /* The user is not allowed to log on from this workstation. */ +#define NERR_InvalidLogonHours (NERR_BASE+141) /* The user is not allowed to log on at this time. */ +#define NERR_PasswordExpired (NERR_BASE+142) /* The password of this user has expired. */ +#define NERR_PasswordCantChange (NERR_BASE+143) /* The password of this user cannot change. */ +#define NERR_PasswordHistConflict (NERR_BASE+144) /* This password cannot be used now. */ +#define NERR_PasswordTooShort (NERR_BASE+145) /* The password is shorter than required. */ +#define NERR_PasswordTooRecent (NERR_BASE+146) /* The password of this user is too recent to change. */ +#define NERR_InvalidDatabase (NERR_BASE+147) /* The UAS database file is corrupted. */ +#define NERR_DatabaseUpToDate (NERR_BASE+148) /* No updates are necessary to this replicant UAS database. */ +#define NERR_SyncRequired (NERR_BASE+149) /* This replicant database is outdated; synchronization is required. */ + +/* + * Use API related + * Error codes from BASE+150 to BASE+169 + */ + +#define NERR_UseNotFound (NERR_BASE+150) /* The connection cannot be found. */ +#define NERR_BadAsgType (NERR_BASE+151) /* This asg_type is invalid. */ +#define NERR_DeviceIsShared (NERR_BASE+152) /* This device is currently being shared. */ + +/* + * Message Server related + * Error codes BASE+170 to BASE+209 + */ + +#define NERR_NoComputerName (NERR_BASE+170) /* A computername has not been configured. */ +#define NERR_MsgAlreadyStarted (NERR_BASE+171) /* The Messenger service is already started. */ +#define NERR_MsgInitFailed (NERR_BASE+172) /* The Messenger service failed to start. */ +#define NERR_NameNotFound (NERR_BASE+173) /* The message alias cannot be found on the local-area network. */ +#define NERR_AlreadyForwarded (NERR_BASE+174) /* This message alias has already been forwarded. */ +#define NERR_AddForwarded (NERR_BASE+175) /* This message alias has been added but is still forwarded. */ +#define NERR_AlreadyExists (NERR_BASE+176) /* This message alias already exists locally. */ +#define NERR_TooManyNames (NERR_BASE+177) /* The maximum number of added message aliases has been exceeded. */ +#define NERR_DelComputerName (NERR_BASE+178) /* The computername cannot be deleted.*/ +#define NERR_LocalForward (NERR_BASE+179) /* Messages cannot be forwarded back to the same workstation. */ +#define NERR_GrpMsgProcessor (NERR_BASE+180) /* Error in domain message processor */ +#define NERR_PausedRemote (NERR_BASE+181) /* The message was sent, but the recipient has paused the Messenger service. */ +#define NERR_BadReceive (NERR_BASE+182) /* The message was sent but not received. */ +#define NERR_NameInUse (NERR_BASE+183) /* The message alias is currently in use. Try again later. */ +#define NERR_MsgNotStarted (NERR_BASE+184) /* The Messenger service has not been started. */ +#define NERR_NotLocalName (NERR_BASE+185) /* The name is not on the local computer. */ +#define NERR_NoForwardName (NERR_BASE+186) /* The forwarded message alias cannot be found on the network. */ +#define NERR_RemoteFull (NERR_BASE+187) /* The message alias table on the remote station is full. */ +#define NERR_NameNotForwarded (NERR_BASE+188) /* Messages for this alias are not currently being forwarded. */ +#define NERR_TruncatedBroadcast (NERR_BASE+189) /* The broadcast message was truncated. */ +#define NERR_InvalidDevice (NERR_BASE+194) /* This is an invalid devicename. */ +#define NERR_WriteFault (NERR_BASE+195) /* A write fault occurred. */ +/* UNUSED BASE+196 */ +#define NERR_DuplicateName (NERR_BASE+197) /* A duplicate message alias exists on the local-area network. */ +#define NERR_DeleteLater (NERR_BASE+198) /* @W This message alias will be deleted later. */ +#define NERR_IncompleteDel (NERR_BASE+199) /* The message alias was not successfully deleted from all networks. */ +#define NERR_MultipleNets (NERR_BASE+200) /* This operation is not supported on machines with multiple networks. */ + +/* + * Server API related + * Error codes BASE+210 to BASE+229 + */ + +#define NERR_NetNameNotFound (NERR_BASE+210) /* This shared resource does not exist.*/ +#define NERR_DeviceNotShared (NERR_BASE+211) /* This device is not shared. */ +#define NERR_ClientNameNotFound (NERR_BASE+212) /* A session does not exist with that computername. */ +#define NERR_FileIdNotFound (NERR_BASE+214) /* There isn't an open file with that ID number. */ +#define NERR_ExecFailure (NERR_BASE+215) /* A failure occurred when executing a remote administration command. */ +#define NERR_TmpFile (NERR_BASE+216) /* A failure occurred when opening a remote temporary file. */ +#define NERR_TooMuchData (NERR_BASE+217) /* The data returned from a remote administration command has been truncated to 64K. */ +#define NERR_DeviceShareConflict (NERR_BASE+218) /* This device cannot be shared as both a spooled and a non-spooled resource. */ +#define NERR_BrowserTableIncomplete (NERR_BASE+219) /* The information in the list of servers may be incorrect. */ +#define NERR_NotLocalDomain (NERR_BASE+220) /* The computer isn't active on this domain. */ + +/* + * CharDev API related + * Error codes BASE+230 to BASE+249 + */ + +/* UNUSED BASE+230 */ +#define NERR_DevInvalidOpCode (NERR_BASE+231) /* The operation is invalid for this device. */ +#define NERR_DevNotFound (NERR_BASE+232) /* This device cannot be shared. */ +#define NERR_DevNotOpen (NERR_BASE+233) /* This device was not open. */ +#define NERR_BadQueueDevString (NERR_BASE+234) /* This devicename list is invalid. */ +#define NERR_BadQueuePriority (NERR_BASE+235) /* The queue priority is invalid. */ +#define NERR_NoCommDevs (NERR_BASE+237) /* There are no shared communication devices. */ +#define NERR_QueueNotFound (NERR_BASE+238) /* The queue you specified doesn't exist. */ +#define NERR_BadDevString (NERR_BASE+240) /* This list of devices is invalid. */ +#define NERR_BadDev (NERR_BASE+241) /* The requested device is invalid. */ +#define NERR_InUseBySpooler (NERR_BASE+242) /* This device is already in use by the spooler. */ +#define NERR_CommDevInUse (NERR_BASE+243) /* This device is already in use as a communication device. */ + +/* + * NetICanonicalize and NetIType and NetIMakeLMFileName + * NetIListCanon and NetINameCheck + * Error codes BASE+250 to BASE+269 + */ + +#define NERR_InvalidComputer (NERR_BASE+251) /* This computername is invalid. */ +/* UNUSED BASE+252 */ +/* UNUSED BASE+253 */ +#define NERR_MaxLenExceeded (NERR_BASE+254) /* The string and prefix specified are too long. */ +/* UNUSED BASE+255 */ +#define NERR_BadComponent (NERR_BASE+256) /* This path component is invalid. */ +#define NERR_CantType (NERR_BASE+257) /* Cannot determine type of input. */ +/* UNUSED BASE+258 */ +/* UNUSED BASE+259 */ +#define NERR_TooManyEntries (NERR_BASE+262) /* The buffer for types is not big enough. */ + +/* + * NetProfile + * Error codes BASE+270 to BASE+276 + */ + +#define NERR_ProfileFileTooBig (NERR_BASE+270) /* Profile files cannot exceed 64K. */ +#define NERR_ProfileOffset (NERR_BASE+271) /* The start offset is out of range. */ +#define NERR_ProfileCleanup (NERR_BASE+272) /* The system cannot delete current connections to network resources. */ +#define NERR_ProfileUnknownCmd (NERR_BASE+273) /* The system was unable to parse the command line in this file.*/ +#define NERR_ProfileLoadErr (NERR_BASE+274) /* An error occurred while loading the profile file. */ +#define NERR_ProfileSaveErr (NERR_BASE+275) /* @W Errors occurred while saving the profile file. The profile was partially saved. */ + + +/* + * NetAudit and NetErrorLog + * Error codes BASE+277 to BASE+279 + */ + +#define NERR_LogOverflow (NERR_BASE+277) /* This log file exceeds the maximum defined size. */ +#define NERR_LogFileChanged (NERR_BASE+278) /* This log file has changed between reads. */ +#define NERR_LogFileCorrupt (NERR_BASE+279) /* This log file is corrupt. */ + +/* + * NetRemote + * Error codes BASE+280 to BASE+299 + */ +#define NERR_SourceIsDir (NERR_BASE+280) /* The source path cannot be a directory. */ +#define NERR_BadSource (NERR_BASE+281) /* The source path is illegal. */ +#define NERR_BadDest (NERR_BASE+282) /* The destination path is illegal. */ +#define NERR_DifferentServers (NERR_BASE+283) /* The source and destination paths are on different servers. */ +/* UNUSED BASE+284 */ +#define NERR_RunSrvPaused (NERR_BASE+285) /* The Run server you requested is paused. */ +/* UNUSED BASE+286 */ +/* UNUSED BASE+287 */ +/* UNUSED BASE+288 */ +#define NERR_ErrCommRunSrv (NERR_BASE+289) /* An error occurred when communicating with a Run server. */ +/* UNUSED BASE+290 */ +#define NERR_ErrorExecingGhost (NERR_BASE+291) /* An error occurred when starting a background process. */ +#define NERR_ShareNotFound (NERR_BASE+292) /* The shared resource you are connected to could not be found.*/ +/* UNUSED BASE+293 */ +/* UNUSED BASE+294 */ + + +/* + * NetWksta.sys (redir) returned error codes. + * + * NERR_BASE + (300-329) + */ + +#define NERR_InvalidLana (NERR_BASE+300) /* The LAN adapter number is invalid. */ +#define NERR_OpenFiles (NERR_BASE+301) /* There are open files on the connection. */ +#define NERR_ActiveConns (NERR_BASE+302) /* Active connections still exist. */ +#define NERR_BadPasswordCore (NERR_BASE+303) /* This netname or password is invalid. */ +#define NERR_DevInUse (NERR_BASE+304) /* The device is being accessed by an active process. */ +#define NERR_LocalDrive (NERR_BASE+305) /* The drive letter is in use locally. */ + +/* + * Alert error codes. + * + * NERR_BASE + (330-339) + */ +#define NERR_AlertExists (NERR_BASE+330) /* The specified client is already registered for the specified event. */ +#define NERR_TooManyAlerts (NERR_BASE+331) /* The alert table is full. */ +#define NERR_NoSuchAlert (NERR_BASE+332) /* An invalid or nonexistent alertname was raised. */ +#define NERR_BadRecipient (NERR_BASE+333) /* The alert recipient is invalid.*/ +#define NERR_AcctLimitExceeded (NERR_BASE+334) /* A user's session with this server has been deleted + * because his logon hours are no longer valid */ + +/* + * Additional Error and Audit log codes. + * + * NERR_BASE +(340-343) + */ +#define NERR_InvalidLogSeek (NERR_BASE+340) /* The log file does not contain the requested record number. */ +/* UNUSED BASE+341 */ +/* UNUSED BASE+342 */ +/* UNUSED BASE+343 */ + +/* + * Additional UAS and NETLOGON codes + * + * NERR_BASE +(350-359) + */ +#define NERR_BadUasConfig (NERR_BASE+350) /* The user account system database is not configured correctly. */ +#define NERR_InvalidUASOp (NERR_BASE+351) /* This operation is not permitted when the Netlogon service is running. */ +#define NERR_LastAdmin (NERR_BASE+352) /* This operation is not allowed on the last admin account. */ +#define NERR_DCNotFound (NERR_BASE+353) /* Unable to find domain controller for this domain. */ +#define NERR_LogonTrackingError (NERR_BASE+354) /* Unable to set logon information for this user. */ +#define NERR_NetlogonNotStarted (NERR_BASE+355) /* The Netlogon service has not been started. */ +#define NERR_CanNotGrowUASFile (NERR_BASE+356) /* Unable to grow the user account system database. */ +/* UNUSED BASE+357 */ +/* UNUSED BASE+358 */ +/* UNUSED BASE+359 */ + +/* + * Server Integration error codes. + * + * NERR_BASE +(360-369) + */ +#define NERR_NoSuchServer (NERR_BASE+360) /* The server ID does not specify a valid server. */ +#define NERR_NoSuchSession (NERR_BASE+361) /* The session ID does not specify a valid session. */ +#define NERR_NoSuchConnection (NERR_BASE+362) /* The connection ID does not specify a valid connection. */ +#define NERR_TooManyServers (NERR_BASE+363) /* There is no space for another entry in the table of available servers. */ +#define NERR_TooManySessions (NERR_BASE+364) /* The server has reached the maximum number of sessions it supports. */ +#define NERR_TooManyConnections (NERR_BASE+365) /* The server has reached the maximum number of connections it supports. */ +#define NERR_TooManyFiles (NERR_BASE+366) /* The server cannot open more files because it has reached its maximum number. */ +#define NERR_NoAlternateServers (NERR_BASE+367) /* There are no alternate servers registered on this server. */ +/* UNUSED BASE+368 */ +/* UNUSED BASE+369 */ + +/* + * UPS error codes. + * + * NERR_BASE + (380-384) + */ +#define NERR_UPSDriverNotStarted (NERR_BASE+380) /* The UPS driver could not be accessed by the UPS service. */ +/* UNUSED BASE+381 */ +/* UNUSED BASE+382 */ +/* UNUSED BASE+383 */ +/* UNUSED BASE+384 */ + +/* + * Remoteboot error codes. + * + * NERR_BASE + (400-419) + * Error codes 400 - 405 are used by RPLBOOT.SYS. + * Error codes 403, 407 - 416 are used by RPLLOADR.COM, + * Error code 417 is the alerter message of REMOTEBOOT (RPLSERVR.EXE). + * Error code 418 is for when REMOTEBOOT can't start + * Error code 419 is for a disallowed 2nd rpl connection + */ +#define NERR_BadDosRetCode (NERR_BASE+400) /* The program below returned an MS-DOS error code:*/ +#define NERR_ProgNeedsExtraMem (NERR_BASE+401) /* The program below needs more memory:*/ +#define NERR_BadDosFunction (NERR_BASE+402) /* The program below called an unsupported MS-DOS function:*/ +#define NERR_RemoteBootFailed (NERR_BASE+403) /* The workstation failed to boot.*/ +#define NERR_BadFileCheckSum (NERR_BASE+404) /* The file below is corrupt.*/ +#define NERR_NoRplBootSystem (NERR_BASE+405) /* No loader is specified in the boot-block definition file.*/ +#define NERR_RplLoadrNetBiosErr (NERR_BASE+406) /* NetBIOS returned an error: The NCB and SMB are dumped above.*/ +#define NERR_RplLoadrDiskErr (NERR_BASE+407) /* A disk I/O error occurred.*/ +#define NERR_ImageParamErr (NERR_BASE+408) /* Image parameter substitution failed.*/ +#define NERR_TooManyImageParams (NERR_BASE+409) /* Too many image parameters cross disk sector boundaries.*/ +#define NERR_NonDosFloppyUsed (NERR_BASE+410) /* The image was not generated from an MS-DOS diskette formatted with /S.*/ +#define NERR_RplBootRestart (NERR_BASE+411) /* Remote boot will be restarted later.*/ +#define NERR_RplSrvrCallFailed (NERR_BASE+412) /* The call to the Remoteboot server failed.*/ +#define NERR_CantConnectRplSrvr (NERR_BASE+413) /* Cannot connect to the Remoteboot server.*/ +#define NERR_CantOpenImageFile (NERR_BASE+414) /* Cannot open image file on the Remoteboot server.*/ +#define NERR_CallingRplSrvr (NERR_BASE+415) /* Connecting to the Remoteboot server...*/ +#define NERR_StartingRplBoot (NERR_BASE+416) /* Connecting to the Remoteboot server...*/ +#define NERR_RplBootServiceTerm (NERR_BASE+417) /* Remote boot service was stopped; check the error log for the cause of the problem.*/ +#define NERR_RplBootStartFailed (NERR_BASE+418) /* Remote boot startup failed; check the error log for the cause of the problem.*/ +#define NERR_RPL_CONNECTED (NERR_BASE+419) /* A second connection to a Remoteboot resource is not allowed.*/ + +/* + * FTADMIN API error codes + * + * NERR_BASE + (425-434) + * + */ +#define NERR_FTNotInstalled (NERR_BASE+425) /* DISKFT.SYS is not installed. */ +#define NERR_FTMONITNotRunning (NERR_BASE+426) /* FTMONIT is not running */ +#define NERR_FTDiskNotLocked (NERR_BASE+427) /* FTADMIN has not locked the disk. */ +#define NERR_FTDiskNotAvailable (NERR_BASE+428) /* Some other process has locked the disk. */ +#define NERR_FTUnableToStart (NERR_BASE+429) /* The verifier/correcter cannot be started. */ +#define NERR_FTNotInProgress (NERR_BASE+430) /* The verifier/correcter can't be aborted because it isn't started. */ +#define NERR_FTUnableToAbort (NERR_BASE+431) /* The verifier/correcter can't be aborted. */ +#define NERR_FTUnabletoChange (NERR_BASE+432) /* The disk could not be locked/unlocked. */ +#define NERR_FTInvalidErrHandle (NERR_BASE+433) /* The error handle was not recognized. */ +#define NERR_FTDriveNotMirrored (NERR_BASE+434) /* The drive is not mirrored. */ + + +#define MAX_NERR (NERR_BASE+899) /* This is the last error in NERR range. */ + +/* + * end of list + * + * WARNING: Do not exceed MAX_NERR; values above this are used by + * other error code ranges (errlog.h, service.h, apperr.h). + */ + + diff --git a/private/os2/inc/os2nls.h b/private/os2/inc/os2nls.h new file mode 100644 index 000000000..27a9b0686 --- /dev/null +++ b/private/os2/inc/os2nls.h @@ -0,0 +1,388 @@ +/*++ + +Copyright (c) 1989 Microsoft Corporation + +Module Name: + + os2nls.h + +Abstract: + + This file contains the NLS OS/2 V2.0/1.X API definitions for the OS/2 Subsystem + +Author: + + Michael Jarus (mjarus) 15-Apr-1992 + +Revision History: + +--*/ + +#ifndef _OS2NLS_ + +#define _OS2NLS_ + +//#define OS2SS_INCLUDE_HEBREW +//#define OS2SS_INCLUDE_ARABIC +//#define OS2SS_INCLUDE_PRCHINA + +#define CCHMAXSYSTEMPATH 260 + +/* + * NLS Support API Structures + */ + +typedef struct _COUNTRYCODE { + ULONG country; + ULONG codepage; +} COUNTRYCODE, *PCOUNTRYCODE; + +typedef struct _COUNTRYINFO { + ULONG country; + ULONG codepage; + ULONG fsDateFmt; + CHAR szCurrency[5]; + CHAR szThousandsSeparator[2]; + CHAR szDecimal[2]; + CHAR szDateSeparator[2]; + CHAR szTimeSeparator[2]; + UCHAR fsCurrencyFmt; + UCHAR cDecimalPlace; + UCHAR fsTimeFmt; + USHORT abReserved1[2]; + CHAR szDataSeparator[2]; + USHORT abReserved2[5]; +} COUNTRYINFO, *PCOUNTRYINFO; + +/* + * NLS internal Structures (for NLS tables in client\nlstable.c) + */ + +typedef struct _OD2_COUNTRY_ENTRY +{ + ULONG Country; + USHORT WinLanuage; + USHORT WinSubLanuage; + PCOUNTRYINFO pCtryInfo; + ULONG CodePageIndex1; + ULONG CodePageIndex2; + ULONG CaseMapFixTableIndex; +} OD2_COUNTRY_ENTRY, *POD2_COUNTRY_ENTRY; + +typedef struct _OD2_CODEPAGE_ENTRY +{ + ULONG CodePage; + ULONG CollateIndex; + ULONG CaseMapIndex; + ULONG DBCSVecIndex; +} OD2_CODEPAGE_ENTRY, *POD2_CODEPAGE_ENTRY; + +typedef struct _OD2_DBCS_VECTOR_ENTRY +{ + ULONG VectorSize; + UCHAR Vector[12]; +} OD2_DBCS_VECTOR_ENTRY, *POD2_DBCS_VECTOR_ENTRY; + +typedef struct _OD2_COLLATE_CTRY_ENTRY +{ + ULONG Country; + ULONG CodePage; + PUCHAR FixTable; +} OD2_COLLATE_CTRY_ENTRY, *POD2_COLLATE_CTRY_ENTRY; + + +/*** NLS Support API Calls */ +#ifndef APIRET // this happens for os2.exe, a windows app +#define APIRET ULONG +#endif +#ifndef DWORD // this happens for client\dll*.c , a "nt" code +#define DWORD ULONG +#endif +#ifndef LCID // this happens for client\dll*.c , a "nt" code +typedef DWORD LCID; +#endif +#ifndef UINT // this happens for client\dll*.c , a "nt" code +typedef unsigned int UINT; +#endif + +/* + * NLS ssrtl routines + */ + +extern USHORT Or2NlsLangIdTable[]; + +DWORD +Or2NlsGetCtryInfo( + IN LCID LocaleID, + IN UINT CodePage, + OUT PCOUNTRYINFO pCountryInfo + ); + +DWORD +Or2NlsGetMapTable( + IN LCID LocaleID, + IN UINT CodePage, + IN DWORD dwFlag, + OUT PUCHAR pTable + ); + +DWORD +Or2NlsGetCountryFromLocale( + IN LCID LocaleID, + OUT PULONG pCountry + ); + +DWORD +Or2NlsGetCPInfo( + IN UINT CP, + OUT POD2_DBCS_VECTOR_ENTRY DBCSVec + ); + +/* + * NLS APIs + */ + +APIRET +DosQueryCtryInfo( + IN ULONG MaxCountryInfoLength, + IN PCOUNTRYCODE CountryCode, + OUT PCOUNTRYINFO CountryInfo, + OUT PULONG ActualCountryInfoLength + ); + +APIRET +DosQueryDBCSEnv( + IN ULONG MaxDBCSEvLength, + IN PCOUNTRYCODE CountryCode, + OUT PCHAR DBCSEv + ); + +APIRET +DosMapCase( + IN ULONG StringLength, + IN PCOUNTRYCODE CountryCode, + IN OUT PUCHAR String + ); + +APIRET +DosQueryCollate( + IN ULONG MaxCollateInfoLength, + IN PCOUNTRYCODE CountryCode, + OUT PUCHAR CollateInfo, + OUT PULONG ActualCollateInfoLength + ); + +APIRET +DosQueryCp( + IN ULONG MaxLengthCodePageList, + OUT ULONG CodePages[], + OUT PULONG CountCodePages + ); + +APIRET +DosSetProcessCp( + IN ULONG ulCodePage, + IN ULONG ulReserved + ); + +/* + * NLS Support Internal Functions + */ + +APIRET +Od2InitNls( IN ULONG CodePage, + IN BOOLEAN StartBySM); + +APIRET +Od2GetCtryInfo( + IN ULONG Country, + IN ULONG CodePage, + OUT PCOUNTRYINFO CountryInfo + ); + +APIRET +Od2GetDBCSEv( + IN ULONG Country, + IN ULONG CodePage, + IN OUT PUCHAR DBCSEv, + OUT PULONG StringLength + ); + +APIRET +Od2GetCaseMapTable( + IN ULONG Country, + IN ULONG CodePage, + OUT PUCHAR CaseMapTable); + +APIRET +Od2GetCollateTable( + IN ULONG Country, + IN ULONG CodePage, + OUT PUCHAR CollateTable); + +APIRET +Od2GetCtryCp( + IN OUT PULONG Country, + IN OUT PULONG CodePage, + OUT PULONG CountryIndex, + OUT PULONG CodePageIndex + ); + +APIRET +VioSetCp( + IN ULONG usReserved, + IN ULONG idCodePage, + IN ULONG hVio + ); + +APIRET +KbdSetCp( + IN ULONG usReserved, + IN ULONG idCodePage, + IN ULONG hKbd + ); + +APIRET +KbdFlushBuffer( + IN ULONG hKbd + ); + + +/* + * NLS Support API definitions + */ + +#define OS2SS_NLS_MB_DEFAULT 0 +#define OS2SS_NLS_WC_DEFAULT 0 + +#define COUNTRY_LATIN_AMERICA 3 +#define COUNTRY_SPAIN 34 +#define COUNTRY_JAPAN 81 +#define COUNTRY_SOUTH_KOREA 82 +#define COUNTRY_PRCHINA 86 +#define COUNTRY_TAIWAN 88 +#define COUNTRY_ARABIC 785 +#define COUNTRY_HEBREW 972 + +//#define MESSAGE_LANGUAGE_ENGLISH LANG_ENGLISH +//#define MESSAGE_LANGUAGE_FRENCH LANG_FRENCH +//#define MESSAGE_LANGUAGE_GERMAN LANG_GERMAN +//#define MESSAGE_LANGUAGE_ITALIAN LANG_ITALIAN +//#define MESSAGE_LANGUAGE_SPANISH LANG_SPANISH +//#define MESSAGE_LANGUAGE_DANISH LANG_DANISH +//#define MESSAGE_LANGUAGE_DUTCH LANG_DUTCH +//#define MESSAGE_LANGUAGE_FINNISH LANG_FINNISH +//#define MESSAGE_LANGUAGE_NORWEGIAN LANG_NORWEGIAN +//#define MESSAGE_LANGUAGE_PORTUGUESE LANG_PORTUGUESE +//#define MESSAGE_LANGUAGE_SWEDISH LANG_SWEDISH +//#define MESSAGE_LANGUAGE_JAPAN LANG_JAPANESE +//#define MESSAGE_LANGUAGE_KOREAN LANG_KOREAN +//#define MESSAGE_LANGUAGE_CHINESE LANG_CHINESE +//#define MESSAGE_LANGUAGE_THAI LANG_THAI + +#define DATEFMT_MM_DD_YY 0 +#define DATEFMT_DD_MM_YY 1 +#define DATEFMT_YY_MM_DD 2 + +#define CURRENCY_FOLLOW (UCHAR)0x01 +#define CURRENCY_SPACE (UCHAR)0x02 +#define CURRENCY_DECIMAL (UCHAR)0x04 + +#define TIMEFMT_12_HOUR 0 +#define TIMEFMT_24_HOUR 1 + +#define CODEPAGE_US 437 +#define CODEPAGE_MULTI 850 +#define CODEPAGE_PORTUGESE 860 +#define CODEPAGE_CANADIAN 863 +#define CODEPAGE_NORDIC 865 +#define CODEPAGE_JAPAN 932 +#define CODEPAGE_KOREA 934 +#define CODEPAGE_TAIWAN 938 +#define CODEPAGE_HEBREW 862 +#define CODEPAGE_ARABIC 864 +#define CODEPAGE_PRC 936 + +#define INDEX_CODEPAGE_US 0 +#define INDEX_CODEPAGE_MULTI 1 +#define INDEX_CODEPAGE_PORTUGESE 2 +#define INDEX_CODEPAGE_CANADIAN 3 +#define INDEX_CODEPAGE_NORDIC 4 +#define INDEX_CODEPAGE_JAPAN 5 +#define INDEX_CODEPAGE_KOREA 6 +#define INDEX_CODEPAGE_TAIWAN 7 +#define INDEX_CODEPAGE_HEBREW 8 +#define INDEX_CODEPAGE_ARABIC 9 +#define INDEX_CODEPAGE_PRC 10 + +#define INDEX_DBCS_437 0 +#define INDEX_DBCS_850 0 +#define INDEX_DBCS_860 0 +#define INDEX_DBCS_863 0 +#define INDEX_DBCS_865 0 +#define INDEX_DBCS_932 1 +#define INDEX_DBCS_934 2 +#define INDEX_DBCS_938 3 +#define INDEX_DBCS_862 0 +#define INDEX_DBCS_864 0 +#define INDEX_DBCS_936 4 + +#define INDEX_COLLATE_437 0 +#define INDEX_COLLATE_850 1 +#define INDEX_COLLATE_860 2 +#define INDEX_COLLATE_863 3 +#define INDEX_COLLATE_865 4 +#define INDEX_COLLATE_932 5 +#define INDEX_COLLATE_934 6 +#define INDEX_COLLATE_938 7 +#define INDEX_COLLATE_862 8 +#define INDEX_COLLATE_864 9 +#define INDEX_COLLATE_936 10 + +#define INDEX_CASEMAP_437 0 +#define INDEX_CASEMAP_850 1 +#define INDEX_CASEMAP_860 2 +#define INDEX_CASEMAP_863 3 +#define INDEX_CASEMAP_865 4 +#define INDEX_CASEMAP_932 5 +#define INDEX_CASEMAP_934 6 +#define INDEX_CASEMAP_938 7 +#define INDEX_CASEMAP_862 8 +#define INDEX_CASEMAP_864 9 +#define INDEX_CASEMAP_936 10 + +// index for CP fix table for 437 code page +// pCaseMapFixTable field in OD2_COUNTRY_ENTRY/TABLE for OD2_FIX_CASEMAP_TABLE + +#define INDEX_FIX_CASE_UNITED_STATES 0 +#define INDEX_FIX_CASE_CANADA 0 +#define INDEX_FIX_CASE_LATIN_AMERICA 0 +#define INDEX_FIX_CASE_NETHERLANDS 2 +#define INDEX_FIX_CASE_BELGIUM 1 +#define INDEX_FIX_CASE_FRANCE 0 +#define INDEX_FIX_CASE_SPAIN 0 +#define INDEX_FIX_CASE_ITALY 0 +#define INDEX_FIX_CASE_SWITZERLAND 1 +#define INDEX_FIX_CASE_AUSTRIA 0 +#define INDEX_FIX_CASE_UNITED_KINGDOM 0 +#define INDEX_FIX_CASE_DENMARK 0 +#define INDEX_FIX_CASE_SWEDEN 1 +#define INDEX_FIX_CASE_NORWAY 0 +#define INDEX_FIX_CASE_GERMANY 0 +#define INDEX_FIX_CASE_MEXICO 0 +#define INDEX_FIX_CASE_BRAZIL 0 +#define INDEX_FIX_CASE_AUSTRALIA 0 +#define INDEX_FIX_CASE_NEW_ZEALAND 0 +#define INDEX_FIX_CASE_PORTUGAL 0 +#define INDEX_FIX_CASE_IRELAND 0 +#define INDEX_FIX_CASE_ICELAND 0 +#define INDEX_FIX_CASE_FINLAND 1 +#define INDEX_FIX_CASE_JAPAN 0 +#define INDEX_FIX_CASE_SOUTH_KOREA 0 +#define INDEX_FIX_CASE_TAIWAN 0 +#define INDEX_FIX_CASE_HEBREW 0 +#define INDEX_FIX_CASE_ARABIC 0 +#define INDEX_FIX_CASE_PRCHINA 0 + +#endif // _OS2NLS_ + diff --git a/private/os2/inc/os2nt.h b/private/os2/inc/os2nt.h new file mode 100644 index 000000000..b47b3286f --- /dev/null +++ b/private/os2/inc/os2nt.h @@ -0,0 +1,986 @@ +/*++ + +Copyright (c) 1989 Microsoft Corporation + +Module Name: + + os2nt.h + +Abstract: + + Prototypes for NT functions that are called from Win32 only os2ss files. + +Author: + + Michael Jarus (mjarus) 21-Dec-1992 + +Environment: + + User Mode Only + +Revision History: + +--*/ + +/**************************************** + * Definitions from nt.h and ntrtl.h + ***************************************/ + +#ifndef NT_INCLUDED // or _NTRTL_ + +VOID +RtlFillMemoryUlong ( + IN PVOID Destination, + IN ULONG Length, + IN ULONG Pattern + ); + +#if DBG + +#define KdPrint(_x_) DbgPrint _x_ + +ULONG +DbgPrint( + PCH Format, + ... + ); + +VOID +RtlAssert( + PVOID FailedAssertion, + PVOID FileName, + ULONG LineNumber, + PCHAR Message OPTIONAL + ); + +#define ASSERT( exp ) \ + if (!(exp)) \ + RtlAssert( #exp, __FILE__, __LINE__, NULL ) + +#define ASSERTMSG( msg, exp ) \ + if (!(exp)) \ + RtlAssert( #exp, __FILE__, __LINE__, msg ) + +#else + +#define KdPrint(_x_) + +#define ASSERT( exp ) +#define ASSERTMSG( msg, exp ) +#endif // DBG + +#endif // NT_INCLUDED + +/************************************ + * Internal definitions from Win32 + ***********************************/ + +BOOL +VerifyConsoleIoHandle( + HANDLE hIoHandle + ); + +#ifdef DBCS +// MSKK Feb.10.1993 V-AkihiS +/******************************************* + * Intrenal definitions from Win32 for DBCS + *******************************************/ +BOOL +GetConsoleNlsMode( + IN HANDLE hConsole, + OUT PDWORD lpdwNlsMode + ); + +BOOL +SetConsoleNlsMode( + IN HANDLE hConsole, + IN DWORD fdwNlsMode + ); + +// MSKK Jul.02.1992 KazuM +BOOL +GetConsoleCharType( + IN HANDLE hConsole, + IN COORD coordCheck, + OUT PDWORD pdwType + ); + +#define CHAR_TYPE_SBCS 0 // Displayed SBCS character +#define CHAR_TYPE_LEADING 2 // Displayed leading byte of DBCS +#define CHAR_TYPE_TRAILING 3 // Displayed trailing byte of DBCS +#endif +#ifdef JAPAN +// MSKK May.11.1993 V-AkihiS + +// kbdjpn.h + + +// +// Returned this value as keyboard type of GetKeyboardType() +// +#define KBD_TYPE_JAPAN 7 + +// There are Microsoft keyboard types +#define SUB_KBD_TYPE_MICROSOFT 0x00 +#define MICROSOFT_KBD_101_TYPE 0 +#define MICROSOFT_KBD_AX_TYPE 1 +#define MICROSOFT_KBD_106_TYPE 2 +#define MICROSOFT_KBD_002_TYPE 3 +#define MICROSOFT_KBD_001_TYPE 4 +#define MICROSOFT_KBD_FUNC 12 + +// There are AX keyboard types +#define SUB_KBD_TYPE_AX 0x01 +#define AX_KBD_DESKTOP_TYPE 1 +#define AX_KBD_DESKTOP_FUNC 12 + +// There are EPSON keyboard types +#define SUB_KBD_TYPE_EPSON 0x04 + +// There are FUJITSU keyboard types +#define SUB_KBD_TYPE_FUJITSU 0x05 +#define FUJITSU_KBD_JIS_TYPE 0 +#define FUJITSU_KBD_OASYS_TYPE 1 + +// There are IBM keyboard types +#define SUB_KBD_TYPE_IBM 0x07 +#define IBM_KBD_001_TYPE 1 +#define IBM_KBD_002_TYPE 2 +#define IBM_KBD_003_TYPE 3 +#define IBM_KBD_A01_TYPE 4 +#define IBM_KBD_S_TYPE 5 + +#define IBM_KBD_002_FUNC 12 +#define IBM_KBD_A01_FUNC 12 + +// There are MATSUSITA keyboard types +#define SUB_KBD_TYPE_MATSUSITA 0x0a + +// There are NEC keyboard types +#define SUB_KBD_TYPE_NEC 0x0d +#define NEC_KBD_NORMAL_TYPE 1 +#define NEC_KBD_N_MODE_TYPE 2 +#define NEC_KBD_H_MODE_TYPE 3 +#define NEC_KBD_LAPTOP_TYPE 4 + +#define NEC_KBD_NORMAL_FUNC 15 +#define NEC_KBD_N_MODE_FUNC 10 +#define NEC_KBD_H_MODE_FUNC 15 +#define NEC_KBD_LAPTOP_FUNC 15 + +// There are TOSHIBA keyboard types +#define SUB_KBD_TYPE_TOSHIBA 0x12 +#define TOSHIBA_KBD_LAPTOP_TYPE 1 +#define TOSHIBA_KBD_LAPTOP_TENKEY_TYPE 2 +#define TOSHIBA_KBD_DESKTOP_TYPE 3 +#define TOSHIBA_KBD_J3100GX_TYPE 4 + +#define TOSHIBA_KBD_LAPTOP_FUNC 10 +#define TOSHIBA_KBD_LAPTOP_TENKEY_FUNC 10 +#define TOSHIBA_KBD_DESKTOP_FUNC 12 +#define TOSHIBA_KBD_J3100GX_FUNC 10 +#endif + +/******************************************************** + * Definitions of debug Win32 API (ssrtl\sswinapi.c) + *******************************************************/ + +#if DBG +BOOL +Or2WinPeekConsoleInputA( + PSZ FuncName, + HANDLE hConsoleInput, + PINPUT_RECORD lpBuffer, + DWORD nLength, + LPDWORD lpNumberOfEventsRead + ); + +BOOL +Or2WinReadConsoleInputA( + PSZ FuncName, + HANDLE hConsoleInput, + PINPUT_RECORD lpBuffer, + DWORD nLength, + LPDWORD lpNumberOfEventsRead + ); + +BOOL +Or2WinWriteConsoleInputA( + PSZ FuncName, + HANDLE hConsoleInput, + PINPUT_RECORD lpBuffer, + DWORD nLength, + LPDWORD lpNumberOfEventsWritten + ); + +BOOL +Or2WinReadConsoleOutputCharacterA( + PSZ FuncName, + HANDLE hConsoleOutput, + LPSTR lpCharacter, + DWORD nLength, + COORD dwReadCoord, + LPDWORD lpNumberOfCharsRead + ); + +BOOL +Or2WinReadConsoleOutputCharacterW( + PSZ FuncName, + HANDLE hConsoleOutput, + LPWSTR lpCharacter, + DWORD nLength, + COORD dwReadCoord, + LPDWORD lpNumberOfCharsRead + ); + +BOOL +Or2WinReadConsoleOutputAttribute( + PSZ FuncName, + HANDLE hConsoleOutput, + LPWORD lpAttribute, + DWORD nLength, + COORD dwReadCoord, + LPDWORD lpNumberOfAttrsRead + ); + +BOOL +Or2WinWriteConsoleOutputCharacterA( + PSZ FuncName, + HANDLE hConsoleOutput, + LPSTR lpCharacter, + DWORD nLength, + COORD dwWriteCoord, + LPDWORD lpNumberOfCharsWritten + ); + +BOOL +Or2WinWriteConsoleOutputCharacterW( + PSZ FuncName, + HANDLE hConsoleOutput, + LPWSTR lpCharacter, + DWORD nLength, + COORD dwWriteCoord, + LPDWORD lpNumberOfCharsWritten + ); + +BOOL +Or2WinWriteConsoleOutputAttribute( + PSZ FuncName, + HANDLE hConsoleOutput, + LPWORD lpAttribute, + DWORD nLength, + COORD dwWriteCoord, + LPDWORD lpNumberOfAttrsWritten + ); + +BOOL +Or2WinFillConsoleOutputCharacterA( + PSZ FuncName, + HANDLE hConsoleOutput, + CHAR cCharacter, + DWORD nLength, + COORD dwWriteCoord, + LPDWORD lpNumberOfCharsWritten + ); + +BOOL +Or2WinFillConsoleOutputAttribute( + PSZ FuncName, + HANDLE hConsoleOutput, + WORD wAttribute, + DWORD nLength, + COORD dwWriteCoord, + LPDWORD lpNumberOfAttrsWritten + ); + +BOOL +Or2WinGetConsoleMode( + PSZ FuncName, + HANDLE hConsoleHandle, + LPDWORD lpMode + ); + +BOOL +Or2WinGetNumberOfConsoleInputEvents( + PSZ FuncName, + HANDLE hConsoleInput, + LPDWORD lpNumberOfEvents + ); + +BOOL +Or2WinGetConsoleScreenBufferInfo( + PSZ FuncName, + HANDLE hConsoleOutput, + PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo + ); + +COORD +Or2WinGetLargestConsoleWindowSize( + PSZ FuncName, + HANDLE hConsoleOutput + ); + +BOOL +Or2WinGetConsoleCursorInfo( + PSZ FuncName, + HANDLE hConsoleOutput, + PCONSOLE_CURSOR_INFO lpConsoleCursorInfo + ); + +BOOL +Or2WinGetNumberOfConsoleMouseButtons( + PSZ FuncName, + LPDWORD lpNumberOfMouseButtons + ); + +BOOL +Or2WinSetConsoleMode( + PSZ FuncName, + HANDLE hConsoleHandle, + DWORD dwMode + ); + +BOOL +Or2WinSetConsoleActiveScreenBuffer( + PSZ FuncName, + HANDLE hConsoleOutput + ); + +BOOL +Or2WinSetConsoleScreenBufferSize( + PSZ FuncName, + HANDLE hConsoleOutput, + COORD dwSize + ); + +BOOL +Or2WinSetConsoleCursorPosition( + PSZ FuncName, + HANDLE hConsoleOutput, + COORD dwCursorPosition + ); + +BOOL +Or2WinSetConsoleCursorInfo( + PSZ FuncName, + HANDLE hConsoleOutput, + PCONSOLE_CURSOR_INFO lpConsoleCursorInfo + ); + +BOOL +Or2WinScrollConsoleScreenBufferA( + PSZ FuncName, + HANDLE hConsoleOutput, + PSMALL_RECT lpScrollRectangle, + PSMALL_RECT lpClipRectangle, + COORD dwDestinationOrigin, + PCHAR_INFO lpFill + ); + +BOOL +Or2WinScrollConsoleScreenBufferW( + PSZ FuncName, + HANDLE hConsoleOutput, + PSMALL_RECT lpScrollRectangle, + PSMALL_RECT lpClipRectangle, + COORD dwDestinationOrigin, + PCHAR_INFO lpFill + ); + +BOOL +Or2WinSetConsoleWindowInfo( + PSZ FuncName, + HANDLE hConsoleOutput, + BOOL bAbsolute, + PSMALL_RECT lpConsoleWindow + ); + +BOOL +Or2WinSetConsoleTextAttribute( + PSZ FuncName, + HANDLE hConsoleOutput, + WORD wAttributes + ); + +BOOL +Or2WinSetConsoleCtrlHandler( + PSZ FuncName, + PHANDLER_ROUTINE HandlerRoutine, + BOOL Add + ); + +DWORD +Or2WinGetConsoleTitleW( + PSZ FuncName, + LPWSTR lpConsoleTitle, + DWORD nSize + ); + +BOOL +Or2WinSetConsoleTitleA( + PSZ FuncName, + LPSTR lpConsoleTitle + ); + +BOOL +Or2WinSetConsoleTitleW( + PSZ FuncName, + LPWSTR lpConsoleTitle + ); + +BOOL +Or2WinWriteConsoleA( + PSZ FuncName, + HANDLE hConsoleOutput, + CONST VOID *lpBuffer, + DWORD nNumberOfCharsToWrite, + LPDWORD lpNumberOfCharsWritten, + LPVOID lpReserved + ); + +HANDLE +Or2WinCreateConsoleScreenBuffer( + PSZ FuncName, + DWORD dwDesiredAccess, + DWORD dwShareMode, + LPSECURITY_ATTRIBUTES lpSecurityAttributes, + DWORD dwFlags, + PVOID lpScreenBufferData + ); + +UINT +Or2WinGetConsoleCP( + PSZ FuncName + ); + +BOOL +Or2WinSetConsoleCP( + PSZ FuncName, + UINT wCodePageID + ); + +UINT +Or2WinGetConsoleOutputCP( + PSZ FuncName + ); + +BOOL +Or2WinSetConsoleOutputCP( + PSZ FuncName, + UINT wCodePageID + ); + +BOOL +Or2WinBeep( + PSZ FuncName, + DWORD dwFreq, + DWORD dwDuration + ); + +BOOL +Or2WinCloseHandle( + PSZ FuncName, + HANDLE hObject + ); + +HANDLE +Or2WinCreateEventW( + PSZ FuncName, + LPSECURITY_ATTRIBUTES lpEventAttributes, + BOOL bManualReset, + BOOL bInitialState, + LPWSTR lpName + ); + +HANDLE +Or2WinCreateFileA( + PSZ FuncName, + LPCSTR lpFileName, + DWORD dwDesiredAccess, + DWORD dwShareMode, + LPSECURITY_ATTRIBUTES lpSecurityAttributes, + DWORD dwCreationDisposition, + DWORD dwFlagsAndAttributes, + HANDLE hTemplateFile + ); + +HANDLE +Or2WinCreateFileW( + PSZ FuncName, + LPCWSTR lpFileName, + DWORD dwDesiredAccess, + DWORD dwShareMode, + LPSECURITY_ATTRIBUTES lpSecurityAttributes, + DWORD dwCreationDisposition, + DWORD dwFlagsAndAttributes, + HANDLE hTemplateFile + ); + +BOOL +Or2WinCreateProcessA( + PSZ FuncName, + LPCSTR lpApplicationName, + LPCSTR lpCommandLine, + LPSECURITY_ATTRIBUTES lpProcessAttributes, + LPSECURITY_ATTRIBUTES lpThreadAttributes, + BOOL bInheritHandles, + DWORD dwCreationFlags, + LPVOID lpEnvironment, + LPSTR lpCurrentDirectory, + LPSTARTUPINFOA lpStartupInfo, + LPPROCESS_INFORMATION lpProcessInformation + ); + +HANDLE +Or2WinCreateThread( + PSZ FuncName, + LPSECURITY_ATTRIBUTES lpThreadAttributes, + DWORD dwStackSize, + LPTHREAD_START_ROUTINE lpStartAddress, + LPVOID lpParameter, + DWORD dwCreationFlags, + LPDWORD lpThreadId + ); + +BOOL +Or2WinDuplicateHandle( + PSZ FuncName, + HANDLE hSourceProcessHandle, + HANDLE hSourceHandle, + HANDLE hTargetProcessHandle, + LPHANDLE lpTargetHandle, + DWORD dwDesiredAccess, + BOOL bInheritHandle, + DWORD dwOptions + ); + +VOID +Or2WinEnterCriticalSection( + PSZ FuncName, + LPCRITICAL_SECTION lpCriticalSection + ); + +LPSTR +Or2WinGetCommandLineA( + PSZ FuncName + ); + +COORD +Or2WinGetConsoleFontSize( + PSZ FuncName, + HANDLE hConsoleOutput, + DWORD nFont + ); + +DWORD +Or2WinGetFileType( + PSZ FuncName, + HANDLE hFile + ); + +DWORD +Or2WinGetFullPathNameA( + PSZ FuncName, + LPCSTR lpFileName, + DWORD nBufferLength, + LPSTR lpBuffer, + LPSTR *lpFilePart + ); + +HANDLE +Or2WinGetModuleHandleA( + PSZ FuncName, + LPCSTR lpModuleName + ); + +HANDLE +Or2WinGetStdHandle( + PSZ FuncName, + DWORD nStdHandle + ); + +UINT +Or2WinGetSystemDirectoryA( + PSZ FuncName, + LPSTR lpBuffer, + UINT uSize + ); + +VOID +Or2WinInitializeCriticalSection( + PSZ FuncName, + LPCRITICAL_SECTION lpCriticalSection + ); + +VOID +Or2WinLeaveCriticalSection( + PSZ FuncName, + LPCRITICAL_SECTION lpCriticalSection + ); + +int +Or2WinLoadStringA( + PSZ FuncName, + HINSTANCE hInstance, + UINT uID, + LPSTR lpBuffer, + int nBufferMax + ); + +int +Or2WinMessageBoxA( + PSZ FuncName, + HWND hWnd , + LPCSTR lpText, + LPCSTR lpCaption , + UINT uType + ); + +HANDLE +Or2WinOpenProcess( + PSZ FuncName, + DWORD dwDesiredAccess, + BOOL bInheritHandle, + DWORD dwProcessId + ); + +DWORD +Or2WinResumeThread( + PSZ FuncName, + HANDLE hThread + ); + +UINT +Or2WinSetErrorMode( + PSZ FuncName, + UINT uMode + ); + +BOOL +Or2WinSetEvent( + PSZ FuncName, + HANDLE hEvent + ); + +BOOL +Or2WinSetStdHandle( + PSZ FuncName, + DWORD nStdHandle, + HANDLE hHandle + ); + +LCID +Or2WinGetThreadLocale( + PSZ FuncName + ); + +BOOL +Or2WinSetThreadLocale( + PSZ FuncName, + LCID Locale + ); + +BOOL +Or2WinSetThreadPriority( + PSZ FuncName, + HANDLE hThread, + int nPriority + ); + +BOOL +Or2WinSystemParametersInfoA( + PSZ FuncName, + UINT uiAction, + UINT uiParam, + PVOID pvParam, + UINT fWinIni + ); + +BOOL +Or2WinTerminateThread( + PSZ FuncName, + HANDLE hThread, + DWORD dwExitCode + ); + +BOOL +Or2WinVerifyConsoleIoHandle( + PSZ FuncName, + HANDLE hIoHandle + ); + +DWORD +Or2WinWaitForSingleObject( + PSZ FuncName, + HANDLE hHandle, + DWORD dwMilliseconds + ); + +BOOL +Or2WinWriteFile( + PSZ FuncName, + HANDLE hFile, + CONST VOID *lpBuffer, + DWORD nNumberOfBytesToWrite, + LPDWORD lpNumberOfBytesWritten, + LPOVERLAPPED lpOverlapped + ); + +int +Or2Win_read( + PSZ FuncName, + int hFile, + void *Buffer, + unsigned int Length + ); + +BOOL +Or2WinReadFile( + PSZ FuncName, + HANDLE hFile, + LPVOID lpBuffer, + DWORD nNumberOfBytesToRead, + LPDWORD lpNumberOfBytesRead, + LPOVERLAPPED lpOverlapped + ); + +BOOL +Or2WinIsValidCodePage( + PSZ FuncName, + UINT CodePage + ); + +UINT +Or2WinGetACP( + PSZ FuncName + ); + +UINT +Or2WinGetOEMCP( + PSZ FuncName + ); + +BOOL +Or2WinGetCPInfo( + PSZ FuncName, + UINT CodePage, + LPCPINFO lpCPInfo + ); + +BOOL +Or2WinIsDBCSLeadByte( + PSZ FuncName, + BYTE TestChar + ); + +int +Or2WinMultiByteToWideChar( + PSZ FuncName, + UINT CodePage, + DWORD dwFlags, + LPCSTR lpMultiByteStr, + int cchMultiByte, + LPWSTR lpWideCharStr, + int cchWideChar + ); + +int +Or2WinWideCharToMultiByte( + PSZ FuncName, + UINT CodePage, + DWORD dwFlags, + LPCWSTR lpWideCharStr, + int cchWideChar, + LPSTR lpMultiByteStr, + int cchMultiByte, + LPSTR lpDefaultChar, + LPBOOL lpUsedDefaultChar + ); + +int +Or2WinCompareStringW( + PSZ FuncName, + LCID Locale, + DWORD dwCmpFlags, + LPCWSTR lpString1, + int cchCount1, + LPCWSTR lpString2, + int cchCount2 + ); + +int +Or2WinLCMapStringW( + PSZ FuncName, + LCID Locale, + DWORD dwMapFlags, + LPCWSTR lpSrcStr, + int cchSrc, + LPWSTR lpDestStr, + int cchDest + ); + +int +Or2WinGetLocaleInfoW( + PSZ FuncName, + LCID Locale, + LCTYPE LCType, + LPWSTR lpLCData, + int cchData + ); + +LANGID +Or2WinGetSystemDefaultLangID( + PSZ FuncName + ); + +LANGID +Or2WinGetUserDefaultLangID( + PSZ FuncName + ); + +LCID +Or2WinGetSystemDefaultLCID( + PSZ FuncName + ); + +LCID +Or2WinGetUserDefaultLCID( + PSZ FuncName + ); + +BOOL +Or2WinGetStringTypeW( + PSZ FuncName, + DWORD dwInfoType, + LPCWSTR lpSrcStr, + int cchSrc, + LPWORD lpCharType + ); + +int +Or2WinFoldStringW( + PSZ FuncName, + DWORD dwMapFlags, + LPCWSTR lpSrcStr, + int cchSrc, + LPWSTR lpDestStr, + int cchDest + ); + +HANDLE +Or2WinHeapCreate( + PSZ FuncName, + DWORD flOptions, + DWORD dwInitialSize, + DWORD dwMaximumSize + ); + +LPSTR +Or2WinHeapAlloc( + PSZ FuncName, + HANDLE hHeap, + DWORD dwFlags, + DWORD dwBytes + ); + +BOOL +Or2WinHeapFree( + PSZ FuncName, + HANDLE hHeap, + DWORD dwFlags, + LPSTR lpMem + ); + +#else +#define Or2WinPeekConsoleInputA PeekConsoleInputA +#define Or2WinReadConsoleInputA ReadConsoleInputA +#define Or2WinWriteConsoleInputA WriteConsoleInputA +#define Or2WinReadConsoleOutputCharacterA ReadConsoleOutputCharacterA +#define Or2WinReadConsoleOutputCharacterW ReadConsoleOutputCharacterW +#define Or2WinReadConsoleOutputAttribute ReadConsoleOutputAttribute +#define Or2WinWriteConsoleOutputCharacterA WriteConsoleOutputCharacterA +#define Or2WinWriteConsoleOutputCharacterW WriteConsoleOutputCharacterW +#define Or2WinWriteConsoleOutputAttribute WriteConsoleOutputAttribute +#define Or2WinFillConsoleOutputCharacterA FillConsoleOutputCharacterA +#define Or2WinFillConsoleOutputAttribute FillConsoleOutputAttribute +#define Or2WinGetConsoleMode GetConsoleMode +#define Or2WinGetNumberOfConsoleInputEvents GetNumberOfConsoleInputEvents +#define Or2WinGetConsoleScreenBufferInfo GetConsoleScreenBufferInfo +#define Or2WinGetLargestConsoleWindowSize GetLargestConsoleWindowSize +#define Or2WinGetConsoleCursorInfo GetConsoleCursorInfo +#define Or2WinGetNumberOfConsoleMouseButtons GetNumberOfConsoleMouseButtons +#define Or2WinSetConsoleMode SetConsoleMode +#define Or2WinSetConsoleActiveScreenBuffer SetConsoleActiveScreenBuffer +#define Or2WinSetConsoleScreenBufferSize SetConsoleScreenBufferSize +#define Or2WinSetConsoleCursorPosition SetConsoleCursorPosition +#define Or2WinSetConsoleCursorInfo SetConsoleCursorInfo +#define Or2WinScrollConsoleScreenBufferA ScrollConsoleScreenBufferA +#define Or2WinScrollConsoleScreenBufferW ScrollConsoleScreenBufferW +#define Or2WinSetConsoleWindowInfo SetConsoleWindowInfo +#define Or2WinSetConsoleTextAttribute SetConsoleTextAttribute +#define Or2WinSetConsoleCtrlHandler SetConsoleCtrlHandler +#define Or2WinGetConsoleTitleW GetConsoleTitleW +#define Or2WinSetConsoleTitleA SetConsoleTitleA +#define Or2WinSetConsoleTitleW SetConsoleTitleW +#define Or2WinWriteConsoleA WriteConsoleA +#define Or2WinCreateConsoleScreenBuffer CreateConsoleScreenBuffer +#define Or2WinGetConsoleCP GetConsoleCP +#define Or2WinSetConsoleCP SetConsoleCP +#define Or2WinGetConsoleOutputCP GetConsoleOutputCP +#define Or2WinSetConsoleOutputCP SetConsoleOutputCP +#define Or2WinBeep Beep +#define Or2WinCloseHandle CloseHandle +#define Or2WinCreateEventW CreateEventW +#define Or2WinCreateFileA CreateFileA +#define Or2WinCreateFileW CreateFileW +#define Or2WinCreateProcessA CreateProcessA +#define Or2WinCreateThread CreateThread +#define Or2WinDuplicateHandle DuplicateHandle +#define Or2WinEnterCriticalSection EnterCriticalSection +#define Or2WinGetCommandLineA GetCommandLineA +#define Or2WinGetConsoleFontSize GetConsoleFontSize +#define Or2WinGetCurrentConsoleFont GetCurrentConsoleFont +#define Or2WinGetFileType GetFileType +#define Or2WinGetFullPathNameA GetFullPathNameA +#define Or2WinGetModuleHandleA GetModuleHandleA +#define Or2WinGetStdHandle GetStdHandle +#define Or2WinGetSystemDirectoryA GetSystemDirectoryA +#define Or2WinInitializeCriticalSection InitializeCriticalSection +#define Or2WinLeaveCriticalSection LeaveCriticalSection +#define Or2WinLoadStringA LoadStringA +#define Or2WinMessageBoxA MessageBoxA +#define Or2WinOpenProcess OpenProcess +#define Or2WinResumeThread ResumeThread +#define Or2WinSetErrorMode SetErrorMode +#define Or2WinSetEvent SetEvent +#define Or2WinSetStdHandle SetStdHandle +#define Or2WinGetThreadLocale GetThreadLocale +#define Or2WinSetThreadLocale SetThreadLocale +#define Or2WinSetThreadPriority SetThreadPriority +#define Or2WinSystemParametersInfoA SystemParametersInfoA +#define Or2WinTerminateThread TerminateThread +#define Or2WinVerifyConsoleIoHandle VerifyConsoleIoHandle +#define Or2WinWaitForSingleObject WaitForSingleObject +#define Or2WinWriteFile WriteFile +#define Or2Win_read _read +#define Or2WinReadFile ReadFile +#define Or2WinIsValidCodePage IsValidCodePage +#define Or2WinGetACP GetACP +#define Or2WinGetOEMCP GetOEMCP +#define Or2WinGetCPInfo GetCPInfo +#define Or2WinIsDBCSLeadByte IsDBCSLeadByte +#define Or2WinMultiByteToWideChar MultiByteToWideChar +#define Or2WinWideCharToMultiByte WideCharToMultiByte +#define Or2WinCompareStringW CompareStringW +#define Or2WinLCMapStringW LCMapStringW +#define Or2WinGetLocaleInfoW GetLocaleInfoW +#define Or2WinGetSystemDefaultLangID GetSystemDefaultLangID +#define Or2WinGetUserDefaultLangID GetUserDefaultLangID +#define Or2WinGetSystemDefaultLCID GetSystemDefaultLCID +#define Or2WinGetUserDefaultLCID GetUserDefaultLCID +#define Or2WinGetStringTypeW GetStringTypeW +#define Or2WinFoldStringW FoldStringW +#define Or2WinHeapCreate HeapCreate +#define Or2WinHeapAlloc HeapAlloc +#define Or2WinHeapFree HeapFree +#endif diff --git a/private/os2/inc/os2res.h b/private/os2/inc/os2res.h new file mode 100644 index 000000000..234a52541 --- /dev/null +++ b/private/os2/inc/os2res.h @@ -0,0 +1,80 @@ +/*++ + +Copyright (c) 1989 Microsoft Corporation + +Module Name: + + os2res.h + +Abstract: + + Prototypes for resources + +Author: + + Michael Jarus (mjarus) 19-Jul-1992 + +Environment: + + User Mode Only + +Revision History: + +--*/ + + +#define ERROR_BUFFER_SIZE 256 + +/* + * OS2.EXE + */ + +#define IDS_OS2_WHATFLAG 100 +#define IDS_OS2_USAGE 101 +#define IDS_OS2_NOCMD 102 +#define IDS_OS2_NOCONNECT 103 +#define IDS_OS2_STARTPROCESS 104 +#define IDS_OS2_CREATECONOUT 105 +#define IDS_OS2_CREATETHREAD 106 + +#define IDS_OS2_INITFAIL 200 +#define IDS_OS2_SEGNUMBER 201 +#define IDS_OS2_EXEINVALID 202 +#define IDS_OS2_STACKSEG 203 +#define IDS_OS2_NOFILE 204 +#define IDS_OS2_NOPROC 205 +#define IDS_OS2_NOORDINAL 206 +#define IDS_OS2_CODESEG 207 +#define IDS_OS2_MODULETYPE 208 +#define IDS_OS2_EXEFORMAT 209 +#define IDS_OS2_NOMEMORY 210 +#define IDS_OS2_RELOCCHAIN 211 +#define IDS_OS2_OS2CODE 212 +#define IDS_OS2_BADFORMAT 213 + +#define IDS_OS2_CONFIGSYS_ACCESS_CAP 300 +#define IDS_OS2_CONFIGSYS_ACCESS_TXT 301 +#define IDS_OS2_WRITE_PROTECT_CAP 302 +#define IDS_OS2_WRITE_PROTECT_TXT 303 +#define IDS_OS2_DEVIVE_NOT_READY_CAP 304 +#define IDS_OS2_DEVIVE_NOT_READY_TXT 305 +#define IDS_OS2_INTERNAL_ERROR 306 +#define IDS_OS2_BOUND_APP_LOAD_CAP 307 +#define IDS_OS2_BOUND_APP_LOAD_TXT 308 +#ifdef PMNT +#define IDS_OS2_PMSHELL_NOT_UP_CAP 309 +#define IDS_OS2_PMSHELL_NOT_UP_TXT 310 +#define IDS_OS2_2ND_PMSHELL_CAP 311 +#define IDS_OS2_2ND_PMSHELL_TXT 312 +#define IDS_OS2_PMSHELL_FULLSCREEN_CAP 313 +#define IDS_OS2_PMSHELL_FULLSCREEN_TXT 314 +#endif + +/* + * OS2SRV.EXE + */ + +#define IDS_OS2SRV_ACCESS_API_GP_CAP 100 +#define IDS_OS2SRV_ACCESS_GP_TXT 101 +#define IDS_OS2SRV_API_GP_TXT 102 + diff --git a/private/os2/inc/os2srv.h b/private/os2/inc/os2srv.h new file mode 100644 index 000000000..8b80171b2 --- /dev/null +++ b/private/os2/inc/os2srv.h @@ -0,0 +1,1650 @@ +/*++ + +Copyright (c) 1989 Microsoft Corporation + +Module Name: + + os2srv.h + +Abstract: + + Main include file for OS/2 Subsystem Server + +Author: + + Steve Wood (stevewo) 22-Aug-1989 + +Revision History: + + Yaron Shamor 4-Apr-91 Add profile for ComputeValidDrives. +--*/ + +// +// Include OS/2 SubSystem Runtime Definitions. Includes NT Definitions, +// OS/2 V2.0 Definitions and Debug definitions. +// + +#include "os2ssrtl.h" + +#if DBG +ULONG Os2Debug; +#endif + +// Flag to let OS2SRV know whether or not to ignore LOGOFF (when started as a service) +extern BOOLEAN fService; + +// +// Include NT Session Manager and Debug SubSystem Interfaces + +#include <ntsm.h> +#include <ntdbg.h> +typedef BOOLEAN (*PSB_API_ROUTINE)( IN PSBAPIMSG SbApiMsg ); + + +#include "os2file.h" +#include "os2ssmsg.h" + +// +// OS/2 Subsystem Semaphore structures. +// + +typedef enum _OS2_SEMAPHORE_TYPE { + Os2EventSem = 1, + Os2MutexSem, + Os2MuxWaitSem +} OS2_SEMAPHORE_TYPE; + +typedef struct _OS2_MUXWAIT_RECORD { + ULONG SemHandleIndex; + ULONG UserKey; + struct _OS2_SEMAPHORE *Semaphore; +} OS2_MUXWAIT_RECORD, *POS2_MUXWAIT_RECORD; + +typedef struct _OS2_MUXWAIT_SEMAPHORE { + USHORT CountMuxWaitRecords; + USHORT Type : 2; + USHORT WaitAll : 1; + USHORT Reserved : 13; + OS2_MUXWAIT_RECORD MuxWaitRecords[ DCMW_MAX_SEMRECORDS ]; +} OS2_MUXWAIT_SEMAPHORE, *POS2_MUXWAIT_SEMAPHORE; + +typedef struct _OS2_SEMAPHORE { + USHORT PointerCount : 14; + USHORT Type : 2; + USHORT OpenCount; + STRING Name; + union { + PVOID Value; + HANDLE EventHandle; + HANDLE MutantHandle; + POS2_MUXWAIT_SEMAPHORE MuxWait; + } u; +} OS2_SEMAPHORE, *POS2_SEMAPHORE; + + +typedef struct _OS2_SESSION { + LIST_ENTRY SessionLink; + ULONG SessionId; + ULONG ReferenceCount; + ULONG TerminationQueueHandle; + struct _OS2_QUEUE *TerminationQueue; + struct _OS2_SESSION *RelatedSession; + struct _OS2_SESSION *BindSession; + HANDLE ConsolePort; + ULONG SessionUniqueId; + ULONG ProcessId; + BOOLEAN Selectable; + USHORT FgBg; // TRUE for background + USHORT InheritOpt; + BOOLEAN ChildSession; + BOOLEAN WinSession; + PVOID Thread; + PVOID Process; + HANDLE hWaitThread; + HANDLE hProcess; + ULONG dwProcessId; + ULONG dwParentProcessId; + HANDLE SesGrpHandle; + PVOID SesGrpAddress; + BOOLEAN InTermination; + HANDLE Win32ForegroundWindow; + struct _OS2_REGISTER_HANDLER_REC *RegisterCtrlHandler; +} OS2_SESSION, *POS2_SESSION; + +typedef struct _OS2_NT_SESSION { + LIST_ENTRY SessionLink; + ULONG SessionId; + ULONG ReferenceCount; + STRING RootDirectory; +} OS2_NT_SESSION, *POS2_NT_SESSION; + +typedef struct _OS2_THREAD { + LIST_ENTRY Link; + struct _OS2_PROCESS *Process; + struct _OS2_WAIT_BLOCK *WaitBlock; + POS2_SEMAPHORE WaitingForSemaphore; + CLIENT_ID ClientId; + TID ThreadId; + HANDLE ThreadHandle; + POS2_TIB ClientOs2Tib; + ULONG Flags; + KPRIORITY Priority; + USHORT PendingSignals; + USHORT CurrentSignals; + USHORT MustComplete; + USHORT DebugState; // A flag for DosPtrace(). + BOOLEAN Dying; + CHAR Os2Level; + UCHAR Os2Class; + ULONG InitialStack; +} OS2_THREAD, *POS2_THREAD; + +// +// Flag definitions for OS2_THREAD.Flags +// + +#define OS2_THREAD_THREAD1 0x00000001 +#define OS2_THREAD_ATTACHED 0x00000002 + +#ifdef PMNT +#define PMNTFIRSTHIDDENTHREAD 40 // There is a check for Maximum thread in + // pmwin\wintodos.inc MAXTHRDID = 52 + // Maximum #threads per process handled by + // AAB.ASM. Assumes thread IDs range from + // 0 to MAXTHRDID-1 +#define PMNTMAXHIDDENTHREADS 10 // We allocated 10 PMNT hidden threads with + // Tid 40-50. See process.c os2allocatetid +#endif + +#define OS2_EXIT_IN_PROGRESS 0x00000001 +#define OS2_EXIT_WAIT_FOR_SYNC 0x00000002 + +typedef struct _OS2_PROCESS { + LIST_ENTRY ListLink; + struct _OS2_PROCESS *Parent; + LIST_ENTRY ChildrenList; + LIST_ENTRY SiblingLink; + LIST_ENTRY ThreadList; + LIST_ENTRY SharedMemoryList; + POS2_NT_SESSION NtSession; + POS2_SESSION Session; + PVOID ExitListDispatcher; + PVOID InfiniteSleep; + PVOID SignalDeliverer; + PVOID FreezeThread; + PVOID UnfreezeThread; + PVOID VectorHandler; + PVOID CritSectionAddr; + PVOID TidBitMapHeader; + PEB_OS2_DATA InitialPebOs2Data; + RESULTCODES ResultCodes; + ULONG ExpectedVersion; + HANDLE ClientPort; + PCH ClientViewBase; + PCH ClientViewBounds; + CLIENT_ID ClientId; + PID ProcessId; + PID CommandSubTreeId; + HANDLE ProcessHandle; + PPIB ClientPib; +// ULONG LastThreadId; removed after TidBitMapHeader was added +#ifdef PMNT + ULONG LastHiddenThreadId; +#endif + ULONG Flags; + USHORT ExceptionFocus; + PFILE_HANDLE HandleTable; // temporary copy of the file handle table during exec + ULONG HandleTableLength; // length of handle table + ULONG ErrorAction; + BOOLEAN CtrlHandlerFlag; + ULONG ExitStatus; // 2 bits: + // Exit in progress + // Wait for sync during exit processing + UCHAR ApplName[OS2_PROCESS_MAX_APPL_NAME]; + ULONG ApplNameLength; + TID DebugThreadId; + PVOID ProcessMTE; // Pointer to process MTE structure + BOOLEAN FirstPtrace; // A flag for first DosPtrace(0xA) + PVOID FirstMTE; // Pointer to the mte that has the INT 3 we inserted for DosPtrace() + PVOID LinkMte; // Link list of mte's to transfer to a debugger process + BOOLEAN ConfigSysUsageFlag; // TRUE if process used config.sys during its life +} OS2_PROCESS, *POS2_PROCESS; + +typedef struct _OS2_REGISTER_HANDLER_REC { + ULONG Signal; + ULONG fAction; + POS2_PROCESS Process; + struct _OS2_REGISTER_HANDLER_REC *Link; +} OS2_REGISTER_HANDLER_REC, *POS2_REGISTER_HANDLER_REC; + +// +// Flags field bit definitions +// + +// When process terminates if no process is waiting for result, put the +// process in the zombie list so that DosWaitChild can find it and return +// the result. +// +#define OS2_PROCESS_SAVERESULT 0x00000001 + +// The process was invoked synchronously and the client is waiting for a +// response to their DosExecPgm request when this process terminates. +// +#define OS2_PROCESS_SYNCHRONOUS 0x00000002 + +// The process was invoked detached from the console and does not get any +// handles to the console device (keyboard, mouse and/or screen). +// +#define OS2_PROCESS_BACKGROUND 0x00000004 + +// The process was invoked in z suspended state. It may be resumed with the +// DosSystemService API call. +// +#define OS2_PROCESS_FROZEN 0x00000008 + +// The process may be modified via the Debug Subsystem. FIX, FIX - what does +// this really mean. +// +#define OS2_PROCESS_TRACE 0x00000010 + +// Any child process created by this process inherits the OS2_PROCESS_TRACE???? +// flags. +// +#define OS2_PROCESS_TRACETREE 0x00000020 + +// The process is terminating after DosPtrace() with a TERMINATE command. +// +#define OS2_PROCESS_TERMINATE 0x00000040 + +// Process is doing ExitList processing +// +#define OS2_PROCESS_EXIT 0x00010000 + +// // Obsolete code below: OS/2 ss was keeping processes around as zombie so +// // that DosCWait doesn't fail when father calls it after child termination. +// // However, it turns out that OS/2 doesn't do this. +// +// // Process is linked into the zombie list. +// // +// #define OS2_PROCESS_ZOMBIE 0x00020000 + +// Process cannot run in the PM screen +// +#define OS2_PROCESS_NOTWINDOWCOMPAT 0x00040000 + +// Process can run in a PM screen +// +#define OS2_PROCESS_WINDOWCOMPAT 0x00080000 + +// Process is using PM APIs +// +#define OS2_PROCESS_WINDOWAPI 0x00100000 + +// Process is PMSHELL - special handling for GPs +// +#define OS2_PROCESS_IS_PMSHELL 0x00200000 + +#if PMNT +// Process is Forced PM process (PM but not marked as WINDOWAPI) +// +#define OS2_PROCESS_FORCEDPM 0x00400000 + +// Process calls WinCreateMsgQueue() +// +#define OS2_PROCESS_PMMSGQUE 0x00800000 + +#define Os2srvProcessIsPMProcess(Process) (Process->Flags & (OS2_PROCESS_WINDOWAPI \ + | OS2_PROCESS_PMMSGQUE | OS2_PROCESS_FORCEDPM)) +#endif +// +// ProcessId limits +// + +#define PID_MIN 0x00000001 // Lowest process id +#define PID_MAX 0x0000FFFF // Highest process id + +// +// ProcessStatus field flag bits. All but the first are private to OS/2 +// + +#define PS_XITLST PS_EXITLIST // Doing ExitList Processing +#define PS_XITTH1 0x00000002 // Exiting thread 1 +#define PS_XITALL 0x00000004 // The whole process is exiting +#define PS_SYNCPARENT 0x00000010 // Parent cares about termination +#define PS_WAITPARENT 0x00000020 // Parent did an exec-and-wait +#define PS_DYING 0x00000040 // Process is dying +#define PS_EMBRYO 0x00000080 // Process in embryonic state + +#define AcquireLocalObjectLock(AssociatedHandleTable) RtlEnterCriticalSection( &(AssociatedHandleTable)->Lock ); +#define ReleaseLocalObjectLock(AssociatedHandleTable) RtlLeaveCriticalSection( &(AssociatedHandleTable)->Lock ); +// +// All exported API calls define the same interface to the OS/2 Server Request +// loop. The return value indicates to the request loop whether or not to +// generate a reply to the client. +// + +typedef BOOLEAN (*POS2_API_ROUTINE)( IN POS2_THREAD t, IN POS2_API_MSG m ); + +BOOLEAN Os2InternalNullApiCall( IN POS2_THREAD t, IN POS2_API_MSG m ); + + +// +// Global data accessed by OS/2 Subsystem Server +// + +#if DBG +ULONG Os2DebugFlag; +#endif // DBG + +PVOID Os2Heap; + +ULONG Os2BootDrive; +ULONG Os2DefaultDrive; +ULONG Os2ValidDrives; +PSZ *environ; +PSZ SystemRootValuePtr; + +HANDLE Os2RootDirectory; +HANDLE Os2DrivesDirectory; +HANDLE Os2DevicesDirectory; + +STRING Os2DebugPortName; +UNICODE_STRING Os2DebugPortName_U; +HANDLE Os2DebugPort; + +STRING Os2ExceptionPortName; +UNICODE_STRING Os2ExceptionPortName_U; +HANDLE Os2ExceptionPort; + +UNICODE_STRING Os2SbApiPortName_U; +HANDLE Os2SbApiPort; +HANDLE Os2SmApiPort; + +/* + * Port and threads for Console Session globals. + */ +HANDLE Os2SessionPort; + +HANDLE Os2SessionRequestThreadHandle; + + +#define OS2_SS_SBAPI_PORT_NAME L"\\OS2SS\\SbApiPort" + +#define OS2_SS_API_LISTEN_THREAD 0 +#define OS2_SS_SBAPI_REQUEST_THREAD 1 +#define OS2_SS_FIRST_API_REQUEST_THREAD 2 + +#define OS2_SS_MAX_THREADS 64 + +HANDLE Os2ServerThreadHandles[ OS2_SS_MAX_THREADS ]; +HANDLE Os2DebugThreadHandle; +CLIENT_ID Os2ServerThreadClientIds[ OS2_SS_MAX_THREADS ]; +CLIENT_ID Os2DebugThreadClientId; + +POR2_HANDLE_TABLE Os2SharedSemaphoreTable; + +CLIENT_ID Os2DebugUserClientId; + + +// +// Routines defined in srvinit.c +// + +NTSTATUS +Os2Initialize( VOID ); + +BOOLEAN +Os2SrvHandleCtrlEvent( + IN int CtrlType + ); + +ULONG +NtGetIntegerFromUnicodeString( + IN WCHAR *WString + ); + +// +// Routines defined in srvnls.c +// +// Note: srvnls.c doesn't include this file. It includes <windows.h> instead +// of <nt.h>. +// All callers to Win32 APIs (like SetConsoleCtrlHandler) should be put there. +// + +ULONG Os2ssCountryCode; +ULONG Os2ssCodePage[2]; +UCHAR Os2ssKeyboardLayout[2]; +#if PMNT +UCHAR Os2ssKeyboardName[4]; // Allow space for keyboard sub-code (103, + // 189, 150G etc.) +#endif +ULONG Os2ssKeysOnFlag; +ULONG Os2SrvExitNow; + +VOID +Os2SrvExitProcess(IN ULONG uExitCode); + +APIRET +Os2InitializeNLS( VOID ); + +VOID +SetEventHandlersAndErrorMode( + IN BOOLEAN fSet + ); + +// +// Routines defined in srvobjmn.c +// + +typedef enum _OS2_LOCAL_OBJECT_TYPE { + LocalObjectAnyType, + LocalObjectQueue, + MaxLocalObject +} OS2_LOCAL_OBJECT_TYPE; + +typedef struct _OS2_LOCAL_OBJECT_DIRENT { + STRING ObjectName; + OS2_LOCAL_OBJECT_TYPE ObjectType; + ULONG ObjectHandle; +} OS2_LOCAL_OBJECT_DIRENT, *POS2_LOCAL_OBJECT_DIRENT; + +NTSTATUS +Os2InitializeLocalObjectManager( VOID ); + +RTL_GENERIC_TABLE Os2LocalObjectNames; + +RTL_GENERIC_COMPARE_RESULTS +Os2LocalObjectCompare( + IN struct _RTL_GENERIC_TABLE *Table, + IN PVOID FirstStruct, + IN PVOID SecondStruct + ); + +PVOID +Os2LocalObjectDirentAllocate( + IN struct _RTL_GENERIC_TABLE *Table, + IN CLONG ByteSize + ); + +VOID +Os2LocalObjectDirentDeallocate( + IN struct _RTL_GENERIC_TABLE *Table, + IN PVOID Buffer + ); + +POS2_LOCAL_OBJECT_DIRENT +Os2LookupLocalObjectByName( + IN PSTRING ObjectName, + IN OS2_LOCAL_OBJECT_TYPE ObjectType + ); + +POS2_LOCAL_OBJECT_DIRENT +Os2InsertLocalObjectName( + IN PSTRING ObjectName, + IN OS2_LOCAL_OBJECT_TYPE ObjectType, + IN ULONG ObjectHandle + ); + +VOID +Os2DeleteLocalObject( + IN POS2_LOCAL_OBJECT_DIRENT Dirent + ); + +// +// Routines defined in srvname.c +// + +NTSTATUS +Os2InitializeNameSpace( VOID ); + +NTSTATUS +Os2InitializeDriveLetters( VOID ); + +NTSTATUS +Os2InitLocalObjectDirectory( VOID ); + +ULONG +Os2ComputeValidDrives( VOID ); + +NTSTATUS +Os2GetClientId(void); + +NTSTATUS +Os2DebugProcess( + IN PCLIENT_ID DebugUserInterface, + IN POS2_THREAD Thread, + IN HANDLE ReplyEvent + ); + +NTSTATUS +Os2DebugThread( + IN HANDLE hThread, + IN HANDLE ReplyEvent + ); + +// +// Routines defined in srvcnfg.c +// + +NTSTATUS +Os2InitializeRegistry( + VOID + ); + +BOOLEAN +Os2ConfigSysCreator( + IN POS2_THREAD t, + IN POS2_API_MSG m + ); + +VOID +Os2UpdateRegistryFromConfigSys( + VOID + ); + +// +// Routines defined in srvnet.c +// + +BOOLEAN +Os2Netbios2Request( + IN POS2_THREAD t, + IN POS2_API_MSG m + ); + +// +// Routines defined in sbinit.c +// + +NTSTATUS +Os2SbApiPortInitialize( VOID ); + + +VOID +Os2SbApiPortTerminate( + NTSTATUS Status + ); + +// +// Routines defined in sbreqst.c +// + +NTSTATUS +Os2SbApiRequestThread( + IN PVOID Parameter + ); + +// +// Routines defined in sbapi.c +// + +BOOLEAN +Os2SbCreateSession( + IN PSBAPIMSG Msg + ); + +BOOLEAN +Os2SbTerminateSession( + IN PSBAPIMSG Msg + ); + +BOOLEAN +Os2SbForeignSessionComplete( + IN PSBAPIMSG Msg + ); + +// +// Routines defined in apiinit.c +// + +NTSTATUS +Os2DebugPortInitialize(void); + + +// +// Routines defined in apireqst.c +// + +NTSTATUS +Os2ApiRequestThread( + IN PVOID Parameter + ); + + +BOOLEAN +Os2CaptureArguments( + IN POS2_THREAD t, + IN POS2_API_MSG m + ); + +VOID +Os2ReleaseCapturedArguments( + IN POS2_API_MSG m + ); + +NTSTATUS +Os2DebugRequestThread( + IN PVOID Parameter + ); + +NTSTATUS +Os2ExceptionRequestThread( + IN PVOID Parameter + ); + +// +// Routines defined in coninit.c +// + +NTSTATUS +Os2InitializeConsolePort( VOID ); + + +// +// Routines defined in conthrds.c +// + +VOID +Os2SessionHandleConnectionRequest( + struct _OS2SESREQUESTMSG *Message + ); + +VOID +HandleOs2ConRequest(IN PVOID pApiReceiveMsg, + OUT PVOID *PReplyMsg + ); + +// +// Routines defined in concreat.c +// + +NTSTATUS +Os2CreateConSession( + IN OUT PVOID RequestMsg + ); + +// +// Routines defined in consignl.c +// + +NTSTATUS +Os2CtrlSignalHandler( + IN OUT PVOID RequestMsg, + IN POS2_PROCESS RecievingProcess + ); + +NTSTATUS +Os2TerminateConSession( + IN POS2_SESSION Session, + IN POS2_TERMINATEPROCESS_MSG a + ); + +// +// Routines and data defined in process.c +// + +// +// The Os2StructureLock critical section protects against races with various +// threads accessing internal structures. +// + +RTL_CRITICAL_SECTION Os2StructureLock; +#define Os2AcquireStructureLock() RtlEnterCriticalSection( &Os2StructureLock ) +#define Os2ReleaseStructureLock() RtlLeaveCriticalSection( &Os2StructureLock ) + +// +// The following is a dummy process that acts as the root of the OS/2 Process +// Structure. It has a ClientId of -1.-1 so it does not conflict with actual +// OS/2 Processes. All processes created via the session manager are children +// of this process, as are all orphaned processes. The ListLink field of this +// process is the head of a list of all OS/2 Processes. +// +POS2_PROCESS Os2RootProcess; + +// // Obsolete code below: OS/2 ss was keeping processes around as zombie so +// // that DosCWait doesn't fail when father calls it after child termination. +// // However, it turns out that OS/2 doesn't do this. +// +// The Os2ZombieList is a list of all zombie processes that contain result +// codes that have not been retrieved yet. Processes in the Zombie List +// are NOT in the process tree rooted at Os2RootProcess. The ListLink +// field of each zombie process is used for the zombie list pointers, since +// they are not used to link them into the process structure. +// +// +// LIST_ENTRY Os2ZombieList; + +// +// OS/2 Process Id values are assigned from this variable. They are handed +// out sequentially. +// + +PID Os2LastProcessId; +PID Os2NextHigherProcessId; + +#define MINIMUM_PROCESS_ID (PID)0x00000001 +#define MAXIMUM_PROCESS_ID (PID)0x0000FFFF + + +NTSTATUS +Os2InitializeProcessStructure( VOID ); + +POS2_PROCESS +Os2AllocateProcess( VOID ); + +VOID +Os2DeallocateProcess( + IN POS2_PROCESS Process + ); + +VOID +Os2InsertProcess( + IN POS2_PROCESS ParentProcess, + IN POS2_PROCESS Process + ); + +VOID +Os2RemoveProcess( + IN POS2_PROCESS Process + ); + +VOID +Os2SuspendProcess( + IN POS2_PROCESS Process + ); + +NTSTATUS +Os2SetProcessContext( + IN POS2_PROCESS Process, + IN POS2_THREAD Thread, + IN BOOLEAN StartedBySm, + IN ULONG HandleTableLength, + IN ULONG CurrentDrive, + IN ULONG CodePage + ); + +POS2_THREAD +Os2AllocateThread( +#ifdef PMNT + IN ULONG Flags, +#endif + IN POS2_PROCESS Process + ); + +VOID +Os2DeallocateThread( + IN POS2_THREAD Thread + ); + +VOID +Os2InsertThread( + IN POS2_PROCESS Process, + IN POS2_THREAD Thread + ); + +VOID +Os2RemoveThread( + IN POS2_PROCESS Process, + IN POS2_THREAD Thread + ); + +VOID +Os2SetThreadPriority( + IN POS2_THREAD Thread, + IN ULONG NewClass, + IN ULONG Delta + ); + +VOID +Os2SetProcessPriority( + IN POS2_PROCESS Process, + IN ULONG NewClass, + IN ULONG Delta + ); + +VOID +Os2SetProcessTreePriority( + IN POS2_PROCESS RootProcess, + IN ULONG NewClass, + IN ULONG Delta + ); + +POS2_PROCESS +Os2LocateProcessByProcessId( + IN POS2_API_MSG m OPTIONAL, + IN POS2_PROCESS CurrentProcess, + IN PID ProcessId, + IN BOOLEAN MustBeChild + ); + +POS2_PROCESS +Os2LocateProcessByClientId( + IN PCLIENT_ID ClientId + ); + +POS2_THREAD +Os2LocateThreadByThreadId( + IN POS2_API_MSG m OPTIONAL, + IN POS2_THREAD CurrentThread, + IN TID ThreadId + ); + +POS2_THREAD +Os2LocateThreadByClientId( + IN POS2_PROCESS Process, + IN PCLIENT_ID ClientId + ); + +// +// Routines and data defined in wait.c +// + +typedef enum _OS2_WAIT_REASON { + WaitProcess, + WaitThread, + WaitQueue, + WaitInterrupt, + WaitSession, + WaitWinProcess, + MaxWaitReason +} OS2_WAIT_REASON; + +typedef +BOOLEAN +(*OS2_WAIT_ROUTINE)( + IN OS2_WAIT_REASON WaitReason, + IN POS2_THREAD WaitingThread, + IN POS2_API_MSG WaitReplyMessage, + IN PVOID WaitParameter, + IN PVOID SatisfyParameter1, + IN PVOID SatisfyParameter2 + ); + +typedef struct _OS2_WAIT_BLOCK { + ULONG Length; + LIST_ENTRY Link; + LIST_ENTRY UserLink; + PVOID WaitParameter; + POS2_THREAD WaitingThread; + OS2_WAIT_ROUTINE WaitRoutine; + OS2_API_MSG WaitReplyMessage; +} OS2_WAIT_BLOCK, *POS2_WAIT_BLOCK; + +LIST_ENTRY Os2WaitLists[ MaxWaitReason ]; + +BOOLEAN +Os2InitializeWait( + IN OS2_WAIT_ROUTINE WaitRoutine, + IN POS2_THREAD WaitingThread, + IN OUT POS2_API_MSG WaitReplyMessage, + IN PVOID WaitParameter, + OUT POS2_WAIT_BLOCK *WaitBlockPtr + ); + +BOOLEAN +Os2CreateWait( + IN OS2_WAIT_REASON WaitReason, + IN OS2_WAIT_ROUTINE WaitRoutine, + IN POS2_THREAD WaitingThread, + IN OUT POS2_API_MSG WaitReplyMessage, + IN PVOID WaitParameter, + IN PLIST_ENTRY UserLinkListHead OPTIONAL + ); + + +BOOLEAN +Os2NotifyWaitBlock( + IN POS2_WAIT_BLOCK WaitBlock, + IN OS2_WAIT_REASON WaitReason, + IN PVOID SatisfyParameter1, + IN PVOID SatisfyParameter2 + ); + +BOOLEAN +Os2NotifyWait( + IN OS2_WAIT_REASON WaitReason, + IN PVOID SatisfyParameter1, + IN PVOID SatisfyParameter2 + ); + +VOID +Os2DestroyWait( + IN POS2_WAIT_BLOCK WaitBlock + ); + +// +// srvque.c +// + +NTSTATUS +Os2InitializeQueues( VOID ); + +typedef struct _OS2_QUEUE_ENTRY { + LIST_ENTRY Links; + REQUESTDATA RequestData; + ULONG EntryId; + PVOID ElementAddress; + ULONG ElementLength; + ULONG Priority; +} OS2_QUEUE_ENTRY, *POS2_QUEUE_ENTRY; + +typedef struct _OS2_QUEUE_SEM_BLOCK { + LIST_ENTRY Links; + HANDLE NtEvent; +} OS2_QUEUE_SEM_BLOCK, *POS2_QUEUE_SEM_BLOCK; + +typedef struct _OS2_QUEUE { + PID CreatorPid; + POS2_LOCAL_OBJECT_DIRENT Dirent; + LONG OpenCount; + ULONG QueueType; + ULONG EntryIdCounter; + LIST_ENTRY Entries; + LIST_ENTRY Waiters; + LIST_ENTRY SemBlocks; +} OS2_QUEUE, *POS2_QUEUE; + +POR2_QHANDLE_TABLE Os2QueueTable; + +VOID +Os2PurgeQueueEntries( + IN POS2_QUEUE Queue + ); + +POS2_QUEUE_ENTRY +Os2LocateQueueEntry( + IN POS2_QUEUE Queue, + IN ULONG ReadPosition + ); + +BOOLEAN +Os2WaitQueueEntries( + IN OS2_WAIT_REASON WaitReason, + IN POS2_THREAD WaitingThread, + IN POS2_API_MSG WaitReplyMessage, + IN PVOID WaitParameter, + IN PVOID SatisfyParameter1, + IN PVOID SatisfyParameter2 + ); + +POS2_QUEUE +Os2OpenQueueByHandle( + IN HQUEUE QueueHandle + ); + +APIRET +Os2CloseQueueByHandle( + IN HQUEUE QueueHandle, + IN ULONG CloseCount, + IN PID OwnerPid, + IN POS2_PROCESS Process + ); + +APIRET +Os2WriteQueueByHandle( + POS2_DOSWRITEQUEUE_MSG a, + PID ProcessId + ); + +VOID +Os2ReadQueueEntry( + IN POS2_QUEUE_ENTRY QueueEntry, + OUT POS2_DOSREADQUEUE_MSG ReadMsg + ); + +VOID +Os2PeekQueueEntry( + IN POS2_QUEUE Queue, + IN POS2_QUEUE_ENTRY QueueEntry, + OUT POS2_DOSPEEKQUEUE_MSG PeekMsg + ); + +VOID +DumpQueueEntry( + IN PSZ Str, + IN POS2_QUEUE_ENTRY QueueEntry + ); +VOID +Os2QueueWaitCheck( + POS2_QUEUE Queue + ); + +VOID +Os2ProcessSemBlocks( + IN POS2_QUEUE Queue + ); + + +BOOLEAN Os2DosCreateQueue( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosOpenQueue( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosCloseQueue( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosPurgeQueue( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosQueryQueue( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosPeekQueue( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosReadQueue( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosWriteQueue( IN POS2_THREAD t, IN POS2_API_MSG m ); + +// +// srvsm.c +// + +LIST_ENTRY Os2SessionList; + +#define OS2_MAX_SESSION 30 + +typedef struct +{ + LIST_ENTRY Waiters; + POS2_SESSION Session; +} SessionTableEntry; + +SessionTableEntry SessionTable[OS2_MAX_SESSION]; + +POS2_SESSION +Os2AllocateSession( + POS2_DOSSTARTSESSION_INFO SessionInfo OPTIONAL, + ULONG UniqueId, + PAPIRET ApiRet + ); + +VOID +Os2ReferenceSession( + POS2_SESSION Session + ); + +POS2_SESSION +Os2DereferenceSession( + POS2_SESSION Session, + POS2_TERMINATEPROCESS_MSG msg, + BOOLEAN Bailout + ); + +VOID +Os2DereferenceSessionByUniqueId( + ULONG UniqueId, + POS2_TERMINATEPROCESS_MSG msg, + BOOLEAN Bailout + ); + +POS2_SESSION +Os2GetSessionByUniqueId( + ULONG UniqueId + ); + +VOID +Os2CreateConSessionFail( IN ULONG SessionUniqueId); + +VOID +Os2CreateConSessionAccept(IN POS2_SESSION Session); + +NTSTATUS +Os2SessionFocusSet(IN OUT PVOID RequestMsg); + +BOOLEAN Os2DosStartSession( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosSelectSession( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosSetSession( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosStopSession( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosSmSetTitle( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosGetCtrlPortForSessionID( IN POS2_THREAD t, IN POS2_API_MSG m); + +// +// srvtask.c +// + +VOID +Os2HandleException( + IN POS2_PROCESS Process, + IN PDBGKM_APIMSG ReceiveMsg + ); + +VOID +Os2HandleDebugEvent( + IN POS2_PROCESS Process, + IN PDBGKM_APIMSG ReceiveMsg + ); + +BOOLEAN Os2DosCreateThread( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosSuspendThread( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosResumeThread( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosExit( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosExitGP(IN POS2_THREAD t, IN POS2_API_MSG m); +BOOLEAN Os2DosWaitChild( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosWaitThread( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosEnterCritSec( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosExitCritSec( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosExecPgm( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosKillProcess( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosSetPriority( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosGetPriority( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosGetPPID( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosError( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2InternalTerminateProcess( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2InternalTerminateThread( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosPTrace( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosCloseHandle(IN POS2_THREAD t, IN POS2_API_MSG m); +#if PMNT +BOOLEAN PMSetPMshellFlag(IN POS2_THREAD t, IN POS2_API_MSG m); +#endif + +BOOLEAN +Os2WaitDeadThreadSatisfy( + IN OS2_WAIT_REASON WaitReason, + IN POS2_THREAD t, + IN POS2_API_MSG m, + IN PVOID WaitParameter, + IN PVOID SatisfyParameter1, + IN PVOID SatisfyParameter2 + ); + +BOOLEAN +Os2WaitChildSatisfy( + IN OS2_WAIT_REASON WaitReason, + IN POS2_THREAD t, + IN POS2_API_MSG m, + IN PVOID WaitParameter, + IN POS2_PROCESS TerminatingProcess, + IN PVOID SatisfyParameter2 + ); + +BOOLEAN +Os2WaitThreadSatisfy( + IN OS2_WAIT_REASON WaitReason, + IN POS2_THREAD t, + IN POS2_API_MSG m, + IN PVOID WaitParameter, + IN POS2_THREAD TerminatingThread, + IN PVOID SatisfyParameter2 + ); + +BOOLEAN +Os2WaitWinExec( + IN OS2_WAIT_REASON WaitReason, + IN POS2_THREAD t, + IN POS2_API_MSG m, + IN PVOID WaitParameter, + IN PID TerminatingProcess, + IN PVOID SatisfyParameter2 + ); + +APIRET +Os2CreateProcess( + IN PVOID RequestMsg OPTIONAL, + IN POS2_THREAD t, + POS2_DOSEXECPGM_MSG a, + POS2_SESSION Session OPTIONAL, + POS2_THREAD *NewThread + ); + +// +// srvxcpt.c +// + +BOOLEAN Os2DosSetSignalExceptionFocus( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosEnterMustComplete( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosExitMustComplete( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosSendSignalException( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosAcknowledgeSignalException( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosDispatch16Signal( IN POS2_THREAD t, IN POS2_API_MSG m); + +BOOLEAN +Os2DispatchVector( + IN PDBGKM_APIMSG ReceiveMsg, + POS2_THREAD Thread, + CONTEXT Context + ); + +VOID +SendSyncPterm( + IN POS2_THREAD Thread + ); + +VOID +SendAsyncPterm( + IN POS2_THREAD Thread + ); + +APIRET +Os2IssueSignal( + IN POS2_PROCESS Process, + IN int Signal + ); + +VOID +Os2IssueSignalTree( + IN POS2_PROCESS RootProcess, + IN int Signal + ); + +BOOLEAN Os2DosRegisterCtrlHandler( IN POS2_THREAD t, IN POS2_API_MSG m ); + +VOID Os2DeRegisterCtrlHandler(IN POS2_PROCESS Process); + +// +// srvvm.c +// + +typedef struct _OS2_SHARED_MEMORY_OBJECT { + LIST_ENTRY Link; + ULONG RefCount; + PVOID BaseAddress; + ULONG Index; + ULONG RegionSize; + HANDLE SectionHandle; + ULONG AllocationFlags; + STRING SectionName; + BOOLEAN IsHuge; + ULONG MaxSegments; + ULONG NumOfSegments; + ULONG SizeOfPartialSeg; + BOOLEAN Sizeable; +} OS2_SHARED_MEMORY_OBJECT, *POS2_SHARED_MEMORY_OBJECT; + +LIST_ENTRY Os2SharedMemoryList; + +// +// A linked list of all the shared memory objects that a process currently +// has open. +// + +typedef struct _OS2_SHARED_MEMORY_PROCESS_REF { + LIST_ENTRY Link; + ULONG RefCount; + ULONG AllocationFlags; + POS2_SHARED_MEMORY_OBJECT SharedMemoryObject; +} OS2_SHARED_MEMORY_PROCESS_REF, *POS2_SHARED_MEMORY_PROCESS_REF; + + +NTSTATUS +Os2InitializeMemory( VOID ); + + +POS2_SHARED_MEMORY_OBJECT +Os2CreateSharedMemoryObject( + IN POS2_API_MSG m, + IN PVOID BaseAddress, + IN ULONG Index, + IN ULONG RegionSize, + IN HANDLE SectionHandle OPTIONAL, + IN ULONG AllocationFlags, + IN PSTRING SectionName + ); + + +VOID +Os2FreeSharedMemoryObject( + POS2_SHARED_MEMORY_OBJECT MemoryObject + ); + + +POS2_SHARED_MEMORY_PROCESS_REF +Os2CreateProcessRefToSharedMemory( + IN POS2_PROCESS Process, + IN POS2_SHARED_MEMORY_OBJECT MemoryObject + ); + + +BOOLEAN +Os2FreeProcessRefToSharedMemory( + IN POS2_PROCESS Process, + IN POS2_SHARED_MEMORY_PROCESS_REF MemoryProcessRef + ); + + +VOID +Os2FreeAllSharedMemoryForProcess( + IN POS2_PROCESS Process + ); + + +POS2_SHARED_MEMORY_OBJECT +Os2FindSharedMemoryObject( + IN PVOID BaseAddress, + IN POS2_PROCESS Process + ); + + +APIRET +Os2MapViewOfSharedMemoryObject( + POS2_SHARED_MEMORY_OBJECT MemoryObject, + POS2_PROCESS Process, + BOOLEAN ProcessIsSelf, + ULONG RequiredAccess, + ULONG PageProtection + ); + +BOOLEAN Os2DosFreeMem( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosSetMem( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosGiveSharedMem( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosGetSharedMem( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosGetNamedSharedMem( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosAllocSharedMem( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2InternalQueryVirtualMemory( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2InternalMarkSharedMemAsHuge( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosReallocSharedMem( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2InternalReallocSharedHuge( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosGetSeg( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosGiveSeg( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosGetShrSeg( IN POS2_THREAD t, IN POS2_API_MSG m ); + +// +// srvfile.c +// + +BOOLEAN Os2InternalCopyHandleTable( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2InternalDeviceShare( IN POS2_THREAD t, IN POS2_API_MSG m ); + +APIRET +InitializeFileSystemForExec( + IN POS2_FILE_SYSTEM_PARAMETERS FileSystemParameters, + IN HANDLE ParentProcessHandle, // NT process handle + IN HANDLE ChildProcessHandle, // NT process handle + POS2_PROCESS ParentProcess, // OS/2 parent process + POS2_PROCESS ChildProcess, // OS/2 child process + IN POS2_DOSEXECPGM_MSG pExecPgmMsg + ); + +VOID +InitializeFileSystemForSesMgr( + IN POS2_PROCESS Process // OS/2 process + ); + +APIRET +InitializeFileSystemForChildSesMgr( + IN POS2_FILE_SYSTEM_PARAMETERS FileSystemParameters, + IN HANDLE ParentProcessHandle, // NT process handle + IN HANDLE ChildProcessHandle, // NT process handle + POS2_PROCESS ParentProcess, // OS/2 parent process + POS2_PROCESS ChildProcess, // OS/2 child process + IN POS2_DOSEXECPGM_MSG pExecPgmMsg + ); + +// +// srvwin.c +// + +ULONG +Os2AccessGPPopup( + IN ULONG CS, + IN ULONG IP, + IN ULONG AX, + IN ULONG BX, + IN ULONG CX, + IN ULONG DX, + IN ULONG SI, + IN ULONG DI, + IN ULONG BP, + IN ULONG SP, + IN ULONG SS, + IN ULONG DS, + IN ULONG ES, + IN PUCHAR AppName + ); + +ULONG +Os2ApiGPPopup( + IN PUCHAR AppName, + IN PUCHAR Text + ); + +extern HANDLE Os2hOs2SrvInstance; // for resouces + +// +// srvsem.c +// + +NTSTATUS +Os2InitializeSemaphores( VOID ); + +BOOLEAN +Os2SemaphoreCreateProcedure( + IN POS2_SEMAPHORE Semaphore, + IN POS2_SEMAPHORE CreateSemaphore + ); + +BOOLEAN +Os2SemaphoreOpenProcedure( + IN POS2_SEMAPHORE Semaphore, + IN POS2_SEMAPHORE OpenSemaphore + ); + +APIRET +Os2ProcessSemaphoreName( + IN PSTRING ObjectName, + IN POS2_SEMAPHORE Semaphore OPTIONAL, + OUT PULONG ExistingHandleIndex OPTIONAL + ); + +PVOID +Os2DestroySemaphore( + IN POS2_SEMAPHORE Semaphore, + IN ULONG HandleIndex + ); + +POS2_SEMAPHORE +Os2ReferenceSemaphore( + IN POS2_SEMAPHORE Semaphore + ); + +VOID +Os2DereferenceSemaphore( + IN POS2_SEMAPHORE Semaphore + ); + +VOID +Os2ThreadWaitingOnSemaphore( + IN POS2_THREAD t, + IN POS2_SEMAPHORE Semaphore, + IN BOOLEAN AboutToWait + ); + + +#if DBG + +VOID +Os2SemaphoreDumpProcedure( + IN POS2_SEMAPHORE Semaphore, + IN ULONG HandleIndex, + IN PVOID DumpParameter + ); + +VOID +Os2DumpSemaphoreTable( + IN PCHAR Title + ); + +#endif // DBG + + +// +// srvevent.c +// + +BOOLEAN Os2DosCreateEventSem( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosOpenEventSem( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosCloseEventSem( IN POS2_THREAD t, IN POS2_API_MSG m ); + + +// +// srvmutex.c +// + +BOOLEAN Os2DosCreateMutexSem( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosOpenMutexSem( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosCloseMutexSem( IN POS2_THREAD t, IN POS2_API_MSG m ); + + +// +// srvmuxwt.c +// + +APIRET +Os2AddMuxWait( + IN POS2_MUXWAIT_SEMAPHORE MuxWait, + IN PSEMRECORD MuxWaitEntry + ); + +APIRET +Os2DeleteMuxWait( + IN POS2_MUXWAIT_SEMAPHORE MuxWait, + IN ULONG MuxWaitEntryIndex, + IN ULONG SemHandleIndex OPTIONAL + ); + +BOOLEAN Os2DosCreateMuxWaitSem( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosOpenMuxWaitSem( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosCloseMuxWaitSem( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosWaitMuxWaitSem( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosAddMuxWaitSem( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosDeleteMuxWaitSem( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2InternalAlertMuxWaiter( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN Os2DosQueryMuxWaitSem( IN POS2_THREAD t, IN POS2_API_MSG m ); + +// +// loader routines +// + +BOOLEAN LDRNewExe( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN LDRUnloadExe( IN POS2_PROCESS Process ); +BOOLEAN LDRDosLoadModule( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN LDRDosFreeModule( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN LDRDosGetModName( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN LDRDosGetModHandle( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN LDRDosGetProcAddr( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN LDRDosQAppType( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN LDRDosGetResource( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN LDRDosGetResource2( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN LDRDosFreeResource( IN POS2_THREAD t, IN POS2_API_MSG m ); +#if PMNT +BOOLEAN LDRIdentifyCodeSelector( IN POS2_THREAD t, IN POS2_API_MSG m ); +BOOLEAN LDRDumpSegments( IN POS2_THREAD t, IN POS2_API_MSG m ); +#endif + +BOOLEAN LDRModifySizeOfSharedSegment( IN POS2_THREAD t, IN ULONG Sel, IN ULONG NewLimit ); + +// +// LinkMTE is used for saving all the mte's of a process +// in a linked list. +// + +typedef struct _LinkMTE { + USHORT MTE; + struct _LinkMTE *NextMTE; + USHORT NeedToTransfer; // used as counter for mtes + // and for flag for DosPtrace +} LinkMTE; + + +// +// xtlexec.c +// + +NTSTATUS +XtlCreateUserProcess( + IN PSTRING NtImagePathName, + IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters, + IN PSECURITY_DESCRIPTOR ProcessSecurityDescriptor OPTIONAL, + IN PSECURITY_DESCRIPTOR ThreadSecurityDescriptor OPTIONAL, + IN HANDLE ParentProcess OPTIONAL, + IN BOOLEAN InheritHandles, + IN HANDLE DebugPort OPTIONAL, + IN HANDLE ExceptionPort OPTIONAL, + OUT PRTL_USER_PROCESS_INFORMATION ProcessInformation + ); + +NTSTATUS +Os2WinCreateProcess (POS2_DOSEXECPGM_MSG a, + POS2_PROCESS ParentProcess, + POS2_SESSION Session, + PHANDLE pHandle + ); + +NTSTATUS +Os2WinRunProcess (IN HANDLE tHandle, + IN POS2_SESSION Session + ); + +// +// srvdebug.c +// + +NTSTATUS +Os2UiLookup(PCLIENT_ID AppClientId, + PCLIENT_ID DebugUiClientId); + +NTSTATUS +Os2CheckStopDebugThread( + IN PVOID Parameter + ); + +// +// exception handling structures and equates +// + +#define MAXIMUM_MUST_COMPLETE 0xFFFF // maximum must complete nesting + +#define SIG_MAXSF 0xFFFF // maximum signal focus nesting + + +// Signal numbers +// these are also defined in os2dll.h, so if the values change be sure +// to change them there + +#define SIGNAL_TO_FLAG(Signal) (1 << (Signal - 1)) + +#define SIGAPTERM 8 // Asynchronous PTERM +#define SIGPTERM 9 // Synchronous PTERM + +// Signal flags + +#define SIGINTRF (1 << (XCPT_SIG_INTR - 1)) // Ctrl-C +#define SIGTERMF (1 << (XCPT_SIG_KILLPROC - 1)) // program termination +#define SIGBREAKF (1 << (XCPT_SIG_BREAK - 1)) // Ctrl-Break +#define SIGAPTERMF (1 << (SIGAPTERM - 1)) // Asyncronous PTERM + +// Error flags +// Similar flags are defined in os2dll.h as OD2_ENABLE_ ... + +#define OS2_ENABLE_HARD_ERROR_POPUP 0x1 +#define OS2_ENABLE_ACCESS_VIO_POPUP 0x2 + +/* Fix for a C8 compilation warning */ +#undef TRUE +#define TRUE (BOOLEAN)1 + +#undef FALSE +#define FALSE (BOOLEAN)0 + +/* Global Information Segment */ + +typedef struct _GINFOSEG { /* gis */ + ULONG time; + ULONG msecs; + UCHAR hour; + UCHAR minutes; + UCHAR seconds; + UCHAR hundredths; + USHORT timezone; + USHORT cusecTimerInterval; + UCHAR day; + UCHAR month; + USHORT year; + UCHAR weekday; + UCHAR uchMajorVersion; + UCHAR uchMinorVersion; + UCHAR chRevisionLetter; + UCHAR sgCurrent; + UCHAR sgMax; + UCHAR cHugeShift; + UCHAR fProtectModeOnly; + USHORT pidForeground; + UCHAR fDynamicSched; + UCHAR csecMaxWait; + USHORT cmsecMinSlice; + USHORT cmsecMaxSlice; + USHORT bootdrive; + UCHAR amecRAS[32]; + UCHAR csgWindowableVioMax; + UCHAR csgPMMax; +} GINFOSEG; + + diff --git a/private/os2/inc/os2ssmsg.h b/private/os2/inc/os2ssmsg.h new file mode 100644 index 000000000..a4ff4bb69 --- /dev/null +++ b/private/os2/inc/os2ssmsg.h @@ -0,0 +1,886 @@ +/*++ + +Copyright (c) 1989 Microsoft Corporation + +Module Name: + + os2ssmsg.h + +Abstract: + + Include file that defines the message formats needed to communicate with + the OS/2 Subsystem Server process + +Author: + + Steve Wood (stevewo) 18-Sep-1989 + +Revision History: + +--*/ + +#define OS2_SS_API_PORT_NAME L"\\OS2SS\\ApiPort" +#define OS2_SS_DEBUG_PORT_NAME L"\\OS2SS\\DebugPort" +#define OS2_SS_EXCEPTION_PORT_NAME L"\\OS2SS\\ExceptionPost" +#define OS2_SS_SYNCHRONIZATION_SEM L"\\OS2SS\\SyncSemaphore" +#if PMNT +#define OS2_SS_PMSHELL_EVENT L"\\OS2SS\\PMShellEvent" +#endif // PMNT + +// +// Important!!! -- MAX_LANA must be kept in sync with <nb30.h> ! +// +#define MAX_LANA_OS2SSMSG 254 + +typedef struct _ExecInfo { + ULONG startaddr; /* instruction pointer */ + ULONG stackaddr; /* stack pointer */ + USHORT ds; /* starting ds only for 16-bit */ + USHORT dgroupsize; /* size of dgroup */ + USHORT heapsize; /* size of heap */ + USHORT loadtype; /* Load type 16-bit or 32-bit */ + USHORT envsel; /* Selector to environment */ + USHORT comoff; /* Offset to command line in env */ + USHORT stacksize; /* size of stack */ + USHORT hmod; /* module handle */ +} EXECINFO; + +typedef struct _PTRACEBUF { + USHORT pid; + USHORT tid; + USHORT cmd; + USHORT value; + USHORT offv; + USHORT segv; + USHORT mte; + USHORT rAX; + USHORT rBX; + USHORT rCX; + USHORT rDX; + USHORT rSI; + USHORT rDI; + USHORT rBP; + USHORT rDS; + USHORT rES; + USHORT rIP; + USHORT rCS; + USHORT rF; + USHORT rSP; + USHORT rSS; +} PTRACEBUF, *pPTRACEBUF; + + +typedef enum _OS2_API_NUMBER { + Oi2NullApiCall, + Oi2AlertMuxWaiter, + Oi2CopyHandleTable, + Oi2DeviceShare, + Oi2TerminateThread, + Oi2TerminateProcess, + Oi2QueryVirtualMemory, + Oi2MarkSharedMemAsHuge, + Oi2ReallocSharedHuge, + Os2CreateThread, + Os2Exit, + Os2WaitChild, + Os2WaitThread, + Os2ExecPgm, + Os2KillProcess, + Os2SetPriority, + Os2FreeMem, + Os2GiveSharedMem, + Os2GetSharedMem, + Os2GetNamedSharedMem, + Os2AllocSharedMem, + Os2CreateEventSem, + Os2OpenEventSem, + Os2CloseEventSem, + Os2CreateMutexSem, + Os2OpenMutexSem, + Os2CloseMutexSem, + Os2CreateMuxWaitSem, + Os2OpenMuxWaitSem, + Os2CloseMuxWaitSem, + Os2WaitMuxWaitSem, + Os2AddMuxWaitSem, + Os2DeleteMuxWaitSem, + Os2QueryMuxWaitSem, + Os2StartSession, + Os2SelectSession, + Os2SetSession, + Os2StopSession, + Os2SmSetTitle, + Os2CreateQueue, + Os2OpenQueue, + Os2CloseQueue, + Os2PurgeQueue, + Os2QueryQueue, + Os2PeekQueue, + Os2ReadQueue, + Os2WriteQueue, + Os2EnterMustComplete, + Os2ExitMustComplete, + Os2SetSignalExceptionFocus, + Os2SendSignalException, + Os2AcknowledgeSignalException, + Os2Dispatch16Signal, + Os2GetPriority, + Os2GetPPID, + Os2Error, + Os2RegisterCtrlHandler, + Os2GetCtrlPortForSessionID, + Os2ExitGP, + Os2CloseHandle, + Os2CreateConfigSys, + Os2Netbios2Reqst, + Os2ReallocSharedMem, + Os2GetSeg, + Os2GiveSeg, + Os2GetShrSeg, + Os2Ptrace, + Ol2LdrNewExe, + Ol2LdrLoadModule, + Ol2LdrFreeModule, + Ol2LdrGetModuleName, + Ol2LdrGetModuleHandle, + Ol2LdrGetProcAddr, + Ol2LdrQAppType, + Ol2LdrGetResource, + Ol2LdrFreeResource, +#if PMNT + Op2IdentifyCodeSelector, + Op2SetPMshellFlag, +#endif +#if PMNT + Ol2LdrDumpSegments, +#endif + Os2MaxApiNumber +} OS2_API_NUMBER; + + +// +// Internal server API messages +// + +typedef struct _OS2_NULLAPICALL_MSG { + LONG CountArguments; + ULONG FastArguments[ 12 ]; + PCHAR *Arguments; +} OS2_NULLAPICALL_MSG, *POS2_NULLAPICALL_MSG; + +typedef struct _OS2_ALERTMUXWAITER_MSG { + TID ThreadId; +} OS2_ALERTMUXWAITER_MSG, *POS2_ALERTMUXWAITER_MSG; + +typedef struct _OS2_COPYHANDLETABLE_MSG { + PFILE_HANDLE ChildHandleTable; // address of child handle table + ULONG ChildTableLength; // number of entries in child table +} OS2_COPYHANDLETABLE_MSG, *POS2_COPYHANDLETABLE_MSG; + +typedef struct _OS2_SHARE_MSG { + SHARE_OPERATION Operation; + IO_VECTOR_TYPE VectorType; + ULONG DesiredAccess; + ULONG ShareAccess; +} OS2_SHARE_MSG, *POS2_SHARE_MSG; + +typedef struct _OS2_TERMINATETHREAD_MSG { + ULONG ExitResult; +} OS2_TERMINATETHREAD_MSG, *POS2_TERMINATETHREAD_MSG; + +typedef struct _OS2_TERMINATEPROCESS_MSG { + ULONG ExitResult; + ULONG ExitReason; + CHAR ErrorText[50]; +} OS2_TERMINATEPROCESS_MSG, *POS2_TERMINATEPROCESS_MSG; + +typedef struct _OS2_QUERYVIRTUALMEMORY_MSG { + PVOID BaseAddress; + BOOLEAN SharedMemory; + ULONG AllocationFlags; + BOOLEAN IsHuge; + ULONG MaxSegments; + ULONG NumOfSegments; + ULONG SizeOfPartialSeg; + BOOLEAN Sizeable; +} OS2_QUERYVIRTUALMEMORY_MSG, *POS2_QUERYVIRTUALMEMORY_MSG; + +typedef struct _OS2_MARKHAREDMEMASHUGE_MSG { + PVOID BaseAddress; + ULONG MaxSegments; + ULONG NumOfSegments; + ULONG SizeOfPartialSeg; + BOOLEAN Sizeable; +} OS2_MARKSHAREDMEMASHUGE_MSG, *POS2_MARKSHAREDMEMASHUGE_MSG; + +typedef struct _OS2_REALLOCSHAREDHUGE_MSG { + PVOID BaseAddress; + ULONG NumOfSegments; + ULONG SizeOfPartialSeg; +} OS2_REALLOCSHAREDHUGE_MSG, *POS2_REALLOCSHAREDHUGE_MSG; + + +// +// Public server API messages +// + +typedef struct _OS2_DOSCREATETHREAD_MSG { + HANDLE ThreadHandle; + CLIENT_ID ClientId; + ULONG Flags; + POS2_TIB ClientOs2Tib; + TID ThreadId; +} OS2_DOSCREATETHREAD_MSG, *POS2_DOSCREATETHREAD_MSG; + + +typedef struct _OS2_DOSEXIT_MSG { + ULONG ExitAction; + ULONG ExitResult; +} OS2_DOSEXIT_MSG, *POS2_DOSEXIT_MSG; + + +typedef struct _OS2_DOSWAITCHILD_MSG { + ULONG WaitTarget; + ULONG WaitOption; + PID ProcessId; + RESULTCODES ResultCodes; + PID ResultProcessId; +} OS2_DOSWAITCHILD_MSG, *POS2_DOSWAITCHILD_MSG; + + +typedef struct _OS2_DOSWAITTHREAD_MSG { + TID ThreadId; + ULONG WaitOption; +} OS2_DOSWAITTHREAD_MSG, *POS2_DOSWAITTHREAD_MSG; + + +typedef struct _OS2_DOSEXECPGM_MSG { + ULONG Flags; + STRING ErrorText; + RESULTCODES ResultCodes; + PID ResultProcessId; + OS2_FILE_SYSTEM_PARAMETERS FileSystemParameters; + ULONG CodePage; + ULONG CurrentDrive; + ULONG CmdLineFlag; + HANDLE hRedirectedFile; + USHORT RedirectedFileType; + HANDLE hProcess; + HANDLE hThread; + CLIENT_ID ClientId; + UCHAR ApplName[33]; + ULONG ApplNameLength; +} OS2_DOSEXECPGM_MSG, *POS2_DOSEXECPGM_MSG; + + +typedef struct _OS2_DOSPTRACE_MSG { + PTRACEBUF PtraceBuf; +} OS2_DOSPTRACE_MSG, *POS2_DOSPTRACE_MSG; + +typedef struct _OS2_DOSKILLPROCESS_MSG { + ULONG KillTarget; + PID ProcessId; +} OS2_DOSKILLPROCESS_MSG, *POS2_DOSKILLPROCESS_MSG; + + +typedef struct _OS2_DOSSETPRIORITY_MSG { + ULONG Scope; + ULONG Class; + LONG Delta; + ULONG TargetId; +} OS2_DOSSETPRIORITY_MSG, *POS2_DOSSETPRIORITY_MSG; + + +typedef struct _OS2_DOSGETPRIORITY_MSG { + ULONG Scope; + ULONG TargetId; + ULONG Priority; +} OS2_DOSGETPRIORITY_MSG, *POS2_DOSGETPRIORITY_MSG; + + +typedef struct _OS2_DOSGETPPID_MSG { + PID ChildPid; + PID ParentPid; +} OS2_DOSGETPPID_MSG, *POS2_DOSGETPPID_MSG; + + +typedef struct _OS2_DOSERROR_MSG { + ULONG ErrorAction; +} OS2_DOSERROR_MSG, *POS2_DOSERROR_MSG; + + +typedef struct _OS2_DOSFREEMEM_MSG { + PVOID BaseAddress; + BOOLEAN RemoveLDTEntry; +} OS2_DOSFREEMEM_MSG, *POS2_DOSFREEMEM_MSG; + + +typedef struct _OS2_DOSGIVESHAREDMEM_MSG { + PVOID BaseAddress; + PID ProcessId; + ULONG Flags; + ULONG PageProtection; +} OS2_DOSGIVESHAREDMEM_MSG, *POS2_DOSGIVESHAREDMEM_MSG; + + +typedef struct _OS2_DOSGETSHAREDMEM_MSG { + PVOID BaseAddress; + ULONG Flags; + ULONG PageProtection; +} OS2_DOSGETSHAREDMEM_MSG, *POS2_DOSGETSHAREDMEM_MSG; + + +typedef struct _OS2_DOSGETNAMEDSHAREDMEM_MSG { + PVOID BaseAddress; + ULONG Flags; + ULONG PageProtection; + STRING ObjectName; +} OS2_DOSGETNAMEDSHAREDMEM_MSG, *POS2_DOSGETNAMEDSHAREDMEM_MSG; + + +typedef struct _OS2_DOSALLOCSHAREDMEM_MSG { + PVOID BaseAddress; + ULONG RegionSize; + ULONG Flags; + ULONG PageProtection; + STRING ObjectName; + BOOLEAN CreateLDTEntry; +} OS2_DOSALLOCSHAREDMEM_MSG, *POS2_DOSALLOCSHAREDMEM_MSG; + + +typedef struct _OS2_DOSCREATEEVENTSEM_MSG { + ULONG HandleIndex; + HANDLE NtEventHandle; + STRING ObjectName; + ULONG CreateAttributes; + BOOLEAN InitialState; +} OS2_DOSCREATEEVENTSEM_MSG, *POS2_DOSCREATEEVENTSEM_MSG; + + +typedef struct _OS2_DOSOPENEVENTSEM_MSG { + ULONG HandleIndex; + HANDLE NtEventHandle; + STRING ObjectName; +} OS2_DOSOPENEVENTSEM_MSG, *POS2_DOSOPENEVENTSEM_MSG; + + +typedef struct _OS2_DOSCLOSEEVENTSEM_MSG { + ULONG HandleIndex; +} OS2_DOSCLOSEEVENTSEM_MSG, *POS2_DOSCLOSEEVENTSEM_MSG; + + +typedef struct _OS2_DOSCREATEMUTEXSEM_MSG { + ULONG HandleIndex; + HANDLE NtMutantHandle; + STRING ObjectName; + ULONG CreateAttributes; + BOOLEAN InitialState; +} OS2_DOSCREATEMUTEXSEM_MSG, *POS2_DOSCREATEMUTEXSEM_MSG; + + +typedef struct _OS2_DOSOPENMUTEXSEM_MSG { + ULONG HandleIndex; + HANDLE NtMutantHandle; + STRING ObjectName; +} OS2_DOSOPENMUTEXSEM_MSG, *POS2_DOSOPENMUTEXSEM_MSG; + + +typedef struct _OS2_DOSCLOSEMUTEXSEM_MSG { + ULONG HandleIndex; +} OS2_DOSCLOSEMUTEXSEM_MSG, *POS2_DOSCLOSEMUTEXSEM_MSG; + + +typedef struct _OS2_DOSCREATEMUXWAITSEM_MSG { + ULONG HandleIndex; + STRING ObjectName; + ULONG CreateAttributes; + ULONG CountMuxWaitEntries; + PSEMRECORD MuxWaitEntries; +} OS2_DOSCREATEMUXWAITSEM_MSG, *POS2_DOSCREATEMUXWAITSEM_MSG; + + +typedef struct _OS2_DOSOPENMUXWAITSEM_MSG { + ULONG HandleIndex; + STRING ObjectName; +} OS2_DOSOPENMUXWAITSEM_MSG, *POS2_DOSOPENMUXWAITSEM_MSG; + + +typedef struct _OS2_DOSCLOSEMUXWAITSEM_MSG { + ULONG HandleIndex; +} OS2_DOSCLOSEMUXWAITSEM_MSG, *POS2_DOSCLOSEMUXWAITSEM_MSG; + + +typedef struct _OS2_DOSWAITMUXWAITSEM_MSG { + ULONG HandleIndex; + LARGE_INTEGER Timeout; + ULONG UserValue; +} OS2_DOSWAITMUXWAITSEM_MSG, *POS2_DOSWAITMUXWAITSEM_MSG; + + +typedef struct _OS2_DOSADDMUXWAITSEM_MSG { + ULONG HandleIndex; + SEMRECORD MuxWaitEntry; +} OS2_DOSADDMUXWAITSEM_MSG, *POS2_DOSADDMUXWAITSEM_MSG; + + +typedef struct _OS2_DOSDELETEMUXWAITSEM_MSG { + ULONG HandleIndex; + ULONG EntryHandleIndex; +} OS2_DOSDELETEMUXWAITSEM_MSG, *POS2_DOSDELETEMUXWAITSEM_MSG; + + +typedef struct _OS2_DOSQUERYMUXWAITSEM_MSG { + ULONG HandleIndex; + ULONG CreateAttributes; + ULONG CountMuxWaitEntries; + PSEMRECORD MuxWaitEntries; +} OS2_DOSQUERYMUXWAITSEM_MSG, *POS2_DOSQUERYMUXWAITSEM_MSG; + +typedef struct _OS2_DOSSTARTSESSION_INFO { + ULONG ResultSessionId; + USHORT Related; + ULONG QueueHandleIndex; + ULONG dwProcessId; + USHORT SessionType; + BOOLEAN WinSession; + BOOLEAN FgBg; +} OS2_DOSSTARTSESSION_INFO, *POS2_DOSSTARTSESSION_INFO; + +typedef struct _OS2_DOSSELECTSESSION_MSG { + ULONG SessionId; +} OS2_DOSSELECTSESSION_MSG, *POS2_DOSSELECTSESSION_MSG; + +typedef struct _OS2_DOSSETSESSION_MSG { + ULONG SessionId; + STATUSDATA StatusData; +} OS2_DOSSETSESSION_MSG, *POS2_DOSSETSESSION_MSG; + +typedef struct _OS2_DOSSTOPSESSION_MSG { + ULONG SessionId; + ULONG fScope; +} OS2_DOSSTOPSESSION_MSG, *POS2_DOSSTOPSESSION_MSG; + +typedef struct _OS2_DOSSMSETTITLE_MSG { + STRING Title; +} OS2_DOSSMSETTITLE_MSG, *POS2_DOSSMSETTITLE_MSG; + +typedef struct _OS2_DOSSTARTSESSION_MSG { + OS2_DOSEXECPGM_MSG ExecPgmInformation; + OS2_DOSSTARTSESSION_INFO StartSessionInformation; +} OS2_DOSSTARTSESSION_MSG, *POS2_DOSSTARTSESSION_MSG; + +typedef struct _OS2_DOSGETCTRLPORTFORSESSION_MSG { + ULONG SessionUniqueId; + HANDLE hControlPort; +} OS2_DOSGETCTRLPORTFORSESSION_MSG, *POS2_DOSGETCTRLPORTFORSESSION_MSG; + +typedef struct _OS2_DOSCREATEQUEUE_MSG { + HQUEUE QueueHandle; + ULONG QueueType; + STRING QueueName; +} OS2_DOSCREATEQUEUE_MSG, *POS2_DOSCREATEQUEUE_MSG; + +typedef struct _OS2_DOSOPENQUEUE_MSG { + PID OwnerProcessId; + HQUEUE QueueHandle; + STRING QueueName; +} OS2_DOSOPENQUEUE_MSG, *POS2_DOSOPENQUEUE_MSG; + +typedef struct _OS2_DOSCLOSEQUEUE_MSG { + HQUEUE QueueHandle; + ULONG CloseCount; + PID OwnerProcessId; +} OS2_DOSCLOSEQUEUE_MSG, *POS2_DOSCLOSEQUEUE_MSG; + +typedef struct _OS2_DOSPURGEQUEUE_MSG { + HQUEUE QueueHandle; +} OS2_DOSPURGEQUEUE_MSG, *POS2_DOSPURGEQUEUE_MSG; + +typedef struct _OS2_DOSQUERYQUEUE_MSG { + HQUEUE QueueHandle; + ULONG CountQueueElements; + PID OwnerProcessId; +} OS2_DOSQUERYQUEUE_MSG, *POS2_DOSQUERYQUEUE_MSG; + +typedef struct _OS2_DOSPEEKQUEUE_MSG { + HQUEUE QueueHandle; + REQUESTDATA RequestInfo; + ULONG DataLength; + PVOID Data; + ULONG ReadPosition; + BOOL32 NoWait; + ULONG SemIndex; + BYTE ElementPriority; +} OS2_DOSPEEKQUEUE_MSG, *POS2_DOSPEEKQUEUE_MSG; + +typedef struct _OS2_DOSREADQUEUE_MSG { + HQUEUE QueueHandle; + REQUESTDATA RequestInfo; + ULONG DataLength; + PVOID Data; + ULONG ReadPosition; + BOOL32 NoWait; + ULONG SemIndex; + BYTE ElementPriority; +} OS2_DOSREADQUEUE_MSG, *POS2_DOSREADQUEUE_MSG; + +typedef struct _OS2_DOSWRITEQUEUE_MSG { + HQUEUE QueueHandle; + PID OwnerProcessId; + ULONG SenderData; + ULONG DataLength; + PVOID Data; + BYTE ElementPriority; +} OS2_DOSWRITEQUEUE_MSG, *POS2_DOSWRITEQUEUE_MSG; + +typedef struct _OS2_DOSENTERMUSTCOMPLETE_MSG { + ULONG NestingLevel; +} OS2_DOSENTERMUSTCOMPLETE_MSG, *POS2_DOSENTERMUSTCOMPLETE_MSG; + +typedef struct _OS2_DOSEXITMUSTCOMPLETE_MSG { + ULONG NestingLevel; +} OS2_DOSEXITMUSTCOMPLETE_MSG, *POS2_DOSEXITMUSTCOMPLETE_MSG; + +typedef struct _OS2_DOSSETSIGNALEXCEPTIONFOCUS_MSG { + ULONG NestingLevel; + BOOL32 Flag; +} OS2_DOSSETSIGNALEXCEPTIONFOCUS_MSG, *POS2_DOSSETSIGNALEXCEPTIONFOCUS_MSG; + +typedef struct _OS2_DOSSENDSIGNALEXCEPTION_MSG { + PID ProcessId; + ULONG Exception; +} OS2_DOSSENDSIGNALEXCEPTION_MSG, *POS2_DOSSENDSIGNALEXCEPTION_MSG; + +typedef struct _OS2_DOSACKNOWLEDGESIGNALEXCEPTION_MSG { + ULONG SignalNumber; +} OS2_DOSACKNOWLEDGESIGNALEXCEPTION_MSG, *POS2_DOSACKNOWLEDGESIGNALEXCEPTION_MSG; + +typedef struct _OS2_DISPATCH16_SIGNAL { + USHORT usFlagNum; + USHORT usFlagArg; + ULONG fscope; + ULONG pidProcess; + ULONG routine; + ULONG sighandleraddr; +} OS2_DISPATCH16_SIGNAL, *POS2_DISPATCH16_SIGNAL; + +#define MAX_API_NAME_FOR_GP 40 + +typedef struct _OS2_DOSGP_MSG { + UCHAR ApiName[MAX_API_NAME_FOR_GP]; +} OS2_DOSGP_MSG, *POS2_DOSGP_MSG; + +typedef struct _OS2_DOSCLOSE_HANDLE_MSG { + ULONG HandleNumber; + HANDLE HandleTable[7]; +} OS2_DOSCLOSE_HANDLE_MSG, *POS2_DOSCLOSE_HANDLE_MSG; + +typedef struct _OS2_CONFIGSYS_MSG { + ULONG RequiredAccess; // IN: either OPEN_ACCESS_READONLY or OPEN_ACCESS_READWRITE + ULONG AllowedAccess; // OUT: either OPEN_ACCESS_READONLY or OPEN_ACCESS_READWRITE + NTSTATUS ReturnStatus; // OUT: an error status report + +// +// Notes: +// -- The os2conf.nt file has been created only if ReturnStatus is success +// -- AllowedAccess is valid on return only if ReturnStatus is success or STATUS_ACCESS_DENIED +// -- if RequiredAccess is READWRITE and only READONLY is available, the +// os2conf.nt won't be created, ReturnStatus will be STATUS_ACCESS_DENIED, +// and AllowedAccess will be READONLY. +// + +} OS2_CONFIGSYS_MSG, *POS2_CONFIGSYS_MSG; + +typedef struct _OS2_NETBIOS_MSG { + UCHAR RequestType; // IN + UCHAR NetNumber; // IN + UCHAR RetCode; // OUT + UCHAR LanaEnumLength; // OUT + NTSTATUS ReturnStatus; // OUT + HANDLE hDev; // OUT + UCHAR LanaEnum[MAX_LANA_OS2SSMSG]; // OUT +} OS2_NETBIOS_MSG, *POS2_NETBIOS_MSG; + +typedef struct _OS2_CAPTURE_HEADER { + ULONG Length; + struct _OS2_CAPTURE_HEADER *RelatedCaptureBuffer; + ULONG CountMessagePointers; + ULONG CountCapturePointers; + PULONG MessagePointerOffsets; // Offsets within OS2_API_MSG of pointers + PULONG CapturePointerOffsets; // Offsets within CaptureBuffer of pointers + PCHAR FreeSpace; +} OS2_CAPTURE_HEADER, *POS2_CAPTURE_HEADER; + +typedef struct _OS2_REGISTER_HANDLER { + ULONG usFlagNum; + ULONG fAction; +} OS2_REGISTER_HANDLER, *POS2_REGISTER_HANDLER; + +typedef struct _OS2_REALLOCSHAREDMEM_MSG{ + PVOID BaseAddress; // base address of shared memory + PVOID AllocFreeBaseAddress; // start address of new allocation / free + USHORT NewLdtLimit; // New segment size in bytes + ULONG NewRegionSize; // New segment size rounded to pages + ULONG CurrentSize; // ldt limit rounded to pages + ULONG Flags; // Flags of new allocated memory + BOOLEAN SharedMemory; // flag set to true if shared segment found +}OS2_REALLOCSHAREDMEM_MSG, *POS2_REALLOCSHAREDMEM_MSG; + +typedef struct _OS2_GIVESEG_MSG{ + ULONG Selector; + PID TargetPid; +}OS2_GIVESEG_MSG, *POS2_GIVESEG_MSG; + +typedef struct _OS2_GETSEG_MSG{ + ULONG Selector; +}OS2_GETSEG_MSG, *POS2_GETSEG_MSG; + +typedef struct _OS2_DOSGETSHRSEG_MSG { + ULONG Selector; + STRING ObjectName; +} OS2_DOSGETSHRSEG_MSG, *POS2_DOSGETSHRSEG_MSG; + +typedef struct _LDRNEWEXE_MSG { + STRING ProcessName; + STRING FailName; + STRING LibPathName; + STRING InitRecords; + ULONG CurrentDrive; + ULONG DoscallsSel; + ULONG EntryFlatAddr; + ULONG NumOfInitRecords; +#if PMNT + BOOLEAN PMProcess; +#endif + BOOLEAN BoundApp; + EXECINFO ExecInfo; +} LDRNEWEXE_MSG, *P_LDRNEWEXE_MSG; + +typedef struct _LDRLOADMODULE_MSG { + STRING ModuleName; + STRING FailName; + STRING LibPathName; + STRING InitRecords; + ULONG ModuleHandle; + ULONG NumOfInitRecords; + EXECINFO ExecInfo; +} LDRLOADMODULE_MSG, *P_LDRLOADMODULE_MSG; + +typedef struct _LDRFREEMODULE_MSG { + ULONG ModuleHandle; +} LDRFREEMODULE_MSG, *P_LDRFREEMODULE_MSG; + +typedef struct _LDRGETMODULENAME_MSG { + STRING ModuleName; + ULONG ModuleHandle; +} LDRGETMODULENAME_MSG, *P_LDRGETMODULENAME_MSG; + +typedef struct _LDRGETMODULEHANDLE_MSG { + STRING ModuleName; + STRING LibPathName; + ULONG ModuleHandle; +} LDRGETMODULEHANDLE_MSG, *P_LDRGETMODULEHANDLE_MSG; + +typedef struct _LDRGETPROCADDR_MSG { + STRING ProcName; + ULONG ModuleHandle; + BOOLEAN ProcNameIsOrdinal; // Selects OrdinalNumber or ProcName fields + ULONG OrdinalNumber; + ULONG ProcAddr; +} LDRGETPROCADDR_MSG, *P_LDRGETPROCADDR_MSG; + +typedef struct _LDRQAPPTYPE_MSG { + STRING AppName; + STRING PathName; + ULONG AppType; +} LDRQAPPTYPE_MSG, *P_LDRQAPPTYPE_MSG; + +typedef struct _LDRGETRESOURCE_MSG { + ULONG ModuleHandle ; + ULONG ResourceType ; + ULONG ResourceName; + ULONG ResourceSel; + ULONG ResourceAddr; + ULONG NumberOfSegments; +} LDRGETRESOURCE_MSG, *P_LDRGETRESOURCE_MSG; + +typedef struct _LDRFREERESOURCE_MSG { + ULONG ResourceAddr; +} LDRFREERESOURCE_MSG, *P_LDRFREERESOURCE_MSG; + +#if PMNT +typedef struct _LDRIDENTIFYCODESELECTOR_MSG { + USHORT sel; + USHORT segNum; + USHORT mte; + STRING ModName; +} LDRIDENTIFYCODESELECTOR_MSG, *P_LDRIDENTIFYCODESELECTOR_MSG; + +typedef struct _PMNTSETPMSHELLFLAG_MSG { + ULONG Dummy; +} PMNTSETPMSHELLFLAG_MSG, *P_PMNTSETPMSHELLFLAG_MSG; +#endif + +#if PMNT && DBG +typedef struct _LDRDUMPSEGMENTS_MSG { + ULONG Dummy ; +} LDRDUMPSEGMENTS_MSG, *P_LDRDUMPSEGMENTS_MSG; +#endif + +typedef struct _OS2_API_MSG { + PORT_MESSAGE h; + ULONG PortType; // 0 - this port; 1 - Console port server. + POS2_CAPTURE_HEADER CaptureBuffer; + OS2_API_NUMBER ApiNumber; + ULONG ReturnedErrorValue; + union { + OS2_NULLAPICALL_MSG NullApiCall; + OS2_COPYHANDLETABLE_MSG CopyHandleTable; + OS2_SHARE_MSG DeviceShare; + OS2_ALERTMUXWAITER_MSG AlertMuxWaiter; + OS2_TERMINATETHREAD_MSG TerminateThread; + OS2_TERMINATEPROCESS_MSG TerminateProcess; + OS2_QUERYVIRTUALMEMORY_MSG QueryVirtualMemory; + OS2_MARKSHAREDMEMASHUGE_MSG MarkSharedMemAsHuge; + OS2_REALLOCSHAREDHUGE_MSG ReallocSharedHuge; + + OS2_DOSCREATETHREAD_MSG DosCreateThread; + OS2_DOSWAITCHILD_MSG DosWaitChild; + OS2_DOSWAITTHREAD_MSG DosWaitThread; + OS2_DOSEXIT_MSG DosExit; + OS2_DOSEXECPGM_MSG DosExecPgm; + OS2_DOSKILLPROCESS_MSG DosKillProcess; + OS2_DOSSETPRIORITY_MSG DosSetPriority; + OS2_DOSGETPRIORITY_MSG DosGetPriority; + OS2_DOSGETPPID_MSG DosGetPPID; + OS2_DOSERROR_MSG DosError; + OS2_DOSFREEMEM_MSG DosFreeMem; + OS2_DOSGIVESHAREDMEM_MSG DosGiveSharedMem; + OS2_DOSGETSHAREDMEM_MSG DosGetSharedMem; + OS2_DOSGETNAMEDSHAREDMEM_MSG DosGetNamedSharedMem; + OS2_DOSALLOCSHAREDMEM_MSG DosAllocSharedMem; + OS2_DOSCREATEEVENTSEM_MSG DosCreateEventSem; + OS2_DOSOPENEVENTSEM_MSG DosOpenEventSem; + OS2_DOSCLOSEEVENTSEM_MSG DosCloseEventSem; + OS2_DOSCREATEMUTEXSEM_MSG DosCreateMutexSem; + OS2_DOSOPENMUTEXSEM_MSG DosOpenMutexSem; + OS2_DOSCLOSEMUTEXSEM_MSG DosCloseMutexSem; + OS2_DOSCREATEMUXWAITSEM_MSG DosCreateMuxWaitSem; + OS2_DOSOPENMUXWAITSEM_MSG DosOpenMuxWaitSem; + OS2_DOSCLOSEMUXWAITSEM_MSG DosCloseMuxWaitSem; + OS2_DOSWAITMUXWAITSEM_MSG DosWaitMuxWaitSem; + OS2_DOSADDMUXWAITSEM_MSG DosAddMuxWaitSem; + OS2_DOSDELETEMUXWAITSEM_MSG DosDeleteMuxWaitSem; + OS2_DOSQUERYMUXWAITSEM_MSG DosQueryMuxWaitSem; + OS2_DOSSTARTSESSION_MSG DosStartSession; + OS2_DOSGETCTRLPORTFORSESSION_MSG DosGetCtrlPortForSession; + OS2_DOSSELECTSESSION_MSG DosSelectSession; + OS2_DOSSETSESSION_MSG DosSetSession; + OS2_DOSSTOPSESSION_MSG DosStopSession; + OS2_DOSSMSETTITLE_MSG DosSmSetTitle; + OS2_DOSCREATEQUEUE_MSG DosCreateQueue; + OS2_DOSOPENQUEUE_MSG DosOpenQueue; + OS2_DOSCLOSEQUEUE_MSG DosCloseQueue; + OS2_DOSPURGEQUEUE_MSG DosPurgeQueue; + OS2_DOSQUERYQUEUE_MSG DosQueryQueue; + OS2_DOSPEEKQUEUE_MSG DosPeekQueue; + OS2_DOSREADQUEUE_MSG DosReadQueue; + OS2_DOSWRITEQUEUE_MSG DosWriteQueue; + OS2_DOSENTERMUSTCOMPLETE_MSG DosEnterMustComplete; + OS2_DOSEXITMUSTCOMPLETE_MSG DosExitMustComplete; + OS2_DOSSETSIGNALEXCEPTIONFOCUS_MSG DosSetSignalExceptionFocus; + OS2_DOSSENDSIGNALEXCEPTION_MSG DosSendSignalException; + OS2_DOSACKNOWLEDGESIGNALEXCEPTION_MSG DosAcknowledgeSignalException; + OS2_DISPATCH16_SIGNAL Dispatch16Signal; + OS2_REGISTER_HANDLER DosRegisterCtrlHandler; + OS2_DOSGP_MSG DosExitGP; + OS2_DOSCLOSE_HANDLE_MSG DosCloseHandle; + OS2_CONFIGSYS_MSG CreateConfigSysRequest; + OS2_NETBIOS_MSG Netbios2Request; + OS2_REALLOCSHAREDMEM_MSG ReallocSharedMem; + OS2_GETSEG_MSG DosGetSeg; + OS2_GIVESEG_MSG DosGiveSeg; + OS2_DOSGETSHRSEG_MSG DosGetShrSeg; + OS2_DOSPTRACE_MSG DosPTrace; + LDRNEWEXE_MSG LdrNewExe; + LDRLOADMODULE_MSG LdrLoadModule; + LDRFREEMODULE_MSG LdrFreeModule; + LDRGETMODULENAME_MSG LdrGetModuleName; + LDRGETMODULEHANDLE_MSG LdrGetModuleHandle; + LDRGETPROCADDR_MSG LdrGetProcAddr; + LDRQAPPTYPE_MSG LdrQAppType; + LDRGETRESOURCE_MSG LdrGetResource; + LDRFREERESOURCE_MSG LdrFreeResource; +#if PMNT + LDRIDENTIFYCODESELECTOR_MSG LdrIdentifyCodeSelector; + PMNTSETPMSHELLFLAG_MSG PMNTSetPMshellFlag; +#endif +#if PMNT && DBG + LDRDUMPSEGMENTS_MSG LdrDumpSegments; +#endif + } u; +} OS2_API_MSG, *POS2_API_MSG; + +typedef struct _OD2_SIG_HANDLER_REC { + ULONG signature; + ULONG fholdenable; + ULONG sighandler[7]; + OS2_DISPATCH16_SIGNAL outstandingsig[7]; + ULONG doscallssel; + USHORT action[7]; +} OD2_SIG_HANDLER_REC, *POD2_SIG_HANDLER_REC; + +#define ThunkOffsetDosExitStub 0 +#define ThunkOffsetLDRLibiReturn 4 +#define ThunkOffsetExitProcessStub 8 +#define ThunkOffsetDosReturn 12 + +/* Signal Numbers for DosSetSigHandler */ + +#define SIG_CTRLC 1 /* Control C */ +#define SIG_BROKENPIPE 2 /* Broken Pipe */ +#define SIG_KILLPROCESS 3 /* Program Termination */ +#define SIG_CTRLBREAK 4 /* Control Break */ +#define SIG_PFLG_A 5 /* Process Flag A */ +#define SIG_PFLG_B 6 /* Process Flag B */ +#define SIG_PFLG_C 7 /* Process Flag C */ +#define SIG_CSIGNALS 8 /* number of signals plus one */ + +/* Flag Numbers for DosFlagProcess */ + +#define PFLG_A 0 /* Process Flag A */ +#define PFLG_B 1 /* Process Flag B */ +#define PFLG_C 2 /* Process Flag C */ + +/* Signal actions */ + +#define SIGA_KILL 0 +#define SIGA_IGNORE 1 +#define SIGA_ACCEPT 2 +#define SIGA_ERROR 3 +#define SIGA_ACKNOWLEDGE 4 +#define SIGA_ENABLE_HANDLING 5 + +#define SIGA_ACKNOWLEDGE_AND_ACCEPT 0xbeef + +/* DosHoldSignal defines */ +#define HLDSIG_ENABLE 0 +#define HLDSIG_DISABLE 1 + +#define HOLD_SIGNAL_CLEARED 0xffff + +typedef struct _OS2_REGISTER16_SIGNAL { + USHORT regSP; /* offset 0 */ + USHORT regSS; /* offset 2 */ + USHORT regBP; /* offset 4 */ + USHORT regDX; /* offset 6 */ + USHORT regBX; /* offset 8 */ + USHORT regCX; /* offset 10 */ + USHORT regSI; /* offset 12 */ + USHORT regDI; /* offset 14 */ + USHORT regES; /* offset 16 */ + USHORT regDS; /* offset 18 */ + USHORT usFlagNum; + USHORT usFlagArg; +} OS2_REGISTER16_SIGNAL, *POS2_REGISTER16_SIGNAL; + diff --git a/private/os2/inc/os2ssrtl.h b/private/os2/inc/os2ssrtl.h new file mode 100644 index 000000000..86dff4920 --- /dev/null +++ b/private/os2/inc/os2ssrtl.h @@ -0,0 +1,476 @@ +/*++ + +Copyright (c) 1989 Microsoft Corporation + +Module Name: + + os2ssrtl.h + +Abstract: + + Main include file for OS/2 Subsystem Runtime Library shared by the Client + and Server image files. + +Author: + + Steve Wood (stevewo) 7-Nov-1989 + +Revision History: + + + 4/14/93 - MJarus - Add OS2SS_SKIP_INCL_OS2V20, for not including os2v20.h + and so enable including <nt.h> and <windows.h> together. + +--*/ + +// +// Include NT Definitions +// + +#include <nt.h> +#include <ntrtl.h> +#include <nturtl.h> + + +// +// Include OS/2SS Debug Definitions +// + +extern ULONG Os2Debug; +#include "os2dbg.h" + + + +// +// Include OS/2 V2.0 Definitions +// + +#ifndef OS2SS_SKIP_INCL_OS2V20 // don'y include os2v20: include nt & windows +#include "os2v20.h" +#else +#ifndef APIRET +#define APIRET ULONG +#endif // APIRET +#endif // OS2SS_SKIP_INCL_OS2V20 + + +// +// Include C Runtime Definitions +// + +#include <string.h> + + +// +// CMD shortcut communication between dlltask.c and server +// + +#define NO_REDIR 0 +#define REDIR_NUL 1 +#define REDIR_FILE 2 +#define CMD_SHORTCUT 4 + +// +// Common types and constant definitions +// + +#define OS2_SS_ROOT_OBJECT_DIRECTORY L"\\OS2SS" + + // + // The following constant should get into ntrtl.h + // +#define RTL_USER_PROC_OS2_16BIT_PROG 0x80000000 + +// +// SubSystemData field in PEB points to the following data structure for +// OS/2 applications. Initial contents is passed back via the connection +// information structure when the client process connects to the OS/2 +// Emulation Subsystem server +// + +// This is equal to OS2_MAX_APPL_NAME in sesport.h +// If you change either one, update also the other. + +#define OS2_PROCESS_MAX_APPL_NAME 33 + +typedef struct _PEB_OS2_DATA { + ULONG Length; + PVOID ClientStartAddress; + BOOLEAN StartedBySm; + ULONG SizeOfInheritedHandleTable; + ULONG InitialDefaultDrive; + HANDLE StdIn; + HANDLE StdOut; + HANDLE StdErr; + HANDLE SessionPortHandle; + PVOID SessionDataBaseAddress; + ULONG CodePage; +} PEB_OS2_DATA, *PPEB_OS2_DATA; + + +// +// shandle.c +// + +typedef struct _OR2_HANDLE_TABLE { + ULONG Length; + RTL_CRITICAL_SECTION Lock; + PVOID Heap; + ULONG LogEntrySize; + ULONG CountEntries; + ULONG CountFixedEntries; + ULONG CountFreeEntries; + PVOID FixedEntries; + PVOID Entries; + PVOID Reserved; +} OR2_HANDLE_TABLE, *POR2_HANDLE_TABLE; + +// +// If the process is dieing, and there is only thread 1, there is no +// need for the lock, and we should not try it incase we terminated +// a thread inside (Acquire .. Release) block. +// +ULONG Od2ThreadId(); +#ifdef Od2SigHandlingInProgress + extern BOOLEAN Od2SigHandlingInProgress; +#else + BOOLEAN Od2SigHandlingInProgress; +#endif +#define AcquireHandleTableLock( p ) \ + if ((!Od2SigHandlingInProgress) || (Od2ThreadId() != 1)) \ + RtlEnterCriticalSection( &(p)->Lock ) +#define ReleaseHandleTableLock( p ) \ + if ((!Od2SigHandlingInProgress) || (Od2ThreadId() != 1)) \ + RtlLeaveCriticalSection( &(p)->Lock ) + +POR2_HANDLE_TABLE +Or2CreateHandleTable( + IN PVOID Heap, + IN ULONG SizeOfEntry, + IN ULONG CountFixedEntries + ); + + +typedef VOID (*OR2_DESTROY_HANDLE_ROUTINE)( + IN PVOID HandleTableEntry, + IN ULONG HandleIndex + ); + +BOOLEAN +Or2DestroyHandleTable( + IN POR2_HANDLE_TABLE HandleTable, + IN OR2_DESTROY_HANDLE_ROUTINE DestroyHandleProcedure + ); + + +BOOLEAN +Or2CreateHandle( + IN POR2_HANDLE_TABLE HandleTable, + IN OUT PULONG Handle, + IN PVOID Value + ); + + +BOOLEAN +Or2DestroyHandle( + IN POR2_HANDLE_TABLE HandleTable, + IN ULONG Handle + ); + + +PVOID +Or2MapHandle( + IN POR2_HANDLE_TABLE HandleTable, + IN ULONG Handle, + IN BOOLEAN TableLocked + ); + +typedef BOOLEAN (*OR2_ENUMERATE_HANDLE_ROUTINE)( + IN PVOID HandleTableEntry, + IN PVOID EnumParameter + ); + +BOOLEAN +Or2EnumHandleTable( + IN POR2_HANDLE_TABLE HandleTable, + IN OR2_ENUMERATE_HANDLE_ROUTINE EnumHandleProcedure, + IN PVOID EnumParameter, + OUT PULONG Handle OPTIONAL + ); + +#if DBG +typedef VOID (*OR2_DUMP_HANDLE_ROUTINE)( + IN PVOID HandleTableEntry, + IN ULONG HandleIndex, + IN PVOID DumpParameter + ); + +ULONG +Or2DumpHandleTable( + IN POR2_HANDLE_TABLE HandleTable, + IN OR2_DUMP_HANDLE_ROUTINE DumpHandleProcedure, + IN PVOID DumpParameter + ); +#endif + +// +// qhandle.c +// + +typedef struct _OR2_QHANDLE_ENTRY { + PVOID Entry; + BOOLEAN EntryIsAllocated; + BOOLEAN EntryIsChunkPointer; +} OR2_QHANDLE_ENTRY, *POR2_QHANDLE_ENTRY; + +typedef struct _OR2_QHANDLE_TABLE { + RTL_CRITICAL_SECTION Lock; + PVOID Heap; + ULONG EntrySize; + ULONG CountEntries; + ULONG CountFreeEntries; + ULONG NextToAllocate; + POR2_QHANDLE_ENTRY QHandles; +} OR2_QHANDLE_TABLE, *POR2_QHANDLE_TABLE; + +POR2_QHANDLE_TABLE +Or2CreateQHandleTable( + IN PVOID Heap, + IN ULONG SizeOfEntry, + IN ULONG CountFixedEntries + ); + +typedef VOID (*OR2_DESTROY_QHANDLE_ROUTINE)( + IN PVOID HandleTableEntry, + IN ULONG HandleIndex + ); + +BOOLEAN +Or2DestroyQHandleTable( + IN POR2_QHANDLE_TABLE HandleTable, + IN OR2_DESTROY_QHANDLE_ROUTINE DestroyHandleProcedure + ); + + +BOOLEAN +Or2CreateQHandle( + IN POR2_QHANDLE_TABLE HandleTable, + IN OUT PULONG Handle, + IN PVOID Value + ); + + +BOOLEAN +Or2DestroyQHandle( + IN POR2_QHANDLE_TABLE HandleTable, + IN ULONG Handle + ); + + +PVOID +Or2MapQHandle( + IN POR2_QHANDLE_TABLE HandleTable, + IN ULONG Handle, + IN BOOLEAN TableLocked + ); + +// +// ntmap.c +// + +APIRET +Or2MapStatus( + IN NTSTATUS Status + ); + +APIRET +Or2MapFlagsToProtection( + ULONG Flags, + PULONG Protection + ); + +APIRET +Or2MapProtectionToFlags( + ULONG Protection, + PULONG Flags + ); + +APIRET +Or2MapNtStatusToOs2Error( + IN NTSTATUS Status, + IN APIRET DefaultRetCode + ); + +// +// consys.c +// + +#define FWD +1L // these are used with +#define BWD -1L // Or2SkipWWS + +#define NULL_DELIM 0 // these are used with +#define CRLF_DELIM 1 // Or2IterateEnvironment + +// +// if OS2CONF_NAME_OPT == 1 then os2conf.nt will reside in %SystemRoot%\system32\os2 . +// if OS2CONF_NAME_OPT == 0 then os2conf.nt will reside in c:\ . +// +// CLIENT_POPUP_ON_READ designates whether the client should generate a popup if the +// program tries to open config.sys for reading (it always generates a popup when +// opening for writing). +// + +#define OS2CONF_NAME_OPT 0 +#define CLIENT_POPUP_ON_READ 1 + +#if OS2CONF_NAME_OPT +#define OS2CONF_NAMEA "\\OS2\\OS2CONF.NT" +#define OS2CONF_NAMEW L"\\OS2\\OS2CONF.NT" +#else +#define OS2CONF_NAMEA "\\OS2CONF.NT" +#define OS2CONF_NAMEW L"\\OS2CONF.NT" +#endif + +typedef VOID (*PFN_ENVIRONMENT_PROCESSOR)( + IN ULONG DispatchTableIndex, + IN PVOID UserParameter, + IN PWSTR Name, + IN ULONG NameLen, + IN PWSTR Value, + IN ULONG ValueLen + ); + +typedef struct _ENVIRONMENT_DISPATCH_TABLE_ENTRY { + PWSTR VarName; + PWSTR Delimiters; + PFN_ENVIRONMENT_PROCESSOR DispatchFunction; + PVOID UserParameter; +} ENVIRONMENT_DISPATCH_TABLE_ENTRY, *PENVIRONMENT_DISPATCH_TABLE_ENTRY; + +typedef PENVIRONMENT_DISPATCH_TABLE_ENTRY ENVIRONMENT_DISPATCH_TABLE; + +typedef struct _ENVIRONMENT_SEARCH_RECORD { + ULONG DispatchTableIndex; + PWSTR Name; + ULONG NameLen; + PWSTR Value; + ULONG ValueLen; +} ENVIRONMENT_SEARCH_RECORD, *PENVIRONMENT_SEARCH_RECORD; + +VOID +Or2SkipWWS( + IN OUT PWSTR *Str, + IN LONG Direction + ); + +VOID +Or2UnicodeStrupr( + IN OUT PWSTR Str + ); + +BOOLEAN +Or2UnicodeEqualCI( + IN PWSTR Str1, + IN PWSTR Str2, + IN ULONG Count + ); + +BOOLEAN +Or2AppendPathToPath( + IN PVOID HeapHandle, + IN PWSTR SrcPath, + IN OUT PUNICODE_STRING DestPath, + IN BOOLEAN ExpandIt + ); + +BOOLEAN +Or2ReplacePathByPath( + IN PVOID HeapHandle, + IN PWSTR SrcPath, + IN OUT PUNICODE_STRING DestPath + ); + +VOID +Or2CheckSemicolon( + IN OUT PUNICODE_STRING Str + ); + +BOOLEAN +Or2GetEnvPath( + OUT PUNICODE_STRING Data, + IN PVOID HeapHandle, + IN USHORT MaxSiz, + IN HANDLE EnvKey, + IN PWSTR ValueName, + IN BOOLEAN ExpandIt + ); + +VOID +Or2IterateEnvironment( + IN PWSTR Environment, + IN ENVIRONMENT_DISPATCH_TABLE DispatchTable, + IN ULONG NumberOfDispatchItems, + IN ULONG DelimOption + ); + +VOID +Or2FillInSearchRecordDispatchFunction( + IN ULONG DispatchTableIndex, + IN PVOID UserParameter, + IN PWSTR Name, + IN ULONG NameLen, + IN PWSTR Value, + IN ULONG ValueLen + ); + +// +// datetime.c +// + +APIRET +Or2GetDateTimeInfo( + PLARGE_INTEGER pSystemTime, + PLARGE_INTEGER pLocalTime, + PTIME_FIELDS pNtDateTime, + PVOID pSystemInformation, + PSHORT pTimeZone + ); + +// +// nls.c +// + +extern ULONG Or2ProcessCodePage; +extern ULONG Or2CurrentCodePageIsOem; + +#define Or2InitMBString RtlInitAnsiString + +//VOID +//Or2InitMBString( +// PANSI_STRING DestinationString, +// PCSZ SourceString); + +APIRET +Or2MBStringToUnicodeString( + PUNICODE_STRING DestinationString, + PANSI_STRING SourceString, + BOOLEAN AllocateDestinationString); + +BOOLEAN +Or2CreateUnicodeStringFromMBz( + OUT PUNICODE_STRING DestinationString, + IN PCSZ SourceString); + +APIRET +Or2UnicodeStringToMBString( + PANSI_STRING DestinationString, + PUNICODE_STRING SourceString, + BOOLEAN AllocateDestinationString); + +#define Or2FreeMBString RtlFreeOemString + +//VOID +//Or2FreeMBString( +// PANSI_STRING AnsiString); + +#include "os2crt.h" diff --git a/private/os2/inc/os2sub.h b/private/os2/inc/os2sub.h new file mode 100644 index 000000000..1bd64662f --- /dev/null +++ b/private/os2/inc/os2sub.h @@ -0,0 +1,416 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + os2sub.h + +Abstract: + + Main include file for OS/2 Client 16 bit VIO API support (Vio, Kbd & Mou ) + +Author: + + Yaron Shamir (YaronS) 19-Jul-1991 + +Revision History: + +--*/ + +#ifndef _OS2VIO_ +#define _OS2VIO_ + +#define KR_KBDCHARIN 0x00000001L +#define KR_KBDPEEK 0x00000002L +#define KR_KBDFLUSHBUFFER 0x00000004L +#define KR_KBDGETSTATUS 0x00000008L +#define KR_KBDSETSTATUS 0x00000010L +#define KR_KBDSTRINGIN 0x00000020L +#define KR_KBDOPEN 0x00000040L +#define KR_KBDCLOSE 0x00000080L +#define KR_KBDGETFOCUS 0x00000100L +#define KR_KBDFREEFOCUS 0x00000200L +#define KR_KBDGETCP 0x00000400L +#define KR_KBDSETCP 0x00000800L +#define KR_KBDXLATE 0x00001000L +#define KR_KBDSETCUSTXT 0x00002000L + +#define IO_WAIT 0 +#define IO_NOWAIT 1 + +#define KEYBOARD_ECHO_ON 0x0001 +#define KEYBOARD_ECHO_OFF 0x0002 +#define KEYBOARD_BINARY_MODE 0x0004 +#define KEYBOARD_ASCII_MODE 0x0008 +#define KEYBOARD_MODIFY_STATE 0x0010 +#define KEYBOARD_MODIFY_INTERIM 0x0020 +#define KEYBOARD_MODIFY_TURNAROUND 0x0040 +#define KEYBOARD_2B_TURNAROUND 0x0080 +#define KEYBOARD_SHIFT_REPORT 0x0100 + +#define KBDTRF_SHIFT_KEY_IN 0x01 +#define KBDTRF_CONVERSION_REQUEST 0x20 +#define KBDTRF_FINAL_CHAR_IN 0x40 +#define KBDTRF_INTERIM_CHAR_IN 0x80 + +#define KEYBOARD_AT_COMPATABLE 0x0001 +#define KEYBOARD_ENHANCED_101 0xAB41 +#define KEYBOARD_ENHANCED_102 0xAB41 +#define KEYBOARD_ENHANCED_122 0xAB85 +#define KEYBOARD_SPACESAVER 0xAB54 + +/* KBDKEYINFO structure, for KbdCharIn and KbdPeek */ + +#pragma pack(1) +typedef struct _KBDKEYINFO { /* kbci */ + UCHAR chChar; + UCHAR chScan; + UCHAR fbStatus; + UCHAR bNlsShift; + USHORT fsState; + ULONG time; +} KBDKEYINFO, *PKBDKEYINFO; + +/* structure for KbdStringIn() */ + +typedef struct _STRINGINBUF { /* kbsi */ + USHORT cb; + USHORT cchIn; +} STRINGINBUF, *PSTRINGINBUF; + +/* KBDINFO structure, for KbdSet/GetStatus */ + +typedef struct _KBDINFO { /* kbst */ + USHORT cb; + USHORT fsMask; + USHORT chTurnAround; + USHORT fsInterim; + USHORT fsState; +} KBDINFO, *PKBDINFO; + +/* structure for KbdGetHWID() */ + +typedef struct _KBDHWID { /* kbhw */ + USHORT cb; + USHORT idKbd; + USHORT usReserved1; + USHORT usReserved2; +} KBDHWID, *PKBDHWID; + +/* structure for KbdXlate() */ + +typedef struct _KBDTRANS { /* kbxl */ + UCHAR chChar; + UCHAR chScan; + UCHAR fbStatus; + UCHAR bNlsShift; + USHORT fsState; + ULONG time; + USHORT fsDD; + USHORT fsXlate; + USHORT fsShift; + USHORT sZero; +} KBDTRANS, *PKBDTRANS; + +/* first parameter registration constants */ + +#define VR_VIOGETCURPOS 0x00000001L +#define VR_VIOGETCURTYPE 0x00000002L +#define VR_VIOGETMODE 0x00000004L +#define VR_VIOGETBUF 0x00000008L +#define VR_VIOGETPHYSBUF 0x00000010L +#define VR_VIOSETCURPOS 0x00000020L +#define VR_VIOSETCURTYPE 0x00000040L +#define VR_VIOSETMODE 0x00000080L +#define VR_VIOSHOWBUF 0x00000100L +#define VR_VIOREADCHARSTR 0x00000200L +#define VR_VIOREADCELLSTR 0x00000400L +#define VR_VIOWRTNCHAR 0x00000800L +#define VR_VIOWRTNATTR 0x00001000L +#define VR_VIOWRTNCELL 0x00002000L +#define VR_VIOWRTTTY 0x00004000L +#define VR_VIOWRTCHARSTR 0x00008000L + +#define VR_VIOWRTCHARSTRATT 0x00010000L +#define VR_VIOWRTCELLSTR 0x00020000L +#define VR_VIOSCROLLUP 0x00040000L +#define VR_VIOSCROLLDN 0x00080000L +#define VR_VIOSCROLLLF 0x00100000L +#define VR_VIOSCROLLRT 0x00200000L +#define VR_VIOSETANSI 0x00400000L +#define VR_VIOGETANSI 0x00800000L +#define VR_VIOPRTSC 0x01000000L +#define VR_VIOSCRLOCK 0x02000000L +#define VR_VIOSCRUNLOCK 0x04000000L +#define VR_VIOSAVREDRAWWAIT 0x08000000L +#define VR_VIOSAVREDRAWUNDO 0x10000000L +#define VR_VIOPOPUP 0x20000000L +#define VR_VIOENDPOPUP 0x40000000L +#define VR_VIOPRTSCTOGGLE 0x80000000L + +/* second parameter registration constants */ + +#define VR_VIOMODEWAIT 0x00000001L +#define VR_VIOMODEUNDO 0x00000002L +#define VR_VIOGETFONT 0x00000004L +#define VR_VIOGETCONFIG 0x00000008L +#define VR_VIOSETCP 0x00000010L +#define VR_VIOGETCP 0x00000020L +#define VR_VIOSETFONT 0x00000040L +#define VR_VIOGETSTATE 0x00000080L +#define VR_VIOSETSTATE 0x00000100L + +/* structure for VioSet/GetCurType() */ + +typedef struct _VIOCURSORINFO { /* vioci */ + USHORT yStart; + USHORT cEnd; + USHORT cx; + USHORT attr; +} VIOCURSORINFO, *PVIOCURSORINFO; + +/* VIOMODEINFO.color constants */ + +#define COLORS_2 0x0001 +#define COLORS_4 0x0002 +#define COLORS_16 0x0004 + +/* structure for VioSet/GetMode() */ + +typedef struct _VIOMODEINFO { /* viomi */ + USHORT cb; + UCHAR fbType; + UCHAR color; + USHORT col; + USHORT row; + USHORT hres; + USHORT vres; + UCHAR fmt_ID; + UCHAR attrib; + ULONG buf_addr; + ULONG buf_length; + ULONG full_length; + ULONG partial_length; + CHAR *ext_data_addr; /* => PCH */ +} VIOMODEINFO, *PVIOMODEINFO; + +#define VGMT_OTHER 0x01 +#define VGMT_GRAPHICS 0x02 +#define VGMT_DISABLEBURST 0x04 + +#define ANSI_ON 1 +#define ANSI_OFF 0 + +#define VSRWI_SAVEANDREDRAW 0 +#define VSRWI_REDRAW 1 + +#define VSRWN_SAVE 0 +#define VSRWN_REDRAW 1 + +#define UNDOI_GETOWNER 0 +#define UNDOI_RELEASEOWNER 1 + +#define UNDOK_ERRORCODE 0 +#define UNDOK_TERMINATE 1 + +#define VMWR_POPUP 0 +#define VMWN_POPUP 0 + +#define LOCKIO_NOWAIT 0 +#define LOCKIO_WAIT 1 + +#define LOCK_SUCCESS 0 +#define LOCK_FAIL 1 + +#define VP_NOWAIT 0x0000 +#define VP_WAIT 0x0001 +#define VP_OPAQUE 0x0000 +#define VP_TRANSPARENT 0x0002 + +/* VIOCONFIGINFO.adapter constants */ + +#define DISPLAY_MONOCHROME 0x0000 +#define DISPLAY_CGA 0x0001 +#define DISPLAY_EGA 0x0002 +#define DISPLAY_VGA 0x0003 +#define DISPLAY_8514A 0x0007 + +/* VIOCONFIGINFO.display constants */ + +#define MONITOR_MONOCHROME 0x0000 +#define MONITOR_COLOR 0x0001 +#define MONITOR_ENHANCED 0x0002 +#define MONITOR_8503 0x0003 +#define MONITOR_851X_COLOR 0x0004 +#define MONITOR_8514 0x0009 + +/* structure for VioGetConfig() */ + +typedef struct _VIOCONFIGINFO { /* vioin */ + USHORT cb; + USHORT adapter; + USHORT display; + ULONG cbMemory; + USHORT Configuration; + USHORT VDHVersion; + USHORT Flags; + ULONG HWBufferSize; + ULONG FullSaveSize; + ULONG PartSaveSize; + USHORT EMAdaptersOFF; + USHORT EMDisplaysOFF; +} VIOCONFIGINFO, *PVIOCONFIGINFO; + +#define VIO_CONFIG_CURRENT 0 +#define VIO_CONFIG_PRIMARY 1 +#define VIO_CONFIG_SECONDARY 2 + +/* structure for VioGet/SetFont() */ + +typedef struct _VIOFONTINFO { /* viofi */ + USHORT cb; + USHORT type; + USHORT cxCell; + USHORT cyCell; + PVOID pbData; + USHORT cbData; +} VIOFONTINFO, *PVIOFONTINFO; + +#define VGFI_GETCURFONT 0 +#define VGFI_GETROMFONT 1 + +typedef struct _VIOPALSTATE { /* viopal */ + USHORT cb; + USHORT type; + USHORT iFirst; + USHORT acolor[1]; +} VIOPALSTATE, *PVIOPALSTATE; + +typedef struct _VIOOVERSCAN { /* vioos */ + USHORT cb; + USHORT type; + USHORT color; +} VIOOVERSCAN, *PVIOOVERSCAN; + +typedef struct _VIOINTENSITY { /* vioint */ + USHORT cb; + USHORT type; + USHORT fs; +} VIOINTENSITY, *PVIOINTENSITY; + +typedef struct _VIOCOLORREG { /* viocreg */ + USHORT cb; + USHORT type; + USHORT firstcolorreg; + USHORT numcolorregs; + CHAR *colorregaddr; /* => PCH */ +} VIOCOLORREG, *PVIOCOLORREG; + +typedef struct _VIOSETULINELOC { /* viouline */ + USHORT cb; + USHORT type; + USHORT scanline; +} VIOSETULINELOC, *PVIOSETULINELOC; + +typedef struct _VIOSETTARGET { /* viosett */ + USHORT cb; + USHORT type; + USHORT defaultalgorithm; +} VIOSETTARGET, *PVIOSETTARGET; + +#define MR_MOUGETNUMBUTTONS 0x00000001L +#define MR_MOUGETNUMMICKEYS 0x00000002L +#define MR_MOUGETDEVSTATUS 0x00000004L +#define MR_MOUGETNUMQUEEL 0x00000008L +#define MR_MOUREADEVENTQUE 0x00000010L +#define MR_MOUGETSCALEFACT 0x00000020L +#define MR_MOUGETEVENTMASK 0x00000040L +#define MR_MOUSETSCALEFACT 0x00000080L +#define MR_MOUSETEVENTMASK 0x00000100L +#define MR_MOUOPEN 0x00000800L +#define MR_MOUCLOSE 0x00001000L +#define MR_MOUGETPTRSHAPE 0x00002000L +#define MR_MOUSETPTRSHAPE 0x00004000L +#define MR_MOUDRAWPTR 0x00008000L +#define MR_MOUREMOVEPTR 0x00010000L +#define MR_MOUGETPTRPOS 0x00020000L +#define MR_MOUSETPTRPOS 0x00040000L +#define MR_MOUINITREAL 0x00080000L +#define MR_MOUSETDEVSTATUS 0x00100000L + +#define MHK_BUTTON1 0x0001 +#define MHK_BUTTON2 0x0002 +#define MHK_BUTTON3 0x0004 + +/* structure for MouGet/SetPtrPos() */ + +typedef struct _PTRLOC { /* moupl */ + USHORT row; + USHORT col; +} PTRLOC, *PPTRLOC; + +/* structure for MouGet/SetPtrShape() */ + +typedef struct _PTRSHAPE { /* moups */ + USHORT cb; + USHORT col; + USHORT row; + USHORT colHot; + USHORT rowHot; +} PTRSHAPE, *PPTRSHAPE; + +/* structure for MouReadEventQue() */ + +typedef struct _MOUEVENTINFO { /* mouev */ + USHORT fs; + ULONG time; + USHORT row; + USHORT col; +} MOUEVENTINFO, *PMOUEVENTINFO; + +/* structure for MouGetNumQueEl() */ + +typedef struct _MOUQUEINFO { /* mouqi */ + USHORT cEvents; + USHORT cmaxEvents; +} MOUQUEINFO, *PMOUQUEINFO; + +/* structure for MouGet/SetScaleFact() */ + +typedef struct _SCALEFACT { /* mousc */ + USHORT rowScale; + USHORT colScale; +} SCALEFACT, *PSCALEFACT; + +/* structure for MouRemovePtr() */ + +typedef struct _NOPTRRECT { /* mourt */ + USHORT row; + USHORT col; + USHORT cRow; + USHORT cCol; +} NOPTRRECT, *PNOPTRRECT; +#pragma pack() + +/* MouGetDevStatus/MouSetDevStatus device status constants */ + +#define MOUSE_QUEUEBUSY 0x0001 +#define MOUSE_BLOCKREAD 0x0002 +#define MOUSE_FLUSH 0x0004 +#define MOUSE_UNSUPPORTED_MODE 0x0008 +#define MOUSE_DISABLED 0x0100 +#define MOUSE_MICKEYS 0x0200 + +/* MouReadEventQue */ + +#define MOU_NOWAIT 0x0000 +#define MOU_WAIT 0x0001 + +#define MOU_NODRAW 0x0001 +#define MOU_DRAW 0x0000 +#define MOU_MICKEYS 0x0002 +#define MOU_PELS 0x0000 + +#endif /* _OS2VIO_ */ + diff --git a/private/os2/inc/os2tile.h b/private/os2/inc/os2tile.h new file mode 100644 index 000000000..9007cf290 --- /dev/null +++ b/private/os2/inc/os2tile.h @@ -0,0 +1,85 @@ +/*++ + +Copyright (c) 1992 Microsoft Corporation + +Module Name: + + os2tile.h + +Abstract: + + Defines the Tiling scheme number for os2ss. Included by thunkcom, client + loader & server. + +Author: + + Yaron Shamir (YaronS) 22-Oct-1992 + +Revision History: + + Patrick Questembert (PatrickQ) 04-Nov-92 + Fixed FLATTOSEL macro (needed ULONG cast) + changed ULONG cast position so + that FLAT may be a pointer to types of any length. + +--*/ + + +#define BASE_TILE 0x38000000 +#define BASE_TILE_ZERO_BITS 1 + +// +// Preallocated areas at the top of the tiled region +// + +#define _64K (64L*1024) +#define _512M ((512L*1024)*1024) + +#define OD2TILEDHEAP_SIZE 20*_64K + +#define VIOSECTION_BASE (BASE_TILE + _512M - _64K) // This must be the last one +#define OD2TILEDHEAP_BASE (VIOSECTION_BASE - OD2TILEDHEAP_SIZE) +#define OD2ENVIRONMENT_BASE (OD2TILEDHEAP_BASE - _64K) +#define GINFOSEG_BASE (OD2ENVIRONMENT_BASE - _64K) +#define R2STACKS_BASE (GINFOSEG_BASE - _64K) +#define R2XFER_BASE (R2STACKS_BASE - _64K) +#define DOSCALLS_BASE (R2XFER_BASE - _64K) +#if PMNT +// The 3 selectors below are used to reserve the same 2 LDT selectors in each +// OS/2 process so that they can map the video memory for PM apps. +// PMDISPLAY_DUMMY is required to allow mapping of frame buffer sections where +// the 2nd selector is not aligned to 64K + the length crosses the 64K +// boundary: in such a case, we need to have the next selector free. +#define PMDISPLAY_DUMMY (DOSCALLS_BASE - _64K) +#define PMDISPLAY_BASE2 (PMDISPLAY_DUMMY - _64K) +#define PMDISPLAY_BASE1 (PMDISPLAY_BASE2 - _64K) +#endif +// +// OD2MAXSEG_MEM must be set to the lowest virtual address which +// is pre-allocated. +// +#if PMNT +#define OD2MAXSEG_MEM (PMDISPLAY_BASE1) +#else +#define OD2MAXSEG_MEM (DOSCALLS_BASE) +#endif +#define OD2MAXSEG_BASE (OD2MAXSEG_MEM - _64K) + +#define SELTOFLAT(SEL) (PVOID) (BASE_TILE + (((SEL) >> 3) << 16)) +#define FLATTOSEL(FLAT) (USHORT) (((((ULONG)(FLAT) - BASE_TILE) & 0x1fff0000) >> 13) | 7) +#define FARPTRTOFLAT(FARPTR) (PVOID) (BASE_TILE + (((((ULONG)(FARPTR)) >> 19) << 16) | (((ULONG)(FARPTR)) & 0xffff))) +#define FLATTOFARPTR(FLAT) ( (((((ULONG)(FLAT) - BASE_TILE) & 0x1fff0000) << 3) | 0x00070000) | (((ULONG)(FLAT)) & 0x0000ffff) ) + +// +// The LDT_DISJOINT_ENTRIES parameter defines the number of LDT entries +// which are reserved for PROGRAM/DLL loading and shared memory segments. +// The entries are reserved at the top of the LDT table. +// PROGRAM/DLL segments are allocated from the bottom of the disjoint area +// while shared memory segments are allocated from the top of the disjoint +// area. +// +// This number MUST be a multiple of 32! +// +#define LDT_DISJOINT_ENTRIES 0x1800 + +#define FIRST_SHARED_SELECTOR ((0x2000-LDT_DISJOINT_ENTRIES)*8) + diff --git a/private/os2/inc/os2v12.h b/private/os2/inc/os2v12.h new file mode 100644 index 000000000..aad8956fd --- /dev/null +++ b/private/os2/inc/os2v12.h @@ -0,0 +1,1106 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + os2v12.h + +Abstract: + + Include file for OS/2 Subsystem Client 16 bit API support. + +Author: + + Patrick Questembert 16-Feb-92 + +Revision History: + +--*/ + +#pragma pack(2) /* To cancel alignement done by 32-bit compiler since we + have in this include file only OS/2 1.x typedefs */ + +#define INCL_DOSINCLUDED + +#ifndef INCL_BASEINCLUDED +#if !(defined(INCL_32) || defined(INCL_16)) +#ifdef M_I386 + #define INCL_32 +#else /* not M_I386 */ + #define INCL_16 +#endif /* M_I386 */ +#endif /* INCL_32 || INCL_16 */ + +#if !defined(INCL_16) +#pragma message ("16-bit Base API included when using 32-bit compiler") +#endif /* INCL_32 */ +#endif /* INCL_BASEINCLUDED */ + +#ifdef INCL_DOS + +#define INCL_DOSPROCESS +#define INCL_DOSINFOSEG +#define INCL_DOSFILEMGR +#define INCL_DOSMEMMGR +#define INCL_DOSSEMAPHORES +#define INCL_DOSDATETIME +#define INCL_DOSMODULEMGR +#define INCL_DOSRESOURCES +#define INCL_DOSNLS +#define INCL_DOSSIGNALS +#define INCL_DOSMISC +#define INCL_DOSMONITORS +#define INCL_DOSQUEUES +#define INCL_DOSSESMGR +#define INCL_DOSDEVICES +#define INCL_DOSNMPIPES +#define INCL_DOSPROFILE +#define INCL_DOSMVDM + +#endif /* INCL_DOS */ + +#ifdef INCL_ERRORS +#define INCL_DOSERRORS +#endif /* INCL_ERRORS */ + +#if (defined(INCL_DOSPROCESS) || !defined(INCL_NOCOMMON)) + + +/* DosExit codes */ +#define EXIT_THREAD 0 +#define EXIT_PROCESS 1 + +#endif /* common INCL_DOSPROCESS definitions */ + +#ifdef INCL_DOSPROCESS + +typedef struct _PIDINFO { /* pidi */ + USHORT pid; + USHORT tid; + USHORT pidParent; +} PIDINFO; +typedef PIDINFO FAR *PPIDINFO; + + +/* Action code values */ +#define DCWA_PROCESS 0 +#define DCWA_PROCESSTREE 1 + +/* Wait option values */ +#define DCWW_WAIT 0 +#define DCWW_NOWAIT 1 + +/* codeTerminate values (also passed to ExitList routines) */ +#define TC_EXIT 0 +#define TC_HARDERROR 1 +#define TC_TRAP 2 +#define TC_KILLPROCESS 3 + + +/* DosExitList functions */ +#define EXLST_ADD 1 +#define EXLST_REMOVE 2 +#define EXLST_EXIT 3 + + +/* DosExecPgm functions */ +#define EXEC_SYNC 0 +#define EXEC_ASYNC 1 +#define EXEC_ASYNCRESULT 2 +#define EXEC_TRACE 3 +#define EXEC_BACKGROUND 4 +#define EXEC_LOAD 5 + + + +/* Priority scopes */ +#define PRTYS_PROCESS 0 +#define PRTYS_PROCESSTREE 1 +#define PRTYS_THREAD 2 + +/* Priority classes */ +#define PRTYC_NOCHANGE 0 +#define PRTYC_IDLETIME 1 +#define PRTYC_REGULAR 2 +#define PRTYC_TIMECRITICAL 3 +#define PRTYC_FOREGROUNDSERVER 4 + +/* Priority deltas */ +#define PRTYD_MINIMUM -31 +#define PRTYD_MAXIMUM 31 + + +#define DKP_PROCESSTREE 0 +#define DKP_PROCESS 1 + +#endif /* INCL_DOSPROCESS */ + + +/*** InfoSeg support */ + +#ifdef INCL_DOSINFOSEG + +/* Global Information Segment */ + +typedef struct _GINFOSEG { /* gis */ + ULONG time; + ULONG msecs; + UCHAR hour; + UCHAR minutes; + UCHAR seconds; + UCHAR hundredths; + USHORT timezone; + USHORT cusecTimerInterval; + UCHAR day; + UCHAR month; + USHORT year; + UCHAR weekday; + UCHAR uchMajorVersion; + UCHAR uchMinorVersion; + UCHAR chRevisionLetter; + UCHAR sgCurrent; + UCHAR sgMax; + UCHAR cHugeShift; + UCHAR fProtectModeOnly; + USHORT pidForeground; + UCHAR fDynamicSched; + UCHAR csecMaxWait; + USHORT cmsecMinSlice; + USHORT cmsecMaxSlice; + USHORT bootdrive; + UCHAR amecRAS[32]; + UCHAR csgWindowableVioMax; + UCHAR csgPMMax; +} GINFOSEG; +typedef GINFOSEG FAR *PGINFOSEG; + +/* Local Information Segment */ + +typedef struct _LINFOSEG { /* lis */ + USHORT pidCurrent; + USHORT pidParent; + USHORT prtyCurrent; + USHORT tidCurrent; + USHORT sgCurrent; + UCHAR rfProcStatus; + UCHAR dummy1; + USHORT fForeground; + UCHAR typeProcess; + UCHAR dummy2; + SEL selEnvironment; + USHORT offCmdLine; + USHORT cbDataSegment; + USHORT cbStack; + USHORT cbHeap; + USHORT hmod; + SEL selDS; +} LINFOSEG; +typedef LINFOSEG FAR *PLINFOSEG; + +/* Process Type codes (local information segment typeProcess field) */ + +#define PT_FULLSCREEN 0 /* Full screen application */ +#define PT_REALMODE 1 /* Real mode process */ +#define PT_WINDOWABLEVIO 2 /* VIO windowable application */ +#define PT_PM 3 /* Presentation Manager application */ +#define PT_DETACHED 4 /* Detached application */ + +/* Process Status Flag definitions (local info seg rfProcStatus field) */ + +#define PS_EXITLIST 1 /* Thread is in exitlist routine */ + + +/* Helper macros used to convert selector to PINFOSEG or LINFOSEG */ + +#define MAKEPGINFOSEG(sel) ((PGINFOSEG)MAKEP(sel, 0)) +#define MAKEPLINFOSEG(sel) ((PLINFOSEG)MAKEP(sel, 0)) + +#endif /* INCL_DOSINFOSEG */ + +/* + * CCHMAXPATH is the maximum fully qualified path name length including + * the drive letter, colon, backslashes and terminating NULL. + */ +#define CCHMAXPATH 260 + +/* + * CCHMAXPATHCOMP is the maximum individual path component name length + * including a terminating NULL. + */ +#define CCHMAXPATHCOMP 256 + +#if (defined(INCL_DOSFILEMGR) || !defined(INCL_NOCOMMON)) + +/*** File manager */ + +/* DosSetFilePtr() file position codes */ + +#define FILE_BEGIN 0x0000 /* relative to beginning of file */ +#define FILE_CURRENT 0x0001 /* relative to current fptr position*/ +#define FILE_END 0x0002 /* relative to end of file */ + +/* DosFindFirst/Next Directory handle types */ + +#define HDIR_SYSTEM 1 /* Use system handle (1) */ + +/* DosCopy control bits - may be or'ed together */ +#define DCPY_EXISTING 0x00001 /* Copy even if target exists */ +#define DCPY_APPEND 0x00002 /* Append to existing file, don't replace*/ +#define DCPY_FAILEAS 0x00004 /* Fail if EAs not supported on target*/ + +/* Dosopen/DosQFHandState/DosQueryFileInfo et al file attributes; also */ +/* known as Dos File Mode bits... */ +#define FILE_NORMAL 0x0000 +#define FILE_READONLY 0x0001 +#define FILE_HIDDEN 0x0002 +#define FILE_SYSTEM 0x0004 +#define FILE_DIRECTORY 0x0010 +#define FILE_ARCHIVED 0x0020 + +/* DosOpen() actions */ +#define FILE_EXISTED 0x0001 +#define FILE_CREATED 0x0002 +#define FILE_TRUNCATED 0x0003 + +/* DosOpen() open flags */ +//#define FILE_OPEN 0x0001 +#define FILE_TRUNCATE 0x0002 +//#define FILE_CREATE 0x0010 + +/* applies if file already exists */ + +#define OPEN_ACTION_FAIL_IF_EXISTS 0x0000 /* ---- ---- ---- 0000 */ +#define OPEN_ACTION_OPEN_IF_EXISTS 0x0001 /* ---- ---- ---- 0001 */ +#define OPEN_ACTION_REPLACE_IF_EXISTS 0x0002 /* ---- ---- ---- 0010 */ + +/* applies if file does not exist */ + +#define OPEN_ACTION_FAIL_IF_NEW 0x0000 /* ---- ---- 0000 ---- */ +#define OPEN_ACTION_CREATE_IF_NEW 0x0010 /* ---- ---- 0001 ---- */ + +/* DosOpen/DosSetFHandState flags */ + +//#define OPEN_ACCESS_READONLY 0x0000 /* ---- ---- ---- -000 */ +//#define OPEN_ACCESS_WRITEONLY 0x0001 /* ---- ---- ---- -001 */ +//#define OPEN_ACCESS_READWRITE 0x0002 /* ---- ---- ---- -010 */ +//#define OPEN_SHARE_DENYREADWRITE 0x0010 /* ---- ---- -001 ---- */ +//#define OPEN_SHARE_DENYWRITE 0x0020 /* ---- ---- -010 ---- */ +//#define OPEN_SHARE_DENYREAD 0x0030 /* ---- ---- -011 ---- */ +//#define OPEN_SHARE_DENYNONE 0x0040 /* ---- ---- -100 ---- */ +//#define OPEN_FLAGS_NOINHERIT 0x0080 /* ---- ---- 1--- ---- */ +//#define OPEN_FLAGS_NO_LOCALITY 0x0000 /* ---- -000 ---- ---- */ +//#define OPEN_FLAGS_SEQUENTIAL 0x0100 /* ---- -001 ---- ---- */ +//#define OPEN_FLAGS_RANDOM 0x0200 /* ---- -010 ---- ---- */ +//#define OPEN_FLAGS_RANDOMSEQUENTIAL 0x0300 /* ---- -011 ---- ---- */ +//#define OPEN_FLAGS_NO_CACHE 0x1000 /* ---1 ---- ---- ---- */ +//#define OPEN_FLAGS_FAIL_ON_ERROR 0x2000 /* --1- ---- ---- ---- */ +//#define OPEN_FLAGS_WRITE_THROUGH 0x4000 /* -1-- ---- ---- ---- */ +//#define OPEN_FLAGS_DASD 0x8000 /* 1--- ---- ---- ---- */ +#define OPEN_FLAGS_NONSPOOLED 0x00040000 + +#define MUST_HAVE_READONLY ( (FILE_READONLY << 8) | FILE_READONLY ) +#define MUST_HAVE_HIDDEN ( (FILE_HIDDEN << 8) | FILE_HIDDEN ) +#define MUST_HAVE_SYSTEM ( (FILE_SYSTEM << 8) | FILE_SYSTEM ) +#define MUST_HAVE_DIRECTORY ( (FILE_DIRECTORY << 8) | FILE_DIRECTORY ) +#define MUST_HAVE_ARCHIVED ( (FILE_ARCHIVED << 8) | FILE_ARCHIVED ) + +/* DosSearchPath() constants */ + +#define SEARCH_PATH 0x0000 +#define SEARCH_CUR_DIRECTORY 0x0001 +#define SEARCH_ENVIRONMENT 0x0002 +#define SEARCH_IGNORENETERRS 0x0004 + +/* + * DosFileIO + */ +/* File IO command words */ +#define FIO_LOCK 0 /* Lock Files */ +#define FIO_UNLOCK 1 /* Unlock Files */ +#define FIO_SEEK 2 /* Seek (set file ptr) */ +#define FIO_READ 3 /* File Read */ +#define FIO_WRITE 4 /* File Write */ + +/* Lock Sharing Modes */ +#define FIO_NOSHARE 0 /* None */ +#define FIO_SHAREREAD 1 /* Read-Only */ + +typedef struct _FIOLOCKCMD16 { /* FLC FileLockCmd prefix */ + USHORT usCmd; /* Cmd = FIO_LOCK */ + USHORT cLockCnt; /* Lock records that follow */ + ULONG cTimeOut; /* in Msec */ +} FIOLOCKCMD16; +typedef FIOLOCKCMD16 FAR *PFIOLOCKCMD16; + + +typedef struct _FIOLOCKREC16 { /* FLR FileLockRecord */ + USHORT fShare; /* FIO_NOSHARE or FIO_SHAREREAD */ + ULONG cbStart; /* Starting offset for lock region */ + ULONG cbLength; /* Length of lock region */ +} FIOLOCKREC16; +typedef FIOLOCKREC16 FAR *PFIOLOCKREC16; + + +typedef struct _FIOUNLOCKCMD16 { /* FUC FileUnlockCmd prefix */ + USHORT usCmd; /* Cmd = FIO_UNLOCK */ + USHORT cUnlockCnt; /* Unlock records that follow */ +} FIOUNLOCKCMD16; +typedef FIOUNLOCKCMD16 FAR *PFIOUNLOCKCMD16; + + +typedef struct _FIOUNLOCKREC16 { /* FUR FileUnlockRecord */ + ULONG cbStart; /* Starting offset for unlock region */ + ULONG cbLength; /* Length of unlock region */ +} FIOUNLOCKREC16; +typedef FIOUNLOCKREC16 FAR *PFIOUNLOCKREC16; + + +typedef struct _FIOSEEKCMD16 { /* FSC Seek command structure */ + USHORT usCmd; /* Cmd = FIO_SEEK */ + USHORT fsMethod; /* One of&gml FPM_BEGINNING, FPM_CURRENT, */ + ///* or FPM_END */ + ULONG cbDistance; /* Byte offset for seek */ + ULONG cbNewPosition; /* Bytes from start of file after seek */ +} FIOSEEKCMD16; +typedef FIOSEEKCMD16 FAR *PFIOSEEKCMD16; + + +typedef struct _FIOREADWRITE16 { /* RWC Read&Write command structure */ + USHORT usCmd; /* Cmd = FIO_READ or FIO_WRITE */ + PVOID pbBuffer; /* Pointer to data buffer */ + USHORT cbBufferLen; /* Bytes in buffer or max size */ + USHORT cbActualLen; /* Bytes actually read/written */ +} FIOREADWRITE16; +typedef FIOREADWRITE16 FAR *PFIOREADWRITE16; + +/*** + * EA Info Levels & Find First/Next + * API's: DosFindFirst, DosQueryFileInfo, DosQueryPathInfo, DosSetFileInfo, + * DosSetPathInfo + */ + +/* File info levels : All listed API's */ +#define FIL_STANDARD 1 /* Info level 1, standard file info */ +#define FIL_QUERYEASIZE 2 /* Level 2, return Full EA size */ +#define FIL_QUERYEASFROMLIST 3 /* Level 3, return requested EA's */ +#define FIL_QUERYALLEAS 4 /* Level 4, return all EA's */ + +/* File info levels: Dos...PathInfo only */ +#define FIL_QUERYFULLNAME 5 /* Level 5, return fully qualified */ + /* name of file */ +#define FIL_NAMEISVALID 6 /* Level 6, check validity of */ + /* file/path name for this FSD */ + +/* DosFindNotifyFirst() */ +#define FNOTIL_STANDARD 1 /* Find-Notify Info level 1&gml Return */ + /* standard directory change info */ + +/* DosFsAttach() */ +/* Attact or detach */ +#define FSATTACH 0 /* Attach file server */ +#define FSDETACH 1 /* Detach file server */ +#define FS_SPOOLATTACH 2 /* Register a spooler device */ +#define FS_SPOOLDETACH 3 /* De-register a spooler device */ + +/* DosFsCtl() */ +/* Routing type */ +#define FSCTL_HANDLE 1 /* File Handle directs req routing */ +#define FSCTL_PATHNAME 2 /* Path Name directs req routing */ +#define FSCTL_FSDNAME 3 /* FSD Name directs req routing */ + +/* DosQueryFSAttach() */ +/* Information level types (defines method of query) */ +#define FSAIL_QUERYNAME 1 /* Return data for a Drive or Device */ +#define FSAIL_DEVNUMBER 2 /* Return data for Ordinal Device # */ +#define FSAIL_DRVNUMBER 3 /* Return data for Ordinal Drive # */ + +/* Item types (from data structure item "iType") */ +#define FSAT_CHARDEV 1 /* Resident character device */ +#define FSAT_PSEUDODEV 2 /* Pusedu-character device */ +#define FSAT_LOCALDRV 3 /* Local drive */ +#define FSAT_REMOTEDRV 4 /* Remote drive attached to FSD */ + +typedef struct _SPOOLATTACH { /* Data structure for spooler operations */ + USHORT hNmPipe; /* Named pipe handle */ + ULONG ulKey; /* Attached Key */ +} SPOOLATTACH; +typedef SPOOLATTACH FAR *PSPOOLATTACH; + + +/* + * File System Drive Information&gml DosQueryFSInfo DosSetFSInfo + */ + +/* FS Drive Info Levels */ +#define FSIL_ALLOC 1 /* Drive allocation info (Query only) */ +#define FSIL_VOLSER 2 /* Drive Volume/Serial information */ + +/* DosQueryFHType() */ +/* Handle classes (low 8 bits of Handle Type) */ +#define FHT_DISKFILE 0x0000 /* Disk file handle */ +#define FHT_CHRDEV 0x0001 /* Character device handle */ +#define FHT_PIPE 0x0002 /* Pipe handle */ + +/* Handle bits (high 8 bits of Handle Type) */ +#define FHB_DSKREMOTE 0x8000 /* Remote disk */ +#define FHB_CHRDEVREMOTE 0x8000 /* Remote character device */ +#define FHB_PIPEREMOTE 0x8000 /* Remote pipe */ + + +//typedef SHANDLE HFILE; /* hf */ +//typedef HFILE FAR *PHFILE; + + +/* File time and date types */ + +//typedef struct _FTIME { /* ftime */ +// USHORT twosecs : 5; +// USHORT minutes : 6; +// USHORT hours : 5; +//} FTIME; +//typedef FTIME FAR *PFTIME; + +//typedef struct _FDATE { /* fdate */ +// USHORT day : 5; +// USHORT month : 4; +// USHORT year : 7; +//} FDATE; +//typedef FDATE FAR *PFDATE; + +typedef struct _FILEFINDBUF { /* findbuf */ + FDATE fdateCreation; + FTIME ftimeCreation; + FDATE fdateLastAccess; + FTIME ftimeLastAccess; + FDATE fdateLastWrite; + FTIME ftimeLastWrite; + ULONG cbFile; + ULONG cbFileAlloc; + USHORT attrFile; + UCHAR cchName; + CHAR achName[CCHMAXPATHCOMP]; +} FILEFINDBUF; +typedef FILEFINDBUF FAR *PFILEFINDBUF; + +typedef struct _FILEFINDBUF2 { /* findbuf2 */ + FDATE fdateCreation; + FTIME ftimeCreation; + FDATE fdateLastAccess; + FTIME ftimeLastAccess; + FDATE fdateLastWrite; + FTIME ftimeLastWrite; + ULONG cbFile; + ULONG cbFileAlloc; + USHORT attrFile; + ULONG cbList; + UCHAR cchName; + CHAR achName[CCHMAXPATHCOMP]; +} FILEFINDBUF2; +typedef FILEFINDBUF2 FAR *PFILEFINDBUF2; + +/* extended attribute structures */ +typedef struct _GEA { /* gea */ + BYTE cbName; /* name length not including NULL */ + CHAR szName[1]; /* attribute name */ +} GEA; +typedef GEA FAR *PGEA; + +typedef struct _GEALIST { /* geal */ + ULONG cbList; /* total bytes of structure inc full list */ + GEA list[1]; /* variable length GEA structures */ +} GEALIST; +typedef GEALIST FAR * PGEALIST; + +typedef struct _FEA { /* fea */ + BYTE fEA; /* flags */ + BYTE cbName; /* name length not including NULL */ + USHORT cbValue; /* value length */ +} FEA; +typedef FEA FAR *PFEA; + +/* flags for _FEA.fEA */ + +#define FEA_NEEDEA 0x80 /* need EA bit */ + +typedef struct _FEALIST { /* feal */ + ULONG cbList; /* total bytes of structure inc full list */ + FEA list[1]; /* variable length FEA structures */ +} FEALIST; +typedef FEALIST FAR * PFEALIST; + +typedef struct _EAOP { /* eaop */ + PGEALIST fpGEAList; /* general EA list */ + PFEALIST fpFEAList; /* full EA list */ + ULONG oError; +} EAOP; +typedef EAOP FAR * PEAOP; + + +/* + * Equates for EA types + * + * Values 0xFFFE thru 0x8000 are reserved. + * Values 0x0000 thru 0x7fff are user definable. + * Value 0xFFFC is not used + */ + +#define EAT_BINARY 0xFFFE /* length preceeded binary */ +#define EAT_ASCII 0xFFFD /* length preceeded ASCII */ +#define EAT_BITMAP 0xFFFB /* length preceeded bitmap */ +#define EAT_METAFILE 0xFFFA /* length preceeded metafile */ +#define EAT_ICON 0xFFF9 /* length preceeded icon */ +#define EAT_EA 0xFFEE /* length preceeded ASCII extended attribute */ + /* name of associated data (#include)*/ +#define EAT_MVMT 0xFFDF /* multi-valued, multi-typed field */ +#define EAT_MVST 0xFFDE /* multi-valued, single-typed field */ +#define EAT_ASN1 0xFFDD /* ASN.1 field */ + + +typedef struct _FILESTATUS16 { /* fsts */ + FDATE fdateCreation; + FTIME ftimeCreation; + FDATE fdateLastAccess; + FTIME ftimeLastAccess; + FDATE fdateLastWrite; + FTIME ftimeLastWrite; + ULONG cbFile; + ULONG cbFileAlloc; + USHORT attrFile; +} FILESTATUS16; +typedef FILESTATUS16 FAR *PFILESTATUS16; + +typedef struct _FILESTATUS2_16 { /* fsts2 */ + FDATE fdateCreation; + FTIME ftimeCreation; + FDATE fdateLastAccess; + FTIME ftimeLastAccess; + FDATE fdateLastWrite; + FTIME ftimeLastWrite; + ULONG cbFile; + ULONG cbFileAlloc; + USHORT attrFile; + ULONG cbList; +} FILESTATUS2_16; +typedef FILESTATUS2_16 FAR *PFILESTATUS2_16; + +//typedef struct _FSALLOCATE { /* fsalloc */ +// ULONG idFileSystem; +// ULONG cSectorUnit; +// ULONG cUnit; +// ULONG cUnitAvail; +// USHORT cbSector; +//} FSALLOCATE; +//typedef FSALLOCATE FAR *PFSALLOCATE; + +//typedef struct _VOLUMELABEL { /* vol */ +// BYTE cch; +// CHAR szVolLabel[12]; +//} VOLUMELABEL; +//typedef VOLUMELABEL FAR *PVOLUMELABEL; + +//typedef struct _FSINFO { /* fsinf */ +// FDATE fdateCreation; +// FTIME ftimeCreation; +// VOLUMELABEL vol; +//} FSINFO; +//typedef FSINFO FAR *PFSINFO; + +/* HANDTYPE values */ + +#define HANDTYPE_FILE 0x0000 +#define HANDTYPE_DEVICE 0x0001 +#define HANDTYPE_PIPE 0x0002 +#define HANDTYPE_NETWORK 0x8000 + +//typedef struct _FILELOCK { /* flock */ +// LONG lOffset; +// LONG lRange; +//} FILELOCK; +//typedef FILELOCK FAR *PFILELOCK; + +//typedef SHANDLE HDIR; /* hdir */ +//typedef HDIR FAR *PHDIR; + +/* defines for dossetpathinfo -pathinfo flag */ +#define DSPI_WRTTHRU 0x10 /* write through */ + +typedef struct _DENA1_16 +{ /* _dena1 level 1 info returned from DosEnumAttribute */ + UCHAR reserved; /* 0 */ + UCHAR cbName; /* length of name exculding NULL */ + USHORT cbValue; /* length of value */ + UCHAR szName[1]; /* variable length asciiz name */ +} DENA1_16; +typedef DENA1_16 FAR *PDENA1_16; + +/* Infolevels for DosEnumAttribute */ +//#define ENUMEA_LEVEL_NO_VALUE 1L /* FEA without value */ +/* Reference types for DosEnumAttribute */ +#define ENUMEA_REFTYPE_FHANDLE 0 /* file handle */ +#define ENUMEA_REFTYPE_PATH 1 /* path name */ +#define ENUMEA_REFTYPE_MAX ENUMEA_REFTYPE_PATH + +#endif /* common INCL_DOSFILEMGR */ + +#if (defined(INCL_DOSMEMMGR) || !defined(INCL_NOCOMMON)) +/*** Memory management */ + +/* Segment attribute flags (used with DosAllocSeg) */ + +#define SEG_NONSHARED 0x0000 +#define SEG_GIVEABLE 0x0001 +#define SEG_GETTABLE 0x0002 +#define SEG_DISCARDABLE 0x0004 +#define SEG_SIZEABLE 0x0008 + +#endif /* common INCL_DOSMEMMGR */ + +#if (defined(INCL_DOSSEMAPHORES) || !defined(INCL_NOCOMMON)) + +/*** Semaphore support */ + +#define SEM_INDEFINITE_WAIT -1L +#define SEM_IMMEDIATE_RETURN 0L + +#endif /* common INCL_DOSSEMAPHORES */ + +#ifdef INCL_DOSSEMAPHORES + +typedef LHANDLE HSYSSEM; /* hssm */ +typedef HSYSSEM FAR *PHSYSSEM; + +#define CSEM_PRIVATE 0 +#define CSEM_PUBLIC 1 + +typedef struct _MUXSEM { /* mxs */ + USHORT zero; + HSEM hsem; +} MUXSEM; +typedef MUXSEM FAR *PMUXSEM; + +typedef struct _MUXSEMLIST { /* mxsl */ + USHORT cmxs; + MUXSEM amxs[16]; +} MUXSEMLIST; +typedef MUXSEMLIST FAR *PMUXSEMLIST; + +/* + * Since a MUXSEMLIST structure is actually a variable length + * structure, the following macro may be used to define a MUXSEMLIST + * structure having size elements, named "name". + */ +#define DEFINEMUXSEMLIST(name, size) \ + struct { \ + USHORT cmxs; \ + MUXSEM amxs[size]; \ + } name; + + +/*** Fast safe ram semaphores */ + +typedef struct _DOSFSRSEM { /* dosfsrs */ + USHORT cb; + USHORT pid; + USHORT tid; + USHORT cUsage; + USHORT client; + ULONG sem; +} DOSFSRSEM; +typedef DOSFSRSEM FAR *PDOSFSRSEM; + + +#endif /* INCL_DOSSEMAPHORES */ + + +/*** Module manager */ + +#ifdef INCL_DOSMODULEMGR + +#define PT_16BIT 0L +#define PT_32BIT 1L + +#endif /* INCL_DOSMODULEMGR */ + +#if (defined(INCL_DOSRESOURCES) || !defined(INCL_NOCOMMON)) + +/*** Resource support */ + +/* Predefined resource types */ + +#define RT_POINTER 1 /* mouse pointer shape */ +#define RT_BITMAP 2 /* bitmap */ +#define RT_MENU 3 /* menu template */ +#define RT_DIALOG 4 /* dialog template */ +#define RT_STRING 5 /* string tables */ +#define RT_FONTDIR 6 /* font directory */ +#define RT_FONT 7 /* font */ +#define RT_ACCELTABLE 8 /* accelerator tables */ +#define RT_RCDATA 9 /* binary data */ +#define RT_MESSAGE 10 /* error mesage tables */ +#define RT_DLGINCLUDE 11 /* dialog include file name */ +#define RT_VKEYTBL 12 /* key to vkey tables */ +#define RT_KEYTBL 13 /* key to UGL tables */ +#define RT_CHARTBL 14 +#define RT_DISPLAYINFO 15 /* screen display information */ + +#define RT_FKASHORT 16 /* function key area short form */ +#define RT_FKALONG 17 /* function key area long form */ + +#define RT_HELPTABLE 18 /* Help table for Cary Help manager */ +#define RT_HELPSUBTABLE 19 /* Help subtable for Cary Help manager */ + +#define RT_FDDIR 20 /* DBCS uniq/font driver directory */ +#define RT_FD 21 /* DBCS uniq/font driver */ + +#define RT_MAX 22 /* 1st unused Resource Type */ + + +#endif /* common INCL_DOSRESOURCES */ + + +/*** Signal support */ + +#ifdef INCL_DOSSIGNALS + +/* Signal Numbers for DosSetSigHandler */ + +#define SIG_CTRLC 1 /* Control C */ +#define SIG_BROKENPIPE 2 /* Broken Pipe */ +#define SIG_KILLPROCESS 3 /* Program Termination */ +#define SIG_CTRLBREAK 4 /* Control Break */ +#define SIG_PFLG_A 5 /* Process Flag A */ +#define SIG_PFLG_B 6 /* Process Flag B */ +#define SIG_PFLG_C 7 /* Process Flag C */ +#define SIG_CSIGNALS 8 /* number of signals plus one */ + +/* Flag Numbers for DosFlagProcess */ + +#define PFLG_A 0 /* Process Flag A */ +#define PFLG_B 1 /* Process Flag B */ +#define PFLG_C 2 /* Process Flag C */ + +/* Signal actions */ + +#define SIGA_KILL 0 +#define SIGA_IGNORE 1 +#define SIGA_ACCEPT 2 +#define SIGA_ERROR 3 +#define SIGA_ACKNOWLEDGE 4 + +/* DosHoldSignal constants */ + +#define HLDSIG_ENABLE 0 +#define HLDSIG_DISABLE 1 + +/* DosFlagProcess codes */ + +#define FLGP_SUBTREE 0 +#define FLGP_PID 1 + +typedef VOID (PASCAL FAR *PFNSIGHANDLER)(USHORT, USHORT); + +#endif /* INCL_DOSSIGNALS */ + + +/*** Monitor support */ + +#ifdef INCL_DOSMONITORS + +typedef SHANDLE HMONITOR; /* hmon */ +typedef HMONITOR FAR *PHMONITOR; + +#endif /* INCL_DOSMONITORS */ + + +/*** Pipe and queue support */ + +#ifdef INCL_DOSQUEUES +#if (defined(INCL_DOSFILEMGR) || !defined(INCL_NOCOMMON)) + +#else /* INCL_DOSFILEMGR || !INCL_NOCOMMON */ +#error PHFILE not defined - define INCL_DOSFILEMGR or undefine INCL_NOCOMMON +#endif /* INCL_DOSFILEMGR || !INCL_NOCOMMON */ +#endif /* INCL_DOSQUEUES */ + +#ifdef INCL_DOSMISC + +/* definitions for DOSSEARCHPATH control word */ +#define DSP_IMPLIEDCUR 1 /* current dir will be searched first */ +#define DSP_PATHREF 2 /* from envirnoment variable */ +#define DSP_IGNORENETERR 4 /* ignore net errs & continue search */ + +/* definition for DOSQSYSINFO */ +#define Q_MAX_PATH_LENGTH (0) /* index for query max path length */ + +/* definitions for DosError - combine with | */ +#define FERR_DISABLEHARDERR 0x00000000L /* disable hard error popups */ +#define FERR_ENABLEHARDERR 0x00000001L /* enable hard error popups */ +#define FERR_ENABLEEXCEPTION 0x00000000L /* enable exception popups */ +#define FERR_DISABLEEXCEPTION 0x00000002L /* disable exception popups */ + +#endif /* INCL_DOSMISC */ + + +/*** Session manager support */ + +#ifdef INCL_DOSSESMGR + +#define SSF_RELATED_INDEPENDENT 0 +#define SSF_RELATED_CHILD 1 + +#define SSF_FGBG_FORE 0 +#define SSF_FGBG_BACK 1 + +#define SSF_TRACEOPT_NONE 0 +#define SSF_TRACEOPT_TRACE 1 +#define SSF_TRACEOPT_TRACEALL 2 + +#define SSF_INHERTOPT_SHELL 0 +#define SSF_INHERTOPT_PARENT 1 + +/* note that these types are identical to those in pmshl.h for PROG_* */ +#define SSF_TYPE_DEFAULT 0 +#define SSF_TYPE_FULLSCREEN 1 +#define SSF_TYPE_WINDOWABLEVIO 2 +#define SSF_TYPE_PM 3 +#define SSF_TYPE_VDM 4 +#define SSF_TYPE_GROUP 5 +#define SSF_TYPE_DLL 6 +#define SSF_TYPE_WINDOWEDVDM 7 +#define SSF_TYPE_PDD 8 +#define SSF_TYPE_VDD 9 + +/* note that these flags are identical to those in pmshl.h for SHE_* */ +#define SSF_CONTROL_VISIBLE 0x0000 +#define SSF_CONTROL_INVISIBLE 0x0001 +#define SSF_CONTROL_MAXIMIZE 0x0002 +#define SSF_CONTROL_MINIMIZE 0x0004 +#define SSF_CONTROL_NOAUTOCLOSE 0x0008 +#define SSF_CONTROL_SETPOS 0x8000 + +typedef struct _REGISTERDATA { /* regdata */ + USHORT Length; + USHORT NotifType; + PSZ DDName; +} REGISTERDATA; +typedef REGISTERDATA FAR *PREGISTERDATA; + +#endif /* INCL_DOSSESMGR */ + +#if (defined(INCL_DOSSESMGR) || defined(INCL_DOSFILEMGR)) + +/* AppType returned in by DosQueryAppType in pFlags as follows */ +#define FAPPTYP_NOTSPEC 0x0000 +#define FAPPTYP_NOTWINDOWCOMPAT 0x0001 +#define FAPPTYP_WINDOWCOMPAT 0x0002 +#define FAPPTYP_WINDOWAPI 0x0003 +#define FAPPTYP_BOUND 0x0008 +#define FAPPTYP_DLL 0x0010 +#define FAPPTYP_DOS 0x0020 +#define FAPPTYP_PHYSDRV 0x0040 /* physical device driver */ +#define FAPPTYP_VIRTDRV 0x0080 /* virtual device driver */ +#define FAPPTYP_PROTDLL 0x0100 /* 'protected memory' dll */ +#define FAPPTYP_32BIT 0x4000 +#define FAPPTYP_EXETYPE FAPPTYP_WINDOWAPI + +#define FAPPTYP_RESERVED ~(FAPPTYP_WINDOWAPI | FAPPTYP_BOUND | FAPPTYP_DLL | FAPPTYP_DOS | FAPPTYP_PHYSDRV | FAPPTYP_VIRTDRV | FAPPTYP_PROTDLL | FAPPTYP_32BIT) + +#ifdef INCL_DOSFILEMGR + +#define EAT_APPTYP_PMAPI 0x00 /* Uses PM API */ +#define EAT_APPTYP_DOS 0x01 /* DOS APP */ +#define EAT_APPTYP_PMW 0x02 /* Window compatible */ +#define EAT_APPTYP_NOPMW 0x03 /* Not Window compatible */ +#define EAT_APPTYP_EXETYPE 0x03 /* EXE type mask */ +#define EAT_APPTYP_RESERVED ~(EAT_APPTYP_EXETYPE) + +#endif /* INCL_DOSFILEMGR */ + +#endif /* INCL_DOSSESMGR || INCL_DOSFILEMGR */ + +/*** Device support */ + +#ifdef INCL_DOSDEVICES + +#define DEVINFO_PRINTER 0 /* Number of printers attached */ +#define DEVINFO_RS232 1 /* Number of RS232 ports */ +#define DEVINFO_FLOPPY 2 /* Number of diskette drives */ +#define DEVINFO_COPROCESSOR 3 /* Presence of math coprocessor */ +#define DEVINFO_SUBMODEL 4 /* PC Submodel Type */ +#define DEVINFO_MODEL 5 /* PC Model Type */ +#define DEVINFO_ADAPTER 6 /* Primary display adapter type */ +#define DEVINFO_COPROCESSORTYPE 7 /* Type of coprocessor functionality */ + +#define INFO_COUNT_PARTITIONABLE_DISKS 1 /* # of partitionable disks */ +#define INFO_GETIOCTLHANDLE 2 /* Obtain handle */ +#define INFO_FREEIOCTLHANDLE 3 /* Release handle */ + + +#endif /* INCL_DOSDEVICES */ + + +/*** DosNamedPipes API Support */ + +#ifdef INCL_DOSNMPIPES + +typedef struct _AVAILDATA { /* AVAILDATA */ + USHORT cbpipe; /* bytes left in the pipe */ + USHORT cbmessage; /* bytes left in current message */ +} AVAILDATA; +typedef AVAILDATA FAR *PAVAILDATA; + +typedef struct _PIPEINFO { /* nmpinf */ + USHORT cbOut; /* length of outgoing I/O buffer */ + USHORT cbIn; /* length of incoming I/O buffer */ + BYTE cbMaxInst; /* maximum number of instances */ + BYTE cbCurInst; /* current number of instances */ + BYTE cbName; /* length of pipe name */ + CHAR szName[1]; /* start of name */ +} PIPEINFO; +typedef PIPEINFO FAR *PPIPEINFO; + +typedef struct _PIPESEMSTATE { /* nmpsmst */ + BYTE fStatus; /* type of record, 0 = EOI, 1 = read ok, */ + /* 2 = write ok, 3 = pipe closed */ + BYTE fFlag; /* additional info, 01 = waiting thread */ + USHORT usKey; /* user's key value */ + USHORT usAvail; /* available data/space if status = 1/2 */ +} PIPESEMSTATE; +typedef PIPESEMSTATE FAR *PPIPESEMSTATE; + +#define NP_INDEFINITE_WAIT -1 +#define NP_DEFAULT_WAIT 0L + +/* DosPeekNmPipe() pipe states */ + +#define NP_STATE_DISCONNECTED 0x0001 +#define NP_STATE_LISTENING 0x0002 +#define NP_STATE_CONNECTED 0x0003 +#define NP_STATE_CLOSING 0x0004 + +/* DosCreateNPipe open modes */ + +#define NP_ACCESS_INBOUND 0x0000 +#define NP_ACCESS_OUTBOUND 0x0001 +#define NP_ACCESS_DUPLEX 0x0002 +#define NP_INHERIT 0x0000 +#define NP_NOINHERIT 0x0080 +#define NP_WRITEBEHIND 0x0000 +#define NP_NOWRITEBEHIND 0x4000 + +/* DosCreateNPipe and DosQueryNPHState state */ + +#define NP_READMODE_BYTE 0x0000 +#define NP_READMODE_MESSAGE 0x0100 +#define NP_TYPE_BYTE 0x0000 +#define NP_TYPE_MESSAGE 0x0400 +#define NP_END_CLIENT 0x0000 +#define NP_END_SERVER 0x4000 +#define NP_WAIT 0x0000 +#define NP_NOWAIT 0x8000 +#define NP_UNLIMITED_INSTANCES 0x00FF + + +/* values in npss_status */ +#define NPSS_EOI 0 /* End Of Information */ +#define NPSS_RDATA 1 /* read data available */ +#define NPSS_WSPACE 2 /* write space available */ +#define NPSS_CLOSE 3 /* pipe in CLOSING state */ + +/* values in npss_flag */ +#define NPSS_WAIT 0x01 /* waiting thread on end of pipe */ + +/* defined bits in pipe mode */ +#define NP_NBLK 0x8000 /* non-blocking read/write */ +#define NP_SERVER 0x4000 /* set if server end */ +#define NP_WMESG 0x0400 /* write messages */ +#define NP_RMESG 0x0100 /* read as messages */ +#define NP_ICOUNT 0x00FF /* instance count field */ + + +/* Named pipes may be in one of several states depending on the actions + * that have been taken on it by the server end and client end. The + * following state/action table summarizes the valid state transitions: + * + * Current state Action Next state + * + * <none> server DosMakeNmPipe DISCONNECTED + * DISCONNECTED server connect LISTENING + * LISTENING client open CONNECTED + * CONNECTED server disconn DISCONNECTED + * CONNECTED client close CLOSING + * CLOSING server disconn DISCONNECTED + * CONNECTED server close CLOSING + * <any other> server close <pipe deallocated> + * + * If a server disconnects his end of the pipe, the client end will enter a + * special state in which any future operations (except close) on the file + * descriptor associated with the pipe will return an error. + */ + +/* + * Values for named pipe state + */ + +#define NP_DISCONNECTED 1 /* after pipe creation or Disconnect */ +#define NP_LISTENING 2 /* after DosNmPipeConnect */ +#define NP_CONNECTED 3 /* after Client open */ +#define NP_CLOSING 4 /* after Client or Server close */ + + +#endif /* INCL_DOSNMPIPES */ + + +/*** DosProfile API support */ + +#ifdef INCL_DOSPROFILE + +/* DosProfile ordinal number */ + +#define PROF_ORDINAL 133 + +/* DosProfile usType */ + +#define PROF_SYSTEM 0 +#define PROF_USER 1 +#define PROF_USEDD 2 +#define PROF_KERNEL 4 +#define PROF_VERBOSE 8 +#define PROF_ENABLE 16 + +/* DosProfile usFunc */ + +#define PROF_ALLOC 0 +#define PROF_CLEAR 1 +#define PROF_ON 2 +#define PROF_OFF 3 +#define PROF_DUMP 4 +#define PROF_FREE 5 + +/* DosProfile tic count granularity (DWORD) */ + +#define PROF_SHIFT 2 + +/* DosProfile module name string length */ + +#define PROF_MOD_NAME_SIZE 10 + +/* DosProfile error code for end of data */ + +#define PROF_END_OF_DATA 13 + +#endif /* INCL_DOSPROFILE */ + + +/*** Virtual DOS Machine API support */ + +#ifdef INCL_DOSMVDM + +typedef LHANDLE HVDD; /* hvdd */ +typedef HVDD FAR *PHVDD; /* phvdd */ + +#endif /* INCL_DOSMVDM */ + +#pragma pack() + diff --git a/private/os2/inc/os2v20.h b/private/os2/inc/os2v20.h new file mode 100644 index 000000000..d7502db71 --- /dev/null +++ b/private/os2/inc/os2v20.h @@ -0,0 +1,2582 @@ +/*++ + +Copyright (c) 1989 Microsoft Corporation + +Module Name: + + os2v20.h + +Abstract: + + This file contains the OS/2 V2.0 API calls exported by the OS/2 Subsystem + +Author: + + Steve Wood (stevewo) 19-Sep-1989 + +Parameters: + + This header file uses the following symbols names to control how much + of the header file is include. They are: + + INCL_OS2V20_TASKING + INCL_OS2V20_FILESYS + INCL_OS2V20_FSD + INCL_OS2V20_MEMORY + INCL_OS2V20_SEMAPHORES + INCL_OS2V20_TIMERS + INCL_OS2V20_LOADER + INCL_OS2V20_NLS + INCL_OS2V20_EXCEPTIONS + INCL_OS2V20_ERRORMSG + INCL_OS2V20_SESSIONMGR + INCL_OS2V20_DEVICE_SUPPORT + INCL_OS2V20_PIPES + INCL_OS2V20_QUEUES + INCL_OS2V20_ERRORS + +Revision History: + +--*/ + +#ifndef _NTDEF__ +#include <nt.h> +#endif // _NTDEF_ + +#ifdef FILE_CREATED +#undef FILE_CREATED // Fortunately NT and OS/2 2.0 both use 0x2 for this +#endif // FILE_CREATED + +#ifdef INCL_OS2V20_ALL +#define INCL_OS2V20_TASKING +#define INCL_OS2V20_FILESYS +#define INCL_OS2V20_FSD +#define INCL_OS2V20_MEMORY +#define INCL_OS2V20_SEMAPHORES +#define INCL_OS2V20_TIMERS +#define INCL_OS2V20_LOADER +#define INCL_OS2V20_NLS +#define INCL_OS2V20_EXCEPTIONS +#define INCL_OS2V20_ERRORMSG +#define INCL_OS2V20_SESSIONMGR +#define INCL_OS2V20_DEVICE_SUPPORT +#define INCL_OS2V20_PIPES +#define INCL_OS2V20_QUEUES +#define INCL_OS2V20_ERRORS +#endif // INCL_OS2V20_ALL + +#define APIRET ULONG +typedef APIRET *PAPIRET; + +typedef HANDLE HMODULE, *PHMODULE; +typedef HANDLE PID, *PPID; +typedef HANDLE TID, *PTID; +typedef HANDLE HFILE, *PHFILE; +typedef HANDLE HDIR, *PHDIR; +typedef HANDLE HTIMER, *PHTIMER; +typedef HANDLE HQUEUE, *PHQUEUE; +typedef HANDLE HPIPE, *PHPIPE; +typedef HANDLE HSEM, *PHSEM; +typedef HANDLE HMTX, *PHMTX; +typedef HANDLE HEV, *PHEV; +typedef HANDLE HMUX, *PHMUX; + +typedef UCHAR BYTE, *PBYTE; + +typedef ULONG BOOL32, *PBOOL32; + +typedef int (*PFN)(); + +/* Tasking API Calls */ + +/* Process Information Block */ + + +typedef struct _PIB { + /* Warning: when adding fields here (which are updated by the server), + add them to sesport.h in SCREQ_CREATE */ + PID ProcessId; /* Process I.D. */ + PID ParentProcessId; /* Parent process I.D. */ + HMODULE ImageFileHandle; /* Program (.EXE) module handle */ + PCHAR CommandLine; /* Command line pointer */ + PCHAR Environment; /* Environment pointer */ + ULONG Status; /* Process Status */ + ULONG Type; /* Process Type */ + ULONG Killed; /* True if Process was killed */ + ULONG SyncOwner; /* Thread Id of the thread owner SyncSem */ + ULONG Saved32Esp; /* Last top of stack in 32bit */ + BOOLEAN SigHandInProgress; /* Signal handler in progress */ + BOOLEAN SignalWasntDelivered; /* The signal wasn't delivered, yet */ +} PIB, *PPIB; + +/* Process Type codes (Type field) */ + +#define PT_FULLSCREEN 0 /* Full screen app. */ +#define PT_REALMODE 1 /* Real mode process */ +#define PT_WINDOWABLEVIO 2 /* VIO windowable app. */ +#define PT_PM 3 /* Presentation Manager app. */ +#define PT_DETACHED 4 /* Detached app. */ + +/* Process Status Flag definitions (Status field) */ + +#define PS_EXITLIST 1 /* Thread is in exitlist routine */ + +typedef APIRET (*PFNPROCESS)( PPEB Peb ); + +#pragma pack(1) +typedef struct _LOCALINFOSEG { /* lis */ + USHORT pidCurrent; + USHORT pidParent; + USHORT prtyCurrent; + USHORT tidCurrent; + USHORT sgCurrent; + UCHAR rfProcStatus; + UCHAR dummy1; + USHORT fForeground; + UCHAR typeProcess; + UCHAR dummy2; + USHORT selEnvironment; + USHORT offCmdLine; + USHORT cbDataSegment; + USHORT cbStack; + USHORT cbHeap; + USHORT hmod; + USHORT selDS; +// UCHAR dummy3; + USHORT dummy5; + ULONG tebptr; + ULONG IsRealTEB; // in 16 bit this will always be zero. in 32bit will always be non-zero (ClientId) +} LOCALINFOSEG; + +#pragma pack() + +typedef struct _OS2_TIB { + /* Warning: when adding fields here (which are updated by the server), + add them to sesport.h in SCREQ_CREATE */ + ULONG ThreadId; /* OS/2 ID for the thread */ + ULONG Priority; /* Thread priority */ + ULONG Version; /* Version number for this structure */ + USHORT MustCompleteCount; + USHORT MustCompleteForceFlag; /* Used by DosSuspend(Resume)Thread and + * DosEnter(Exit)CritSec APIs. See possible values below + */ + LOCALINFOSEG LInfoSeg; + /* WARNING: The following filed must follow immediately the previous one */ + /* Refer to client\i386\dllthunk\MoveInfoSegintoTeb and RestoreTeb */ + LOCALINFOSEG TebBackupIn16Bit; /* This field holds the TEB info when app runs in */ + /* 16 bits (LOCALINFOSEG type is for the size only) */ +} OS2_TIB, *POS2_TIB; +// +// The bits of MustCompleteForceFlag in TIB: +// +#define MCF_SUSPENDED 1 // Was suspended by DosSuspendThread +#define MCF_IN32BIT 2 // The thread is in 32 bit context (between 16->32 and + // 32->16 thunks) +#define MCF_FROZEN 4 +#define MCF_SUSPENDED_AND_FROZEN 8 + +typedef APIRET (*PFNTHREAD)( ULONG Parameter ); + +typedef VOID (*PFNEXITLIST)( ULONG ExitReason ); + +typedef struct _RESULTCODES { + ULONG ExitReason; + ULONG ExitResult; +} RESULTCODES, *PRESULTCODES; + +typedef struct _FTIME { + USHORT twosecs : 5; + USHORT minutes : 6; + USHORT hours : 5; +} FTIME, *PFTIME; + +typedef struct _FDATE { + USHORT day : 5; + USHORT month : 4; + USHORT year : 7; +} FDATE, *PFDATE; + +typedef struct _FDATETIME { + FDATE date; + FTIME time; +} FDATETIME, *PFDATETIME; + +typedef struct _FILESTATUS { + FDATE fdateCreation; + FTIME ftimeCreation; + FDATE fdateLastAccess; + FTIME ftimeLastAccess; + FDATE fdateLastWrite; + FTIME ftimeLastWrite; + ULONG cbFile; + ULONG cbFileAlloc; + ULONG attrFile; +} FILESTATUS, *PFILESTATUS; + +typedef struct _FILESTATUS2 { + FDATE fdateCreation; + FTIME ftimeCreation; + FDATE fdateLastAccess; + FTIME ftimeLastAccess; + FDATE fdateLastWrite; + FTIME ftimeLastWrite; + ULONG cbFile; + ULONG cbFileAlloc; + ULONG attrFile; + ULONG cbList; +} FILESTATUS2, *PFILESTATUS2; + +/* + * CCHMAXPATH is the maximum fully qualified path name length including + * the drive letter, colon, backslashes and terminating NULL. + */ +#define CCHMAXPATH 260 + +/* + * CCHMAXPATH is the maximum fully qualified path name length including + * the drive letter, colon, backslashes and terminating NULL. + */ +#define CCHMAXCOMP 255 + +/* + * CCHMAXPATHCOMP is the maximum individual path component name length + * including a terminating NULL. + */ +#define CCHMAXPATHCOMP 256 + +typedef struct _FILEFINDBUF3 { + ULONG oNextEntryOffset; + FDATE fdateCreation; + FTIME ftimeCreation; + FDATE fdateLastAccess; + FTIME ftimeLastAccess; + FDATE fdateLastWrite; + FTIME ftimeLastWrite; + ULONG cbFile; + ULONG cbFileAlloc; + ULONG attrFile; + UCHAR cchName; + CHAR achName[CCHMAXPATHCOMP]; +} FILEFINDBUF3, *PFILEFINDBUF3; + +typedef struct _FILEFINDBUF4 { + ULONG oNextEntryOffset; + FDATE fdateCreation; + FTIME ftimeCreation; + FDATE fdateLastAccess; + FTIME ftimeLastAccess; + FDATE fdateLastWrite; + FTIME ftimeLastWrite; + ULONG cbFile; + ULONG cbFileAlloc; + ULONG attrFile; + ULONG cbList; + UCHAR cchName; + CHAR achName[CCHMAXPATHCOMP]; +} FILEFINDBUF4, *PFILEFINDBUF4; + +/* extended attribute structures */ + +typedef struct _GEA2 { + ULONG oNextEntryOffset; /* offset to next GEA */ + BYTE cbName; /* name length not including NULL */ + CHAR szName[1]; /* attribute name */ +} GEA2, *PGEA2; + +typedef struct _GEA2LIST { + ULONG cbList; /* total bytes of structure including full list */ + GEA2 list[1]; /* variable length GEA structures */ +} GEA2LIST, *PGEA2LIST; + +typedef struct _FEA2 { + ULONG oNextEntryOffset; /* offset to next FEA */ + BYTE fEA; /* flags */ + BYTE cbName; /* name length not including NULL */ + USHORT cbValue; /* value length */ + CHAR szName[1]; /* attribute name */ +} FEA2, *PFEA2; + +/* flags for _FEA.fEA */ + +#define FEA_NEEDEA 0x80 /* need EA bit */ + +typedef struct _FEA2LIST { + ULONG cbList; /* total bytes of structure including full list */ + FEA2 list[1]; /* variable length FEA structures */ +} FEA2LIST, *PFEA2LIST; + +typedef struct _EAOP2 { + PGEA2LIST fpGEA2List; /* general EA list */ + PFEA2LIST fpFEA2List; /* full EA list */ + ULONG oError; +} EAOP2, *PEAOP2; + +#define ULONG_MASK ~3 +#define RoundUpToUlong(number) ((number+(sizeof(ULONG)-1)) & ULONG_MASK) + +/* + * The following macros can be used to calculate the size of the current FEA + * and the offset of the next FEA + * + */ + +#define FEA_sizeof(fea) (sizeof(FEA2)+(fea).cbName+1+(fea).cbValue) +#define FEA_oNextEntryOffset(fea) (RoundUpToUlong(FEA_sizeof(fea)) + +/* + * The following macros can be used to access the fea_szName and + * fea_aValue fields in a given FEA. + * + */ + +#define FEA_szNameFromFEA(fea) (((PCHAR)&(fea))+sizeof(FEA2)) +#define FEA_AValueFromFEA(fea) (((PCHAR)&(fea))+sizeof(FEA2)+(fea).cbName+1) + +typedef struct _FILELOCK { + LONG lOffset; + LONG lRange; +} FILELOCK, *PFILELOCK; + +typedef struct _FSQBUFFER { + USHORT iType; /* Item type */ + USHORT cbName; /* Length of item name, sans NULL */ + UCHAR szName[1]; /* ASCIIZ item name */ + USHORT cbFSDName; /* Length of FSD name, sans NULL */ + UCHAR szFSDName[1]; /* ASCIIZ FSD name */ + USHORT cbFSAData; /* Length of FSD Attach data returned */ + UCHAR rgFSAData[1]; /* FSD Attach data from FSD */ +} FSQBUFFER, *PFSQBUFFER; + +typedef struct _PSEMRECORD { + HSEM hsemCur; + ULONG ulUser; +} SEMRECORD, *PSEMRECORD; + +#define DC_SEM_NAMEPREFIX "\\SEM32\\" + +#define DCMW_MAX_SEMRECORDS 64 /* DosCreateMuxWait limit on the */ + /* CountMuxWaitEntries parameter */ + + +typedef struct _DATETIME { + UCHAR hours; + UCHAR minutes; + UCHAR seconds; + UCHAR hundredths; + UCHAR day; + UCHAR month; + USHORT year; + SHORT timezone; + UCHAR weekday; +} DATETIME, *PDATETIME; + +typedef struct _STARTDATA { + USHORT Length; + USHORT Related; + USHORT FgBg; + USHORT TraceOpt; + PSZ PgmTitle; + PSZ PgmName; + PBYTE PgmInputs; + PBYTE TermQ; + PBYTE Environment; + USHORT InheritOpt; + USHORT SessionType; + PSZ IconFile; + ULONG PgmHandle; + USHORT PgmControl; + USHORT InitXPos; + USHORT InitYPos; + USHORT InitXSize; + USHORT InitYSize; + USHORT Reserved; + PSZ ObjectBuffer; + ULONG ObjectBuffLen; +} STARTDATA, *PSTARTDATA; + +#define SSF_RELATED_INDEPENDENT 0 +#define SSF_RELATED_CHILD 1 + +#define SSF_FGBG_FORE 0 +#define SSF_FGBG_BACK 1 + +#define SSF_TRACEOPT_NONE 0 +#define SSF_TRACEOPT_TRACE 1 +#define SSF_TRACEOPT_TRACEALL 2 + +#define SSF_INHERTOPT_SHELL 0 +#define SSF_INHERTOPT_PARENT 1 + +/* note that these types are identical to those in pmshl.h for PROG_* */ +#define SSF_TYPE_DEFAULT 0 +#define SSF_TYPE_FULLSCREEN 1 +#define SSF_TYPE_WINDOWABLEVIO 2 +#define SSF_TYPE_PM 3 +#define SSF_TYPE_VDM 4 +#define SSF_TYPE_GROUP 5 +#define SSF_TYPE_DLL 6 +#define SSF_TYPE_WINDOWEDVDM 7 +#define SSF_TYPE_PDD 8 +#define SSF_TYPE_VDD 9 + +/* note that these flags are identical to those in pmshl.h for SHE_* */ +#define SSF_CONTROL_VISIBLE 0x0000 +#define SSF_CONTROL_INVISIBLE 0x0001 +#define SSF_CONTROL_MAXIMIZE 0x0002 +#define SSF_CONTROL_MINIMIZE 0x0004 +#define SSF_CONTROL_NOAUTOCLOSE 0x0008 +#define SSF_CONTROL_SETPOS 0x8000 + +#pragma pack(1) +typedef struct _STATUSDATA { + USHORT Length; + USHORT SelectInd; + USHORT BondInd; +} STATUSDATA, *PSTATUSDATA; +#pragma pack() + +/* STATUSDATA.SelectInd constants */ + +#define TARGET_UNCHANGED 0x0000 +#define TARGET_SELECTABLE 0x0001 +#define TARGET_NOT_SELECTABLE 0x0002 + +/* STATUSDATA.BondInd constants */ + +#define BOND_UNCHANGED 0x0000 +#define BOND_CHILD 0x0001 +#define BOND_NONE 0x0002 + +typedef struct _REQUESTDATA { + PID SenderProcessId; + ULONG SenderData; +} REQUESTDATA, *PREQUESTDATA; + +#ifdef INCL_OS2V20_TASKING + +APIRET +DosCreateThread( + OUT PTID ThreadId, + IN PFNTHREAD StartAddress, + IN ULONG Parameter, + IN ULONG Flags, + IN ULONG StackSize + ); + +/* Flags parameter values */ + +#define DCT_RUNABLE 0 // Create thread in a runable state + // allocate low thread ID (1,2,..n) +#define DCT_SUSPENDED 1 // Create thread in a suspened state +#ifdef PMNT +#define DCT_RUNABLE_HIDDEN 2 // Create thread in a runable state and +#endif // allocate high thread ID (53, 52..) + +#define DCT_ATTACHED 4 // Created from Win32 thread + +APIRET +DosResumeThread( + IN TID ThreadId + ); + +APIRET +DosSuspendThread( + IN TID ThreadId + ); + +APIRET +DosGetThreadInfo( + OUT PNT_TIB *ThreadInfo, + OUT PPIB *ProcessInfo + ); + +APIRET +DosGetProcessInfo( + OUT PPIB *ProcessInfo + ); + +VOID +DosExit( + IN ULONG ExitAction, + IN ULONG ExitResult + ); + +#define EXIT_THREAD 0 +#define EXIT_PROCESS 1 + +/* ExitReason values (also passed to ExitList routines) */ + +#define TC_EXIT 0 +#define TC_HARDERROR 1 +#define TC_TRAP 2 +#define TC_KILLPROCESS 3 + +/* Wait target values */ + +#define DCWA_PROCESS 0 +#define DCWA_PROCESSTREE 1 + +/* Wait option values */ + +#define DCWW_WAIT 0 +#define DCWW_NOWAIT 1 + +APIRET +DosWaitChild( + IN ULONG WaitTarget, + IN ULONG WaitOption, + OUT PRESULTCODES ResultCodes, + OUT PPID ResultProcessId, + IN PID ProcessId + ); + +APIRET +DosWaitThread( + IN OUT PTID ThreadId, + IN ULONG WaitOption + ); + +APIRET +DosEnterCritSec( VOID ); + +APIRET +DosExitCritSec( VOID ); + +APIRET +DosSleep( + IN ULONG MilliSeconds + ); + +APIRET +DosExecPgm( + OUT PSZ ErrorText, + IN LONG ErrorTextMaximumLength, + IN ULONG Flags, + IN PSZ Arguments OPTIONAL, + IN PSZ Variables OPTIONAL, + OUT PRESULTCODES ResultCodes, + IN PSZ ImageFileName + ); + +/* DosExecPgm Flags parameter values */ + +#define EXEC_SYNC 0 +#define EXEC_ASYNC 1 +#define EXEC_ASYNCRESULT 2 +#define EXEC_TRACE 3 +#define EXEC_BACKGROUND 4 +#define EXEC_FROZEN 5 +#define EXEC_TRACETREE 6 + +APIRET +Od2ExitList( + ULONG OrderCode, + PFNEXITLIST ExitRoutine, + BOOLEAN flag + ); + +APIRET +DosExitList( + ULONG OrderCode, + PFNEXITLIST ExitRoutine + ); + +APIRET +Dos16ExitList( + ULONG OrderCode, + PFNEXITLIST ExitRoutine + ); + +/* DosExitList functions */ + +#define EXLST_ADD 1 +#define EXLST_REMOVE 2 +#define EXLST_EXIT 3 + +APIRET +DosKillProcess( + IN ULONG KillTarget, + IN PID ProcessId + ); + +#define DKP_PROCESSTREE 0 +#define DKP_PROCESS 1 + +APIRET +DosSetPriority( + IN ULONG Scope, + IN ULONG Class, + IN LONG Delta, + IN ULONG TargetId + ); + +/* Priority scopes */ + +#define PRTYS_PROCESS 0 +#define PRTYS_PROCESSTREE 1 +#define PRTYS_THREAD 2 + +/* Priority classes */ + +#define PRTYC_NOCHANGE 0 +#define PRTYC_IDLETIME 1 +#define PRTYC_REGULAR 2 +#define PRTYC_TIMECRITICAL 3 +#define PRTYC_FOREGROUNDSERVER 4 + +/* Priority deltas */ + +#define PRTYD_MINIMUM -31 +#define PRTYD_MAXIMUM 31 + + +APIRET +DosSetDefaultDisk( + IN ULONG DiskNumber + ); + +APIRET +DosQueryCurrentDisk( + OUT PULONG DiskNumber, + OUT PULONG LogicalDrives + ); + +APIRET +DosSetCurrentDir( + IN PSZ DirectoryName + ); + +APIRET +DosQueryCurrentDir( + IN ULONG DiskNumber, + OUT PSZ DirectoryName, + IN OUT PULONG DirectoryNameLength + ); + +APIRET +DosQueryVerify( + OUT PBOOL32 Verify + ); + +APIRET +DosSetVerify( + IN BOOL32 Verify + ); + +APIRET +DosSetMaxFH( + IN ULONG MaxFileHandles + ); + +APIRET +DosScanEnv( + IN PSZ VariableName, + OUT PSZ *VariableValue + ); + +APIRET +DosSearchPath( + IN ULONG SearchFlags, + IN PSZ PathOrVariableName, + IN PSZ FileName, + OUT PBYTE Buffer, + IN ULONG Length + ); + +/* DosSearchPath() constants */ + +#define SEARCH_PATH 0x0000 +#define SEARCH_CUR_DIRECTORY 0x0001 +#define SEARCH_ENVIRONMENT 0x0002 +#define SEARCH_IGNORENETERRS 0x0004 + +/* definitions for DosSearchPath control word */ +#define DSP_IMPLIEDCUR 1 /* current dir will be searched first */ +#define DSP_PATHREF 2 /* from env.variable */ +#define DSP_IGNORENETERR 4 /* ignore net errs & continue search */ + +#endif // INCL_OS2V20_TASKING + + +#ifdef INCL_OS2V20_FILESYS + +/* File System API Calls */ + +/*** File System */ + +/* File info levels: All listed API's */ +#define FIL_STANDARD 1 /* Info level 1, standard file info */ +#define FIL_QUERYEASIZE 2 /* Level 2, return Full EA size */ +#define FIL_QUERYEASFROMLIST 3 /* Level 3, return requested EA's */ +#define FIL_QUERYALLEAS 4 /* Level 4, return all EAs NOT SUPPORTED */ +/* File info levels: Dos32...PathInfo only */ +#define FIL_QUERYFULLNAME 5 /* Level 5, return fully qualified + name of file */ +#define FIL_NAMEISVALID 6 /* Level 6, check validity of file/path + name for this FSD */ + +#define FIL_SETEAS 2 /* Level 2, set EAs */ + +#define MAXQFILEINFOLEVEL FIL_QUERYEASFROMLIST // level 4 is invalid +#define MAXSETFILEINFOLEVEL FIL_SETEAS +#define MAXQPATHINFOLEVEL FIL_NAMEISVALID // level 4 is invalid +#define MAXSETPATHINFOLEVEL FIL_SETEAS +#define MAXFINDINFOLEVEL FIL_QUERYEASFROMLIST + +/* File time and date types */ + +/* + * Equates for the types of EAs that follow the convention that we have + * established. + * + * Values 0xFFFE thru 0x8000 are reserved. + * Values 0x0000 thru 0x7fff are user definable. + * Value 0xFFFC is not used + */ + +#define EAT_BINARY 0xFFFE /* length preceeded binary */ +#define EAT_ASCII 0xFFFD /* length preceeded ASCII */ +#define EAT_BITMAP 0xFFFB /* length preceeded bitmap */ +#define EAT_METAFILE 0xFFFA /* length preceeded metafile */ +#define EAT_ICON 0xFFF9 /* length preceeded icon */ +#define EAT_EA 0xFFEE /* length preceeded ASCII */ + /* name of associated data (#include) */ +#define EAT_MVMT 0xFFDF /* multi-valued, multi-typed field */ +#define EAT_MVST 0xFFDE /* multi-valued, single-typed field */ +#define EAT_ASN1 0xFFDD /* ASN.1 field */ + + +APIRET +DosOpen( + IN PSZ FileName, + OUT PHFILE FileHandle, + OUT PULONG ActionTaken, + IN ULONG CreateSize, + IN ULONG FileAttribute, + IN ULONG OpenFlags, + IN ULONG OpenMode, + IN OUT PEAOP2 ExtendedFileAttr OPTIONAL + ); + +/* DosOpen/DosQueryFHState/DosQueryFileInfo et al file attributes; also */ +/* known as Dos File Mode bits... */ +#define FILE_READONLY 0x0001 +#define FILE_HIDDEN 0x0002 +#define FILE_SYSTEM 0x0004 +#define FILE_DIRECTORY 0x0010 +#define FILE_ARCHIVED 0x0020 + +#define ATTR_CHANGEABLE (FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM | FILE_ARCHIVED) +#define ATTR_ALL (FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM | FILE_DIRECTORY | FILE_ARCHIVED) +#define ATTR_NOT_NORM 0x8000 // do not find normal files + +/* DosOpen() actions */ + +#define FILE_EXISTED 0x0001 +#define FILE_CREATED 0x0002 +#define FILE_TRUNCATED 0x0003 + +/* DosOpen() open flags */ +#define FILE_OPEN_EXISTING_FILE 0x0001 +#define FILE_TRUNCATE_EXISTING_FILE 0x0002 +#define FILE_CREATE_NEW_FILE 0x0010 + +/* this nibble applies if file already exists xxxx */ + +#define OPEN_ACTION_FAIL_IF_EXISTS 0x0000 /* ---- ---- ---- 0000 */ +#define OPEN_ACTION_OPEN_IF_EXISTS 0x0001 /* ---- ---- ---- 0001 */ +#define OPEN_ACTION_REPLACE_IF_EXISTS 0x0002 /* ---- ---- ---- 0010 */ + +/* this nibble applies if file does not exist xxxx */ + +#define OPEN_ACTION_FAIL_IF_NEW 0x0000 /* ---- ---- 0000 ---- */ +#define OPEN_ACTION_CREATE_IF_NEW 0x0010 /* ---- ---- 0001 ---- */ + +#define OPEN_ACTION_RESERVED 0xFFEC + +/* DosOpen/DosSetFHState flags */ + +#define OPEN_ACCESS_READONLY 0x00000000 /* ---- ---- ---- -000 */ +#define OPEN_ACCESS_WRITEONLY 0x00000001 /* ---- ---- ---- -001 */ +#define OPEN_ACCESS_READWRITE 0x00000002 /* ---- ---- ---- -010 */ +#define OPEN_SHARE_DENYREADWRITE 0x00000010 /* ---- ---- -001 ---- */ +#define OPEN_SHARE_DENYWRITE 0x00000020 /* ---- ---- -010 ---- */ +#define OPEN_SHARE_DENYREAD 0x00000030 /* ---- ---- -011 ---- */ +#define OPEN_SHARE_DENYNONE 0x00000040 /* ---- ---- -100 ---- */ +#define OPEN_FLAGS_NOINHERIT 0x00000080 /* ---- ---- 1--- ---- */ +#define OPEN_FLAGS_NO_LOCALITY 0x00000000 /* ---- -000 ---- ---- */ +#define OPEN_FLAGS_SEQUENTIAL 0x00000100 /* ---- -001 ---- ---- */ +#define OPEN_FLAGS_RANDOM 0x00000200 /* ---- -010 ---- ---- */ +#define OPEN_FLAGS_RANDOMSEQUENTIAL 0x00000300 /* ---- -011 ---- ---- */ +#define OPEN_FLAGS_NO_CACHE 0x00001000 /* ---1 ---- ---- ---- */ +#define OPEN_FLAGS_FAIL_ON_ERROR 0x00002000 /* --1- ---- ---- ---- */ +#define OPEN_FLAGS_WRITE_THROUGH 0x00004000 /* -1-- ---- ---- ---- */ +#define OPEN_FLAGS_DASD 0x00008000 /* 1--- ---- ---- ---- */ + +#define ACCESS_FLAGS (OPEN_ACCESS_READONLY | OPEN_ACCESS_WRITEONLY | \ + OPEN_ACCESS_READWRITE) +#define SHARE_FLAGS (OPEN_SHARE_DENYREADWRITE | OPEN_SHARE_DENYWRITE | \ + OPEN_SHARE_DENYREAD | OPEN_SHARE_DENYNONE) +#define QFHSTATE_FLAGS (OPEN_FLAGS_NOINHERIT | OPEN_FLAGS_WRITE_THROUGH | \ + OPEN_FLAGS_FAIL_ON_ERROR | OPEN_FLAGS_NO_CACHE | \ + ACCESS_FLAGS | SHARE_FLAGS) +#define SETFHSTATE_FLAGS (OPEN_FLAGS_NOINHERIT | OPEN_FLAGS_WRITE_THROUGH | \ + OPEN_FLAGS_FAIL_ON_ERROR | OPEN_FLAGS_NO_CACHE) +#define OPEN_RESERVED ~(OPEN_ACCESS_READONLY | OPEN_ACCESS_WRITEONLY | \ + OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYREADWRITE | \ + OPEN_SHARE_DENYWRITE | OPEN_SHARE_DENYREAD | \ + OPEN_SHARE_DENYNONE | OPEN_FLAGS_NOINHERIT | \ + OPEN_FLAGS_NO_LOCALITY | OPEN_FLAGS_SEQUENTIAL | \ + OPEN_FLAGS_RANDOM | OPEN_FLAGS_RANDOMSEQUENTIAL | \ + OPEN_FLAGS_NO_CACHE | OPEN_FLAGS_FAIL_ON_ERROR | \ + OPEN_FLAGS_WRITE_THROUGH | OPEN_FLAGS_DASD) + + +#define LOCALITY_FLAGS (OPEN_FLAGS_NO_LOCALITY | OPEN_FLAGS_SEQUENTIAL | \ + OPEN_FLAGS_RANDOM | OPEN_FLAGS_RANDOMSEQUENTIAL) + +APIRET +DosClose( + IN HFILE FileHandle + ); + +APIRET +DosRead( + IN HFILE FileHandle, + OUT PVOID Buffer, + IN ULONG Length, + OUT PULONG BytesRead + ); + +APIRET +DosWrite( + IN HFILE FileHandle, + IN PVOID Buffer, + IN ULONG Length, + OUT PULONG BytesWritten + ); + +APIRET +DosDelete( + IN PSZ FileName + ); + + +APIRET +DosDupHandle( + IN HFILE OldFileHandle, + IN OUT PHFILE NewFileHandle + ); + +#define DDH_NEW_HANDLE -1 + +APIRET +DosQueryFHState( + IN HFILE FileHandle, + OUT PULONG OpenMode + ); + +APIRET +DosSetFHState( + IN HFILE FileHandle, + IN ULONG OpenMode + ); + +APIRET +DosQueryHType( + IN HFILE FileHandle, + OUT PULONG HandleType, + OUT PULONG DeviceFlags + ); + +/* DosQueryHType() */ +/* Handle classes (low 8 bits of Handle Type) */ +#define FHT_DISKFILE 0x0000 /* Disk file handle */ +#define FHT_CHRDEV 0x0001 /* Character device handle */ +#define FHT_PIPE 0x0002 /* Pipe handle */ + +/* Handle bits (high 8 bits of Handle Type) */ +#define FHB_DSKREMOTE 0x8000 /* Remote disk */ +#define FHB_CHRDEVREMOTE 0x8000 /* Remote character device */ +#define FHB_PIPEREMOTE 0x8000 /* Remote pipe */ + +#define HANDTYPE_FILE 0x0000 +#define HANDTYPE_DEVICE 0x0001 +#define HANDTYPE_PIPE 0x0002 +#define HANDTYPE_NETWORK 0x8000 + +APIRET +DosFindFirst( + IN PSZ FileName, + IN OUT PHDIR DirectoryHandle, + IN ULONG FileAttributes, + IN PFILEFINDBUF3 Buffer, + IN ULONG Length, + IN OUT PULONG CountEntriesFound, + IN ULONG FileInformationLevel + ); + +APIRET +DosFindNext( + IN HDIR DirectoryHandle, + IN PFILEFINDBUF3 Buffer, + IN ULONG Length, + IN OUT PULONG CountEntriesFound + ); + +/* DosFindFirst/Next Directory handle types */ + +#define HDIR_SYSTEM 1 /* Use system handle (1) */ +#define HDIR_CREATE -1 /* Allocate a new, unused handle */ + +APIRET +DosFindClose( + IN HDIR DirectoryHandle + ); + +APIRET +DosSetFileSize( + IN HFILE FileHandle, + IN ULONG NewFileSize + ); + +APIRET +DosResetBuffer( + IN HFILE FileHandle + ); + +#define FLUSH_ALL -1 // Flush buffers for all of process's handles + +APIRET +DosSetFilePtr( + IN HFILE FileHandle, + IN LONG StartingFilePosition, + IN ULONG NewFilePosition, + IN OUT PULONG CurrentFilePosition + ); + +/* DosSetFilePtr() file position codes */ + +#define FILE_BEGIN 0x0000 /* Move relative to beginning of file */ +#define FILE_CURRENT 0x0001 /* Move relative to current fptr position */ +#define FILE_END 0x0002 /* Move relative to end of file */ + +APIRET +DosSetFileLocks( + IN HFILE FileHandle, + IN PFILELOCK UnlockRequest, + IN PFILELOCK LockRequest + ); + +APIRET +DosMove( + IN PSZ OldFileName, + IN PSZ NewFileName + ); + +APIRET +DosCopy( + IN PSZ OldFileName, + IN PSZ NewFileName, + IN ULONG CopyOption + ); + +/* DosCopy option bits; may be or'ed together */ + +#define DCPY_EXISTING 0x00001 /* Copy even if target exists */ +#define DCPY_APPEND 0x00002 /* Append to existing file, do not replace */ +#define DCPY_EA_FAIL_COPY 0x0004 /* fail copy if EAs not supported */ + /* by destination file system */ +#define DCPY_ALL (DCPY_EXISTING | DCPY_APPEND | DCPY_EA_FAIL_COPY) + + +APIRET +DosEditName( + IN ULONG EditLevel, + IN PSZ SourceString, + IN PSZ EditString, + OUT PBYTE Buffer, + IN ULONG Length + ); + +#define EDIT_LEVEL_ONE 0x0001 // use OS2 v1.2 editing semantics +#define MAX_EDIT_LEVEL EDIT_LEVEL_ONE + +APIRET +DosFileIO( + IN HFILE FileHandle, + IN PBYTE CommandBuffer, + IN ULONG Length, + OUT PUSHORT ErrorOffset + ); + +/* DosFileIO command words */ + +#define FIO_LOCK 0 /* Lock Files */ +#define FIO_UNLOCK 1 /* Unlock Files */ +#define FIO_SEEK 2 /* Seek (set file ptr) */ +#define FIO_READ 3 /* File Read */ +#define FIO_WRITE 4 /* File Write */ + +/* Lock Sharing Modes */ +#define FIO_NOSHARE 0 /* None */ +#define FIO_SHAREREAD 1 /* Read-Only */ + +typedef struct _FIOLOCKCMD { + USHORT usCmd; /* Cmd = FIO_LOCK */ + USHORT cLockCnt; /* Lock records that follow */ + ULONG cTimeOut; /* in Msec */ +} FIOLOCKCMD, *PFIOLOCKCMD; + + +typedef struct _FIOLOCKREC { + USHORT fShare; /* FIO_NOSHARE or FIO_SHAREREAD */ + ULONG cbStart; /* Starting offset for lock region */ + ULONG cbLength; /* Length of lock region */ +} FIOLOCKREC, *PIOLOCKREC; + + +typedef struct _FIOUNLOCKCMD { + USHORT usCmd; /* Cmd = FIO_UNLOCK */ + USHORT cUnlockCnt; /* Unlock records that follow */ +} FIOUNLOCKCMD, *PFIOUNLOCKCMD; + + +typedef struct _FIOUNLOCKREC { + ULONG cbStart; /* Starting offset for unlock region */ + ULONG cbLength; /* Length of unlock region */ +} FIOUNLOCKREC, *PFIOUNLOCKREC; + + +typedef struct _FIOSEEKCMD { + USHORT usCmd; /* Cmd = FIO_SEEK */ + USHORT fsMethod; /* One of: FPM_BEGINNING, FPM_CURRENT, + or FPM_END */ + ULONG cbDistance; /* Byte offset for seek */ + ULONG cbNewPosition; /* Bytes from start of file after + seek */ +} FIOSEEKCMD, *PFIOSEEKCMD; + + +typedef struct _FIOREADWRITE { + USHORT usCmd; /* Cmd = FIO_READ or FIO_WRITE */ + PVOID pbBuffer; /* Pointer to data buffer */ + ULONG cbBufferLen; /* Bytes in buffer or max size */ + ULONG cbActualLen; /* Bytes actually read/written */ +} FIOREADWRITE, *PFIOREADWRITE; + + + +APIRET +DosCreateDir( + IN PSZ DirectoryName, + IN PEAOP2 DirectoryAttributes OPTIONAL + ); + +APIRET +DosDeleteDir( + IN PSZ DirectoryName + ); + +APIRET +DosQueryFileInfo( + IN HFILE FileHandle, + IN ULONG FileInformationLevel, + OUT PBYTE Buffer, + IN ULONG Length + ); + +APIRET +DosSetFileInfo( + IN HFILE FileHandle, + IN ULONG FileInformationLevel, + IN OUT PBYTE Buffer, + IN ULONG Length + ); + +APIRET +DosQueryPathInfo( + IN PSZ pszPath, + IN ULONG FileInformationLevel, + OUT PBYTE Buffer, + IN ULONG Length + ); + +APIRET +DosSetPathInfo( + IN PSZ pszPath, + IN ULONG FileInformationLevel, + IN OUT PBYTE Buffer, + IN ULONG Length, + IN ULONG Flags + ); + +/* defines for DosSetPathInfo Flags parameter values */ +#define DSPI_WRTTHRU 0x10 /* write through */ + +APIRET +DosEnumAttribute( + IN ULONG RefType, + IN PVOID FileRef, + IN ULONG EntryNum, + OUT PVOID Buffer, + IN ULONG Length, + IN OUT PULONG ActualLength, + IN ULONG FileInformationLevel + ); + +#define ENUM_EANAME 1 // DosEnumAttribute infolevel 1 + +/* Infolevels for DosEnumAttribute */ +#define ENUMEA_LEVEL_NO_VALUE 1 /* FEA without value */ + +/* Reference types for DosEnumAttribute */ +#define ENUMEA_REFTYPE_FHANDLE 0 /* file handle */ +#define ENUMEA_REFTYPE_PATH 1 /* path name */ +#define ENUMEA_REFTYPE_MAX ENUMEA_REFTYPE_PATH + +/* level 1 info returned from DosEnumAttribute */ + +typedef struct _DENA1 { + ULONG oNextEntryOffset; /* offset to next EA */ + UCHAR fEA; /* flags */ + UCHAR cbName; /* length of name excluding NULL */ + USHORT cbValue; /* length of value */ + UCHAR szName[1]; /* variable length asciiz name */ +} DENA1, *PDENA1; + +#endif // INCL_OS2V20_FILESYS + +#ifdef INCL_OS2V20_FSD + +/* FSD API Calls */ + +APIRET +DosShutdown( + IN ULONG Reserved + ); + +APIRET +DosFSAttach( + IN PSZ DeviceName, + IN PSZ FsName, + IN PBYTE FsData, + IN ULONG FsDataLength, + IN ULONG AttachFlags + ); + +/* Dos32FsAttach() */ +/* Attact or detach */ +#define FS_ATTACH 0 /* Attach file server */ +#define FS_DETACH 1 /* Detach file server */ + + +APIRET +DosQueryFSAttach( + IN PSZ DeviceName, + IN ULONG Ordinal, + IN ULONG FsInformationLevel, + OUT PBYTE FsAttributes, + IN OUT PULONG FsAttributesLength + ); + +/* DosQueryFSAttach() */ +/* Information level types (defines method of query) */ +#define FSAIL_QUERYNAME 1 /* Return data for a Drive or Device */ +#define FSAIL_DEVNUMBER 2 /* Return data for Ordinal Device # */ +#define FSAIL_DRVNUMBER 3 /* Return data for Ordinal Drive # */ + +/* Item types (from data structure item "iType") */ +#define FSAT_CHARDEV 1 /* Resident character device */ +#define FSAT_PSEUDODEV 2 /* Pusedu-character device */ +#define FSAT_LOCALDRV 3 /* Local drive */ +#define FSAT_REMOTEDRV 4 /* Remote drive attached to FSD */ + +typedef struct _FSQBUFFER2 { /* Data structure for QFSAttach */ + USHORT iType; /* Item type */ + USHORT cbName; /* Length of item name, sans NULL */ + USHORT cbFSDName; /* Length of FSD name, sans NULL */ + USHORT cbFSAData; /* Length of FSD Attach data returned */ + UCHAR szName[1]; /* ASCIIZ item name */ + UCHAR szFSDName[1]; /* ASCIIZ FSD name */ + UCHAR rgFSAData[1]; /* FSD Attach data from FSD */ +} FSQBUFFER2, *PFSQBUFFER2; + +APIRET +DosFSCtl( + IN PBYTE Data, + IN ULONG DataLength, + OUT PULONG ActualDataLength, + IN PBYTE Parameters, + IN ULONG ParametersLength, + OUT PULONG ActualParametersLength, + IN ULONG Function, + IN PSZ RouteName, + IN HFILE FileHandle, + IN ULONG RoutingMethod + ); + +/* Dos32FsCtl() */ +/* Routing type */ +#define FSCTL_HANDLE 1 /* File Handle directs req routing */ +#define FSCTL_PATHNAME 2 /* Path Name directs req routing */ +#define FSCTL_FSDNAME 3 /* FSD Name directs req routing */ + + +APIRET +DosQueryFSInfo( + IN ULONG DiskNumber, + IN ULONG FsInformationLevel, + IN PBYTE Buffer, + IN ULONG Length + ); + +APIRET +DosSetFSInfo( + ULONG DiskNumber, + ULONG FsInformationLevel, + PBYTE Buffer, + ULONG Length + ); + +/* FS Drive Info Levels */ +#define FSIL_ALLOC 1 /* Drive allocation info (Query only) */ +#define FSIL_VOLSER 2 /* Drive Volum/Serial info */ + +#pragma pack(1) +typedef struct _FSALLOCATE { + ULONG ulReserved; + ULONG cSectorUnit; + ULONG cUnit; + ULONG cUnitAvail; + USHORT cbSector; +} FSALLOCATE, *PFSALLOCATE; +#pragma pack() + +#define MAX_LABEL_LENGTH 11 // maximum length of volume label + +typedef struct _VOLUMELABEL { + BYTE cch; + CHAR szVolLabel[MAX_LABEL_LENGTH+1]; +} VOLUMELABEL, *PVOLUMELABEL; + +typedef struct _FSINFO { + ULONG ulVSN; + VOLUMELABEL vol; +} FSINFO, *PFSINFO; + +#endif // INCL_OS2V20_FSD + +#ifdef INCL_OS2V20_MEMORY + +/*** Memory management API Calls */ + +APIRET +DosAllocMem( + OUT PVOID *BaseAddress, + IN ULONG RegionSize, + IN ULONG Flags + ); + +APIRET +DosFreeMem( + PVOID BaseAddress, + PBOOLEAN pRemoveLDTEntry + ); + +APIRET +DosSetMem( + IN PVOID BaseAddress, + IN ULONG RegionSize, + IN ULONG Flags + ); + +APIRET +DosGiveSharedMem( + IN PVOID BaseAddress, + IN PID ProcessId, + IN ULONG Flags + ); + +APIRET +DosGetSharedMem( + IN PVOID BaseAddress, + IN ULONG Flags + ); + +APIRET +DosGetNamedSharedMem( + OUT PVOID *BaseAddress, + IN PSZ ObjectName, + IN ULONG Flags + ); + +APIRET +DosAllocSharedMem( + OUT PVOID *BaseAddress, + IN PSZ ObjectName, + IN ULONG RegionSize, + IN ULONG Flags, + IN BOOLEAN CreateLDTEntry + ); + +APIRET +DosQueryMem( + IN PVOID BaseAddress, + IN OUT PULONG RegionSize, + OUT PULONG Flags + ); + +#define DA_SHAREMEM_NAMEPREFIX "\\SHAREMEM\\" + +/* Access protection */ +#define PAG_READ 0x00000001 /* read access */ +#define PAG_WRITE 0x00000002 /* write access */ +#define PAG_EXECUTE 0x00000004 /* execute access */ +#define PAG_GUARD 0x00000008 /* guard protection */ +#define PAG_DEFAULT 0x00000400 /* default (initial) access */ + +/* Commit */ +#define PAG_COMMIT 0x00000010 /* commit storage */ +#define PAG_DECOMMIT 0x00000020 /* decommit storage */ + +/* Allocation attributes */ +#define OBJ_TILE 0x00000040 /* tile object */ +#define OBJ_GETTABLE 0x00000100 /* gettable by other processes */ +#define OBJ_GIVEABLE 0x00000200 /* giveable to other processes */ + +/* Allocation type (returned from DosQueryMem) */ +#define PAG_SHARED 0x00002000 /* shared object */ +#define PAG_FREE 0x00004000 /* pages are free */ +#define PAG_BASE 0x00010000 /* first page in object */ + +#define fPERM (PAG_EXECUTE + PAG_READ + PAG_WRITE + PAG_GUARD) +#define fSHARE (OBJ_GETTABLE + OBJ_GIVEABLE) + +/* DosAllocMem flags */ +#define fALLOC (OBJ_TILE + PAG_COMMIT + fPERM) + +/* DosAllocSharedMem flags */ +#define fALLOCSHR (OBJ_TILE + PAG_COMMIT + fSHARE + fPERM) + +/* DosGetNamedSharedMem flags */ +#define fGETNMSHR (fPERM) + +/* DosGetSharedMem flags */ +#define fGETSHR (fPERM) + +/* DosGiveSharedMem flags */ +#define fGIVESHR (fPERM) + +/* DosSetMem flags */ +#define fSET (OBJ_TILE + PAG_COMMIT + PAG_DECOMMIT + PAG_DEFAULT + fPERM) + +#ifdef NOT_IMPLEMENTED + +#define OBJ_PROTECTED 0x00000080 /* protect object + NOTE: This flag is NOT available at + the api level */ +#define PAG_PRIVATE 0x00001000 /* private object */ + +APIRET +DosAliasMem( + PVOID pb, + ULONG cb, + PVOID *ppbAlias + ); + +APIRET +DosQueryMemState( + IN PVOID BaseAddress, + IN OUT PULONG RegionSize, + OUT PULONG Flags + ); + +/* Page state (returned from DosQueryMemState) */ +#define PAG_NPOUT 0x00000000 /* page is not present, not in core */ +#define PAG_PRESENT 0x00000001 /* page is present */ +#define PAG_NPIN 0x00000002 /* page is not present, in core */ +#define PAG_PRESMASK 0x00000003 /* present state mask */ +#define PAG_INVALID 0x00000000 /* page is invalid */ +#define PAG_RESIDENT 0x00000010 /* page is resident */ +#define PAG_SWAPPABLE 0x00000020 /* page is swappable */ +#define PAG_DISCARDABLE 0x00000030 /* page is discardable */ +#define PAG_TYPEMASK 0x00000030 /* type mask */ + + +APIRET +DosQueryMemState( + PVOID pb, + PULONG cb, + PULONG pFlag + ); + +#endif // NOT_IMPLEMENTED + + +APIRET +DosSubSet( + IN PVOID HeapAddress, + IN ULONG Flags, + IN ULONG NewSize + ); + +/* DosSubSet flags */ +#define DOSSUB_INIT 0x01 /* initialize memory object for */ + /* suballocation */ +#define DOSSUB_GROW 0x02 /* increase size of memory pool */ + /* for suballocation */ +#define DOSSUB_SPARSE_OBJ 0x04 /* indicator for DosSub to */ + /* manage the commitment of */ + /* pages spanned by the memory */ + /* pool */ +#define DOSSUB_SERIALIZE 0x08 /* indicates that access to the */ + /* memory pool is to be */ + /* serialized by DosSub */ + + +APIRET +DosSubUnset( + IN PVOID HeapAddress + ); + + +APIRET +DosSubAlloc( + IN PVOID HeapAddress, + OUT PVOID *BaseAddress, + IN ULONG Size + ); + +APIRET +DosSubFree( + IN PVOID HeapAddress, + IN PVOID BaseAddress, + IN ULONG Size + ); + +#endif // INCL_OS2V20_MEMORY + +#ifdef INCL_OS2V20_SEMAPHORES + +/* Semaphore API Calls */ + + +/* Semaphore CreateAttributes */ + +#define DC_SEM_MAXNAMEL 256 + +#define DC_SEM_SHARED 0x01 /* DosCreateMutex, DosCreateEvent, and */ + /* DosCreateMuxWait use it to indicate */ + /* whether the semaphore is shared or */ + /* private when the PSZ is null */ +#define DCMW_WAIT_ANY 0x02 /* DosCreateMuxWait option for wait on any */ + /* event/mutex to occur */ +#define DCMW_WAIT_ALL 0x04 /* DosCreateMuxWait option for wait on all */ + /* events/mutexs to occur */ + +#define SEM_INDEFINITE_WAIT -1L +#define SEM_IMMEDIATE_RETURN 0L + +APIRET +DosCreateEventSem( + IN PSZ ObjectName, + OUT PHEV EventHandle, + IN ULONG CreateAttributes, + IN BOOL32 InitialState + ); + +APIRET +DosOpenEventSem( + IN PSZ ObjectName, + IN OUT PHEV EventHandle + ); + +APIRET +DosCloseEventSem( + IN HEV EventHandle + ); + +APIRET +DosResetEventSem( + IN HEV EventHandle, + OUT PULONG PostCount + ); + +APIRET +DosPostEventSem( + IN HEV EventHandle + ); + +APIRET +DosWaitEventSem( + IN HEV EventHandle, + IN ULONG Timeout + ); + +APIRET +DosQueryEventSem( + IN HEV EventHandle, + OUT PULONG PostCount + ); + +APIRET +DosCreateMutexSem( + IN PSZ ObjectName, + OUT PHMTX MutexHandle, + IN ULONG CreateAttributes, + IN BOOL32 InitialState + ); + +APIRET +DosOpenMutexSem( + IN PSZ ObjectName, + IN OUT PHMTX MutexHandle + ); + +APIRET +DosCloseMutexSem( + IN HMTX MutexHandle + ); + +APIRET +DosRequestMutexSem( + IN HMTX MutexHandle, + IN ULONG Timeout + ); + +APIRET +DosReleaseMutexSem( + IN HMTX MutexHandle + ); + +APIRET +DosQueryMutexSem( + IN HMTX MutexHandle, + OUT PPID OwnerPid, + OUT PTID OwnerTid, + OUT PULONG OwnerRequestLevel + ); + +APIRET +DosCreateMuxWaitSem( + IN PSZ ObjectName, + OUT PHMUX MuxWaitHandle, + IN ULONG CountMuxWaitEntries, + IN SEMRECORD MuxWaitEntries[], + IN ULONG CreateAttributes + ); + +APIRET +DosOpenMuxWaitSem( + IN PSZ ObjectName, + IN OUT PHMUX MuxWaitHandle + ); + +APIRET +DosCloseMuxWaitSem( + IN HMUX MuxWaitHandle + ); + +APIRET +DosWaitMuxWaitSem( + IN HMUX MuxWaitHandle, + IN ULONG Timeout, + OUT PULONG UserValue + ); + +APIRET +DosAddMuxWaitSem( + IN HMUX MuxWaitHandle, + IN PSEMRECORD MuxWaitEntry + ); + +APIRET +DosDeleteMuxWaitSem( + IN HMUX MuxWaitHandle, + IN HSEM MuxWaitEntrySem + ); + +APIRET +DosQueryMuxWaitSem( + IN HMUX MuxWaitHandle, + IN OUT PULONG CountMuxWaitEntries, + OUT SEMRECORD MuxWaitEntries[], + OUT PULONG CreateAttributes + ); + +#endif // INCL_OS2V20_SEMAPHORES + +#ifdef INCL_OS2V20_TIMERS + +/*** Timer Services API Calls */ + +APIRET +DosGetDateTime( + OUT PDATETIME DateTime + ); + +APIRET +DosSetDateTime( + IN PDATETIME DateTime + ); + + +APIRET +DosAsyncTimer( + IN ULONG MilliSeconds, + IN HEV EventSem, + OUT PHTIMER TimerHandle + ); + +APIRET +DosStartTimer( + IN ULONG MilliSeconds, + IN HEV EventSem, + OUT PHTIMER TimerHandle + ); + +APIRET +DosStopTimer( + IN HTIMER TimerHandle + ); + +#endif // INCL_OS2V20_TIMERS + + +#ifdef INCL_OS2V20_LOADER + +/*** Loader API Calls */ + +APIRET +DosLoadModule( + OUT PSZ ErrorText, + IN ULONG ErrorTextLength, + IN PSZ ModuleName, + OUT PHMODULE ModuleHandle + ); + +APIRET +DosFreeModule( + IN HMODULE ModuleHandle + ); + +APIRET +DosQueryProcAddr( + IN HMODULE ModuleHandle, + IN ULONG ProcOrdinal, + IN PSZ ProcName OPTIONAL, + OUT PFN *ProcAddress + ); + +APIRET +DosQueryProcType( + IN HMODULE ModuleHandle, + IN ULONG ProcOrdinal, + IN PSZ ProcName OPTIONAL, + OUT PULONG *ProcType + ); + +/**** + defined in os2v12.h +#define PT_32BIT 0 +#define PT_16BIT 1 +*****/ + +APIRET +DosReplaceModule( + IN PSZ pszOldModule, + IN PSZ pszNewModule, + IN PSZ pszBackupModule + ); + +APIRET +DosQueryModuleHandle( + IN PSZ ModuleName, + OUT PHMODULE ModuleHandle + ); + +APIRET +DosQueryModuleName( + IN HMODULE ModuleHandle, + IN ULONG ModuleNameLength, + OUT PSZ ModuleName + ); + +APIRET +DosGetResource( + IN HMODULE ModuleHandle, + IN ULONG ResourceTypeId, + IN ULONG ResourceNameId, + OUT PVOID *ResourceBaseAddress + ); + +APIRET +DosQueryResourceSize( + IN HMODULE ModuleHandle, + IN ULONG ResourceTypeId, + IN ULONG ResourceNameId, + OUT PULONG ResourceSize + ); + + +/* Predefined resource types */ + +#define RT_POINTER 1 /* mouse pointer shape */ +#define RT_BITMAP 2 /* bitmap */ +#define RT_MENU 3 /* menu template */ +#define RT_DIALOG 4 /* dialog template */ +#define RT_STRING 5 /* string tables */ +#define RT_FONTDIR 6 /* font directory */ +#define RT_FONT 7 /* font */ +#define RT_ACCELTABLE 8 /* accelerator tables */ +#define RT_RCDATA 9 /* binary data */ +#define RT_MESSAGE 10 /* error msg tables */ +#define RT_DLGINCLUDE 11 /* dialog include file name */ +#define RT_VKEYTBL 12 /* key to vkey tables */ +#define RT_KEYTBL 13 /* key to UGL tables */ +#define RT_CHARTBL 14 /* glyph to character tables */ +#define RT_DISPLAYINFO 15 /* screen display information */ + +#define RT_FKASHORT 16 /* function key area short form */ +#define RT_FKALONG 17 /* function key area long form */ + +#define RT_HELPTABLE 18 /* Help table for Cary Help manager */ +#define RT_HELPSUBTABLE 19 /* Help subtable for Cary Help manager */ + +#define RT_FDDIR 20 /* DBCS uniq/font driver directory */ +#define RT_FD 21 /* DBCS uniq/font driver */ + +#define RT_MAX 22 /* 1st unused Resource Type */ + + +#define RF_ORDINALID 0x80000000L /* ordinal id flag in resource table */ + + +APIRET +DosQueryAppType( + IN PSZ ImageFileName, + OUT PULONG AppTypeFlags + ); + +/* AppType returned in AppTypeFlags is defined as follows */ + +#define FAPPTYP_NOTSPEC 0x0000 +#define FAPPTYP_NOTWINDOWCOMPAT 0x0001 +#define FAPPTYP_WINDOWCOMPAT 0x0002 +#define FAPPTYP_WINDOWAPI 0x0003 +#define FAPPTYP_BOUND 0x0008 +#define FAPPTYP_DLL 0x0010 +#define FAPPTYP_DOS 0x0020 +#define FAPPTYP_PHYSDRV 0x0040 /* physical device driver */ +#define FAPPTYP_VIRTDRV 0x0080 /* virtual device driver */ +#define FAPPTYP_PROTDLL 0x0100 /* 'protected memory' dll */ + +#endif // INCL_OS2V20_LOADER + + +#ifdef INCL_OS2V20_NLS + +// #include "os2nls.h" + +#endif // INCL_OS2V20_NLS + + +#ifdef INCL_OS2V20_EXCEPTIONS + +/*** Exception API Calls */ + +/* + * User Exception Handler Return Codes: + */ + +#define XCPT_CONTINUE_SEARCH 0x00000000 /* exception not handled */ +#define XCPT_CONTINUE_EXECUTION 0xFFFFFFFF /* exception handled /* + +/* + * fHandlerFlags values (see ExceptionStructure): + * + * The user may only set (but not clear) the EH_NONCONTINUABLE flag. + * All other flags are set by the system. + * + */ + +#define EH_NONCONTINUABLE 0x1 /* Noncontinuable exception */ +#define EH_UNWINDING 0x2 /* Unwind is in progress */ +#define EH_EXIT_UNWIND 0x4 /* Exit unwind is in progress */ +#define EH_STACK_INVALID 0x8 /* Stack out of limits or unaligned */ +#define EH_NESTED_CALL 0x10 /* Nested exception handler call */ + + +/* + * Unwind all exception handlers (see DosUnwindException API) + */ + +#define UNWIND_ALL 0 + +/* + * Exception values are 32 bit values layed out as follows: + * + * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 + * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 + * +---+-+-------------------------+-------------------------------+ + * |Sev|C| Facility | Code | + * +---+-+-------------------------+-------------------------------+ + * + * where + * + * Sev - is the severity code + * 00 - Success + * 01 - Informational + * 10 - Warning + * 11 - Error + * + * C - is the Customer code flag + * + * Facility - is the facility code + * + * Code - is the facility's status code + * + * Exceptions specific to Cruiser (e.g. XCPT_SIGNAL) will be marked + * with a facility code of 1. + * + * System defined exceptions have a facility code of zero. + * + * Each exception may also have several pieces of additional information. + * These are stored in the ExceptionInformation fields of the + * ExceptionReportRecord. They are documented here with the exceptions + * only for ease of reference. + */ + +#define XCPT_FATAL_EXCEPTION 0xC0000000 +#define XCPT_SEVERITY_CODE 0xC0000000 +#define XCPT_CUSTOMER_CODE 0x20000000 +#define XCPT_FACILITY_CODE 0x1FFF0000 +#define XCPT_EXCEPTION_CODE 0x0000FFFF + +/* + * Access flags in ExceptionInformation + */ +#define XCPT_READ_ACCESS 0 +#define XCPT_WRITE_ACCESS 1 +#define XCPT_EXECUTE_ACCESS 2 +#define XCPT_ACCESS_UNKNOWN 3 + +/* + * Signal subtypes for XCPT_SIGNAL + */ +#define XCPT_SIGNAL_INTR 1 +#define XCPT_SIGNAL_KILLPROC 3 +#define XCPT_SIGNAL_BREAK 4 + +/* + * Portable non-fatal software generated exceptions + */ + +#define XCPT_GUARD_PAGE_VIOLATION 0x80000001 + /* ExceptionInformation[ 0 ] - R/W flag */ + /* ExceptionInformation[ 1 ] - FaultAddr */ + +#define XCPT_UNABLE_TO_GROW_STACK 0x80010001 + +/* + * Portable fatal hardware generated exceptions + */ + +#define XCPT_DATATYPE_MISALIGNMENT 0x80000002 + /* ExceptionInformation[ 0 ] - R/W flag */ + /* ExceptionInformation[ 1 ] - Alignment */ + /* ExceptionInformation[ 2 ] - FaultAddr */ + +#define XCPT_BREAKPOINT 0xC0000003 + /* ExceptionInformation[ 0 ] - R/W/E/I flags */ + +#define XCPT_SINGLE_STEP 0xC0000004 + +#define XCPT_ACCESS_VIOLATION 0xC0000005 + /* ExceptionInformation[ 0 ] - R/W flag */ + /* ExceptionInformation[ 1 ] - FaultAddr */ + +#define XCPT_ILLEGAL_INSTRUCTION 0xC000001C +#define XCPT_FLOAT_DENORMAL_OPERAND 0xC0000094 +#define XCPT_FLOAT_DIVIDE_BY_ZERO 0xC0000095 +#define XCPT_FLOAT_INEXACT_RESULT 0xC0000096 +#define XCPT_FLOAT_INVALID_OPERATION 0xC0000097 +#define XCPT_FLOAT_OVERFLOW 0xC0000098 +#define XCPT_FLOAT_STACK_CHECK 0xC0000099 +#define XCPT_FLOAT_UNDERFLOW 0xC000009A + +#define XCPT_INTEGER_DIVIDE_BY_ZERO 0xC000009B +#define XCPT_INTEGER_OVERFLOW 0xC000009C +#define XCPT_PRIVILEGED_INSTRUCTION 0xC000009D + +/* + * Portable fatal software generated exceptions + */ + +#define XCPT_IN_PAGE_ERROR 0xC0000006 + /* ExceptionInformation[ 0 ] - FaultAddr */ + +#define XCPT_PROCESS_TERMINATE 0xC0010001 +#define XCPT_ASYNC_PROCESS_TERMINATE 0xC0010002 + /* ExceptionInfo[0] - TID of 'terminator' thread */ + +#define XCPT_NONCONTINUABLE_EXCEPTION 0xC0000024 +#define XCPT_INVALID_DISPOSITION 0xC0000025 + +/* + * Non-portable fatal exceptions + */ + +#define XCPT_INVALID_LOCK_SEQUENCE 0xC000001D +#define XCPT_ARRAY_BOUNDS_EXCEEDED 0xC0000093 + +/* + * Misc exceptions + */ + +#define XCPT_UNWIND 0xC0000026 +#define XCPT_BAD_STACK 0xC0000027 +#define XCPT_INVALID_UNWIND_TARGET 0xC0000028 + +/* + * Signal Exceptions + */ + +#define XCPT_SIGNAL 0xC0010003 + /* ExceptionInfo[0] - signal number */ + +/* + * Exception Context. + * + * This is the machine specific register contents for the thread + * at the time of the exception. Note that only the register sets + * specified by ContextFlags contain valid data. Conversely, only + * registers specified in ContextFlags will be restored if an exception + * is handled. + */ + +/* XLATOFF */ +#pragma pack(1) +/* XLATON */ + +struct _fpreg { /* coprocessor stack register element */ + ULONG losig; + ULONG hisig; + USHORT signexp; +}; +typedef struct _fpreg FPREG; + +/* XLATOFF */ +#pragma pack() +/* XLATON */ + + +/* + * ExceptionReportRecord + * + * This structure contains machine independant information about an + * exception/unwind. No system exception will ever have more than + * EXCEPTION_MAXIMUM_PARAMETERS parameters. User exceptions are not + * bound to this limit. + */ + +#undef EXCEPTION_MAXIMUM_PARAMETERS + +#define EXCEPTION_MAXIMUM_PARAMETERS 4 /* Enough for all system exceptions. */ + +struct _EXCEPTIONREPORTRECORD { + ULONG ExceptionNum; /* exception number */ + ULONG fHandlerFlags; + struct _EXCEPTIONREPORTRECORD *NestedExceptionReportRecord; + PVOID ExceptionAddress; + ULONG cParameters; /* Size of Exception Specific Info */ + ULONG ExceptionInfo[EXCEPTION_MAXIMUM_PARAMETERS]; + /* Exception Specfic Info */ +}; +typedef struct _EXCEPTIONREPORTRECORD EXCEPTIONREPORTRECORD; +typedef struct _EXCEPTIONREPORTRECORD *PEXCEPTIONREPORTRECORD; + +/* + * ExceptionRegistrationRecord + * + * These are linked together to form a chain of exception handlers that + * will be dispatched to upon receipt of an exception. + * + * NOTE: Exception handlers should *NOT* be Registered directly from a + * high level language, such as 'C'. This is the responsibility of + * the language runtime. + */ + +struct _EXCEPTIONREGISTRATIONRECORD { + struct _EXCEPTIONREGISTRATIONRECORD *prev_structure; + ULONG (*ExceptionHandler)(); +}; +typedef struct _EXCEPTIONREGISTRATIONRECORD EXCEPTIONREGISTRATIONRECORD; +typedef struct _EXCEPTIONREGISTRATIONRECORD *PEXCEPTIONREGISTRATIONRECORD; + +// +// DosSetSigExceptionFocus codes +// + +#define SIG_UNSETFOCUS 0 +#define SIG_SETFOCUS 1 + +APIRET +DosRaiseException( + IN PEXCEPTIONREPORTRECORD ExceptionReportRecord + ); + +APIRET +DosUnwindException( + IN PEXCEPTIONREGISTRATIONRECORD ExceptionHandler, + IN PVOID TargetIP, + IN PEXCEPTIONREPORTRECORD ExceptionReportRecord + ); + +APIRET +DosEnterMustComplete( + OUT PULONG NestingLevel + ); + +APIRET +DosExitMustComplete( + OUT PULONG NestingLevel + ); + +APIRET +DosAcknowledgeSignalException( + IN ULONG SignalNumber + ); + +APIRET +DosSendSignalException( + IN PID ProcessId, + IN ULONG Exception + ); + +APIRET +DosSetSignalExceptionFocus( + IN BOOL32 Flag, + OUT PULONG NestingLevel + ); + +#endif // INCL_OS2V20_EXCEPTIONS + +#ifdef INCL_OS2V20_ERRORMSG + +/* Error API Calls */ + +APIRET +DosError( + IN ULONG ErrorFlags + ); + +/* definitions for DosError - combine with | */ + +#define DE_DISABLE_HARD_ERRORS 0x00000000 +#define DE_ENABLE_HARD_ERRORS 0x00000001 +#define DE_ENABLE_EXCEPTIONS 0x00000000 +#define DE_DISABLE_EXCEPTIONS 0x00000002 + +#define FERR_DISABLEHARDERR 0x00000000L /* disable hard error popups */ +#define FERR_ENABLEHARDERR 0x00000001L /* enable hard error popups */ +#define FERR_ENABLEEXCEPTION 0x00000000L /* enable exception popups */ +#define FERR_DISABLEEXCEPTION 0x00000002L /* disable exception popups */ + + +APIRET +DosErrClass( + IN ULONG ErrorCode, + OUT PULONG ErrorClass, + OUT PULONG ErrorAction, + OUT PULONG ErrorLocus + ); + +/* Values for error CLASS */ + +#define ERRCLASS_OUTRES 1 +#define ERRCLASS_TEMPSIT 2 +#define ERRCLASS_AUTH 3 +#define ERRCLASS_INTRN 4 +#define ERRCLASS_HRDFAIL 5 +#define ERRCLASS_SYSFAIL 6 +#define ERRCLASS_APPERR 7 +#define ERRCLASS_NOTFND 8 +#define ERRCLASS_BADFMT 9 +#define ERRCLASS_LOCKED 10 +#define ERRCLASS_MEDIA 11 +#define ERRCLASS_ALREADY 12 +#define ERRCLASS_UNK 13 +#define ERRCLASS_CANT 14 +#define ERRCLASS_TIME 15 + +/* Values for error ACTION */ + +#define ERRACT_RETRY 1 +#define ERRACT_DLYRET 2 +#define ERRACT_USER 3 +#define ERRACT_ABORT 4 +#define ERRACT_PANIC 5 +#define ERRACT_IGNORE 6 +#define ERRACT_INTRET 7 + +/* Values for error LOCUS */ + +#define ERRLOC_UNK 1 +#define ERRLOC_DISK 2 +#define ERRLOC_NET 3 +#define ERRLOC_SERDEV 4 +#define ERRLOC_MEM 5 + + +APIRET +DosGetMessage( + IN PSZ Variables[], + IN ULONG CountVariables, + OUT PCHAR Buffer, + IN ULONG Length, + IN ULONG MessageNumber, + IN PSZ MessageFileName, + OUT PULONG MessageLength, + IN PBYTE pMsgSeg + ); + +APIRET +DosInsertMessage( + IN PSZ Variables[], + IN ULONG CountVariables, + IN PCHAR Message, + IN ULONG MessageLength, + OUT PCHAR Buffer, + IN ULONG Length, + OUT PULONG ActualMessageLength + ); + +APIRET +DosPutMessage( + IN HFILE FileHandle, + IN ULONG MessageLength, + IN PCHAR Message + ); + +APIRET +DosQueryMessageCP( + PCHAR Buffer, + ULONG Length, + IN PSZ MessageFileName, + OUT PULONG ActualLength + ); + + +#endif // INCL_OS2V20_ERRORMSG + +#ifdef INCL_OS2V20_SESSIONMGR + +/*** Session manager API Calls */ + +APIRET +DosShutdown( + ULONG ulReserved + ); + +APIRET +DosStartSession( + IN PSTARTDATA StartData, + OUT PULONG SessionId, + OUT PPID ProcessId + ); + +APIRET +DosSetSession( + IN ULONG SessionId, + IN PSTATUSDATA SessionStatusData + ); + +APIRET +DosSelectSession( + IN ULONG SessionId, + IN ULONG ulReserved + ); + +APIRET +DosStopSession( + IN ULONG StopTarget, + IN ULONG SessionId, + IN ULONG ulReserved + ); + +#define DSS_SESSION 0x0 +#define DSS_ALL_SESSIONS 0x1 + +#endif // INCL_OS2V20_SESSIONMSG + +#ifdef INCL_OS2V20_DEVICE_SUPPORT + +/*** Device support API Calls */ + +APIRET +DosBeep( + IN ULONG Frequency, + IN ULONG Duration + ); + + +APIRET +DosDevConfig( + OUT PVOID DeviceInformation, + IN ULONG DeviceInformationIndex + ); + +#define DDC_NUMBER_PRINTERS 0 // USHORT +#define DDC_NUMBER_RS232_PORTS 1 // USHORT +#define DDC_NUMBER_DISKETTE_DRIVES 2 // USHORT +#define DDC_MATH_COPROCESSOR 3 // BYTE +#define DDC_PC_SUBMODEL_TYPE 4 // BYTE +#define DDC_PC_MODEL_TYPE 5 // BYTE +#define DDC_PRIMARY_DISPLAY_TYPE 6 // BYTE +#define DDC_COPROCESSORTYPE 7 // BYTE + +APIRET +DosQuerySysInfo( + IN ULONG SysInfoIndexStart, + IN ULONG SysInfoIndexEnd, + OUT PBYTE Buffer, + IN ULONG Length + ); + +/* Values for SysInfoIndex of DosQuerySysInfo */ + +#define QSV_MAX_PATH_LENGTH 1 +/* +defined in os2v12.h #define Q_MAX_PATH_LENGTH QSV_MAX_PATH_LENGTH +*/ +#define QSV_MAX_TEXT_SESSIONS 2 +#define QSV_MAX_PM_SESSIONS 3 +#define QSV_MAX_VDM_SESSIONS 4 +#define QSV_BOOT_DRIVE 5 /* 1=A, 2=B, etc. */ +#define QSV_DYN_PRI_VARIATION 6 /* 0=Absolute, 1=Dynamic */ +#define QSV_MAX_WAIT 7 /* seconds */ +#define QSV_MIN_SLICE 8 /* milli seconds */ +#define QSV_MAX_SLICE 9 /* milli seconds */ +#define QSV_PAGE_SIZE 10 +#define QSV_VERSION_MAJOR 11 +#define QSV_VERSION_MINOR 12 +#define QSV_VERSION_REVISION 13 /* Revision letter */ +#define QSV_MS_COUNT 14 /* Free running millisecond counter */ +#define QSV_TIME_LOW 15 /* Low dword of time in seconds */ +#define QSV_TIME_HIGH 16 /* High dword of time in seconds */ +#define QSV_TOTPHYSMEM 17 /* Physical memory on system */ +#define QSV_TOTRESMEM 18 /* Resident memory on system */ +#define QSV_TOTAVAILMEM 19 /* Available memory for all processes */ +#define QSV_MAXPRMEM 20 /* Avail private mem for calling proc */ +#define QSV_MAXSHMEM 21 /* Avail shared mem for calling proc */ +#define QSV_TIMER_INTERVAL 22 /* Timer interval in tenths of ms */ +#define QSV_MAX_COMP_LENGTH 23 /* max len of one component in a name */ +#define QSV_MAXIMUM_INDEX 23 + +#ifdef NOT_IMPLEMENTED + +APIRET +DosDevIOCtl( + PVOID pData, + ULONG cbData, + PVOID pParams, + ULONG cbParams, + ULONG function, + ULONG category, + PHFILE phDevice + ); + +APIRET +DosPhysicalDisk( + ULONG function, + PBYTE pBuf, + ULONG cbBuf, + PBYTE pParams, + ULONG cbParams + ); +#endif // NOT_IMPLEMENTED + +#endif // INCL_OS2V20_DEVICE_SUPPORT + +#ifdef INCL_OS2V20_PIPES + +/*** Pipe and Named Pipe API Calls */ + +APIRET +DosCreatePipe( + OUT PHFILE phfRead, + OUT PHFILE phfWrite, + IN ULONG PipeSize + ); + +APIRET +DosCallNPipe( + PSZ pszName, + PBYTE pInbuf, + ULONG cbIn, + PBYTE pOutbuf, + ULONG cbOut, + PULONG pcbActual, + ULONG msec + ); + +APIRET +DosConnectNPipe( + HPIPE hpipe + ); + +APIRET +DosDisConnectNPipe( + HPIPE hpipe + ); + +APIRET +DosCreateNPipe( + PSZ pszName, + PHPIPE pHpipe, + ULONG openmode, + ULONG pipemode, + ULONG cbOutbuf, + ULONG cbInbuf, + ULONG msec + ); + +APIRET +DosPeekNPipe( + HPIPE hpipe, + PBYTE pBuf, + ULONG cbBuf, + PULONG pcbActual, + PULONG pcbMore, + PULONG pState + ); + +APIRET +DosQueryNPHState( + HPIPE hpipe, + PULONG pState + ); + +APIRET +DosQueryNPipeInfo( + HPIPE hpipe, + ULONG infolevel, + PBYTE pBuf, + ULONG cbBuf + ); + +APIRET +DosQueryNPipeSemState( + HSEM hsem, + PBYTE pBuf, + ULONG cbBuf + ); + +APIRET +DosRawReadNPipe( + PSZ pszName, + ULONG cb + ); + +APIRET +DosRawWriteNPipe( + PSZ pszName, + ULONG cb + ); + +APIRET +DosSetNPHState( + HPIPE hpipe, + ULONG state + ); + +APIRET +DosSetNPipeSem( + HPIPE hpipe, + HSEM hsem, + ULONG key + ); + +APIRET +DosTransactNPipe( + HPIPE hpipe, + PBYTE pOutbuf, + ULONG cbOut, + PBYTE pInbuf, + ULONG cbIn, + PULONG pcbRead + ); + +APIRET +DosWaitNPipe( + PSZ pszName, + ULONG msec + ); + +/*** Data structures and equates used with named pipes ***/ + +struct npi_data1 { /* PipeInfo data block (returned, level 1) */ + unsigned short npi_obuflen; /* length of outgoing I/O buffer */ + unsigned short npi_ibuflen; /* length of incoming I/O buffer */ + unsigned char npi_maxicnt; /* maximum number of instances */ + unsigned char npi_curicnt; /* current number of instances */ + unsigned char npi_namlen; /* length of pipe name */ + char npi_name[1]; /* start of name */ +}; /* npi_data1 */ + +struct npss { /* QNmPipeSemState information record */ + unsigned char npss_status; /* type of record, 0 = EOI, 1 = read ok, */ + /* 2 = write ok, 3 = pipe closed */ + unsigned char npss_flag; /* additional info, 01 = waiting thread */ + unsigned short npss_key; /* user's key value */ + unsigned short npss_avail; /* available data/space if status = 1/2 */ +}; /* npss */ + +/* values in npss_status */ +#define NPSS_EOI 0 /* End Of Information */ +#define NPSS_RDATA 1 /* read data available */ +#define NPSS_WSPACE 2 /* write space available */ +#define NPSS_CLOSE 3 /* pipe in CLOSING state */ + +/* values in npss_flag */ +#define NPSS_WAIT 0x01 /* waiting thread on end of pipe */ + +/* defined bits in pipe mode */ +#define NP_NBLK 0x8000 /* non-blocking read/write */ +#define NP_SERVER 0x4000 /* set if server end */ +#define NP_WMESG 0x0400 /* write messages */ +#define NP_RMESG 0x0100 /* read as messages */ +#define NP_ICOUNT 0x00FF /* instance count field */ + + +/* Named pipes may be in one of several states depending on the actions + * that have been taken on it by the server end and client end. The + * following state/action table summarizes the valid state transitions: + * + * Current state Action Next state + * + * <none> server DosMakeNmPipe DISCONNECTED + * DISCONNECTED server connect LISTENING + * LISTENING client open CONNECTED + * CONNECTED server disconn DISCONNECTED + * CONNECTED client close CLOSING + * CLOSING server disconn DISCONNECTED + * CONNECTED server close CLOSING + * <any other> server close <pipe deallocated> + * + * If a server disconnects his end of the pipe, the client end will enter a + * special state in which any future operations (except close) on the file + * descriptor associated with the pipe will return an error. + */ + +/* + * Values for named pipe state + */ + +#define NP_DISCONNECTED 1 /* after pipe creation or Disconnect */ +#define NP_LISTENING 2 /* after DosNmPipeConnect */ +#define NP_CONNECTED 3 /* after Client open */ +#define NP_CLOSING 4 /* after Client or Server close */ + + +#endif // INCL_OS2V20_PIPES + + +#ifdef INCL_OS2V20_QUEUES + +#define DC_QUEUES_NAMEPREFIX "\\QUEUES\\" + +/*** Queue API Calls */ + +APIRET +DosCreateQueue( + OUT PHQUEUE QueueHandle, + IN ULONG QueueType, + IN PSZ ObjectName + ); + +#define QUE_FIFO 0x0 +#define QUE_LIFO 0x1 +#define QUE_PRIORITY 0x2 + +APIRET +DosOpenQueue( + OUT PPID OwnerProcessId, + OUT PHQUEUE QueueHandle, + IN PSZ ObjectName + ); + +APIRET +DosCloseQueue( + IN HQUEUE QueueHandle + ); + +APIRET +DosPurgeQueue( + IN HQUEUE QueueHandle + ); + +APIRET +DosQueryQueue( + IN HQUEUE QueueHandle, + OUT PULONG CountQueuedElements + ); + + +APIRET +DosPeekQueue( + IN HQUEUE QueueHandle, + OUT PREQUESTDATA RequestInfo, + OUT PULONG DataLength, + OUT PULONG Data, + IN OUT PULONG ReadPosition, + IN BOOL32 NoWait, + OUT PBYTE ElementPriority, + IN HSEM SemHandle + ); + +APIRET +DosReadQueue( + IN HQUEUE QueueHandle, + OUT PREQUESTDATA RequestInfo, + OUT PULONG DataLength, + OUT PULONG Data, + IN ULONG ReadPosition, + IN BOOL32 NoWait, + OUT PBYTE ElementPriority, + IN HSEM SemHandle + ); + +APIRET +DosWriteQueue( + IN HQUEUE QueueHandle, + IN ULONG SenderData, + IN ULONG DataLength, + IN PBYTE Data, + IN ULONG ElementPriority + ); + +#endif // INCL_OS2V20_QUEUES + +#ifdef INCL_OS2V20_ERRORS + +#include "os2err.h" + +#endif // INCL_OS2V20_ERRORS + +// +// The following error codes are defined by the OS/2 Emulation Subsystem +// server as a means of communicating with the stub procedures in the OS/2 +// Client DLL. +// + +#define ERROR_SS_RETRY 0xF000 +#define ERROR_SS_UNKNOWN_STATUS 0xF800 + +APIRET +DosNullApiCall( + IN LONG CountArguments, + IN PCHAR *Arguments OPTIONAL + ); diff --git a/private/os2/inc/os2win.h b/private/os2/inc/os2win.h new file mode 100644 index 000000000..4289356c7 --- /dev/null +++ b/private/os2/inc/os2win.h @@ -0,0 +1,767 @@ +/*++ + +Copyright (c) 1989 Microsoft Corporation + +Module Name: + + os2win.h + +Abstract: + + Prototypes for win32 functions that are called from NT only os2ss files. + +Author: + + Yaron Shamir (yarons) 2-Nov-1992 + +Environment: + + User Mode Only + +Revision History: + +--*/ + +#ifndef _WINDOWS_ + +#ifndef DWORD +typedef long int DWORD; +#endif +typedef unsigned short WORD; +typedef unsigned int UINT; +#define APIENTRY +#ifndef BOOL +typedef long int BOOL; +#endif +#ifndef LPBOOL +typedef BOOL *LPBOOL; +#endif + + + // + // Termination commands - communication to Os2TerminationThread (srvwin.c) + // +typedef enum _OS2_TERMCMD_TYPE { + Os2TerminateProcess = 1, + Os2TerminateThread, + Os2MaxTermCmd +} OS2_TERMCMD_TYPE; + +typedef struct _OS2_TERMCMD { + OS2_TERMCMD_TYPE op; + HANDLE Handle; + PVOID Param1; + PVOID Param2; +} OS2_TERMCMD, *POS2_TERMCMD; + +// winbase.h + +#ifndef WAIT_FAILED +#define WAIT_FAILED (DWORD)0xFFFFFFFF +#endif + +#if PMNT +ULONG +SetThreadAffinityMask( + HANDLE hThread, + DWORD dwThreadAffinityMask + ); +#endif // PMNT + +ULONG +GetCurrentProcessId( + VOID + ); + +HANDLE +GetCurrentProcess( + VOID + ); + +HANDLE +GetCurrentThread( + VOID + ); + +HANDLE +OpenProcess( + ULONG dwDesiredAccess, + BOOLEAN bInheritHandle, + ULONG dwProcessId + ); + +#define CREATE_SUSPENDED 0x00000004 +#define WAIT_OBJECT_0 ((STATUS_WAIT_0 ) + 0 ) +#define MAX_PATH 260 +#define STD_INPUT_HANDLE (ULONG)-10 +#define STD_OUTPUT_HANDLE (ULONG)-11 +#define STD_ERROR_HANDLE (ULONG)-12 +#define INVALID_HANDLE_VALUE (HANDLE)-1 +#define MB_OK 0x00000000L +#define MB_OKCANCEL 0x00000001L +#define MB_ABORTRETRYIGNORE 0x00000002L +#define MB_YESNOCANCEL 0x00000003L +#define MB_YESNO 0x00000004L +#define MB_RETRYCANCEL 0x00000005L +#define MB_ICONHAND 0x00000010L +#define MB_ICONQUESTION 0x00000020L +#define MB_ICONEXCLAMATION 0x00000030L +#define MB_ICONASTERISK 0x00000040L +#define MB_ICONINFORMATION MB_ICONASTERISK +#define MB_ICONSTOP MB_ICONHAND +#define MB_APPLMODAL 0x00000000L +#define MB_SETFOREGROUND 0x00010000L +#define IDOK 1 +#define IDCANCEL 2 +#define IDABORT 3 +#define IDRETRY 4 +#define IDIGNORE 5 +#define IDYES 6 +#define IDNO 7 +#define RESOURCETYPE_ANY 0x00000000 + + +typedef struct _NETRESOURCEA { + ULONG dwScope; + ULONG dwType; + ULONG dwDisplayType; + ULONG dwUsage; + PSZ lpLocalName; + PSZ lpRemoteName; + PSZ lpComment ; + PSZ lpProvider; +}NETRESOURCEA, *PNETRESOURCEA; + +#ifndef PFNTHREAD +typedef ULONG (*PFNTHREAD)( + ULONG lpThreadParameter + ); + +#endif // PFNTHREAD + +HANDLE +CreateThread( + PVOID lpThreadAttributes, // LPSECURITY_ATTRIBUTES lpThreadAttributes, + ULONG dwStackSize, + PFNTHREAD lpStartAddress, + PVOID lpParameter, + ULONG dwCreationFlags, + PULONG lpThreadId + ); + +VOID +ExitThread( + ULONG dwExitCode + ); + +ULONG +ResumeThread( + HANDLE hThread + ); + +BOOLEAN +TerminateThread( + HANDLE hThread, + ULONG dwExitCode + ); + +BOOLEAN +TerminateProcess( + HANDLE hProcess, + ULONG dwExitCode + ); + +VOID +Sleep( + ULONG dwMilliseconds + ); + +ULONG +GetTickCount( + VOID + ); + +#ifndef ERROR_NO_MEDIA_IN_DRIVE +#define ERROR_NO_MEDIA_IN_DRIVE 1112L +#endif + +ULONG +GetLastError( + VOID + ); + +BOOLEAN +GetExitCodeProcess( + HANDLE hProcess, + PULONG lpExitCode + ); +#ifndef INFINITE +#define INFINITE 0xFFFFFFFF // Infinite timeout +#endif + +ULONG +WaitForSingleObject( + HANDLE hObject, + ULONG dwTimeout + ); + +BOOLEAN +WriteFile( + HANDLE hFile, + VOID *lpBuffer, + ULONG nNumberOfBytesToWrite, + PULONG lpNumberOfBytesWritten, + PVOID lpOverlapped + ); + +BOOLEAN +DuplicateHandle( + HANDLE hSourceProcessHandle, + HANDLE hSourceHandle, + HANDLE hTargetProcessHandle, + PHANDLE lpTargetHandle, + ULONG dwDesiredAccess, + BOOLEAN bInheritHandle, + ULONG dwOptions + ); + +HANDLE +GetStdHandle( + ULONG nStdHandle + ); + +BOOLEAN +SetStdHandle( + ULONG nStdHandle, + HANDLE hHandle + ); + +BOOLEAN +CloseHandle( + HANDLE hObject + ); + +PVOID +GetEnvironmentStrings( + VOID + ); + +BOOLEAN +SetEnvironmentVariableA( + PSZ lpName, + PSZ lpValue + ); + +ULONG +WNetGetConnectionA( + PSZ lpName, + PSZ lpData, + PULONG pCb + ); + +ULONG +GetEnvironmentVariableA( + PSZ lpName, + PSZ lpBuffer, + ULONG nSize + ); + +BOOLEAN +SetCurrentDirectoryA( + PSZ DirectoryName); + +DWORD +GetCurrentDirectoryA( + DWORD nSize, + PSZ DirectoryName); + +HANDLE +OpenProcess( + ULONG dwDesiredAccess, + BOOLEAN bInheritHandle, + ULONG dwProcessId + ); + +VOID +ExitProcess( + int ExitCode + ); + +PUCHAR +GetCommandLineA( + VOID + ); + +int +MessageBoxExW( + HANDLE hWnd, + PWSTR lpText, + PWSTR lpCaption, + UINT uType, + WORD wLanguageId); + +ULONG +SetErrorMode( + ULONG uMode + ); + +ULONG +GetLogicalDrives( + VOID + ); + +UINT +GetSystemDirectoryA( + LPSTR lpBuffer, + UINT uSize + ); + +UINT +GetSystemDirectoryW( + LPWSTR lpBuffer, + UINT uSize + ); + +ULONG +WNetAddConnection2A( + PNETRESOURCEA lpNetResource, + PSZ lpPassword, + PSZ lpUserName, + ULONG dwFlags + ); + +ULONG +WNetCancelConnection2A( + PSZ lpName, + ULONG dwFlags, + ULONG fForce + ); + +// wincon.h + +BOOLEAN +SetConsoleTitleA( + PSZ lpConsoleTitle + ); + +#if PMNT +ULONG +GetConsoleTitleA( + PSZ lpConsoleTitle, + ULONG lConsoleTitleLength + ); + +#ifdef JAPAN //MSKK [ShigeO] Aug 6, 1993 + +// wingdi.h + +HANDLE +CreateFontIndirectA( + PVOID lpLogFont + ); + +HANDLE +CreateDCA( + LPCSTR lpszDriver, + LPCSTR lpszDevice, + LPCSTR lpszOutput, + PVOID lpInitdata + ); + +BOOLEAN +GetTextMetricsA( + HANDLE hdc, + PVOID lptm + ); + +HANDLE +SelectObject( + HANDLE hdc, + HANDLE hgdiobj + ); + +UINT +GetStringBitmapA( + HANDLE hdc, + LPCSTR lpszStr, + UINT cbStr, + UINT cbData, + PVOID lpSB + ); + +#endif //JAPAN +#endif // PMNT + +#define CTRL_C_EVENT 0 +#define CTRL_BREAK_EVENT 1 +#define CTRL_CLOSE_EVENT 2 +// 3 is reserved! +// 4 is reserved! +#define CTRL_LOGOFF_EVENT 5 +#define CTRL_SHUTDOWN_EVENT 6 + +BOOLEAN +GenerateConsoleCtrlEvent( + ULONG dwCtrlEvent, + ULONG dwProcessGroupId + ); + +// winnls.h + +int +MultiByteToWideChar( + UINT CodePage, + ULONG dwFlags, + LPCSTR lpMultiByteStr, + int cchMultiByte, + LPWSTR lpWideCharStr, + int cchWideChar + ); + +int +WideCharToMultiByte( + UINT CodePage, + ULONG dwFlags, + LPCWSTR lpWideCharStr, + int cchWideChar, + LPSTR lpMultiByteStr, + int cchMultiByte, + LPSTR lpDefaultChar, + LPBOOL lpUsedDefaultChar + ); + +BOOLEAN +OpenIcon( + HANDLE hwnd + ); + +BOOLEAN +SetForegroundWindow( + HANDLE hwnd + ); + +ULONG +GetLogicalDrives( VOID ); + +#endif // _WINDOWS_ + + // + // Internal Routines (Ow2Xxx) to interface between client side code + // and os2ses modules which inturn call win32 + // + +// This bit is set in Flags for a window program. The process is created with +// CREATE_NEW_PROCESS_GROUP (which enable us to send CTRL_EVENT to all the group) + +#define EXEC_WINDOW_PROGRAM 0x80000000 + + // + // Used to pass standard handle redir info in ExecPgm/StartSession + // + +#define STDFLAG_IN 0x1L // enables stdin redir +#define STDFLAG_OUT 0x2L // enables stdout redir +#define STDFLAG_ERR 0x4L // enables stderr redir +#define STDFLAG_ALL 0x7L // mask for previous 3 +#define STDFLAG_CLOSEIN 0x10L // indicates that stdin should be closed after use +#define STDFLAG_CLOSEOUT 0x20L // indicates that stdout should be closed after use +#define STDFLAG_CLOSEERR 0x40L // indicates that stderr should be closed after use +#define STDFLAG_CLOSEALL 0x70L // mask for previous 3 + +typedef struct _OS2_STDHANDLES { + ULONG Flags; + HANDLE StdIn; + HANDLE StdOut; + HANDLE StdErr; +} OS2_STDHANDLES, *POS2_STDHANDLES; + +HANDLE +Ow2GetNulDeviceHandle( + VOID + ); + +ULONG +Ow2ExecPgm( + IN ULONG Flags, + IN PSZ Arguments OPTIONAL, + IN PSZ Variables OPTIONAL, + IN PSZ ImageFileName, +#if PMNT + IN ULONG IsPMApp, +#endif // PMNT + IN PVOID SessionStartData OPTIONAL, + IN POS2_STDHANDLES StdStruc, + OUT HANDLE *pHandle, + OUT HANDLE *tHandle, + OUT ULONG *dwProcessId + ); + +VOID +Ow2WinExitCode2ResultCode( + IN ULONG Status, + OUT PULONG pReturnCode, + OUT PULONG pExitReason + ); + +ULONG +Ow2HardErrorPopup( + IN int Drive, + IN BOOLEAN WriteProtectError, + OUT int * ReturnedAction, + IN PUCHAR AppName + ); + +ULONG +Ow2ConReadFile( + IN HANDLE hFile, + IN ULONG Length, + OUT PVOID Buffer, + OUT PULONG BytesRead + ); + +ULONG +Ow2ConWriteFile( + IN HANDLE hFile, + IN ULONG Length, + IN PVOID Buffer, + OUT PULONG BytesWritten + ); + +ULONG +Ow2ConCloseHandle( + IN HANDLE hFile + ); + +ULONG +Ow2ConBeep( + IN ULONG dwFreq, + IN ULONG dwDuration + ); + +/* + * internal vio routine to perform: + * + * VioWriteTTYStr - in viotty.c + * VioWriteCellStr - used also by violvb.c + * VioReadCellStr - used also by violvb.c + * VioGetLVBBuf - in violvb.c + * VioShowLVBBuf - in violvb.c +*/ + +ULONG +Ow2VioWriteTTYStr( + IN PUCHAR string, + IN ULONG Length, + IN ULONG RequestType + ); + +ULONG +Ow2VioWriteCellStr( + IN ULONG Length, + IN ULONG Row, + IN ULONG Col, + IN PVOID SourBuffer + ); + +ULONG +Ow2VioWriteCharStr( + IN ULONG Length, + IN ULONG Row, + IN ULONG Col, + IN PVOID SourBuffer + ); + +ULONG +Ow2VioWriteCharStrAtt( + IN ULONG Length, + IN ULONG Row, + IN ULONG Col, + IN PVOID SourBuffer, + IN PUCHAR AttrBuffer + ); + +ULONG +Ow2VioReadCellStr( + IN OUT PULONG Length, + IN ULONG Row, + IN ULONG Col, + IN PVOID DestBuffer + ); + +ULONG +Ow2VioReadCharStr( + IN OUT PULONG pLength, + IN ULONG Row, + IN ULONG Col, + IN PVOID DestBuffer + ); + +ULONG +Ow2VioFillNChar( + IN ULONG Number, + IN ULONG Row, + IN ULONG Col, + IN PVOID SourBuffer + ); + +ULONG +Ow2VioFillNAttr( + IN ULONG Number, + IN ULONG Row, + IN ULONG Col, + IN PVOID SourBuffer + ); + +ULONG +Ow2VioFillNCell( + IN ULONG Number, + IN ULONG Row, + IN ULONG Col, + IN PVOID SourBuffer + ); + +ULONG +Ow2VioScroll( + IN PVOID VioScroll, + IN ULONG ScrollDirection + ); + +ULONG +Ow2VioGetConfig( + IN OUT PVOID VioConfig + ); + +ULONG +Ow2VioSetMode( + IN PVOID VioMode + ); + +ULONG +Ow2VioGetMode( + IN OUT PVOID VioMode + ); + +ULONG +Ow2VioSetCurPos( + IN ULONG Row, + IN ULONG Column + ); + +ULONG +Ow2VioGetCurPos( + IN PUSHORT pRow, + IN PUSHORT pColumn + ); + +ULONG +Ow2VioSetCurType( + IN PVOID VioCurType + ); + +ULONG +Ow2VioGetCurType( + IN OUT PVOID VioCurType + ); + +ULONG +Ow2VioSetNewCp( + IN ULONG CodePage + ); + +ULONG +Ow2VioPopUp( + ULONG PopUpMode, + PUCHAR AppName + ); + +ULONG +Ow2VioEndPopUp(); + +ULONG +Ow2VioGetLVBBuf( + IN PULONG Length + ); + +ULONG +Ow2VioShowLVBBuf( + IN ULONG Length, + IN ULONG Offset + ); + +#ifdef DBCS +// MSKK Apr.20.1993 V-AkihiS +ULONG +Ow2VioCheckCharType( + OUT PVOID pchType, + IN ULONG Row, + IN ULONG Column + ); +#endif + +ULONG +Ow2PrintOpen( + IN ULONG Attribute, + IN ULONG OpenFlags, + IN ULONG OpenMode, + IN PUCHAR PrinterName, + IN OUT PHANDLE phPrinter, + IN OUT PULONG Action + ); + +ULONG +Ow2PrintClose( + IN HANDLE hPrinter + ); + +ULONG +Ow2PrintWrite( + IN HANDLE hPrinter, + IN PVOID Buffer, + IN OUT PULONG Length + ); + +ULONG +Ow2NlsGetCtryInfo( + IN ULONG NlsCodePage, + IN ULONG NlsCountryCode, + OUT PVOID NlsCountryInfo + ); + +ULONG +Ow2NlsGetDBCSEn( + IN ULONG NlsCodePage, + OUT PVOID NlsDBCSVec + ); + +ULONG +Ow2NlsGetCollateTable( + IN ULONG NlsCodePage, + IN ULONG NlsCountryCode, + OUT PVOID NlsColateTable + ); + +ULONG +Ow2NlsGetCaseMapTable( + IN ULONG NlsCodePage, + IN ULONG NlsCountryCode, + OUT PVOID NlsColateTable + ); + + // + // Routines for displaying and filtering Exception information - os2ses\os2.c + // + +ULONG +Ow2FaultFilter( + IN ULONG uFaultFilter, + IN PEXCEPTION_POINTERS lpExP); + +VOID Ow2DisplayExceptionInfo( VOID ); + +#ifdef DBCS +// MSKK Sep.27.1993 V-AkihiS +#define Ow2NlsIsDBCSLeadByte(NlsTestChar, NlsCodePage) \ + ((NlsCodePage == SesGrp->PrimaryCP) || (NlsCodePage == 0)) \ + ? IsDBCSLeadByte(NlsTestChar) : FALSE +#endif + diff --git a/private/os2/inc/pmnt.h b/private/os2/inc/pmnt.h new file mode 100644 index 000000000..e7fbad4a3 --- /dev/null +++ b/private/os2/inc/pmnt.h @@ -0,0 +1,306 @@ +/*++ + +Copyright (c) 1990 Microsoft Corporation + +Module Name: + + pmnt.h + +Abstract: + + This is the include file that defines all constants and types for + the PMNTDD device & the PMNT.DLL services. + Define INCL_32BIT before #include statement if and only if this file is + included by a 32-bit C module (ie OS/2 ss or PMNTDD.SYS). + +Author: + + Patrick Questembert (PatrickQ) 03-Aug-1992. + +Revision History: + +--*/ + +#ifndef _PMNTINCLUDE_ +#define _PMNTINCLUDE_ + +#ifndef INCL_32BIT +#define INCL_16BIT +#endif // INCL_32BIT + +#define PMNT_DAYTONA 1 // Define this ONLY for post 570 builds (i.e. DAYTONA) + +/***************************************************************************/ +/* Below is the structure returned by the 32-bit code down to PM from the */ +/* ReadConsoleInputA API. This */ +/* duplicates the WIN32 Console structure (29 Nov 92) - it is defined here */ +/* so that the 16-bit PM code is unaffected by possible changes to the */ +/* WIN32 structure. */ +/***************************************************************************/ + +#ifdef INCL_16BIT +#pragma pack(1) +#endif + +typedef struct _PM_KEY_INPUT_RECORD { + UCHAR monflags; + UCHAR scancode; + UCHAR xlatedchar; + UCHAR xlatedscan; + USHORT shiftDBCS; + USHORT shiftstate; + ULONG time; + USHORT ddflags; + } PM_KEY_INPUT_RECORD; + +#ifdef INCL_16BIT +#pragma pack () +#endif + +#ifdef INCL_16BIT +#pragma pack(4) // Because the structures below will come from NT +#endif + +typedef struct _PMNT_KEY_EVENT_RECORD { + ULONG bKeyDown; // ULONG instead of BOOL + USHORT wRepeatCount; // USHORT instead of WORD + USHORT wVirtualKeyCode; // USHORT instead of WORD + USHORT wVirtualScanCode; // USHORT instead of WORD + union { + USHORT UnicodeChar; // USHORT instead of WCHAR + CHAR AsciiChar; + } uChar; + ULONG dwControlKeyState; // ULONG instead of DWORD +} PMNT_KEY_EVENT_RECORD; + +typedef struct _PMNT_COORD { + SHORT X; + SHORT Y; +} PMNT_COORD; + +typedef struct _PMNT_MOUSE_EVENT_RECORD { + PMNT_COORD dwMousePosition; // PMNT_COORD instead of COORD + ULONG dwButtonState; // ULONG instead of DWORD + ULONG dwControlKeyState; // ULONG instead of DWORD + ULONG dwEventFlags; // ULONG instead of DWORD +} PMNT_MOUSE_EVENT_RECORD; + +typedef struct _PMNT_WINDOW_BUFFER_SIZE_RECORD { + PMNT_COORD dwSize; +} PMNT_WINDOW_BUFFER_SIZE_RECORD; + +typedef struct _PMNT_MENU_EVENT_RECORD { + unsigned int dwCommandId; +} PMNT_MENU_EVENT_RECORD; + +typedef struct _PMNT_FOCUS_EVENT_RECORD { + ULONG bSetFocus; // ULONG instead of BOOL +} PMNT_FOCUS_EVENT_RECORD; + +typedef struct _PMNT_INPUT_RECORD { + USHORT EventType; + union { + PMNT_KEY_EVENT_RECORD KeyEvent; + PMNT_MOUSE_EVENT_RECORD MouseEvent; + PMNT_WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent; + PMNT_MENU_EVENT_RECORD MenuEvent; + PMNT_FOCUS_EVENT_RECORD FocusEvent; + } Event; +} PMNT_INPUT_RECORD; + +#define PMNT_KEY_EVENT 0x0001 // Event contains key event record +#define PMNT_MOUSE_EVENT 0x0002 // Event contains mouse event record +#define PMNT_WINDOW_BUFFER_SIZE_EVENT 0x0004 // Event contains window change event record +#define PMNT_MENU_EVENT 0x0008 // Event contains menu event record +#define PMNT_FOCUS_EVENT 0x0010 // event contains focus change + +/* Flags for the WIN32 Console mouse event mask */ +#define PMNT_MOUSE_CLICK 0x0000 +#define PMNT_MOUSE_MOVED 0x0001 +#define PMNT_DOUBLE_CLICK 0x0002 + +#ifdef INCL_16BIT +#pragma pack(1) +#endif + +typedef struct _PM_MOUSE_INPUT_RECORD { + USHORT EventMask; + ULONG Time; + USHORT absY; + USHORT absX; + } PM_MOUSE_INPUT_RECORD; + +#define PMNT_SQ_KBD 1 /* See ..\h\pmwinp.h, SQ_XXX */ +#define PMNT_SQ_MOU 2 + +typedef struct _PM_INPUT_RECORD { + USHORT EventType; + union + { + PM_KEY_INPUT_RECORD KeyEvent; + PM_MOUSE_INPUT_RECORD MouseEvent; + } Event; +} PM_INPUT_RECORD; + +#ifdef INCL_16BIT +#pragma pack () +#endif + + +#ifdef INCL_16BIT +#pragma pack (4) /* Because structures are aligned to DWORD in 32-bit DLL */ +#endif + +#ifndef INCL_16BIT +#if DBG +#define KdPrint(_x_) DbgPrint _x_ +#else +#define KdPrint(_x_) +#endif // else of DBG +#endif // else of INCL_16BIT + +/***************************************************************************/ +/* PMNTDD.SYS definitions */ +/***************************************************************************/ + +#define IOCTL_PMNT_IO_MAP 0L +#define IOCTL_PMNT_MEM_MAP 1L +#define IOCTL_PMNT_REGISTER_HARDWARE 2L + +#ifndef INCL_16BIT +#include "devioctl.h" + +#define PMNTDD_DEVICE_TYPE FILE_DEVICE_BEEP + +#define PMNTDD_DEVICE_NAME "\\Device\\PMNTDD" +#define PMNTDD_DEVICE_NAME_U L"\\Device\\PMNTDD" + +#define IOCTL_PMNTDD_IO_MAP CTL_CODE((unsigned long)PMNTDD_DEVICE_TYPE, IOCTL_PMNT_IO_MAP, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_PMNTDD_MEM_MAP CTL_CODE((unsigned long)PMNTDD_DEVICE_TYPE, IOCTL_PMNT_MEM_MAP, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_PMNTDD_REGISTER_HARDWARE \ + CTL_CODE((unsigned long)PMNTDD_DEVICE_TYPE, IOCTL_PMNT_REGISTER_HARDWARE, METHOD_BUFFERED, FILE_ANY_ACCESS) +#endif // ndef INCL_16BIT + +/* Data types for the PMNTRegisterDisplayHardware routine */ + +#define PMNT_IOPM_DATA_TYPE_PORT 0L +#define PMNT_IOPM_DATA_TYPE_MEMORY 1L + +typedef struct _PMNT_IOPM_DATA_ENTRY { + ULONG Base; + ULONG Length; +} PMNT_IOPM_DATA_ENTRY, *PPMNT_IOPM_DATA_ENTRY; + +typedef struct _PMNT_IOPM_DATA { + ULONG EntryType; // PMNT_IOPM_DATA_TYPE_PORT or PMNT_IOPM_DATA_TYPE_MEMORY + ULONG NumEntries; + PMNT_IOPM_DATA_ENTRY Entry[1]; +} PMNT_IOPM_DATA, *PPMNT_IOPM_DATA; + +typedef struct _PMNT_IOPM_IOCTL_DATA +{ + ULONG ThreadHandle; + PMNT_IOPM_DATA DriverData; +} PMNT_IOPM_IOCTL_DATA, *PPMNT_IOPM_IOCTL_DATA; + +/* Data types for the PMNTMemMap routine */ + +//BUGBUG - needed anymore ??? +typedef struct _PMNT_MEM_DATA +{ + ULONG PhysicalAddress; + ULONG VirtualAddress; + ULONG Length; +} PMNT_MEM_DATA, *PPMNT_MEM_DATA; + +typedef struct _PMNT_MEMMAP_RESULTS +{ + ULONG VirtualAddress; + ULONG Length; +} PMNT_MEMMAP_RESULTS; + +/* Data structure for passing parameters to PMNTDD.SYS via PMNT.DLL */ +typedef struct _PMNT_IOCTL_DD_IOCTL_PARAMS +{ + ULONG Request; + ULONG InputBuffer; + ULONG InputBufferLength; + ULONG OutputBuffer; + ULONG OutputBufferLength; +} PMNT_IOCTL_DD_IOCTL_PARAMS; + +/* IOCTL codes for the PMNT.DLL PMNTIOCTL service */ +#define PMNT_IOCTL_DD_IOCTL 2 /* PMNTDD.SYS IOCTL services */ +#define PMNT_IOCTL_DUMP_SEGMENT_TABLE 3 /* Debug service - dump segment table */ +#define PMNT_IOCTL_HIDE_WIN32_WINDOW 4 /* Hide WIN32 Console window - for CBA */ + +#ifdef INCL_16BIT +#pragma pack () /* Restore default */ +#endif + +#ifdef INCL_16BIT +/***************************************************************************/ +/* PMNT.DLL exported services which can be called directly without using */ +/* PMNT.LIB. */ +/***************************************************************************/ +extern VOID APIENTRY PMNTSetFullScreen(USHORT Register); +extern USHORT APIENTRY PMNTGetWin32Hwnd(ULONG far *pWin32ShellHwnd); +extern USHORT APIENTRY PMNTSetFocus(ULONG Win32Hwnd); +extern USHORT APIENTRY PMNTCloseWindow(VOID); +extern USHORT APIENTRY PMNTGetNextEvent(PMNT_INPUT_RECORD far *ppm_input_rec); +extern USHORT APIENTRY PMNTGetPgmName(char far *Buffer, short BufferLength); +extern USHORT APIENTRY PMNTSetConsoleTitle(PSZ Buffer); +extern USHORT APIENTRY PMNTGetFullScreen(ULONG Operation); +extern USHORT APIENTRY PMNTIOCTL(USHORT req, PVOID pin, PVOID pout); +extern VOID APIENTRY PMNTDbgPrint(PSZ str, ULONG l1, ULONG l2, ULONG l3, ULONG l4); +extern USHORT APIENTRY PMNTMemMap(PUSHORT PSel); +extern USHORT APIENTRY PMNTSetPMshellFlag(VOID); +extern VOID APIENTRY PMNTGetSystemTime(PULONG pTime); +extern USHORT APIENTRY PMNTRegisterDisplayAdapter(PMNT_IOPM_DATA far *MemoryRange, PMNT_IOPM_DATA far *IORange, USHORT col, USHORT row); +extern USHORT APIENTRY PMNTIOMap(VOID); +extern USHORT APIENTRY PMNTIsSessionRoot(VOID); +extern USHORT APIENTRY PMNTIdentifyCodeSelector( USHORT, PVOID ); +extern USHORT APIENTRY PMNTCreateHiddenThread(PVOID pfnFun, PUSHORT pTid, PBYTE pbStack); +extern USHORT APIENTRY PMNTProcessIsPMShell(VOID); +extern USHORT APIENTRY PMNTQueryScreenSize(PUSHORT xRight, PUSHORT yTop); +extern USHORT APIENTRY PMNTCreateFontIndirect(PVOID lplf); +extern USHORT APIENTRY PMNTGetTextMetrics(ULONG ulFont, PVOID lptm); +extern USHORT APIENTRY PMNTGetStringBitmap(ULONG ulFont, PSZ lpszStr, ULONG cbStr, ULONG cbData, PVOID lpSB); +extern USHORT APIENTRY PMNTDeleteObject(ULONG ulFont); +extern USHORT APIENTRY PMNTGetEUDCTimeStamp(VOID); +extern USHORT APIENTRY PMNTDisableWin32IME(VOID); +extern USHORT APIENTRY PMNTSetShutdownPriority(ULONG NewPriority, USHORT Disable); + +/***************************************************************************/ +/* Services provided by PMNT.LIB */ +/***************************************************************************/ +extern VOID _cdecl far PMNTPrint(PSZ str, ...); +extern USHORT _cdecl far PMNTCreateThread(PFN Thread, USHORT StackSize); +#endif // INCL_16BIT + +#ifdef INCL_32BIT +/* Values returned by the server to specify type of application loaded */ +#define APPTYPE_CHARMODE 0 +#define APPTYPE_PM 1 +#define APPTYPE_PMSHELL 2 +#define APPTYPE_PMSHELL_CHILD 4 + +extern ULONG PMFlags; + +#define ProcessIsPMProcess() (PMFlags & APPTYPE_PM) +#define ProcessIsPMShell() (PMFlags & APPTYPE_PMSHELL) +#define ProcessIsPMApp() (ProcessIsPMProcess() && !ProcessIsPMShell()) +#define ProcessIsPMShellChild() (PMFlags & APPTYPE_PMSHELL_CHILD) +#define SetPMShellFlag() PMFlags |= APPTYPE_PMSHELL; +#define SetPMAppFlag() PMFlags |= APPTYPE_PM; + +/***************************************************************************/ +/* PM\NT specific error codes and popup */ +/***************************************************************************/ +#define ERROR_PMSHELL_NOT_UP 0xff01 +#define ERROR_2ND_PMSHELL 0xff02 +#define ERROR_PMSHELL_FULLSCREEN 0xff03 +extern VOID Ow2PMShellErrorPopup(PSZ AppName,int rc); +#endif //INCL_32BIT + +#endif /* _PMNTINCLUDE_ */ diff --git a/private/os2/inc/sesgrp.h b/private/os2/inc/sesgrp.h new file mode 100644 index 000000000..4ca436494 --- /dev/null +++ b/private/os2/inc/sesgrp.h @@ -0,0 +1,180 @@ +/*++ + +Copyright (c) 1990 Microsoft Corporation + +Module Name: + + sesgrp.h + +Abstract: + + This module defines the OS/2 subsystem memory view of Session-Group + +Author: + + Michael Jarus (mjarus) 20-Nov-1991 + +Revision History: + +--*/ + + +/* + * This file defines the SesGrp : a section, which holds all common + * parameters for the entire session (SES_GROUP). + * + * It's initilized to zero by the os2srv (which also init the NLS and + * some other parameters). + * + * Parameters can be put into SesGrp in os2ses/client only after it + * gets the section from the os2srv (after ntinitss.CtrlListen is called). + */ + +typedef struct _OS2_SES_GROUP_PARMS +{ + USHORT FirstProcess; + ULONG InTermination; + + HANDLE LockProcess; + ULONG PrinterMonitor; + ULONG OutputModeFlags; // Console Output Mode + ULONG DefaultWinOutputMode; // Default Win Console Input Mode + ULONG WinProcessNumberInSession; + ULONG WinSyncProcessNumberInSession; + + /* + * handles (and flags) for in/out/Std, + */ + + HANDLE hConsoleInput; + HANDLE hConsoleOutput; + HANDLE StdIn; + HANDLE StdOut; + HANDLE StdErr; + USHORT StdInFlag; // TRUE if console (not redirected) + USHORT StdOutFlag; + USHORT StdErrFlag; + USHORT StdInFileType; // FileType for HandleTable + USHORT StdOutFileType; + USHORT StdErrFileType; + USHORT StdInHandleCount; // Count of open handle + USHORT StdOutHandleCount; + USHORT StdErrHandleCount; + + /* + * VIO Parameters + */ + + ULONG PauseScreenUpdate; + USHORT BytesPerCell; + USHORT VioLengthMask; + WCHAR WinSpaceChar; + WCHAR WinBlankChar; + VIOMODEINFO Os2ModeInfo; + SHORT MinRowNum; + SMALL_RECT ScreenRect; // Screen Rect for WriteConsoleOutput + VIOCURSORINFO CursorInfo; // Cursor Info + SHORT ScreenColNum; // col number + SHORT ScreenRowNum; // row number + ULONG ScreenSize; // screen size in bytes + SHORT CellHSize; // Horizontal Cell size + SHORT CellVSize; // Vertical Cell size + USHORT VioLength2CellShift; + ULONG dwWinCursorSize; + BOOLEAN bWinCursorVisible; + + /* + * TTY Parameters + */ + + ULONG AnsiMode; // state of AnsiFlag + UCHAR AnsiCellAttr[3]; // attribute of TTY (3 bytes for MSKK) + UCHAR ansi_base; + UCHAR ansi_foreground; + UCHAR ansi_background; + UCHAR ansi_reverse; + UCHAR ansi_bold; + UCHAR ansi_cancel; + UCHAR ansi_faint; + UCHAR ansi_italic; + UCHAR ansi_blink; + UCHAR ansi_blue; + COORD WinCoord; + USHORT WinAttr; + + /* + * LVB Parameters + */ + + ULONG MaxLVBsize; + ULONG LVBsize; + BOOLEAN LVBOn; + + /* + * POPUP Parameters + */ + + HANDLE hConsolePopUp; + HANDLE PopUpProcess; + USHORT PopUpFlag; + + /* + * Kbd parameters + */ + + ULONG KbdInFocus; + PVOID PhyKbd; + ULONG KeysOnFlag; + ULONG KeyboardCountry; + ULONG KeyboardType; + USHORT NoKbdFocus; + USHORT ModeFlag; // 0 - ASCII, 1 - Binary + + /* + * NLS definitions. + * If you add anything or change the order, do it also in server\srvnls.c + */ + + ULONG Os2srvUseRegisterInfo; // set when NLS parms are from the registry + // reset when they are inherit from Win32 + ULONG Win32CountryCode; // Win32 NLS parms: country code + ULONG Win32OEMCP; // OEM CP + ULONG Win32ACP; // ACP + ULONG Win32LANGID; // LANGID + ULONG Win32LCID; // LCID + ULONG CountryCode; // Os2ss NLS parms: country code + ULONG DosCP; // Dos CP + ULONG PrimaryCP; // Primary CP + ULONG SecondaryCP; // Secondary CP + ULONG VioCP; // Vio CP + ULONG KbdCP; // Kbd CP + ULONG Os2ssLCID; // LCID + ULONG LanguageID; // message file LanguageID + UCHAR KeyboardLayout[2]; // Keyboard Layout +#if PMNT + UCHAR KeyboardName[4]; // Keyboard Name +#endif // PMNT + OD2_DBCS_VECTOR_ENTRY PriDBCSVec; + OD2_DBCS_VECTOR_ENTRY SecDBCSVec; + UCHAR PriCollateTable[256]; // Primary Collate Table + UCHAR SecCollateTable[256]; // Secondary Collate Table + UCHAR PriCaseMapTable[256]; // Primary Case Map Table + UCHAR SecCaseMapTable[256]; // Secondary Case Map Table + COUNTRYINFO CountryInfo; // Country Info + ULONG DBCSCountryFlag; // + UCHAR SystemDirectory[CCHMAXSYSTEMPATH]; + + /* + * End of NLS definitions. + */ + +} OS2_SES_GROUP_PARMS, *POS2_SES_GROUP_PARMS; + + /* + * KeyboardType + */ + +#define OS2SS_EN_KBD 0 +#define OS2SS_AT_KBD 1 +#define OS2SS_ENNEW_KBD 2 + diff --git a/private/os2/inc/sesport.h b/private/os2/inc/sesport.h new file mode 100644 index 000000000..408337946 --- /dev/null +++ b/private/os2/inc/sesport.h @@ -0,0 +1,659 @@ + +#ifndef _SESPORT_ + +#define _SESPORT_ + +#ifndef _WINCON_ + +typedef struct _COORD +{ + SHORT X; /* Row */ + SHORT Y; /* Col */ +} COORD, *PCOORD; + +typedef struct _SMALL_RECT +{ + SHORT Left; + SHORT Top; + SHORT Right; + SHORT Bottom; +} SMALL_RECT, *PSMALL_RECT; + +#endif /* _WINCON_ */ + +#include "os2sub.h" +#include "os2nls.h" +#include "sesgrp.h" +#ifndef BYTE +typedef UCHAR BYTE; +#endif +#ifndef PBYTE +typedef UCHAR *PBYTE; +#endif +#include "os2dev.h" + +//#include "wincon.h" should be called by the caller to this +/* this files need to be included if NTOS2_ONLY macro doesn't protect + * tructures with PORT_MESSAGE: + * + * #include <ntdef.h> + * #include <ntkeapi.h> + * #include <ntseapi.h> + * #include <ntpsapi.h> + * #include <ntlpcapi.h> + */ + +#define U_OS2_SS_INITIALIZATION_EVENT L"OS2SSINITIALIZATIONEVENT" + +/* + * os2srv port to accept all requests (CON and API) from clients + */ + +#define U_OS2_SS_SESSION_PORT_NAME L"\\OS2SS\\SESPORT" + +/* + * Session sections and port + * + * Each session is identified by an unique id (which is define by the os2srv). + * For each session, the OS2 creates: + * + * - Section to hold all common parameters - SES_GROUP (G) + * - Port for all input requests (i.e. KBD, MOU and MON) to get to the + * first OS2.EXE in the session from all processes in that session (P). + * - Section to serve as the LVB (L) + */ + +#define U_OS2_SES_BASE_PORT_NAME L"\\OS2SS\\OS2SES" +#define U_OS2_SES_BASE_PORT_NAME_LENGTH 32 +#define U_OS2_SES_BASE_PORT_PREFIX L'P' // Port +#define U_OS2_SES_BASE_DATA_PREFIX L'D' // Data +#define U_OS2_SES_GROUP_PREFIX L'G' // Session Group Data +#define U_OS2_SES_BASE_LVB_PREFIX L'L' // LVB +#define U_OS2_SES_PAUSE_EVENT_PREFIX L'S' // ^S (pause) +#define U_OS2_SES_CTRL_PORT_SEMAPHORE_PREFIX L'T' // Data Section Semaphore +#define U_OS2_SES_KBD_PORT_SEMAPHORE_PREFIX L'K' // Kbd Port(requests) Semaphore +#define U_OS2_SES_MOU_PORT_SEMAPHORE_PREFIX L'M' // Mou Port(requests) Semaphore +#define U_OS2_SES_KBD_FOCUS_SEMAPHORE_PREFIX L'F' // KbdGetFocus(logical) +#define U_OS2_SES_POPUP_SEMAPHORE_PREFIX L'O' // PopUp +#define U_OS2_SES_SLOCK_SEMAPHORE_PREFIX L'C' // Screen Lock +#define U_OS2_SES_STD_HANDLE_LOCK_PREFIX L'H' // STD-handle lock +#define U_OS2_SES_VIOWRITE_SEMAPHORE_PREFIX L'W' // Vio Write mutex + +#define CONSTRUCT_U_OS2_SES_NAME(Name_U, t, id) \ + { \ +int __cdecl wsprintfW(LPWSTR, LPCWSTR, ...); \ + \ + wsprintfW(Name_U, L"%s\\%c%d", \ + U_OS2_SES_BASE_PORT_NAME, t, id); \ + } + +/* + * max message size + */ + +#define OS2_CON_PORT_MSG_SIZE 0x10000L +#define OS2_KBD_PORT_MSG_SIZE 0x200 +#define OS2SES_CTRL_SECTION_SIZE (OS2_CON_PORT_MSG_SIZE + OS2_KBD_PORT_MSG_SIZE) +#define KBD_OFFSET OS2_CON_PORT_MSG_SIZE + +#define OS2SES_GROUP_SECTION_SIZE sizeof(OS2_SES_GROUP_PARMS) + +/* + * section size + * + * The OS2_Ses_BASE_DATA section is combined from the following: + * + * - OS2_CON_PORT_MSG_SIZE bytes : data passed between os2.exe and client + * - OS2_KBD_PORT_MSG_SIZE bytes : kbd data passed from os2.exe to client + */ + +#define OS2_MAX_APPL_NAME 13 + +/* + * Session Console ConnectInfo struct + */ + +typedef struct _SCCONNECTINFO +{ int dummy; +} SCCONNECTINFO, *PSCCONNECTINFO; + +typedef struct _VIOSCROLL +{ SMALL_RECT ScrollRect; + SHORT cbLines; + UCHAR Cell[4]; +} VIOSCROLL, *PVIOSCROLL; + +typedef enum +{ + VIOWrtTTY, + VIOWrtStdOut, + VIOWrtStdErr, + VIOWrtScreen +} VIOREQUESTNUMBER; + +/* -------- End of Vio Requests section -------- */ + +/* + * Kbd requests + */ + +typedef enum +{ KBDOpen, + KBDClose, + KBDDupLogHandle, + KBDNewFocus, + KBDFreeFocus, + KBDCharIn, + KBDStringIn, + KBDPeek, + KBDFlushBuffer, + KBDReadStdIn, + KBDRead, + KBDGetStatus, + KBDSetStatus, + KBDXlate, + KBDGetCp, + KBDSetCp, + KBDSetCustXt, + KBDGetInputMode, + KBDGetInterimFlag, + KBDGetKbdType, + KBDGetHotKey, + KBDGetShiftState, + KBDSetInputMode, + KBDSetShiftState, + KBDSetTypamaticRate, + KBDSetInTerimFlag, + KBDNewCountry +} KBDREQUESTNUMBER; + +typedef struct _KBDREQUEST +{ KBDREQUESTNUMBER Request; + HANDLE hKbd; + ULONG fWait; + ULONG Length; /* Length for string R/W */ + union + { KBDKEYINFO KeyInfo; + STRINGINBUF String; + KBDINFO KbdInfo; + KBDTRANS KbdTrans; + ULONG CodePage; + UCHAR InputMode; + UCHAR Interim; + SHIFTSTATE Shift; +#ifdef JAPAN +// MSKK May.07.1993 V-AkihiS + USHORT KbdType[3]; +#else + USHORT KbdType; +#endif + UCHAR HotKey[8]; + RATEDELAY RateDelay; + } d; +} KBDREQUEST, *PKBDREQUEST; + +/* -------- End of Kbd Requests section -------- */ + +/* + * Mou requests + */ + +typedef enum +{ + MOUOpen, + MOUClose, + MOUReadEventQue, + MOUFlushQue, + MOUGetNumQueEl, + MOUDrawPtr, + MOURemovePtr, + MOUGetDevStatus, + MOUSetDevStatus, + MOUGetEventMask, + MOUSetEventMask, + MOUGetNumButtons, + MOUGetNumMickeys, + MOUGetPtrPos, + MOUSetPtrPos, + MOUGetPtrShape, + MOUSetPtrShape, + MOUGetScaleFact, + MOUSetScaleFact +} MOUREQUESTNUMBER; + +typedef struct _MOUREQUEST +{ MOUREQUESTNUMBER Request; + HANDLE hMOU; + USHORT fWait; + union + { ULONG Setup; /* according to API: DevStatus, EventMask, + #Buttoms, #Mickeys */ + PTRLOC Loc; + PTRSHAPE Shape; + SCALEFACT ScalFact; + MOUEVENTINFO MouInfo; + NOPTRRECT NoPtrRect; + MOUQUEINFO NumEvent; + } d; +} MOUREQUEST, *PMOUREQUEST; + +/* -------- End of Mou Requests section -------- */ + +/* + * Mon requests + */ + +#define MON_BUFFER_SIZE 80 + +typedef enum +{ KbdDevice, + MouseDevice, + Lpt1Device, + Lpt2Device, + Lpt3Device +} MONDEVNUMBER; + +typedef enum +{ MONOpen, + MONReg, + MONRead, + MONWrite, + MONClose +} MONREQUESTNUMBER; + +typedef struct _MON_OC +{ + HANDLE hMON; + MONDEVNUMBER MonDevice; +} MON_OC, *PMON_OC; + +typedef struct _MON_REG +{ + ULONG Pos; + ULONG Index; + USHORT InSize; + USHORT OutSize; + PVOID In; + PVOID Out; + ULONG ProcessId; + HANDLE hMON; +} MON_REG, *PMON_REG; + +typedef struct _MON_RW +{ + ULONG ProcessId; + USHORT Length; + PVOID MonBuffer; + USHORT fWait; + UCHAR ioBuff[MON_BUFFER_SIZE]; +} MON_RW, *PMON_RW; + +typedef struct _MONREQUEST +{ MONREQUESTNUMBER Request; + union + { + MON_OC OpenClose; + MON_REG Reg; + MON_RW rwParms; + } d; +} MONREQUEST, *PMONREQUEST; + +/* -------- End of Mon Requests section -------- */ + +/* + * Net requests + */ + +typedef enum { + NETGetDCName, + NETHandleGetInfo, + NETServerDiskEnum, + NETServerEnum2, + NETServerGetInfo, + NETServiceControl, + NETServiceEnum, + NETServiceGetInfo, + NETServiceInstall, + NETShareEnum, + NETShareGetInfo, + NETUseAdd, + NETUseDel, + NETUseEnum, + NETUseGetInfo, + NETUserEnum, + NETUserGetInfo, + NETWkstaGetInfo, + NETAccessAdd, + NETAccessSetInfo, + NETAccessDel, + NETShareAdd, + NETShareDel, + NETBios +} NETREQUESTNUMBER; + +#define MAXNETMSGSIZE 64 + +typedef struct _NETREQUEST { + NETREQUESTNUMBER Request; + char d[MAXNETMSGSIZE]; +} NETREQUEST, *PNETREQUEST; + +/* -------- End of Net Requests section -------- */ + +/* + * Console requests + * these are mapped 1-1 to the win32 Console services + */ + + +#define OS2SS_IDABORT 3 +#define OS2SS_IDRETRY 4 +#define OS2SS_IDIGNORE 5 + +/* + * Prt requests + */ + +#define OS2_MAX_PRT_NAME 10 + +typedef enum +{ PRTOpen, + PRTClose, + PRTWrite, + PRTRead // BUGBUG: do we need it ? +} PRTREQUESTNUMBER; + +typedef struct _PRTWRITE +{ ULONG Length; /* Length for string R/W */ + PVOID Offset; +} PRTWRITE; + +typedef struct _PRTOPEN +{ ULONG Attribute; + ULONG OpenFlags; + ULONG OpenMode; + ULONG Action; + UCHAR PrinterName[OS2_MAX_PRT_NAME]; +} PRTOPEN, *PPRTOPEN; + +typedef struct _PRTREQUEST +{ PRTREQUESTNUMBER Request; + HANDLE hPrinter; + union + { PRTOPEN Open; + PRTWRITE Write; + } d; +} PRTREQUEST, *PPRTREQUEST; + +/* -------- End of Prt Requests section -------- */ + +/* + * TaskManager requests + */ + +typedef enum +{ TmExit, + TmTitle, + TmReleaseLPC +} SCTMREQUESTNUMBER; + + +typedef struct +{ SCTMREQUESTNUMBER Request; + ULONG ExitResults; + CHAR ErrorText[50]; +} SCTMREQUEST, *PSCTMREQUEST; + + +/* -------- End of TaskManager Requests section -------- */ + +typedef enum _EXECREQUESTNUMBER +{ RemoveConsoleThread, + RestartConsoleThread, + AddWin32ChildProcess, + RemWin32ChildProcess +} EXECREQUESTNUMBER; + + +typedef struct _WINEXECPGM_MSG +{ + EXECREQUESTNUMBER Request; +} WINEXECPGM_MSG, *PWINEXECPGM_MSG; + +/* -------- End of CreateProcess Requests section -------- */ + +#ifdef DBCS +// MSKK Dec.18.1992 V-AkihiS +// Support IMMON API +/* + * IMMon requests + */ + +typedef enum +{ IMMONStatus, + IMMONActive, + IMMONInactive +} IMMONREQUESTNUMBER; + +#pragma pack(1) +typedef struct _MONINSBLK +{ + USHORT cb; + ULONG ulReserved1; + ULONG ulReserved2; + ULONG ulReserved3; +} MONINSBLK, *PMONINSBLK; + +typedef struct _MONSTATBLK +{ + USHORT cb; + USHORT usInfoLevel; + PUCHAR pInfoBuf; + USHORT cbInfoBuf; +} MONSTATBLK, *PMONSTATBLK; +#pragma pack() + +typedef struct _IMMONREQUEST +{ IMMONREQUESTNUMBER Request; + union + { MONSTATBLK MonStatBlk; + } d; +} IMMONREQUEST, *PIMMONREQUEST; + +/* -------- End of IMMON Requests section -------- */ +#endif + +/* + * Os2Ses requests: + * Request for CONSOLE services from OS2 SS and OS2 clients to the console + * process + */ + +typedef enum _SCREQUESTNUMBER +{ KbdRequest, + MouRequest, + MonRequest, + NetRequest, + TaskManRequest, + WinCreateProcess, + PrtRequest +#ifdef DBCS +// MSKK Dec.18.1992 V-AkihiS + , + ImmonRequest +#endif +} SCREQUESTNUMBER; + +#ifdef NTOS2_ONLY + +typedef struct _SCREQUESTMSG +{ PORT_MESSAGE h; + union { + SCCONNECTINFO ConnectionRequest; + struct { + SCREQUESTNUMBER Request; + NTSTATUS Status; // returned status for the request. + PVOID DataPointer; // for read/write + union { + KBDREQUEST Kbd; + MOUREQUEST Mou; + MONREQUEST Mon; + NETREQUEST Net; + SCTMREQUEST Tm; + WINEXECPGM_MSG WinExecPgm; + PRTREQUEST Prt; +#ifdef DBCS +// MSKK Dec.18.1992 V-AkihiS + IMMONREQUEST Immon; +#endif + } d; + }; + }; +} SCREQUESTMSG, *PSCREQUESTMSG; + +#endif // NTOS2_ONLY + +#define OS2_SS_VERSION 0x00000201 + +/* + * OS2 SS Session ConnectInfo struct + */ + +typedef union _OS2SESCONNECTINFO { + struct { + int SessionDbg; + ULONG ExpectedVersion; + HANDLE Win32ForegroundWindow; + } In; + + struct { + ULONG Os2SrvId; + ULONG SessionUniqueID; // unique ID of the ssesion + ULONG ProcessUniqueID; + ULONG IsNewSession; // see definitions below + ULONG CurrentVersion; + ULONG Od2Debug; + } Out; + +} OS2SESCONNECTINFO, *POS2SESCONNECTINFO; + +/* + * IsNewSession definitions + * + * 0 - child process, 1 - new session, 2 - child session + */ + +#define OS2SS_CHILD_PROCESS 0 +#define OS2SS_NEW_SESSION 1 +#define OS2SS_CHILD_SESSION 2 + +#define OS2SS_IS_SESSION(SessionFlag) \ + (((SessionFlag) == OS2SS_NEW_SESSION) || \ + ((SessionFlag) == OS2SS_CHILD_SESSION)) + +#define OS2SS_IS_PROCESS(SessionFlag) \ + ((SessionFlag) == OS2SS_CHILD_PROCESS) + +#define OS2SS_IS_NEW_SESSION(SessionFlag) \ + ((SessionFlag) == OS2SS_NEW_SESSION) + +/* + * Os2 SS Session requests + * Requests from the session console process (OS2SES.EXE) to the OS2 SS + * e.g. Create session, CtrlBreak, etc. + */ + +typedef enum _OS2SESREQUESTNUMBER { + SesCheckPortAndConCreate, + SesConCreate, + SesConSignal, + SesConFocus, + SesNetBiosPost +} OS2SESREQUESTNUMBER; + +typedef struct { + union + { + struct + { + HANDLE hEventThread; + HANDLE hSessionRequestThread; + HANDLE hProcess; + HANDLE hThread; + PVOID SignalDeliverer; + PVOID ExitListDispatcher; + PVOID InfiniteSleep; + PVOID FreezeThread; + PVOID UnfreezeThread; + PVOID VectorHandler; + PVOID CritSectionAddr; + PVOID ClientPib; + PVOID ClientOs2Tib; + ULONG InitialPebOs2Length; + //ULONG SessionUniqueId; + ULONG IsNewSession; // see definitions in OS2SESCONNECTINFO + UCHAR ApplName[OS2_MAX_APPL_NAME]; + } In; + struct + { + HANDLE DeviceDirectory; + HANDLE CtrlPortHandle; + ULONG BootDrive; + ULONG SystemDrive; + ULONG SessionNumber; + PVOID GInfoAddr; + ULONG InitialPebOs2Data[12]; + ULONG Os2TibThreadId; /* Os2Tib: OS/2 ID for the thread */ + ULONG Os2TibVersion; /* Os2Tib: Version number for this structure */ + HANDLE PibProcessId; /* Pib: Process I.D. */ + HANDLE PibParentProcessId; /* Pib: Parent process I.D. */ + HANDLE PibImageFileHandle; /* Pib: Program (.EXE) module handle */ + ULONG PibStatus; /* Pib: Process Status */ + ULONG PibType; /* Pib: Process Type */ + } Out; + } d; +} SCREQ_CREATE, *PSCREQ_CREATE; + +typedef struct { + int Type; +} SCREQ_SIGNAL; + +typedef struct { + ULONG AppNcbAddr; + ULONG AppPostAddr; + ULONG RetCode; +} SCREQ_NETBIOS; + +#ifdef NTOS2_ONLY + +typedef struct _OS2SESREQUESTMSG { + PORT_MESSAGE h; + union { + OS2SESCONNECTINFO ConnectionRequest; + struct { + ULONG PortType; // 0 - ApiPort in server; 1 - this port. + HANDLE Session; + OS2SESREQUESTNUMBER Request; + NTSTATUS Status; + union { + SCREQ_CREATE Create; + SCREQ_SIGNAL Signal; + ULONG FocusSet; + SCREQ_NETBIOS NetBios; + } d; + }; + }; +} OS2SESREQUESTMSG, *POS2SESREQUESTMSG; + +#endif // NTOS2_ONLY + + +/* + * Common macros to access PORT_MESSAGE fields + */ +#define PORT_MSG_TYPE(m) ((m).h.u2.s2.Type) +#define PORT_MSG_DATA_LENGTH(m) ((m).h.u1.s1.DataLength) +#define PORT_MSG_TOTAL_LENGTH(m) ((m).h.u1.s1.TotalLength) +#define PORT_MSG_ZERO_INIT(m) ((m).h.u2.ZeroInit) + +#endif // _SESPORT_ |