Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

331 lines
6.7 KiB

  1. /*
  2. *
  3. * REVISIONS:
  4. * pcy24Nov92: Added !C_WINDOWS to #ifndef HFILE stuff
  5. * RCT25Nov92 Added some stuff
  6. * pcy02Dec92: No need for BOOL if C_WINDOWS
  7. * pcy07Dec92: Changed BOOL to INT rather than enum so OS2 doesn't choke
  8. * ane11Dec92: Changed defn of PFILE and HFILE on OS2
  9. * rct11Dec92: Added FLOAT
  10. * pcy14Dec92: Semicolon needed in typedef of BOOL
  11. * pcy14Dec92: PFILE needed on C_WINDOWS in all cases
  12. * pcy14Dec92: Extra #endif needed in PFILE syntax
  13. * jod15Dec92: Removed the #if (C_OS & C_OS2) for HFILE and PFILE
  14. * pcy17Dec92: Removed VALID, INVALID
  15. * rct27Jan93: Added UCHAR, PUCHAR
  16. * pcy02Feb93: Added UINT
  17. * rct21Apr93: defined VOID as void for NLMs
  18. * pcy28Apr93: #ifdef _cplusplus added around extern "C"
  19. * pcy16May93: Added typedef for WORD
  20. * cad27May93: typedef USHORT even for OS2
  21. * cad18Sep93: Added memory debugging stuff
  22. * cad07Oct93: added SmartHeap malloc
  23. * cad18Nov93: not setting up smartheap strdup if it isn't there
  24. * cad08Dec93: added extended set/get types
  25. * cad27Dec93: include file madness
  26. * ram21Mar94: added some windows specific stuff
  27. * cad07Apr94: added DEBUG_PRT macro
  28. * mwh12Apr94: port for SCO
  29. * mwh01Jun94: port for INTERACTIVE
  30. * ajr07Jul94: Lets undef UINT on Unix platforms first
  31. * ajr30Jan95: Send DEBUG_PRT stuff to stderr
  32. * daf17May95: port for ALPHA/OSF
  33. * jps13Jul94: added VOID and DWORD for os2 1.x
  34. * ajr07Nov95: cannot have c++ comments on preprosser lines for sinix
  35. * cgm08Dec95: added SLONG, change LONG for NLM and Watcom 10.5
  36. * djs22Feb96: added CHANGESET
  37. * tjd24Feb97: added RESOURCE_STR_SIZE to define maximum resource string length
  38. * tjd28Feb97: added the resource dll instance handle
  39. */
  40. #ifndef __APC_H
  41. #define __APC_H
  42. #ifdef USE_SMARTHEAP
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #include <stdlib.h>
  46. }
  47. #include <smrtheap.hpp>
  48. #else
  49. #include <smrtheap.h>
  50. #endif
  51. // prevent malloc.h from being included
  52. #define __malloc_h
  53. #define _INC_MALLOC
  54. #include <shmalloc.h>
  55. #ifdef MEM_strdup
  56. // override default strdup
  57. #undef strdup
  58. #include <string.h>
  59. #define strdup(p) MEM_strdup(p)
  60. #endif
  61. #endif /* USE_SMARTHEAP */
  62. #ifndef FALSE
  63. #define FALSE 0
  64. #endif
  65. #ifndef TRUE
  66. #define TRUE 1
  67. #endif
  68. #if (C_OS & C_UNIX)
  69. #undef UINT
  70. #endif
  71. #ifndef PVOID
  72. typedef void * PVOID;
  73. #endif
  74. #ifndef VOID
  75. #if (C_OS & C_NLM | C_ALPHAOSF) || ((C_OS & C_OS2) && (C_VERSION & C_OS2_13))
  76. #define VOID void
  77. #else
  78. typedef void VOID;
  79. #endif
  80. #endif
  81. #ifndef INT
  82. #if (C_OS & C_DOS)
  83. typedef int INT;
  84. #else
  85. typedef int INT;
  86. #endif
  87. #endif
  88. #ifndef UINT
  89. # if C_OS & (C_WIN311 | C_WINDOWS)
  90. # ifndef _INC_WINDOWS
  91. typedef unsigned int UINT;
  92. # endif
  93. # else
  94. typedef unsigned int UINT ;
  95. # endif
  96. #endif
  97. #ifndef CHAR
  98. #if (C_OS & C_IRIX)
  99. // pcy - compiler bug on IRIX. SGI is looking into this one.
  100. #define CHAR char
  101. #else
  102. typedef char CHAR;
  103. #endif
  104. #endif
  105. #if C_OS & (C_WIN311 | C_WINDOWS)
  106. #ifndef _INC_WINDOWS
  107. typedef INT BOOL;
  108. #endif
  109. #else
  110. #if (!(C_OS & C_OS2)) /* not on OS2 */
  111. #ifndef __WINDOWS_H /* not if windows.h has already been included */
  112. #ifndef BOOL
  113. typedef INT BOOL;
  114. #endif
  115. #endif
  116. #endif
  117. #endif
  118. typedef unsigned char UCHAR;
  119. typedef unsigned char * PUCHAR;
  120. #ifndef PCHAR
  121. typedef char * PCHAR;
  122. #endif
  123. #if (C_OS & C_DOS)
  124. #ifndef DWORD
  125. typedef unsigned long DWORD;
  126. #endif
  127. #endif
  128. #if (C_OS & C_OS2)
  129. #ifndef DWORD
  130. typedef unsigned long DWORD;
  131. #endif
  132. #endif
  133. #ifndef WORD
  134. typedef unsigned short WORD;
  135. #endif
  136. #if (!(C_OS & C_OS2))
  137. #if (C_OS & (C_WIN311 | C_WINDOWS))
  138. #ifndef PFILE
  139. #define PFILE FILE*
  140. #endif
  141. #ifndef __WINDOWS_H /* not if windows.h has already been included */
  142. #ifndef HFILE
  143. #define HFILE FILE*
  144. #endif
  145. #endif
  146. #endif
  147. #endif
  148. #if ( !( C_OS & (C_WIN311 | C_WINDOWS ) ))
  149. #define PFILE FILE*
  150. #endif
  151. #if ( C_OS & (C_WIN311 | C_WINDOWS )) /* Need this for Novell FE */
  152. #define DWORD unsigned long
  153. #define BYTE unsigned char
  154. #endif
  155. #if (!(C_OS & C_OS2))
  156. #ifndef BYTE
  157. typedef unsigned char BYTE;
  158. #endif
  159. #endif
  160. #ifndef UNSIGNED
  161. typedef unsigned UNSIGNED;
  162. #endif
  163. /* #if (!(C_OS & C_OS2)) */
  164. #ifndef USHORT
  165. typedef unsigned short USHORT;
  166. #endif
  167. /* #endif */
  168. #ifndef ULONG
  169. typedef unsigned long ULONG;
  170. #endif
  171. #ifndef SLONG
  172. typedef signed long SLONG;
  173. #endif
  174. #ifndef LONG
  175. #if C_OS & C_NLM
  176. #define LONG unsigned long
  177. #else
  178. typedef long LONG;
  179. #endif
  180. #endif
  181. #if (C_OS & C_UNIX)
  182. #undef USHORT
  183. #define USHORT int
  184. #if (C_OS & (C_SCO | C_INTERACTIVE))
  185. typedef unsigned int ssize_t; /* SCO uses size_t, so type it ourselves */
  186. #endif
  187. #endif
  188. enum Type {GET, SET, GETRESPONSE, ALERT, DATASET, DECREMENTSET, PAUSESET,
  189. SIMPLE_SET, EXTENDED_GET, EXTENDED_SET, INCREMENTSET,
  190. CHANGESET};
  191. /* typedef Type MessageType;
  192. typedef int AttributeCode;
  193. typedef int EventCode;
  194. typedef int EventID;
  195. typedef int State;
  196. typedef int Signal;
  197. */
  198. #ifndef SEMAPHORE
  199. #if (C_OS & C_OS2)
  200. typedef ULONG SEMAPHORE;
  201. #elif (!(C_OS & (C_WIN311 | C_WINDOWS | C_DOS)))
  202. typedef LONG SEMAPHORE;
  203. #endif
  204. #endif
  205. #if (!(C_OS & C_OS2))
  206. #ifndef TID
  207. typedef unsigned int TID;
  208. #endif
  209. #endif
  210. #define OK 1
  211. typedef INT COUNTTYPE;
  212. typedef INT HASHTYPE;
  213. typedef HASHTYPE * PHASHTYPE;
  214. typedef float FLOAT;
  215. #ifdef APCDEBUG
  216. #if (C_OS & C_WIN311)
  217. #define DEBUG_PRT(a) wpf_debug_prt(a) /* defined in winprtf.cxx */
  218. #define DEBUG_PRT1(a) DEBUG_PRT(a) /* defined in winprtf.cxx */
  219. #define DEBUG_PRT2(a, b) wpf_debug_prt2(a,b) /* defined in winprtf.cxx */
  220. #define DEBUG_PRT3(a, b, c) wpf_debug_prt3(a,b,c) /* defined in winprtf.cxx */
  221. #define DEBUG_PRT_S_D(a,b) wpf_debug_prt_s_d(a,b) /* defined in winprtf.cxx */
  222. #else
  223. #define DEBUG_PRT(_a) \
  224. {if(theDebugFlag) { \
  225. fprintf (stderr,_a); \
  226. fflush(stdout); \
  227. }\
  228. }
  229. #define DEBUG_PRT1(a) \
  230. {if(theDebugFlag) { \
  231. fprintf(stderr,a); \
  232. printf("\n");\
  233. }\
  234. }
  235. #define DEBUG_PRT2(a, b) \
  236. {if(theDebugFlag) { \
  237. fprintf(stderr,a); \
  238. fprintf(stderr,": ");\
  239. fprintf(stderr,b);\
  240. fprintf(stderr,"\n");\
  241. }\
  242. }
  243. #define DEBUG_PRT3(a, b, c) \
  244. {if(theDebugFlag) { \
  245. fprintf(stderr,a); \
  246. fprintf(stderr,": ");\
  247. fprintf(stderr,b);\
  248. fprintf(stderr,c);\
  249. fprintf(stderr,"\n");\
  250. }\
  251. }
  252. #endif
  253. #define DEBUG_COUT(a) if(theDebugFlag) { \
  254. (cout << a);\
  255. }
  256. #else
  257. #define DEBUG_PRT(a)
  258. #define DEBUG_PRT1(a)
  259. #define DEBUG_PRT2(a, b)
  260. #define DEBUG_PRT3(a, b, c)
  261. #define DEBUG_PRT_S_D(a,b)
  262. #define DEBUG_COUT(a)
  263. #endif
  264. // @@@
  265. #define INTERNATIONAL
  266. #define RESOURCE_STR_SIZE 256
  267. #if (C_OS & C_NT)
  268. #include <windows.h>
  269. #endif
  270. // @@@
  271. #endif