home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / kee.zip / kee.h next >
C/C++ Source or Header  |  2001-10-28  |  7KB  |  245 lines

  1. /* Released to the public domain. All rights perverse */
  2. /*
  3.  * This is not an official IBM header file, and never was.
  4.  * It is published in the hope that some day IBM will document
  5.  * the new KEE32 32 bit driver API properly. 
  6.  * There is no warranty that the declarations and symbols are correct
  7.  * and match corresponding official symbols correctly, however the
  8.  * information herein has been collected and analysed carefully. It 
  9.  * represents the authors's current knowledge about this API.
  10.  *
  11.  * Last change: Apr 26, 2K: fixed number of params of KernLinToPageList
  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. VOID APIENTRY KernThunkStackTo16(VOID);
  94.  
  95. /*ordinal 41*/
  96. VOID APIENTRY KernThunkStackTo32(VOID);
  97.  
  98. /*ordinal 42*/
  99. VOID APIENTRY KernSerialize16BitDD(VOID);
  100.  
  101. /*ordinal 43*/
  102. VOID APIENTRY KernUnserialize16BitDD(VOID);
  103.  
  104. /*ordinal 44*/
  105. VOID APIENTRY KernArmHook(ULONG hook,ULONG data);
  106.  
  107. /*ordinal 45*/
  108. APIRET APIENTRY KernAllocateContextHook(PVOID pfHandler,ULONG dummy,
  109.                     PULONG pHook);
  110.  
  111. /*ordinal 50*/
  112. APIRET APIENTRY KernCopyIn(PVOID trgt, PVOID src, ULONG size);
  113.  
  114. /*ordinal 51*/
  115. APIRET APIENTRY KernCopyOut(PVOID trgt, PVOID src, ULONG size);
  116.  
  117.  
  118. /* same bits as with DevHlp_VMAlloc, see explanation there */
  119. #define KEE_VMA_16MB    0x00000001
  120. #define KEE_VMA_FIXED    0x00000002
  121. #define KEE_VMA_SWAP    0x00000004
  122. #define KEE_VMA_CONTIG    0x00000008
  123. #define KEE_VMA_PHYS    0x00000010
  124. #define KEE_VMA_PROCESS    0x00000020
  125. #define KEE_VMA_SGSCONT    0x00000040
  126. #define KEE_VMA_GETSEL    0x00000080
  127. #define KEE_VMA_RESERVE    0x00000100
  128. #define KEE_VMA_SHARED    0x00000400
  129. #define KEE_VMA_USEHIGHMEM 0x00000800
  130.  
  131. /*ordinal 60*/
  132. APIRET APIENTRY KernVMAlloc(ULONG size, ULONG flags, PVOID* linaddr,
  133.                 PVOID* physaddr, PSHORT sel);
  134.  
  135. /*ordinal 61*/
  136. APIRET APIENTRY KernVMFree(PVOID linaddr);
  137.  
  138. /* this is the lockhandle, like with DevHlp_VMLock */
  139. typedef struct {
  140.     UCHAR lock[12];
  141. } KEEVMLock;
  142.  
  143. /* this is a page list element, like PageList_s in 16 bit Devhlp */
  144. typedef struct {
  145.     ULONG addr;
  146.     ULONG size;
  147. } KEEVMPageList;
  148.  
  149. /* the same bits as with DevHlp_VMLock */
  150. #define KEE_VML_NOTBLOCK    0x00000001
  151. #define KEE_VML_CONTIG        0x00000002
  152. #define KEE_VML_16M        0x00000004
  153. #define KEE_VML_WRITEABLE    0x00000008
  154. #define KEE_VML_LONGLOCK    0x00000010
  155. #define KEE_VML_VERIFYONLY    0x00000020
  156. #define KEE_VML_unknown        0x80000000
  157.  
  158. /*ordinal 62*/
  159. APIRET APIENTRY KernVMLock(ULONG flags,PVOID linaddr,ULONG size,
  160.                KEEVMLOCK* lock, KEEVMPageList* pglist,
  161.                PULONG pgsize);
  162.  
  163. /*ordinal 63*/
  164. APIRET APIENTRY KernVMUnlock(KEEVMLOCK* lock);
  165.  
  166. /*ordinal 64*/
  167. APIRET APIENTRY KernLinToPageList(PVOID linaddr,ULONG size,
  168.                   KEEVMPageList* list,PULONG pgsize);
  169.  
  170. #define KEE_VMS_UNCOMMIT    0x00000001
  171. #define KEE_VMS_RESIDENT    0x00000002
  172. #define KEE_VMS_SWAPPABLE    0x00000004
  173.  
  174. /*ordinal 65*/
  175. APIRET APIENTRY KernVMSetMem(ULONG flags, PVOID linaddr, ULONG size);
  176.  
  177. /*ordinal 66*/
  178. ULONG KernSelToFlat(ULONG addr16);
  179.  
  180. /*ordinal 70*/
  181. APIRET APIENTRY KernDynamicAPI(PVOID addr, ULONG cnt, ULONG dummy, PUSHORT sel);
  182.  
  183. /*ordinal 80*/
  184. APIRET APIENTRY KernRASSysTrace(ULONG major,ULONG minor,PVOID buf, ULONG size);
  185.  
  186. /*ordinal 81*/
  187. APIRET APIENTRY KernPerfSysTrace(ULONG major,ULONG minor,PVOID buf, ULONG size);
  188.  
  189. /* this is actually a pointer to the SFT entry for the file */
  190. typedef ULONG KEEhfile;
  191.  
  192. /*ordinal 100*/
  193. APIRET APIENTRY KernLockFile(HFILE hfd,KEEhfile* khfd);
  194.  
  195. /*ordinal 101*/
  196. APIRET APIENTRY KernUnLockFile(KEEhfile khfd);
  197.  
  198. /* this is the file size as returned by ordinal 102 */
  199. typedef QWORD KEEfilesize;
  200.  
  201. /*ordinal 102*/
  202. APIRET APIENTRY KernGetFileSize(KEEhfile khfd,KEEfilesize* sz);
  203.  
  204. /*ordinal 103*/
  205. APIRET APIENTRY KernTestFileCache(KEEhfile khfd);
  206.  
  207. /*ordinal 104*/
  208. APIRET APIENTRY KernReadFileAt(KEEhfile khfd,PVOID buf, QWORD off,
  209.                    ULONG nbytes, PULONG nread);
  210.  
  211. typedef struct {
  212.     ULONG pagelistsz;
  213.     KEEVMPageList* pagelist;
  214.     ULONG physlistsz;
  215.     KEEVMPageList* physlist;
  216. } KEECachePages;
  217.  
  218. /*ordinal 105*/
  219. APIRET APIENTRY KernReadFileAtCache(KEEhfile khfd,KEECachePages** ptr,
  220.                     QWORD off, ULONG nbytes, PULONG nread);
  221.  
  222. /*ordinal 106*/
  223. APIRET APIENTRY KernReturnFileCache(KEEhfile khfd,KEECachePages* ptr);
  224.  
  225. typedef struct {
  226.     ULONG data[8];
  227. } KEEUnicodeStruct;
  228.  
  229. /*ordinal 120*/
  230. APIRET APIENTRY KernCreateUconvObject(USHORT codepage, KEEUnicodeStruct* ucs);
  231.  
  232. /*ordinal 121*/
  233. APIRET APIENTRY KernStrFromUcs(KEEUnicodeStruct* ucs, PCHAR trgt,
  234.                    PCHAR usrc, ULONG trgtsize, ULONG srcsize);
  235. /*ordinal 122*/
  236. APIRET APIENTRY KernStrToUcs(KEEUnicodeStruct* ucs, PCHAR utrgt, PCHAR src,
  237.                  ULONG trgtsize,ULONG srcsize);
  238.  
  239. #ifdef __cplusplus
  240. }
  241. #endif
  242.  
  243.  
  244. #endif
  245.