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.

739 lines
22 KiB

  1. /*++
  2. Copyright (c) 1994-1998 Microsoft Corporation
  3. Module Name :
  4. pudebug.h
  5. Abstract:
  6. This module declares the DEBUG_PRINTS object helpful in
  7. testing the programs
  8. Author:
  9. Murali R. Krishnan ( MuraliK ) 14-Dec-1994
  10. Revision History:
  11. MuraliK 13-Nov-1998 Ported over to IIS-DuctTape
  12. --*/
  13. #if !defined(BUILD_PUDEBUG)
  14. //
  15. // if we are not using this header for building the pudebug library
  16. // then better this be used with dbgutil.h
  17. //
  18. # ifndef _DBGUTIL_H_
  19. // error Please make sure you included dbgutil.h!
  20. // error Do not include pudebug.h directly
  21. #include <dbgutil.h>
  22. # endif // _DBGUTIL_H_
  23. #endif
  24. # ifndef _PUDEBUG_H_
  25. # define _PUDEBUG_H_
  26. #ifndef _NO_TRACING_
  27. # define _NO_TRACING_
  28. #endif // _NO_TRACING_
  29. /************************************************************
  30. * Include Headers
  31. ************************************************************/
  32. # ifdef __cplusplus
  33. extern "C" {
  34. # endif // __cplusplus
  35. # include <windows.h>
  36. # ifndef dllexp
  37. # define dllexp __declspec( dllexport)
  38. # endif // dllexp
  39. /***********************************************************
  40. * Macros
  41. ************************************************************/
  42. enum PRINT_REASONS {
  43. PrintNone = 0x0, // Nothing to be printed
  44. PrintError = 0x1, // An error message
  45. PrintWarning = 0x2, // A warning message
  46. PrintLog = 0x3, // Just logging. Indicates a trace of where ...
  47. PrintMsg = 0x4, // Echo input message
  48. PrintCritical = 0x5, // Print and Exit
  49. PrintAssertion= 0x6 // Printing for an assertion failure
  50. };
  51. enum DEBUG_OUTPUT_FLAGS {
  52. DbgOutputNone = 0x0, // None
  53. DbgOutputKdb = 0x1, // Output to Kernel Debugger
  54. DbgOutputLogFile = 0x2, // Output to LogFile
  55. DbgOutputTruncate = 0x4, // Truncate Log File if necessary
  56. DbgOutputStderr = 0x8, // Send output to std error
  57. DbgOutputBackup = 0x10, // Make backup of debug file ?
  58. DbgOutputMemory = 0x20, // Dump to memory buffer
  59. DbgOutputAll = 0xFFFFFFFF // All the bits set.
  60. };
  61. # define MAX_LABEL_LENGTH ( 100)
  62. // The following flags are used internally to track what level of tracing we
  63. // are currently using. Bitmapped for extensibility.
  64. #define DEBUG_FLAG_ODS 0x00000001
  65. #define DEBUG_FLAG_INFO 0x00000002
  66. #define DEBUG_FLAG_WARN 0x00000004
  67. #define DEBUG_FLAG_ERROR 0x00000008
  68. // The following are used internally to determine whether to log or not based
  69. // on what the current state is
  70. #define DEBUG_FLAGS_INFO (DEBUG_FLAG_ODS | DEBUG_FLAG_INFO)
  71. #define DEBUG_FLAGS_WARN (DEBUG_FLAG_ODS | DEBUG_FLAG_INFO | DEBUG_FLAG_WARN)
  72. #define DEBUG_FLAGS_ERROR (DEBUG_FLAG_ODS | DEBUG_FLAG_INFO | DEBUG_FLAG_WARN | DEBUG_FLAG_ERROR)
  73. #define DEBUG_FLAGS_ANY (DEBUG_FLAG_INFO | DEBUG_FLAG_WARN | DEBUG_FLAG_ERROR)
  74. //
  75. // user of DEBUG infrastructure may choose unique variable name for DEBUG_FLAGS
  76. // that's specially useful for cases where DEBUG infrastructure is used within
  77. // static library (static library may prefer to maintain it's own DebugFlags independent
  78. // on the main program it links to
  79. //
  80. #ifndef DEBUG_FLAGS_VAR
  81. #define DEBUG_FLAGS_VAR g_dwDebugFlags
  82. #endif
  83. extern
  84. #ifdef __cplusplus
  85. "C"
  86. # endif // _cplusplus
  87. DWORD DEBUG_FLAGS_VAR ; // Debugging Flags
  88. # define DECLARE_DEBUG_VARIABLE()
  89. # define SET_DEBUG_FLAGS( dwFlags) DEBUG_FLAGS_VAR = dwFlags
  90. # define GET_DEBUG_FLAGS() ( DEBUG_FLAGS_VAR )
  91. # define LOAD_DEBUG_FLAGS_FROM_REG(hkey, dwDefault) \
  92. DEBUG_FLAGS_VAR = PuLoadDebugFlagsFromReg((hkey), (dwDefault))
  93. # define LOAD_DEBUG_FLAGS_FROM_REG_STR(pszRegKey, dwDefault) \
  94. DEBUG_FLAGS_VAR = PuLoadDebugFlagsFromRegStr((pszRegKey), (dwDefault))
  95. # define SAVE_DEBUG_FLAGS_IN_REG(hkey, dwDbg) \
  96. PuSaveDebugFlagsInReg((hkey), (dwDbg))
  97. # define DEBUG_IF( arg, s) if ( DEBUG_ ## arg & GET_DEBUG_FLAGS()) { \
  98. s \
  99. } else {}
  100. # define IF_DEBUG( arg) if ( DEBUG_## arg & GET_DEBUG_FLAGS())
  101. /*++
  102. class DEBUG_PRINTS
  103. This class is responsible for printing messages to log file / kernel debugger
  104. Currently the class supports only member functions for <ANSI> char.
  105. ( not unicode-strings).
  106. --*/
  107. typedef struct _DEBUG_PRINTS {
  108. CHAR m_rgchLabel[MAX_LABEL_LENGTH];
  109. CHAR m_rgchLogFilePath[MAX_PATH];
  110. CHAR m_rgchLogFileName[MAX_PATH];
  111. HANDLE m_LogFileHandle;
  112. HANDLE m_StdErrHandle;
  113. BOOL m_fInitialized;
  114. BOOL m_fBreakOnAssert;
  115. DWORD m_dwOutputFlags;
  116. VOID *m_pMemoryLog;
  117. } DEBUG_PRINTS, FAR * LPDEBUG_PRINTS;
  118. LPDEBUG_PRINTS
  119. PuCreateDebugPrintsObject(
  120. IN const char * pszPrintLabel,
  121. IN DWORD dwOutputFlags);
  122. //
  123. // frees the debug prints object and closes any file if necessary.
  124. // Returns NULL on success or returns pDebugPrints on failure.
  125. //
  126. LPDEBUG_PRINTS
  127. PuDeleteDebugPrintsObject(
  128. IN OUT LPDEBUG_PRINTS pDebugPrints);
  129. VOID
  130. PuDbgPrint(
  131. IN OUT LPDEBUG_PRINTS pDebugPrints,
  132. IN const char * pszFilePath,
  133. IN int nLineNum,
  134. IN const char * pszFunctionName,
  135. IN const char * pszFormat,
  136. ...);
  137. // arglist
  138. VOID
  139. PuDbgPrintW(
  140. IN OUT LPDEBUG_PRINTS pDebugPrints,
  141. IN const char * pszFilePath,
  142. IN int nLineNum,
  143. IN const char * pszFunctionName,
  144. IN const WCHAR * pszFormat,
  145. ...); // arglist
  146. // PuDbgPrintError is similar to PuDbgPrint() but allows
  147. // one to print error code in friendly manner
  148. VOID
  149. PuDbgPrintError(
  150. IN OUT LPDEBUG_PRINTS pDebugPrints,
  151. IN const char * pszFilePath,
  152. IN int nLineNum,
  153. IN const char * pszFunctionName,
  154. IN DWORD dwError,
  155. IN const char * pszFormat,
  156. ...); // arglist
  157. /*++
  158. PuDbgDump() does not do any formatting of output.
  159. It just dumps the given message onto the debug destinations.
  160. --*/
  161. VOID
  162. PuDbgDump(
  163. IN OUT LPDEBUG_PRINTS pDebugPrints,
  164. IN const char * pszFilePath,
  165. IN int nLineNum,
  166. IN const char * pszFunctionName,
  167. IN const char * pszDump
  168. );
  169. //
  170. // PuDbgAssertFailed() *must* be __cdecl to properly capture the
  171. // thread context at the time of the failure.
  172. //
  173. INT
  174. __cdecl
  175. PuDbgAssertFailed(
  176. IN OUT LPDEBUG_PRINTS pDebugPrints,
  177. IN const char * pszFilePath,
  178. IN int nLineNum,
  179. IN const char * pszFunctionName,
  180. IN const char * pszExpression,
  181. IN const char * pszMessage);
  182. VOID
  183. PuDbgCaptureContext (
  184. OUT PCONTEXT ContextRecord
  185. );
  186. VOID
  187. PuDbgPrintCurrentTime(
  188. IN OUT LPDEBUG_PRINTS pDebugPrints,
  189. IN const char * pszFilePath,
  190. IN int nLineNum,
  191. IN const char * pszFunctionName
  192. );
  193. VOID
  194. PuSetDbgOutputFlags(
  195. IN OUT LPDEBUG_PRINTS pDebugPrints,
  196. IN DWORD dwFlags);
  197. DWORD
  198. PuGetDbgOutputFlags(
  199. IN const LPDEBUG_PRINTS pDebugPrints);
  200. //
  201. // Following functions return Win32 error codes.
  202. // NO_ERROR if success
  203. //
  204. DWORD
  205. PuOpenDbgPrintFile(
  206. IN OUT LPDEBUG_PRINTS pDebugPrints,
  207. IN const char * pszFileName,
  208. IN const char * pszPathForFile);
  209. DWORD
  210. PuReOpenDbgPrintFile(
  211. IN OUT LPDEBUG_PRINTS pDebugPrints);
  212. DWORD
  213. PuCloseDbgPrintFile(
  214. IN OUT LPDEBUG_PRINTS pDebugPrints);
  215. DWORD
  216. PuOpenDbgMemoryLog(
  217. IN OUT LPDEBUG_PRINTS pDebugPrints);
  218. DWORD
  219. PuCloseDbgMemoryLog(
  220. IN OUT LPDEBUG_PRINTS pDebugPrints);
  221. DWORD
  222. PuLoadDebugFlagsFromReg(IN HKEY hkey, IN DWORD dwDefault);
  223. DWORD
  224. PuLoadDebugFlagsFromRegStr(IN LPCSTR pszRegKey, IN DWORD dwDefault);
  225. DWORD
  226. PuSaveDebugFlagsInReg(IN HKEY hkey, IN DWORD dwDbg);
  227. # define PuPrintToKdb( pszOutput) \
  228. if ( pszOutput != NULL) { \
  229. OutputDebugString( pszOutput); \
  230. } else {}
  231. # ifdef __cplusplus
  232. };
  233. # endif // __cplusplus
  234. // begin_user_unmodifiable
  235. /***********************************************************
  236. * Macros
  237. ************************************************************/
  238. extern
  239. #ifdef __cplusplus
  240. "C"
  241. # endif // _cplusplus
  242. DEBUG_PRINTS * g_pDebug; // define a global debug variable
  243. # if DBG
  244. // For the CHK build we want ODS enabled. For an explanation of these flags see
  245. // the comment just after the definition of DBG_CONTEXT
  246. # define DECLARE_DEBUG_PRINTS_OBJECT() \
  247. DEBUG_PRINTS * g_pDebug = NULL; \
  248. DWORD DEBUG_FLAGS_VAR = DEBUG_FLAG_ERROR;
  249. #else // !DBG
  250. # define DECLARE_DEBUG_PRINTS_OBJECT() \
  251. DEBUG_PRINTS * g_pDebug = NULL; \
  252. DWORD DEBUG_FLAGS_VAR = 0;
  253. #endif // !DBG
  254. //
  255. // Call the following macro as part of your initialization for program
  256. // planning to use the debugging class.
  257. //
  258. # define CREATE_DEBUG_PRINT_OBJECT( pszLabel) \
  259. g_pDebug = PuCreateDebugPrintsObject( pszLabel, DEFAULT_OUTPUT_FLAGS);\
  260. if ( g_pDebug == NULL) { \
  261. OutputDebugStringA( "Unable to Create Debug Print Object \n"); \
  262. }
  263. //
  264. // Call the following macro once as part of the termination of program
  265. // which uses the debugging class.
  266. //
  267. # define DELETE_DEBUG_PRINT_OBJECT( ) \
  268. g_pDebug = PuDeleteDebugPrintsObject( g_pDebug);
  269. # define VALID_DEBUG_PRINT_OBJECT() \
  270. ( ( g_pDebug != NULL) && g_pDebug->m_fInitialized)
  271. //
  272. // Use the DBG_CONTEXT without any surrounding braces.
  273. // This is used to pass the values for global DebugPrintObject
  274. // and File/Line information
  275. //
  276. # define DBG_CONTEXT g_pDebug, __FILE__, __LINE__, __FUNCTION__
  277. // The 3 main tracing macros, each one corresponds to a different level of
  278. // tracing
  279. // The 3 main tracing macros, each one corresponds to a different level of
  280. // tracing
  281. # define DBGINFO(args) {if (DEBUG_FLAGS_VAR & DEBUG_FLAGS_INFO) { PuDbgPrint args; }}
  282. # define DBGWARN(args) {if (DEBUG_FLAGS_VAR & DEBUG_FLAGS_WARN) { PuDbgPrint args; }}
  283. # define DBGERROR(args) {if (DEBUG_FLAGS_VAR & DEBUG_FLAGS_ERROR) { PuDbgPrint args; }}
  284. # define DBGINFOW(args) {if (DEBUG_FLAGS_VAR & DEBUG_FLAGS_INFO) { PuDbgPrintW args; }}
  285. # define DBGWARNW(args) {if (DEBUG_FLAGS_VAR & DEBUG_FLAGS_WARN) { PuDbgPrintW args; }}
  286. # define DBGERRORW(args) {if (DEBUG_FLAGS_VAR & DEBUG_FLAGS_ERROR) { PuDbgPrintW args; }}
  287. //
  288. // DBGPRINTF() is printing function ( much like printf) but always called
  289. // with the DBG_CONTEXT as follows
  290. // DBGPRINTF( ( DBG_CONTEXT, format-string, arguments for format list));
  291. //
  292. # define DBGPRINTF DBGINFO
  293. //
  294. // DPERROR() is printing function ( much like printf) but always called
  295. // with the DBG_CONTEXT as follows
  296. // DPERROR( ( DBG_CONTEXT, error, format-string,
  297. // arguments for format list));
  298. //
  299. # define DPERROR( args) {if (DEBUG_FLAGS_VAR & DEBUG_FLAGS_ERROR) { PuDbgPrintError args; }}
  300. # if DBG
  301. # define DBG_CODE(s) s /* echoes code in debugging mode */
  302. // The same 3 main tracing macros however in this case the macros are only compiled
  303. // into the CHK build. This is necessary because some tracing info used functions or
  304. // variables which are not compiled into the FRE build.
  305. # define CHKINFO(args) { PuDbgPrint args; }
  306. # define CHKWARN(args) { PuDbgPrint args; }
  307. # define CHKERROR(args) { PuDbgPrint args; }
  308. # define CHKINFOW(args) { PuDbgPrintW args; }
  309. # define CHKWARNW(args) { PuDbgPrintW args; }
  310. # define CHKERRORW(args) { PuDbgPrintW args; }
  311. # define DBG_ASSERT( exp ) ((VOID) ( (exp) || PuDbgAssertFailed( DBG_CONTEXT, #exp, NULL)))
  312. # define DBG_ASSERT_MSG( exp, pszMsg) \
  313. if ( !(exp)) { \
  314. PuDbgAssertFailed( DBG_CONTEXT, #exp, pszMsg); \
  315. } else {}
  316. # define DBG_REQUIRE( exp) DBG_ASSERT( exp)
  317. # define DBG_LOG() PuDbgPrint( DBG_CONTEXT, "\n")
  318. # define DBG_OPEN_LOG_FILE( pszFile, pszPath) \
  319. PuOpenDbgPrintFile( g_pDebug, (pszFile), (pszPath))
  320. # define DBG_CLOSE_LOG_FILE( ) \
  321. PuCloseDbgPrintFile( g_pDebug)
  322. # define DBG_OPEN_MEMORY_LOG() \
  323. PuOpenDbgMemoryLog( g_pDebug )
  324. # define DBGDUMP( args) PuDbgDump args
  325. # define DBGPRINT_CURRENT_TIME() PuDbgPrintCurrentTime( DBG_CONTEXT)
  326. # else // !DBG
  327. # define DBG_CODE(s) ((void)0) /* Do Nothing */
  328. # define CHKINFO(args) ((void)0) /* Do Nothing */
  329. # define CHKWARN(args) ((void)0) /* Do Nothing */
  330. # define CHKERROR(args) ((void)0) /* Do Nothing */
  331. # define CHKINFOW(args) ((void)0) /* Do Nothing */
  332. # define CHKWARNW(args) ((void)0) /* Do Nothing */
  333. # define CHKERRORW(args) ((void)0) /* Do Nothing */
  334. # define DBG_ASSERT(exp) ((void)0) /* Do Nothing */
  335. # define DBG_ASSERT_MSG(exp, pszMsg) ((void)0) /* Do Nothing */
  336. # define DBG_REQUIRE( exp) ( (void) (exp))
  337. # define DBGDUMP( args) ((void)0) /* Do nothing */
  338. # define DBG_LOG() ((void)0) /* Do Nothing */
  339. # define DBG_OPEN_LOG_FILE( pszFile, pszPath) ((void)0) /* Do Nothing */
  340. # define DBG_OPEN_MEMORY_LOG() ((void)0) /* Do Nothing */
  341. # define DBG_CLOSE_LOG_FILE() ((void)0) /* Do Nothing */
  342. # define DBGPRINT_CURRENT_TIME() ((void)0) /* Do Nothing */
  343. # endif // !DBG
  344. // end_user_unmodifiable
  345. // begin_user_unmodifiable
  346. #ifdef ASSERT
  347. # undef ASSERT
  348. #endif
  349. # define ASSERT( exp) DBG_ASSERT( exp)
  350. // end_user_unmodifiable
  351. // begin_user_modifiable
  352. //
  353. // Debugging constants consist of two pieces.
  354. // All constants in the range 0x0 to 0x8000 are reserved
  355. // User extensions may include additional constants (bit flags)
  356. //
  357. # define DEBUG_API_ENTRY 0x00000001L
  358. # define DEBUG_API_EXIT 0x00000002L
  359. # define DEBUG_INIT_CLEAN 0x00000004L
  360. # define DEBUG_ERROR 0x00000008L
  361. // End of Reserved Range
  362. # define DEBUG_RESERVED 0x00000FFFL
  363. // end_user_modifiable
  364. /***********************************************************
  365. * Platform Type related variables and macros
  366. ************************************************************/
  367. //
  368. // Enum for product types
  369. //
  370. typedef enum _PLATFORM_TYPE {
  371. PtInvalid = 0, // Invalid
  372. PtNtWorkstation = 1, // NT Workstation
  373. PtNtServer = 2, // NT Server
  374. } PLATFORM_TYPE;
  375. //
  376. // IISGetPlatformType is the function used to the platform type
  377. //
  378. extern
  379. #ifdef __cplusplus
  380. "C"
  381. # endif // _cplusplus
  382. PLATFORM_TYPE
  383. IISGetPlatformType(
  384. VOID
  385. );
  386. //
  387. // External Macros
  388. //
  389. #define InetIsNtServer( _pt ) ((_pt) == PtNtServer)
  390. #define InetIsNtWksta( _pt ) ((_pt) == PtNtWorkstation)
  391. #define InetIsValidPT(_pt) ((_pt) != PtInvalid)
  392. extern
  393. #ifdef __cplusplus
  394. "C"
  395. # endif // _cplusplus
  396. PLATFORM_TYPE g_PlatformType;
  397. // Use the DECLARE_PLATFORM_TYPE macro to declare the platform type
  398. #define DECLARE_PLATFORM_TYPE() \
  399. PLATFORM_TYPE g_PlatformType = PtInvalid;
  400. // Use the INITIALIZE_PLATFORM_TYPE to init the platform type
  401. // This should typically go inside the DLLInit or equivalent place.
  402. #define INITIALIZE_PLATFORM_TYPE() \
  403. g_PlatformType = IISGetPlatformType();
  404. //
  405. // Additional Macros to use the Platform Type
  406. //
  407. #define TsIsNtServer( ) InetIsNtServer(g_PlatformType)
  408. #define TsIsNtWksta( ) InetIsNtWksta(g_PlatformType)
  409. #define IISIsValidPlatform() InetIsValidPT(g_PlatformType)
  410. #define IISPlatformType() (g_PlatformType)
  411. /***********************************************************
  412. * Some utility functions for Critical Sections
  413. ************************************************************/
  414. //
  415. // IISSetCriticalSectionSpinCount() provides a thunk for the
  416. // original NT4.0sp3 API SetCriticalSectionSpinCount() for CS with Spin counts
  417. // Users of this function should definitely dynlink with kernel32.dll,
  418. // Otherwise errors will surface to a large extent
  419. //
  420. extern
  421. # ifdef __cplusplus
  422. "C"
  423. # endif // _cplusplus
  424. DWORD
  425. IISSetCriticalSectionSpinCount(
  426. LPCRITICAL_SECTION lpCriticalSection,
  427. DWORD dwSpinCount
  428. );
  429. //
  430. // Macro for the calls to SetCriticalSectionSpinCount()
  431. //
  432. # define SET_CRITICAL_SECTION_SPIN_COUNT( lpCS, dwSpins) \
  433. IISSetCriticalSectionSpinCount( (lpCS), (dwSpins))
  434. //
  435. // IIS_DEFAULT_CS_SPIN_COUNT is the default value of spins used by
  436. // Critical sections defined within IIS.
  437. // NYI: We should have to switch the individual values based on experiments!
  438. // Current value is an arbitrary choice
  439. //
  440. # define IIS_DEFAULT_CS_SPIN_COUNT (1000)
  441. //
  442. // Initializes a critical section and sets its spin count
  443. // to IIS_DEFAULT_CS_SPIN_COUNT. Equivalent to
  444. // InitializeCriticalSectionAndSpinCount(lpCS, IIS_DEFAULT_CS_SPIN_COUNT),
  445. // but provides a safe thunking layer for older systems that don't provide
  446. // this API.
  447. //
  448. extern
  449. # ifdef __cplusplus
  450. "C"
  451. # endif // _cplusplus
  452. BOOL
  453. IISInitializeCriticalSection(
  454. LPCRITICAL_SECTION lpCriticalSection
  455. );
  456. //
  457. // Macro for the calls to InitializeCriticalSection()
  458. //
  459. # define INITIALIZE_CRITICAL_SECTION(lpCS) IISInitializeCriticalSection(lpCS)
  460. # endif /* _DEBUG_HXX_ */
  461. //
  462. // The following macros allow the automatic naming of certain Win32 objects.
  463. // See IIS\SVCS\IISRTL\WIN32OBJ.C for details on the naming convention.
  464. //
  465. // Set IIS_NAMED_WIN32_OBJECTS to a non-zero value to enable named events,
  466. // semaphores, and mutexes.
  467. //
  468. #if DBG
  469. #define IIS_NAMED_WIN32_OBJECTS 1
  470. #else
  471. #define IIS_NAMED_WIN32_OBJECTS 0
  472. #endif
  473. #ifdef __cplusplus
  474. extern "C" {
  475. #endif
  476. HANDLE
  477. PuDbgCreateEvent(
  478. IN LPSTR FileName,
  479. IN ULONG LineNumber,
  480. IN LPSTR MemberName,
  481. IN PVOID Address,
  482. IN BOOL ManualReset,
  483. IN BOOL InitialState
  484. );
  485. HANDLE
  486. PuDbgCreateSemaphore(
  487. IN LPSTR FileName,
  488. IN ULONG LineNumber,
  489. IN LPSTR MemberName,
  490. IN PVOID Address,
  491. IN LONG InitialCount,
  492. IN LONG MaximumCount
  493. );
  494. HANDLE
  495. PuDbgCreateMutex(
  496. IN LPSTR FileName,
  497. IN ULONG LineNumber,
  498. IN LPSTR MemberName,
  499. IN PVOID Address,
  500. IN BOOL InitialOwner
  501. );
  502. #ifdef __cplusplus
  503. } // extern "C"
  504. #endif
  505. #if IIS_NAMED_WIN32_OBJECTS
  506. #define IIS_CREATE_EVENT( membername, address, manual, state ) \
  507. PuDbgCreateEvent( \
  508. (LPSTR)__FILE__, \
  509. (ULONG)__LINE__, \
  510. (membername), \
  511. (PVOID)(address), \
  512. (manual), \
  513. (state) \
  514. )
  515. #define IIS_CREATE_SEMAPHORE( membername, address, initial, maximum ) \
  516. PuDbgCreateSemaphore( \
  517. (LPSTR)__FILE__, \
  518. (ULONG)__LINE__, \
  519. (membername), \
  520. (PVOID)(address), \
  521. (initial), \
  522. (maximum) \
  523. )
  524. #define IIS_CREATE_MUTEX( membername, address, initial ) \
  525. PuDbgCreateMutex( \
  526. (LPSTR)__FILE__, \
  527. (ULONG)__LINE__, \
  528. (membername), \
  529. (PVOID)(address), \
  530. (initial) \
  531. )
  532. #else // !IIS_NAMED_WIN32_OBJECTS
  533. #define IIS_CREATE_EVENT( membername, address, manual, state ) \
  534. CreateEventA( \
  535. NULL, \
  536. (manual), \
  537. (state), \
  538. NULL \
  539. )
  540. #define IIS_CREATE_SEMAPHORE( membername, address, initial, maximum ) \
  541. CreateSemaphoreA( \
  542. NULL, \
  543. (initial), \
  544. (maximum), \
  545. NULL \
  546. )
  547. #define IIS_CREATE_MUTEX( membername, address, initial ) \
  548. CreateMutexA( \
  549. NULL, \
  550. (initial), \
  551. NULL \
  552. )
  553. #endif // IIS_NAMED_WIN32_OBJECTS
  554. /************************ End of File ***********************/