home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lxapi32.zip / Include / kee.h < prev    next >
C/C++ Source or Header  |  2002-04-26  |  7KB  |  258 lines

  1. /* $Id: kee.h,v 1.2 2002/04/26 23:09:00 smilcke Exp $ */
  2.  
  3. /* Released to the public domain. All rights perverse */
  4. /*
  5.  * This is not an official IBM header file, and never was.
  6.  * It is published in the hope that some day IBM will document
  7.  * the new KEE32 32 bit driver API properly. 
  8.  * There is no warranty that the declarations and symbols are correct
  9.  * and match corresponding official symbols correctly, however the
  10.  * information herein has been collected and analysed carefully. It 
  11.  * represents the authors's current knowledge about this API.
  12.  */
  13.  
  14. #ifndef __KEE_H__
  15. #define __KEE_H__
  16.  
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20.  
  21. /* The spinlock data type. KEE spinlock functions either put 0 (unused)
  22.  * or 0xff (used) into the variable, and 0xff000000 when the lock is
  23.  * acquired.
  24.  */
  25. typedef ULONG KEESpinLock;
  26.  
  27. /*ordinal 10 */
  28. APIRET APIENTRY KernAllocSpinLock(KEESpinLock* sl);
  29.  
  30. /*ordinal 11*/
  31. /* XXX I suppose this routine should receive a KEESpinLock*, but
  32.  * so far, it just returns NO_ERROR, and not even clearing the Spinlock
  33.  * ownership. I think this is a bug in 14.039F_SMP
  34.  */
  35. APIRET APIENTRY KernFreeSpinLock(/*KEESpinLock* sl*/);
  36.  
  37. /*ordinal 12*/
  38. VOID APIENTRY KernAcquireSpinLock(KEESpinLock* sl);
  39.  
  40. /*ordinal 13*/
  41. VOID APIENTRY KernReleaseSpinLock(KEESpinLock* sl);
  42.  
  43. typedef struct {
  44.   ULONG mtx[2];
  45. } KEEMutexLock;
  46.  
  47. /*ordinal 20*/
  48. APIRET APIENTRY KernAllocMutexLock(KEEMutexLock* ml);
  49.  
  50. /*ordinal 21*/
  51. /* XXX Like ordinal 11, I think this should really do something. Actually,
  52.  * it just returns NO_ERROR. At least, it accesses the argument. But
  53.  * it doesn't do anything. Again, likely an error in 14.039F_SMP
  54.  */
  55. APIRET APIENTRY KernFreeMutexLock(KEEMutexLock* ml);
  56.  
  57. /*ordinal 22*/
  58. VOID APIENTRY KernRequestSharedMutex(KEEMutexLock* ml);
  59.  
  60. /*ordinal 23*/
  61. VOID APIENTRY KernReleaseSharedMutex(KEEMutexLock* ml);
  62.  
  63. /*ordinal 24*/
  64. INT APIENTRY KernTryRequestSharedMutex(KEEMutexLock* ml);
  65.  
  66. /*ordinal 25*/
  67. VOID APIENTRY KernRequestExclusiveMutex(KEEMutexLock* ml);
  68.  
  69. /*ordinal 26*/
  70. VOID APIENTRY KernReleaseExclusiveMutex(KEEMutexLock* ml);
  71.  
  72. /*ordinal 27*/
  73. INT APIENTRY KernTryRequestExclusiveMutex(KEEMutexLock* ml);
  74.  
  75. #define KEE_BLOCK_NOSIGNALS    0x00000001
  76. #define KEE_BLOCK_SPINLOCK      0x00000002
  77. #define KEE_BLOCK_EXMUTEXLOCK   0x00000004
  78. #define KEE_BLOCK_SHMUTEXLOCK   0x00000008
  79. #define KEE_BLOCK_NOACQUIRE     0x00000010
  80.  
  81. /*ordinal 30*/
  82. APIRET APIENTRY KernBlock(ULONG id, ULONG timeout, ULONG flags,
  83.               PVOID ptr, PULONG retdata);
  84.  
  85. #define KEE_WAKE_SINGLE         0x00000001
  86. #define KEE_WAKE_PRIOINCR       0x00000004
  87. #define KEE_WAKE_RETDATA        0x00000008
  88.  
  89. /*ordinal 31*/
  90. APIRET APIENTRY KernWakeup(ULONG id, ULONG flags, PULONG ptr, ULONG retdata);
  91.  
  92. /*ordinal 40*/
  93. // Returns: flat base of kernel stack in eax
  94. //NOTE: esp and ebp are modified when this function returns 
  95. //      --> can cause problems if compiler uses i.e. ebp for storing a value!!
  96. ULONG APIENTRY KernThunkStackTo16(VOID);
  97.  
  98. /*ordinal 41*/
  99. // Returns: flat base of kernel stack in edx
  100. //          16 bits stack selector in eax (not during interrupts (bug??))
  101. //NOTE: esp and ebp are modified when this function returns 
  102. //      --> can cause problems if compiler uses i.e. ebp for storing a value!!
  103.  
  104. #ifdef    __WATCOMC__
  105. ULONG KernThunkStackTo32(VOID); 
  106. #pragma aux KernThunkStackTo32 "KernThunkStackTo32" modify exact [eax ecx edx] value [edx];
  107. #else
  108. ULONG APIENTRY KernThunkStackTo32(VOID); 
  109. #endif
  110.  
  111.  
  112. /*ordinal 42*/
  113. VOID APIENTRY KernSerialize16BitDD(VOID);
  114.  
  115. /*ordinal 43*/
  116. VOID APIENTRY KernUnserialize16BitDD(VOID);
  117.  
  118. /*ordinal 44*/
  119. VOID APIENTRY KernArmHook(ULONG hook,ULONG data);
  120.  
  121. /*ordinal 45*/
  122. APIRET APIENTRY KernAllocateContextHook(PVOID pfHandler,ULONG dummy,
  123.                     PULONG pHook);
  124.  
  125. /*ordinal 50*/
  126. APIRET APIENTRY KernCopyIn(PVOID trgt, PVOID src, ULONG size);
  127.  
  128. /*ordinal 51*/
  129. APIRET APIENTRY KernCopyOut(PVOID trgt, PVOID src, ULONG size);
  130.  
  131.  
  132. /* same bits as with DevHlp_VMAlloc, see explanation there */
  133. #define KEE_VMA_16MB    0x00000001
  134. #define KEE_VMA_FIXED    0x00000002
  135. #define KEE_VMA_SWAP    0x00000004
  136. #define KEE_VMA_CONTIG    0x00000008
  137. #define KEE_VMA_PHYS    0x00000010
  138. #define KEE_VMA_PROCESS    0x00000020
  139. #define KEE_VMA_SGSCONT    0x00000040
  140. #define KEE_VMA_GETSEL    0x00000080
  141. #define KEE_VMA_RESERVE    0x00000100
  142. #define KEE_VMA_SHARED    0x00000400
  143. #define KEE_VMA_USEHIGHMEM 0x00000800
  144.  
  145. /*ordinal 60*/
  146. APIRET APIENTRY KernVMAlloc(ULONG size, ULONG flags, PVOID* linaddr,
  147.                 PVOID* physaddr, PSHORT sel);
  148.  
  149. /*ordinal 61*/
  150. APIRET APIENTRY KernVMFree(PVOID linaddr);
  151.  
  152. /* this is the lockhandle, like with DevHlp_VMLock */
  153. typedef struct {
  154.     UCHAR lock[12];
  155. } KEEVMLock;
  156.  
  157. /* this is a page list element, like PageList_s in 16 bit Devhlp */
  158. typedef struct {
  159.     ULONG addr;
  160.     ULONG size;
  161. } KEEVMPageList;
  162.  
  163. /* the same bits as with DevHlp_VMLock */
  164. #define KEE_VML_NOTBLOCK    0x00000001
  165. #define KEE_VML_CONTIG        0x00000002
  166. #define KEE_VML_16M        0x00000004
  167. #define KEE_VML_WRITEABLE    0x00000008
  168. #define KEE_VML_LONGLOCK    0x00000010
  169. #define KEE_VML_VERIFYONLY    0x00000020
  170. #define KEE_VML_unknown        0x80000000
  171.  
  172. /*ordinal 62*/
  173. APIRET APIENTRY KernVMLock(ULONG flags,PVOID linaddr,ULONG size,
  174.                KEEVMLock* lock, KEEVMPageList* pglist,
  175.                PULONG pgsize);
  176.  
  177. /*ordinal 63*/
  178. APIRET APIENTRY KernVMUnlock(KEEVMLock* lock);
  179.  
  180. /*ordinal 64*/
  181. APIRET APIENTRY KernLinToPageList(PVOID linaddr,ULONG size,KEEVMPageList* list, ULONG *pgcnt);
  182.  
  183. #define KEE_VMS_UNCOMMIT    0x00000001
  184. #define KEE_VMS_RESIDENT    0x00000002
  185. #define KEE_VMS_SWAPPABLE    0x00000004
  186.  
  187. /*ordinal 65*/
  188. APIRET APIENTRY KernVMSetMem(ULONG flags, PVOID linaddr, ULONG size);
  189.  
  190. /*ordinal 66*/
  191. ULONG KernSelToFlat(ULONG addr16);
  192.  
  193. /*ordinal 70*/
  194. APIRET APIENTRY KernDynamicAPI(PVOID addr, ULONG cnt, ULONG dummy, PUSHORT sel);
  195.  
  196. /*ordinal 80*/
  197. APIRET APIENTRY KernRASSysTrace(ULONG major,ULONG minor,PVOID buf, ULONG size);
  198.  
  199. /*ordinal 81*/
  200. APIRET APIENTRY KernPerfSysTrace(ULONG major,ULONG minor,PVOID buf, ULONG size);
  201.  
  202. /* this is actually a pointer to the SFT entry for the file */
  203. typedef ULONG KEEhfile;
  204.  
  205. /*ordinal 100*/
  206. APIRET APIENTRY KernLockFile(HFILE hfd,KEEhfile* khfd);
  207.  
  208. /*ordinal 101*/
  209. APIRET APIENTRY KernUnLockFile(KEEhfile khfd);
  210.  
  211. /* this is the file size as returned by ordinal 102 */
  212. typedef QWORD KEEfilesize;
  213.  
  214. /*ordinal 102*/
  215. APIRET APIENTRY KernGetFileSize(KEEhfile khfd,KEEfilesize* sz);
  216.  
  217. /*ordinal 103*/
  218. APIRET APIENTRY KernTestFileCache(KEEhfile khfd);
  219.  
  220. /*ordinal 104*/
  221. APIRET APIENTRY KernReadFileAt(KEEhfile khfd,PVOID buf, QWORD off,
  222.                    ULONG nbytes, PULONG nread);
  223.  
  224. typedef struct {
  225.     ULONG pagelistsz;
  226.     KEEVMPageList* pagelist;
  227.     ULONG physlistsz;
  228.     KEEVMPageList* physlist;
  229. } KEECachePages;
  230.  
  231. /*ordinal 105*/
  232. APIRET APIENTRY KernReadFileAtCache(KEEhfile khfd,KEECachePages** ptr,
  233.                     QWORD off, ULONG nbytes, PULONG nread);
  234.  
  235. /*ordinal 106*/
  236. APIRET APIENTRY KernReturnFileCache(KEEhfile khfd,KEECachePages* ptr);
  237.  
  238. typedef struct {
  239.     ULONG data[8];
  240. } KEEUnicodeStruct;
  241.  
  242. /*ordinal 120*/
  243. APIRET APIENTRY KernCreateUconvObject(USHORT codepage, KEEUnicodeStruct* ucs);
  244.  
  245. /*ordinal 121*/
  246. APIRET APIENTRY KernStrFromUcs(KEEUnicodeStruct* ucs, PCHAR trgt,
  247.                    PCHAR usrc, ULONG trgtsize, ULONG srcsize);
  248. /*ordinal 122*/
  249. APIRET APIENTRY KernStrToUcs(KEEUnicodeStruct* ucs, PCHAR utrgt, PCHAR src,
  250.                  ULONG trgtsize,ULONG srcsize);
  251.  
  252. #ifdef __cplusplus
  253. }
  254. #endif
  255.  
  256.  
  257. #endif
  258.