| 1 | /* $Id: oslibdos.h,v 1.12 2000-03-10 16:12:00 sandervl Exp $ */ | 
|---|
| 2 |  | 
|---|
| 3 | /* | 
|---|
| 4 | * Wrappers for OS/2 Dos* API | 
|---|
| 5 | * | 
|---|
| 6 | * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl) | 
|---|
| 7 | * | 
|---|
| 8 | * | 
|---|
| 9 | * Project Odin Software License can be found in LICENSE.TXT | 
|---|
| 10 | * | 
|---|
| 11 | */ | 
|---|
| 12 | #ifndef __OSLIBDOS_H__ | 
|---|
| 13 | #define __OSLIBDOS_H__ | 
|---|
| 14 |  | 
|---|
| 15 |  | 
|---|
| 16 | DWORD OSLibDosAliasMem(LPVOID pb, ULONG cb, LPVOID *ppbAlias, ULONG fl); | 
|---|
| 17 | DWORD OSLibDosAllocMem(LPVOID *lplpMemAddr, DWORD size, DWORD flags); | 
|---|
| 18 | DWORD OSLibDosFreeMem(LPVOID lpMemAddr); | 
|---|
| 19 | DWORD OSLibDosQueryMem(LPVOID lpMemAddr, DWORD *lpRangeSize, DWORD *lpAttr); | 
|---|
| 20 | DWORD OSLibDosSetMem(LPVOID lpMemAddr, DWORD size, DWORD flags); | 
|---|
| 21 | DWORD OSLibDosAllocSharedMem(LPVOID *lplpMemAddr, DWORD size, DWORD flags, LPSTR name); | 
|---|
| 22 | DWORD OSLibDosGetNamedSharedMem(LPVOID *lplpMemAddr, LPSTR name); | 
|---|
| 23 | DWORD OSLibDosChangeMaxFileHandles(); | 
|---|
| 24 |  | 
|---|
| 25 | #define ODIN_INCREMENT_MAX_FILEHANDLES  64 | 
|---|
| 26 | #define ODIN_DEFAULT_MAX_FILEHANDLES    256 | 
|---|
| 27 | DWORD OSLibDosSetInitialMaxFileHandles(DWORD maxhandles); | 
|---|
| 28 |  | 
|---|
| 29 | BOOL OSLibDosGetFileAttributesEx(LPSTR pszName, ULONG ulDummy, PVOID pBuffer); | 
|---|
| 30 |  | 
|---|
| 31 | #define OSLIB_NOERROR                   0 | 
|---|
| 32 | #define OSLIB_ERROR_INVALID_ADDRESS     1 | 
|---|
| 33 | #define OSLIB_ERROR_ACCESS_DENIED       2 | 
|---|
| 34 | #define OSLIB_ERROR_INVALID_PARAMETER   3 | 
|---|
| 35 |  | 
|---|
| 36 | #ifndef __OS2_H__ | 
|---|
| 37 |  | 
|---|
| 38 | /* Access protection                                                          */ | 
|---|
| 39 | #define PAG_READ          0x00000001U      /* read access                      */ | 
|---|
| 40 | #define PAG_WRITE         0x00000002U      /* write access                     */ | 
|---|
| 41 | #define PAG_EXECUTE       0x00000004U      /* execute access                   */ | 
|---|
| 42 | #define PAG_GUARD         0x00000008U      /* guard protection                 */ | 
|---|
| 43 | #define PAG_DEFAULT       0x00000400U      /* default (initial) access         */ | 
|---|
| 44 |  | 
|---|
| 45 | /* Commit                                                                     */ | 
|---|
| 46 | #define PAG_COMMIT        0x00000010U      /* commit storage                   */ | 
|---|
| 47 | #define PAG_DECOMMIT      0x00000020U      /* decommit storage                 */ | 
|---|
| 48 |  | 
|---|
| 49 | /* Allocation attributes                                                      */ | 
|---|
| 50 | #define OBJ_TILE          0x00000040U      /* tile object                      */ | 
|---|
| 51 | #define OBJ_PROTECTED     0x00000080U      /* protect object */ | 
|---|
| 52 | #define OBJ_GETTABLE      0x00000100U      /* gettable by other processes      */ | 
|---|
| 53 | #define OBJ_GIVEABLE      0x00000200U      /* giveable to other processes      */ | 
|---|
| 54 |  | 
|---|
| 55 | /* Allocation type (returned from DosQueryMem)                                */ | 
|---|
| 56 | #define PAG_SHARED        0x00002000U     /* shared object                    */ | 
|---|
| 57 | #define PAG_FREE          0x00004000U     /* pages are free                   */ | 
|---|
| 58 | #define PAG_BASE          0x00010000U     /* first page in object             */ | 
|---|
| 59 |  | 
|---|
| 60 | #endif | 
|---|
| 61 |  | 
|---|
| 62 | #define OSLIB_ACCESS_READONLY           1 | 
|---|
| 63 | #define OSLIB_ACCESS_READWRITE          2 | 
|---|
| 64 | #define OSLIB_ACCESS_SHAREDENYNONE      4 | 
|---|
| 65 | #define OSLIB_ACCESS_SHAREDENYREAD      8 | 
|---|
| 66 | #define OSLIB_ACCESS_SHAREDENYWRITE     16 | 
|---|
| 67 |  | 
|---|
| 68 | DWORD OSLibDosOpen(char *lpszFileName, DWORD flags); | 
|---|
| 69 | DWORD OSLibDosClose(DWORD hFile); | 
|---|
| 70 | DWORD OSLibDosGetFileSize(DWORD hFile); | 
|---|
| 71 | DWORD OSLibDosRead(DWORD hFile, LPVOID lpBuffer, DWORD size, DWORD *nrBytesRead); | 
|---|
| 72 | DWORD OSLibDosWrite(DWORD hFile, LPVOID lpBuffer, DWORD size, DWORD *nrBytesWritten); | 
|---|
| 73 |  | 
|---|
| 74 | #define OSLIB_SETPTR_FILE_CURRENT       1 | 
|---|
| 75 | #define OSLIB_SETPTR_FILE_BEGIN         2 | 
|---|
| 76 | #define OSLIB_SETPTR_FILE_END           3 | 
|---|
| 77 |  | 
|---|
| 78 | DWORD OSLibDosSetFilePtr(DWORD hFile, DWORD offset, DWORD method); | 
|---|
| 79 |  | 
|---|
| 80 | #define OSLIB_SEARCHDIR         1 | 
|---|
| 81 | #define OSLIB_SEARCHCURDIR      2 | 
|---|
| 82 | #define OSLIB_SEARCHFILE        3 | 
|---|
| 83 | #define OSLIB_SEARCHENV         4 | 
|---|
| 84 |  | 
|---|
| 85 | DWORD OSLibDosSearchPath(DWORD cmd, char *path, char *name, char *full_name, DWORD length_fullname); | 
|---|
| 86 |  | 
|---|
| 87 |  | 
|---|
| 88 | DWORD OSLibDosCreate(CHAR *lpFileName, | 
|---|
| 89 | DWORD dwAccess, | 
|---|
| 90 | DWORD dwShare, | 
|---|
| 91 | LPSECURITY_ATTRIBUTES lpSecurityAttributes, | 
|---|
| 92 | DWORD dwCreation, | 
|---|
| 93 | DWORD dwFlags, | 
|---|
| 94 | HANDLE hTemplate, | 
|---|
| 95 | DWORD *dwFile); | 
|---|
| 96 |  | 
|---|
| 97 | DWORD OSLibDosResetBuffer(DWORD hFile); | 
|---|
| 98 | DWORD OSLibDosDupHandle(DWORD hFile, DWORD *hNew); | 
|---|
| 99 | DWORD OSLibDosSetFilePtr2(DWORD hFile, DWORD offset, DWORD method); | 
|---|
| 100 |  | 
|---|
| 101 | #ifndef PAGE_SIZE | 
|---|
| 102 | #define PAGE_SIZE 4096 | 
|---|
| 103 | #endif | 
|---|
| 104 |  | 
|---|
| 105 | void OSLibDosDisableHardError(BOOL fTurnOff); | 
|---|
| 106 | BOOL OSLibDosQueryProcTimes(DWORD procid, ULONG *kerneltime, ULONG *usertime); | 
|---|
| 107 |  | 
|---|
| 108 | BOOL OSLibDosTransactNamedPipe( DWORD  hNamedPipe, | 
|---|
| 109 | LPVOID lpInBuffer, | 
|---|
| 110 | DWORD nInBufferSize, | 
|---|
| 111 | LPVOID lpOutBuffer, | 
|---|
| 112 | DWORD nOutBufferSize, | 
|---|
| 113 | LPDWORD lpBytesRead, | 
|---|
| 114 | LPOVERLAPPED lpOverlapped); | 
|---|
| 115 |  | 
|---|
| 116 | BOOL OSLibDosCallNamedPipe( LPCTSTR lpNamedPipeName, | 
|---|
| 117 | LPVOID  lpInBuffer, | 
|---|
| 118 | DWORD   nInBufferSize, | 
|---|
| 119 | LPVOID  lpOutBuffer, | 
|---|
| 120 | DWORD   nOutBufferSize, | 
|---|
| 121 | LPDWORD lpBytesRead, | 
|---|
| 122 | DWORD   nTimeOut ); | 
|---|
| 123 |  | 
|---|
| 124 | BOOL OSLibDosPeekNamedPipe(DWORD   hPipe, | 
|---|
| 125 | LPVOID  lpvBuffer, | 
|---|
| 126 | DWORD   cbBuffer, | 
|---|
| 127 | LPDWORD lpcbRead, | 
|---|
| 128 | LPDWORD lpcbAvail, | 
|---|
| 129 | LPDWORD lpcbMessage); | 
|---|
| 130 |  | 
|---|
| 131 | BOOL OSLibDosConnectNamedPipe(DWORD hNamedPipe, LPOVERLAPPED lpOverlapped); | 
|---|
| 132 |  | 
|---|
| 133 | DWORD OSLibDosCreateNamedPipe(LPCTSTR lpName, | 
|---|
| 134 | DWORD   dwOpenMode, | 
|---|
| 135 | DWORD   dwPipeMode, | 
|---|
| 136 | DWORD   nMaxInstances, | 
|---|
| 137 | DWORD   nOutBufferSize, | 
|---|
| 138 | DWORD   nInBufferSize, | 
|---|
| 139 | DWORD   nDefaultTimeOut, | 
|---|
| 140 | void* lpSecurityAttributes); | 
|---|
| 141 |  | 
|---|
| 142 | BOOL OSLibDosWaitNamedPipe(LPCSTR lpszNamedPipeName, | 
|---|
| 143 | DWORD   dwTimeout); | 
|---|
| 144 |  | 
|---|
| 145 | BOOL OSLibDosDisconnectNamedPipe(DWORD hPipe); | 
|---|
| 146 |  | 
|---|
| 147 |  | 
|---|
| 148 | #endif | 
|---|