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.

295 lines
6.3 KiB

  1. /*++
  2. Copyright (c) 1990-1994 Microsoft Corporation
  3. All rights reserved
  4. Module Name:
  5. Router.h
  6. Abstract:
  7. Holds defs for router
  8. Author:
  9. Albert Ting (AlbertT) 18-Jan-94
  10. Environment:
  11. User Mode -Win32
  12. Revision History:
  13. --*/
  14. typedef enum _ESTATUSCHANGE {
  15. STATUS_CHANGE_EMPTY = 0, // One of these is valid,
  16. STATUS_CHANGE_FORMING = 1, // but they still need x^2.
  17. STATUS_CHANGE_VALID = 2,
  18. STATUS_CHANGE_CLOSING = 0x000100, // bitfield
  19. STATUS_CHANGE_CLIENT = 0x000200, // Event valid (local pChange)
  20. STATUS_CHANGE_ACTIVE = 0x000400, // Currently processing or on LL
  21. STATUS_CHANGE_ACTIVE_REQ = 0x000800, // Needs to go on Linked List
  22. STATUS_CHANGE_INFO = 0x001000, // Info requested.
  23. STATUS_CHANGE_DISCARDED = 0x008000, // Discard locally
  24. STATUS_CHANGE_DISCARDNOTED = 0x010000, // Discard noted on client
  25. } ESTATUSCHANGE;
  26. typedef struct _LINK *PLINK, *LPLINK;
  27. typedef struct _LINK {
  28. PLINK pNext;
  29. } LINK;
  30. VOID
  31. LinkAdd(
  32. PLINK pLink,
  33. PLINK* ppLinkHead);
  34. VOID
  35. LinkDelete(
  36. PLINK pLink,
  37. PLINK* ppLinkHead);
  38. #define CLUSTERHANDLE_SIGNATURE 0x6262
  39. typedef struct _PRINTHANDLE *PPRINTHANDLE, *LPPRINTHANDLE;
  40. typedef struct _CHANGEINFO {
  41. LINK Link; // Must be first item
  42. PPRINTHANDLE pPrintHandle;
  43. DWORD fdwOptions;
  44. DWORD fdwFilterFlags; // Original filter of flags to watch
  45. DWORD fdwStatus; // Status from providor
  46. DWORD dwPollTime;
  47. DWORD dwPollTimeLeft;
  48. BOOL bResetPollTime;
  49. DWORD fdwFlags;
  50. PPRINTER_NOTIFY_INFO pPrinterNotifyInfo;
  51. } CHANGEINFO, *PCHANGEINFO;
  52. typedef struct _CHANGE {
  53. LINK Link; // Must be first item
  54. DWORD signature;
  55. ESTATUSCHANGE eStatus;
  56. DWORD dwColor;
  57. DWORD cRef;
  58. LPWSTR pszLocalMachine;
  59. CHANGEINFO ChangeInfo;
  60. DWORD dwCount; // number of notifications
  61. HANDLE hEvent; // Event for local notification
  62. DWORD fdwFlags;
  63. DWORD fdwChangeFlags; // Accumulated changes
  64. DWORD dwPrinterRemote; // Remote printer handle (ID only)
  65. HANDLE hNotifyRemote; // Remote notification handle
  66. } CHANGE, *PCHANGE, *LPCHANGE;
  67. #define CHANGEHANDLE_SIGNATURE 0x6368
  68. typedef struct _NOTIFY *PNOTIFY, *LPNOTIFY;
  69. #define NOTIFYHANDLE_SIGNATURE 0x6e6f
  70. typedef struct _PROVIDOR {
  71. struct _PROVIDOR *pNext;
  72. LPWSTR lpName;
  73. HANDLE hModule;
  74. FARPROC fpInitialize;
  75. PRINTPROVIDOR PrintProvidor;
  76. } PROVIDOR, *LPPROVIDOR;
  77. typedef struct _PRINTHANDLE {
  78. DWORD signature; // Must be first (match _NOTIFY)
  79. LPPROVIDOR pProvidor;
  80. HANDLE hPrinter;
  81. PCHANGE pChange;
  82. PNOTIFY pNotify;
  83. PPRINTHANDLE pNext; // List of handles waiting for replys
  84. DWORD fdwReplyTypes; // Types of replys being used.
  85. HANDLE hFileSpooler;
  86. LPWSTR szTempSpoolFile;
  87. LPWSTR pszPrinter;
  88. DWORD dwUniqueSessionID; // DWORD passed as a hprinter to remote machines
  89. // for notifications. Cant be 0 or 0xffffffff when in use.
  90. } PRINTHANDLE;
  91. #define PRINTHANDLE_SIGNATURE 0x6060
  92. typedef struct _GDIHANDLE {
  93. DWORD signature;
  94. LPPROVIDOR pProvidor;
  95. HANDLE hGdi;
  96. } GDIHANDLE, *PGDIHANDLE, *LPGDIHANDLE;
  97. #define GDIHANDLE_SIGNATURE 0x6161
  98. typedef struct _ROUTERCACHE {
  99. LPWSTR pPrinterName;
  100. BOOL bAvailable;
  101. LPPROVIDOR pProvidor;
  102. SYSTEMTIME st;
  103. } ROUTERCACHE, *PROUTERCACHE;
  104. #define ROUTERCACHE_DEFAULT_MAX 16
  105. LPPROVIDOR
  106. FindEntryinRouterCache(
  107. LPWSTR pPrinterName
  108. );
  109. DWORD
  110. AddEntrytoRouterCache(
  111. LPWSTR pPrinterName,
  112. LPPROVIDOR pProvidor
  113. );
  114. VOID
  115. DeleteEntryfromRouterCache(
  116. LPWSTR pPrinterName
  117. );
  118. DWORD
  119. RouterIsOlderThan(
  120. DWORD i,
  121. DWORD j
  122. );
  123. LPBYTE
  124. CopyPrinterNameToPrinterInfo4(
  125. LPWSTR pServerName,
  126. LPWSTR pPrinterName,
  127. LPBYTE pPrinter,
  128. LPBYTE pEnd);
  129. BOOL
  130. RouterOpenPrinterW(
  131. LPWSTR pPrinterName,
  132. HANDLE *pHandle,
  133. LPPRINTER_DEFAULTS pDefault,
  134. LPBYTE pSplClientInfo,
  135. DWORD dwLevel,
  136. BOOL bLocalPrintProvidor
  137. );
  138. VOID
  139. FixupOldProvidor(
  140. LPPRINTPROVIDOR pProvidor
  141. );
  142. extern BOOL Initialized;
  143. extern DWORD dwUpgradeFlag;
  144. extern CRITICAL_SECTION RouterNotifySection;
  145. extern LPWSTR pszSelfMachine;
  146. extern HANDLE hEventInit;
  147. extern LPPROVIDOR pLocalProvidor;
  148. extern LPWSTR szEnvironment;
  149. extern LPWSTR szLocalSplDll;
  150. extern WCHAR *szDevices;
  151. extern LPWSTR szPrintKey;
  152. extern LPWSTR szRegistryProvidors;
  153. extern LPWSTR szOrder;
  154. extern DWORD gbFailAllocs;
  155. #ifdef __cplusplus
  156. extern "C" WCHAR szMachineName[MAX_COMPUTERNAME_LENGTH+3];
  157. #else
  158. extern WCHAR szMachineName[MAX_COMPUTERNAME_LENGTH+3];
  159. #endif
  160. extern SERVICE_STATUS_HANDLE ghSplHandle;
  161. LPWSTR
  162. AppendOrderEntry(
  163. LPWSTR szOrderString,
  164. DWORD cbStringSize,
  165. LPWSTR szOrderEntry,
  166. LPDWORD pcbBytesReturned
  167. );
  168. LPWSTR
  169. RemoveOrderEntry(
  170. LPWSTR szOrderString,
  171. DWORD cbStringSize,
  172. LPWSTR szOrderEntry,
  173. LPDWORD pcbBytesReturned
  174. );
  175. BOOL
  176. WPCInit();
  177. VOID
  178. WPCDestroy();
  179. BOOL
  180. ThreadInit();
  181. VOID
  182. ThreadDestroy();
  183. VOID
  184. RundownPrinterChangeNotification(
  185. HANDLE hNotify);
  186. VOID
  187. FreePrinterHandle(
  188. PPRINTHANDLE pPrintHandle);
  189. BOOL
  190. FreeChange(
  191. PCHANGE pChange);
  192. VOID
  193. FreePrinterChangeInfo(
  194. PCHANGEINFO pChangeInfo);
  195. BOOL
  196. DeleteSubKeyTree(
  197. HKEY ParentHandle,
  198. WCHAR SubKeyName[]
  199. );
  200. BOOL
  201. ThreadNotify(
  202. LPPRINTHANDLE pPrintHandle);
  203. BOOL
  204. NotifyNeeded(
  205. PCHANGE pChange);
  206. VOID
  207. HandlePollNotifications();
  208. DWORD
  209. GetNetworkIdWorker(
  210. HKEY hKeyDevices,
  211. LPWSTR pDeviceName);
  212. VOID
  213. UpdateSignificantError(
  214. DWORD dwNewError,
  215. PDWORD pdwOldError
  216. );
  217. #define EnterRouterSem() EnterCriticalSection(&RouterNotifySection)
  218. #define LeaveRouterSem() LeaveCriticalSection(&RouterNotifySection)
  219. #define RouterInSem()
  220. #define RouterOutSem()