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.

531 lines
9.4 KiB

  1. /*++
  2. Copyright (c) 1992-1993 Microsoft Corporation
  3. Module Name:
  4. nw.h
  5. Abstract:
  6. Main header of the NetWare Workstation service included by all
  7. modules.
  8. Author:
  9. Rita Wong (ritaw) 11-Dec-1992
  10. Environment:
  11. User Mode -Win32
  12. Revision History:
  13. --*/
  14. #ifndef _NW_INCLUDED_
  15. #define _NW_INCLUDED_
  16. //
  17. // Includes
  18. //
  19. #include <stdlib.h>
  20. #include <string.h>
  21. #include <nt.h>
  22. #include <ntrtl.h>
  23. #include <nturtl.h>
  24. #include <windows.h>
  25. #include <windef.h>
  26. #include <winbase.h>
  27. #include <winerror.h>
  28. #include <winsvc.h>
  29. #include <winreg.h>
  30. #include <winspool.h>
  31. #include <svcs.h> // intrinsic service definitions
  32. #include <align.h>
  33. #include <nwcanon.h>
  34. #include <nwpkstr.h>
  35. #include <rpc.h>
  36. #include <nwwks.h>
  37. #include <nwevent.h>
  38. #include <ntddnwfs.h>
  39. #include <nwsnames.h>
  40. #include <handle.h>
  41. #include <ndsapi32.h>
  42. #include <ntddnwfs.h>
  43. #define NW_DRIVER_NAME DD_NWFS_FILESYS_NAME_U
  44. //
  45. // Debug trace level bits for turning on/off trace statements in the
  46. // Workstation service
  47. //
  48. //
  49. // Initialization and reading info from registry
  50. //
  51. #define NW_DEBUG_INIT 0x00000001
  52. //
  53. // Connection APIs
  54. //
  55. #define NW_DEBUG_CONNECT 0x00000002
  56. //
  57. // Enumeration APIs
  58. //
  59. #define NW_DEBUG_ENUM 0x00000004
  60. //
  61. // Credential management APIs
  62. //
  63. #define NW_DEBUG_LOGON 0x00000008
  64. //
  65. // Queue management APIs
  66. //
  67. #define NW_DEBUG_QUEUE 0x00000010
  68. //
  69. // Print Provider APIs
  70. //
  71. #define NW_DEBUG_PRINT 0x00000020
  72. //
  73. // Calls to redirector
  74. //
  75. #define NW_DEBUG_DEVICE 0x00000040
  76. //
  77. // Message APIs
  78. //
  79. #define NW_DEBUG_MESSAGE 0x00000080
  80. #if DBG
  81. extern DWORD WorkstationTrace;
  82. #define IF_DEBUG(DebugCode) if (WorkstationTrace & NW_DEBUG_ ## DebugCode)
  83. #define STATIC
  84. #else
  85. #define IF_DEBUG(DebugCode) if (FALSE)
  86. #define STATIC static
  87. #endif // DBG
  88. //
  89. // Initialization states
  90. //
  91. #define NW_EVENTS_CREATED 0x00000001
  92. #define NW_RDR_INITIALIZED 0x00000002
  93. #define NW_BOUND_TO_TRANSPORTS 0x00000004
  94. #define NW_RPC_SERVER_STARTED 0x00000008
  95. #define NW_INITIALIZED_MESSAGE 0x00000010
  96. //
  97. // Key path to redirector driver entry
  98. //
  99. #define SERVICE_REGISTRY_KEY L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\"
  100. // now all SKUs have TerminalServer flag. If App Server is enabled, SingleUserTS flag is cleared
  101. #define IsTerminalServer() (BOOLEAN)(!(USER_SHARED_DATA->SuiteMask & (1 << SingleUserTS))) //user mode
  102. //
  103. // Event that will be signaled when the service is stopping
  104. //
  105. extern HANDLE NwDoneEvent;
  106. //
  107. // Events for controlling popups, and the global popup data.
  108. //
  109. extern HANDLE NwPopupEvent;
  110. extern HANDLE NwPopupDoneEvent;
  111. typedef struct _NWWKS_POPUP_DATA {
  112. DWORD MessageId ;
  113. LUID LogonId;
  114. DWORD InsertCount ;
  115. LPWSTR InsertStrings[10] ;
  116. } NWWKS_POPUP_DATA, *LPNWWKS_POPUP_DATA ;
  117. extern NWWKS_POPUP_DATA PopupData ;
  118. //
  119. // Flag to control DBCS translations
  120. //
  121. extern LONG Japan;
  122. //
  123. // Name of the network provider and print provider
  124. //
  125. extern WCHAR NwProviderName[];
  126. extern DWORD NwPacketBurstSize;
  127. extern DWORD NwPrintOption;
  128. //
  129. // critical sections used
  130. //
  131. extern CRITICAL_SECTION NwLoggedOnCritSec;
  132. extern CRITICAL_SECTION NwServiceListCriticalSection;
  133. extern CRITICAL_SECTION NwPrintCritSec;
  134. //
  135. // Functions from device.c
  136. //
  137. DWORD
  138. NwInitializeRedirector(
  139. VOID
  140. );
  141. DWORD
  142. NwOpenRedirector(
  143. VOID
  144. );
  145. DWORD
  146. NwShutdownRedirector(
  147. VOID
  148. );
  149. DWORD
  150. NwLoadOrUnloadDriver(
  151. BOOL Load
  152. );
  153. DWORD
  154. NwBindToTransports(
  155. VOID
  156. );
  157. DWORD
  158. NwOpenPreferredServer(
  159. PHANDLE ServerHandle
  160. );
  161. VOID
  162. NwInitializePrintProvider(
  163. VOID
  164. );
  165. VOID
  166. NwTerminatePrintProvider(
  167. VOID
  168. );
  169. DWORD
  170. NwRedirFsControl(
  171. IN HANDLE FileHandle,
  172. IN ULONG RedirControlCode,
  173. IN PNWR_REQUEST_PACKET Rrp,
  174. IN ULONG RrpLength,
  175. IN PVOID SecondBuffer OPTIONAL,
  176. IN ULONG SecondBufferLength,
  177. OUT PULONG Information OPTIONAL
  178. );
  179. DWORD
  180. NwCreateTreeConnectName(
  181. IN LPWSTR UncName,
  182. IN LPWSTR LocalName OPTIONAL,
  183. OUT PUNICODE_STRING TreeConnectStr
  184. );
  185. DWORD
  186. NwOpenCreateConnection(
  187. IN PUNICODE_STRING TreeConnectionName,
  188. IN LPWSTR UserName OPTIONAL,
  189. IN LPWSTR Password OPTIONAL,
  190. IN LPWSTR UncName,
  191. IN ACCESS_MASK DesiredAccess,
  192. IN ULONG CreateDisposition,
  193. IN ULONG CreateOptions,
  194. IN ULONG ConnectionType,
  195. OUT PHANDLE TreeConnectionHandle,
  196. OUT PULONG_PTR Information OPTIONAL
  197. );
  198. DWORD
  199. NwNukeConnection(
  200. IN HANDLE TreeConnection,
  201. IN DWORD UseForce
  202. );
  203. DWORD
  204. NwGetServerResource(
  205. IN LPWSTR LocalName,
  206. IN DWORD LocalNameLength,
  207. OUT LPWSTR RemoteName,
  208. IN DWORD RemoteNameLen,
  209. OUT LPDWORD CharsRequired
  210. );
  211. DWORD
  212. NwEnumerateConnections(
  213. IN OUT PDWORD_PTR ResumeId,
  214. IN DWORD_PTR EntriesRequested,
  215. IN LPBYTE Buffer,
  216. IN DWORD BufferSize,
  217. OUT LPDWORD BytesNeeded,
  218. OUT LPDWORD EntriesRead,
  219. IN DWORD ConnectionType,
  220. IN PLUID LogonId
  221. );
  222. DWORD
  223. NwGetNextServerEntry(
  224. IN HANDLE PreferredServer,
  225. IN OUT LPDWORD LastObjectId,
  226. OUT LPSTR ServerName
  227. );
  228. DWORD
  229. NwGetNextServerConnection(
  230. OUT LPNW_ENUM_CONTEXT ContextHandle
  231. );
  232. DWORD
  233. NwGetNextNdsTreeEntry(
  234. OUT LPNW_ENUM_CONTEXT ContextHandle
  235. );
  236. DWORD
  237. NwGetNextVolumeEntry(
  238. IN HANDLE ServerConnection,
  239. IN DWORD LastObjectId,
  240. OUT LPSTR VolumeName
  241. );
  242. DWORD
  243. NwRdrLogonUser(
  244. IN PLUID LogonId,
  245. IN LPWSTR UserName,
  246. IN DWORD UserNameSize,
  247. IN LPWSTR Password OPTIONAL,
  248. IN DWORD PasswordSize,
  249. IN LPWSTR PreferredServer OPTIONAL,
  250. IN DWORD PreferredServerSize,
  251. IN LPWSTR NdsPreferredServer OPTIONAL,
  252. IN DWORD NdsPreferredServerSize,
  253. IN DWORD PrintOption
  254. );
  255. VOID
  256. NwRdrChangePassword(
  257. IN PNWR_REQUEST_PACKET Rrp
  258. );
  259. DWORD
  260. NwRdrSetInfo(
  261. IN DWORD PrintOption,
  262. IN DWORD PacketBurstSize,
  263. IN LPWSTR PreferredServer,
  264. IN DWORD PreferredServerSize,
  265. IN LPWSTR ProviderName,
  266. IN DWORD ProviderNameSize
  267. );
  268. DWORD
  269. NwRdrLogoffUser(
  270. IN PLUID LogonId
  271. );
  272. DWORD
  273. NwConnectToServer(
  274. IN LPWSTR ServerName
  275. );
  276. NTSTATUS
  277. NwOpenHandle(
  278. IN PUNICODE_STRING ObjectName,
  279. IN BOOL ValidateFlag,
  280. OUT PHANDLE ObjectHandle
  281. );
  282. NTSTATUS
  283. NwCallNtOpenFile(
  284. OUT PHANDLE ObjectHandle,
  285. IN ACCESS_MASK DesiredAccess,
  286. IN PUNICODE_STRING ObjectName,
  287. IN ULONG OpenOptions
  288. );
  289. //
  290. // Functions from queue.c
  291. //
  292. DWORD
  293. NwGetNextQueueEntry(
  294. IN HANDLE PreferredServer,
  295. IN OUT LPDWORD LastObjectId,
  296. OUT LPSTR QueueName
  297. );
  298. DWORD
  299. NwAttachToNetwareServer(
  300. IN LPWSTR ServerName,
  301. OUT LPHANDLE phandleServer
  302. );
  303. //
  304. // Functions from enum.c
  305. //
  306. DWORD
  307. NwOpenEnumPrintServers(
  308. OUT LPNWWKSTA_CONTEXT_HANDLE EnumHandle
  309. );
  310. DWORD
  311. NwOpenEnumPrintQueues(
  312. IN LPWSTR ServerName,
  313. OUT LPNWWKSTA_CONTEXT_HANDLE EnumHandle
  314. );
  315. DWORD
  316. NwWriteNetResourceEntry(
  317. IN OUT LPBYTE * FixedPortion,
  318. IN OUT LPWSTR * EndOfVariableData,
  319. IN LPWSTR ContainerName OPTIONAL,
  320. IN LPWSTR LocalName OPTIONAL,
  321. IN LPWSTR RemoteName,
  322. IN DWORD ScopeFlags,
  323. IN DWORD DisplayFlags,
  324. IN DWORD UsageFlags,
  325. IN DWORD ResourceType,
  326. IN LPWSTR SystemPath OPTIONAL,
  327. OUT LPWSTR * lppSystem OPTIONAL,
  328. OUT LPDWORD BytesNeeded
  329. );
  330. DWORD
  331. NwCloseAllConnections(
  332. VOID
  333. );
  334. DWORD
  335. NwWritePrinterInfoEntry(
  336. IN OUT LPBYTE *FixedPortion,
  337. IN OUT LPWSTR *EndOfVariableData,
  338. IN LPWSTR ContainerName OPTIONAL,
  339. IN LPWSTR RemoteName,
  340. IN DWORD Flags,
  341. OUT LPDWORD BytesNeeded
  342. );
  343. //
  344. // Functions from credentl.c
  345. //
  346. VOID
  347. NwInitializeLogon(
  348. VOID
  349. );
  350. VOID
  351. NwGetLogonCredential(
  352. VOID
  353. );
  354. //
  355. // Functions from util.c
  356. //
  357. DWORD
  358. NwMapStatus(
  359. IN NTSTATUS NtStatus
  360. );
  361. DWORD
  362. NwMapBinderyCompletionCode(
  363. IN NTSTATUS NtStatus
  364. );
  365. DWORD
  366. NwImpersonateClient(
  367. VOID
  368. );
  369. DWORD
  370. NwRevertToSelf(
  371. VOID
  372. );
  373. VOID
  374. NwLogEvent(
  375. DWORD MessageId,
  376. DWORD NumberOfSubStrings,
  377. LPWSTR *SubStrings,
  378. DWORD ErrorCode
  379. );
  380. BOOL
  381. NwConvertToUnicode(
  382. OUT LPWSTR *UnicodeOut,
  383. IN LPSTR OemIn
  384. );
  385. VOID
  386. DeleteAllConnections(
  387. VOID
  388. );
  389. //
  390. // Functions from connect.c
  391. //
  392. DWORD
  393. NwCreateSymbolicLink(
  394. IN LPWSTR Local,
  395. IN LPWSTR TreeConnectStr,
  396. IN BOOL ImpersonatingClient
  397. );
  398. VOID
  399. NwDeleteSymbolicLink(
  400. IN LPWSTR LocalDeviceName,
  401. IN LPWSTR TreeConnectStr,
  402. IN LPWSTR SessionDeviceName, //Terminal Server Addition
  403. IN BOOL ImpersonatingClient
  404. );
  405. DWORD
  406. NwOpenHandleToDeleteConn(
  407. IN LPWSTR UncName,
  408. IN LPWSTR LocalName OPTIONAL,
  409. IN DWORD UseForce,
  410. IN BOOL IsStopWksta,
  411. IN BOOL ImpersonatingClient
  412. );
  413. DWORD
  414. NwCreateConnection(
  415. IN LPWSTR LocalName OPTIONAL,
  416. IN LPWSTR RemoteName,
  417. IN DWORD Type,
  418. IN LPWSTR Password OPTIONAL,
  419. IN LPWSTR UserName OPTIONAL
  420. );
  421. //
  422. // (Functions from citrix.c)
  423. // Terminal Server Addition
  424. //
  425. BOOL
  426. SendMessageToLogonIdW(
  427. IN LUID LogonId,
  428. IN LPWSTR pMessage,
  429. IN LPWSTR pTitle
  430. );
  431. NTSTATUS
  432. NwGetSessionId(
  433. OUT PULONG pSessionId
  434. );
  435. #endif // _NW_INCLUDED_