home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / AutoPC / apcsdk10.exe / data1.cab / Emulation_Include_Files / kfuncs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-05-13  |  3.4 KB  |  157 lines

  1. /*++
  2.  
  3. Copyright (c) 1995  Microsoft Corporation
  4.  
  5. Module Name: kfuncs.h
  6.  
  7. ++*/
  8.  
  9. #ifndef __KFUNCS_H__
  10. #define __KFUNCS_H__
  11.  
  12. #define NUM_SYS_HANDLES  32
  13.  
  14. #define SYS_HANDLE_BASE     64
  15. #define SH_WIN32                0
  16. #define SH_CURTHREAD            1
  17. #define SH_CURPROC              2
  18. #define SH_KWIN32               3       // Direct kernel win32 calls
  19.  
  20. #define SH_LAST_NOTIFY            16    // Last set notified on Thread/Process Termination
  21. #define SH_GDI                  16
  22. #define SH_WMGR                 17
  23. #define SH_INIT                 18
  24. #define SH_COMM                 19      // Communications not "COM"
  25. #define SH_FILESYS_APIS            20      // File system APIS
  26. #define SH_SHELL                21
  27. #define SH_DEVMGR_APIS            22        // File system device manager
  28. #define SH_TAPI                    23
  29. #define SH_PATCHER                24
  30. #define SH_IMM                    25
  31. #define SH_WNET                    26      // WNet APIs for network redirector
  32.  
  33. #ifdef WINCEOEM
  34. #include <psyscall.h>    // change to include only defines required by OEMs
  35. #endif
  36.  
  37. #if defined(ARM)
  38. #define PUserKData ((LPBYTE)0xFFFFC800)
  39. #else
  40. #define PUserKData ((LPBYTE)0x00005800)
  41. #endif
  42. #define SYSHANDLE_OFFSET 0x004
  43.  
  44. #ifdef WINCEOEM
  45. #include <pkfuncs.h>    // change to include only defines required by OEMs
  46. #ifdef WINCEMACRO
  47. #include <mkfuncs.h>
  48. #endif
  49. #endif
  50.  
  51. #ifndef EventModify
  52. BOOL WINAPI EventModify(HANDLE hEvent, DWORD func);
  53. #endif
  54.  
  55. #if defined(MIPS)
  56.  
  57. extern void __asm(char[], ...);
  58. _inline void DebugBreak() {
  59.     __asm("break 1");
  60. }
  61.  
  62. #elif defined(PPC)
  63.  
  64. void __emit(unsigned const __int32);
  65. _inline void DebugBreak() {
  66.     __emit(0x0FE00016);    // "twi 31,0,0x16"
  67. }
  68.  
  69. #elif defined(x86) || defined(_X86_)
  70.  
  71. _inline void DebugBreak() {
  72.     __asm int 3
  73. }
  74.  
  75. #elif defined(SHx)
  76.  
  77. extern void __asm(const char *, ...);
  78. #define DebugBreak() __asm("trapa #1")
  79.  
  80. #elif defined(ARM)
  81.  
  82. void __emit(unsigned const __int32);
  83. #define DebugBreak() __emit(0xE6000010)
  84.  
  85. #else
  86.  
  87. extern void DebugBreak();
  88.  
  89. #endif
  90.  
  91. #define EVENT_PULSE     1
  92. #define EVENT_RESET     2
  93. #define EVENT_SET       3
  94.  
  95. _inline BOOL PulseEvent(HANDLE h) {
  96.     return EventModify(h,EVENT_PULSE);
  97. }
  98.  
  99. _inline BOOL ResetEvent(HANDLE h) {
  100.     return EventModify(h,EVENT_RESET);
  101. }
  102.  
  103. _inline BOOL SetEvent(HANDLE h) {
  104.     return EventModify(h,EVENT_SET);
  105. }
  106.  
  107. #ifdef _WIN32_WCE_EMULATION
  108. HANDLE WINAPI GetCurrentThread(void);
  109. HANDLE WINAPI GetCurrentProcess(void);
  110. DWORD WINAPI GetCurrentThreadId(void);
  111. DWORD WINAPI GetCurrentProcessId(void);
  112. #else  // _WIN32_WCE_EMULATION
  113. _inline HANDLE GetCurrentThread(void) {
  114.     return ((HANDLE)(SH_CURTHREAD+SYS_HANDLE_BASE));
  115. }
  116.  
  117. _inline HANDLE GetCurrentProcess(void) {
  118.     return ((HANDLE)(SH_CURPROC+SYS_HANDLE_BASE));
  119. }
  120.  
  121. _inline DWORD GetCurrentThreadId(void) {
  122.     return ((DWORD)(((HANDLE *)(PUserKData+SYSHANDLE_OFFSET))[SH_CURTHREAD]));
  123. }
  124.  
  125. _inline DWORD GetCurrentProcessId(void) {
  126.     return ((DWORD)(((HANDLE *)(PUserKData+SYSHANDLE_OFFSET))[SH_CURPROC]));
  127. }
  128. #endif  // _WIN32_WCE_EMULATION
  129.  
  130. #define TLS_FUNCALLOC   0
  131. #define TLS_FUNCFREE    1
  132.  
  133. #ifndef TlsCall
  134. DWORD WINAPI TlsCall(DWORD p1, DWORD p2);
  135. #endif
  136.  
  137. _inline DWORD WINAPI TlsAlloc(void) {
  138.     return TlsCall(TLS_FUNCALLOC, 0);
  139. }
  140.  
  141. _inline BOOL WINAPI TlsFree(DWORD dwTlsIndex) {
  142.     return TlsCall(TLS_FUNCFREE, dwTlsIndex);
  143. }
  144.  
  145. #define VERIFY_READ_FLAG    0
  146. #define VERIFY_EXECUTE_FLAG 0
  147. #define VERIFY_WRITE_FLAG   1
  148. #define VERIFY_KERNEL_OK    2
  149.  
  150. _inline LPVOID LockResource(HGLOBAL hResData) {
  151.     return ((LPVOID)hResData);
  152. }
  153.  
  154.  
  155. #endif
  156.  
  157.