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.

256 lines
5.1 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. All rights reserved
  4. Module Name:
  5. local.h
  6. Abstract:
  7. DDK version of local.h
  8. Environment:
  9. User Mode -Win32
  10. Revision History:
  11. --*/
  12. // @@BEGIN_DDKSPLIT
  13. #ifdef INTERNAL
  14. #include "splcom.h"
  15. #endif
  16. // @@END_DDKSPLIT
  17. #define READTHREADTIMEOUT 5000
  18. #define READ_THREAD_EOJ_TIMEOUT 60000 // 1 min
  19. #define READ_THREAD_ERROR_WAITTIME 5000 // 5 sec
  20. #define READ_THREAD_IDLE_WAITTIME 30000 // 30 sec
  21. #define ALL_JOBS 0xFFFFFFFF
  22. // ---------------------------------------------------------------------
  23. // EXTERN VARIABLES
  24. // ---------------------------------------------------------------------
  25. extern HANDLE hInst;
  26. extern DWORD dwReadThreadErrorTimeout;
  27. extern DWORD dwReadThreadEOJTimeout;
  28. extern DWORD dwReadThreadIdleTimeoutOther;
  29. extern CRITICAL_SECTION pjlMonSection;
  30. extern DWORD SplDbgLevel;
  31. // ---------------------------------------------------------------------
  32. // FUNCTION PROTOTYPE
  33. // ---------------------------------------------------------------------
  34. VOID
  35. EnterSplSem(
  36. VOID
  37. );
  38. VOID
  39. LeaveSplSem(
  40. VOID
  41. );
  42. VOID
  43. SplInSem(
  44. VOID
  45. );
  46. VOID
  47. SplOutSem(
  48. VOID
  49. );
  50. DWORD
  51. UpdateTimeoutsFromRegistry(
  52. IN HANDLE hPrinter,
  53. IN HKEY hKey,
  54. IN PMONITORREG pMonitorReg
  55. );
  56. PINIPORT
  57. FindIniPort(
  58. IN LPTSTR pszName
  59. );
  60. PINIPORT
  61. CreatePortEntry(
  62. IN LPTSTR pszPortName
  63. );
  64. VOID
  65. DeletePortEntry(
  66. IN PINIPORT pIniPort
  67. );
  68. VOID
  69. FreeIniJobs(
  70. PINIPORT pIniPort
  71. );
  72. VOID
  73. SendJobLastPageEjected(
  74. PINIPORT pIniPort,
  75. DWORD dwValue,
  76. BOOL bTime
  77. );
  78. VOID
  79. FreeIniJob(
  80. IN OUT PINIJOB pIniJob
  81. );
  82. // @@BEGIN_DDKSPLIT
  83. // ---------------------------------------------------------------------
  84. // UNICODE TO ANSI MACRO
  85. // ??? !!! we should get rid of these sooner or later
  86. // ---------------------------------------------------------------------
  87. // @@END_DDKSPLIT
  88. #include <string.h>
  89. #include <stdlib.h>
  90. #include <stdio.h>
  91. LPSTR
  92. mystrrchr(
  93. LPSTR cs,
  94. char c
  95. );
  96. LPSTR
  97. mystrchr(
  98. LPSTR cs,
  99. char c
  100. );
  101. int
  102. mystrncmp(
  103. LPSTR cs,
  104. LPSTR ct,
  105. int n
  106. );
  107. // @@BEGIN_DDKSPLIT
  108. #ifndef INTERNAL
  109. // @@END_DDKSPLIT
  110. extern CRITICAL_SECTION pjlMonSection;
  111. LPWSTR AllocSplStr(LPWSTR pStr);
  112. LPVOID AllocSplMem(DWORD cbAlloc);
  113. #define FreeSplMem( pMem ) (GlobalFree( pMem ) ? FALSE:TRUE)
  114. #define FreeSplStr( lpStr ) ((lpStr) ? (GlobalFree(lpStr) ? FALSE:TRUE):TRUE)
  115. // @@BEGIN_DDKSPLIT
  116. /* DEBUGGING:
  117. */
  118. #define DBG_NONE 0x0000
  119. #define DBG_INFO 0x0001
  120. #define DBG_WARN 0x0002
  121. #define DBG_WARNING 0x0002
  122. #define DBG_ERROR 0x0004
  123. #define DBG_TRACE 0x0008
  124. #define DBG_SECURITY 0x0010
  125. #define DBG_EXEC 0x0020
  126. #define DBG_PORT 0x0040
  127. #define DBG_NOTIFY 0x0080
  128. #define DBG_PAUSE 0x0100
  129. #define DBG_ASSERT 0x0200
  130. #define DBG_THREADM 0x0400
  131. #define DBG_MIN 0x0800
  132. #define DBG_TIME 0x1000
  133. #define DBG_FOLDER 0x2000
  134. #define DBG_NOHEAD 0x8000
  135. #if DEBUG
  136. ULONG
  137. DbgPrint(
  138. PCH Format,
  139. ...
  140. );
  141. VOID
  142. DbgBreakPoint(
  143. VOID
  144. );
  145. #define GLOBAL_DEBUG_FLAGS LocalMonDebug
  146. extern DWORD GLOBAL_DEBUG_FLAGS;
  147. /* These flags are not used as arguments to the DBGMSG macro.
  148. * You have to set the high word of the global variable to cause it to break.
  149. * It is ignored if used with DBGMSG.
  150. * (Here mainly for explanatory purposes.)
  151. */
  152. #define DBG_BREAK_ON_WARNING ( DBG_WARNING << 16 )
  153. #define DBG_BREAK_ON_ERROR ( DBG_ERROR << 16 )
  154. /* Double braces are needed for this one, e.g.:
  155. *
  156. * DBGMSG( DBG_ERROR, ( "Error code %d", Error ) );
  157. *
  158. * This is because we can't use variable parameter lists in macros.
  159. * The statement gets pre-processed to a semi-colon in non-debug mode.
  160. *
  161. * Set the global variable GLOBAL_DEBUG_FLAGS via the debugger.
  162. * Setting the flag in the low word causes that level to be printed;
  163. * setting the high word causes a break into the debugger.
  164. * E.g. setting it to 0x00040006 will print out all warning and error
  165. * messages, and break on errors.
  166. */
  167. #define DBGMSG( Level, MsgAndArgs ) \
  168. { \
  169. if( ( Level & 0xFFFF ) & GLOBAL_DEBUG_FLAGS ) \
  170. DbgPrint MsgAndArgs; \
  171. if( ( Level << 16 ) & GLOBAL_DEBUG_FLAGS ) \
  172. DbgBreakPoint(); \
  173. }
  174. #define SPLASSERT(expr) \
  175. if (!(expr)) { \
  176. DbgMsg( "Failed: %s\nLine %d, %s\n", \
  177. #expr, \
  178. __LINE__, \
  179. __FILE__ ); \
  180. DebugBreak(); \
  181. }
  182. #else
  183. #define DBGMSG
  184. #define SPLASSERT(exp)
  185. #endif
  186. #endif
  187. // @@END_DDKSPLIT
  188. //
  189. // Needed by DDK
  190. //
  191. // @@BEGIN_DDKSPLIT
  192. /*
  193. // @@END_DDKSPLIT
  194. #define DBGMSG(x,y)
  195. #define SPLASSERT(exp)
  196. // @@BEGIN_DDKSPLIT
  197. */
  198. // @@END_DDKSPLIT