Source code of Windows XP (NT5)
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.

622 lines
10 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. #define NW_GATEWAY_LOGON 0x00000020
  97. //
  98. // Key path to redirector driver entry
  99. //
  100. #define SERVICE_REGISTRY_KEY L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\"
  101. // now all SKUs have TerminalServer flag. If App Server is enabled, SingleUserTS flag is cleared
  102. #define IsTerminalServer() (BOOLEAN)(!(USER_SHARED_DATA->SuiteMask & (1 << SingleUserTS))) //user mode
  103. //
  104. // Event that will be signaled when the service is stopping
  105. //
  106. extern HANDLE NwDoneEvent;
  107. //
  108. // Events for controlling popups, and the global popup data.
  109. //
  110. extern HANDLE NwPopupEvent;
  111. extern HANDLE NwPopupDoneEvent;
  112. typedef struct _NWWKS_POPUP_DATA {
  113. DWORD MessageId ;
  114. LUID LogonId;
  115. DWORD InsertCount ;
  116. LPWSTR InsertStrings[10] ;
  117. } NWWKS_POPUP_DATA, *LPNWWKS_POPUP_DATA ;
  118. extern NWWKS_POPUP_DATA PopupData ;
  119. //
  120. // Flag to control DBCS translations
  121. //
  122. extern LONG Japan;
  123. //
  124. // Name of the network provider and print provider
  125. //
  126. extern WCHAR NwProviderName[];
  127. extern DWORD NwPacketBurstSize;
  128. extern DWORD NwPrintOption;
  129. extern DWORD NwGatewayPrintOption;
  130. extern BOOL GatewayLoggedOn ;
  131. extern BOOL GatewayConnectionAlways ;
  132. //
  133. // critical sections used
  134. //
  135. extern CRITICAL_SECTION NwLoggedOnCritSec;
  136. extern CRITICAL_SECTION NwServiceListCriticalSection;
  137. extern CRITICAL_SECTION NwPrintCritSec;
  138. //
  139. // Functions from device.c
  140. //
  141. DWORD
  142. NwInitializeRedirector(
  143. VOID
  144. );
  145. DWORD
  146. NwOpenRedirector(
  147. VOID
  148. );
  149. DWORD
  150. NwShutdownRedirector(
  151. VOID
  152. );
  153. DWORD
  154. NwLoadOrUnloadDriver(
  155. BOOL Load
  156. );
  157. DWORD
  158. NwBindToTransports(
  159. VOID
  160. );
  161. DWORD
  162. NwOpenPreferredServer(
  163. PHANDLE ServerHandle
  164. );
  165. VOID
  166. NwInitializePrintProvider(
  167. VOID
  168. );
  169. VOID
  170. NwTerminatePrintProvider(
  171. VOID
  172. );
  173. DWORD
  174. NwRedirFsControl(
  175. IN HANDLE FileHandle,
  176. IN ULONG RedirControlCode,
  177. IN PNWR_REQUEST_PACKET Rrp,
  178. IN ULONG RrpLength,
  179. IN PVOID SecondBuffer OPTIONAL,
  180. IN ULONG SecondBufferLength,
  181. OUT PULONG Information OPTIONAL
  182. );
  183. DWORD
  184. NwCreateTreeConnectName(
  185. IN LPWSTR UncName,
  186. IN LPWSTR LocalName OPTIONAL,
  187. OUT PUNICODE_STRING TreeConnectStr
  188. );
  189. DWORD
  190. NwOpenCreateConnection(
  191. IN PUNICODE_STRING TreeConnectionName,
  192. IN LPWSTR UserName OPTIONAL,
  193. IN LPWSTR Password OPTIONAL,
  194. IN LPWSTR UncName,
  195. IN ACCESS_MASK DesiredAccess,
  196. IN ULONG CreateDisposition,
  197. IN ULONG CreateOptions,
  198. IN ULONG ConnectionType,
  199. OUT PHANDLE TreeConnectionHandle,
  200. OUT PULONG_PTR Information OPTIONAL
  201. );
  202. DWORD
  203. NwNukeConnection(
  204. IN HANDLE TreeConnection,
  205. IN DWORD UseForce
  206. );
  207. DWORD
  208. NwGetServerResource(
  209. IN LPWSTR LocalName,
  210. IN DWORD LocalNameLength,
  211. OUT LPWSTR RemoteName,
  212. IN DWORD RemoteNameLen,
  213. OUT LPDWORD CharsRequired
  214. );
  215. DWORD
  216. NwEnumerateConnections(
  217. IN OUT PDWORD_PTR ResumeId,
  218. IN DWORD_PTR EntriesRequested,
  219. IN LPBYTE Buffer,
  220. IN DWORD BufferSize,
  221. OUT LPDWORD BytesNeeded,
  222. OUT LPDWORD EntriesRead,
  223. IN DWORD ConnectionType,
  224. IN PLUID LogonId
  225. );
  226. DWORD
  227. NwGetNextServerEntry(
  228. IN HANDLE PreferredServer,
  229. IN OUT LPDWORD LastObjectId,
  230. OUT LPSTR ServerName
  231. );
  232. DWORD
  233. NwGetNextServerConnection(
  234. OUT LPNW_ENUM_CONTEXT ContextHandle
  235. );
  236. DWORD
  237. NwGetNextNdsTreeEntry(
  238. OUT LPNW_ENUM_CONTEXT ContextHandle
  239. );
  240. DWORD
  241. NwGetNextVolumeEntry(
  242. IN HANDLE ServerConnection,
  243. IN DWORD LastObjectId,
  244. OUT LPSTR VolumeName
  245. );
  246. DWORD
  247. NwRdrLogonUser(
  248. IN PLUID LogonId,
  249. IN LPWSTR UserName,
  250. IN DWORD UserNameSize,
  251. IN LPWSTR Password OPTIONAL,
  252. IN DWORD PasswordSize,
  253. IN LPWSTR PreferredServer OPTIONAL,
  254. IN DWORD PreferredServerSize,
  255. IN LPWSTR NdsPreferredServer OPTIONAL,
  256. IN DWORD NdsPreferredServerSize,
  257. IN DWORD PrintOption
  258. );
  259. VOID
  260. NwRdrChangePassword(
  261. IN PNWR_REQUEST_PACKET Rrp
  262. );
  263. DWORD
  264. NwRdrSetInfo(
  265. IN DWORD PrintOption,
  266. IN DWORD PacketBurstSize,
  267. IN LPWSTR PreferredServer,
  268. IN DWORD PreferredServerSize,
  269. IN LPWSTR ProviderName,
  270. IN DWORD ProviderNameSize
  271. );
  272. DWORD
  273. NwRdrLogoffUser(
  274. IN PLUID LogonId
  275. );
  276. DWORD
  277. NwConnectToServer(
  278. IN LPWSTR ServerName
  279. );
  280. NTSTATUS
  281. NwOpenHandle(
  282. IN PUNICODE_STRING ObjectName,
  283. IN BOOL ValidateFlag,
  284. OUT PHANDLE ObjectHandle
  285. );
  286. NTSTATUS
  287. NwCallNtOpenFile(
  288. OUT PHANDLE ObjectHandle,
  289. IN ACCESS_MASK DesiredAccess,
  290. IN PUNICODE_STRING ObjectName,
  291. IN ULONG OpenOptions
  292. );
  293. //
  294. // Functions from queue.c
  295. //
  296. DWORD
  297. NwGetNextQueueEntry(
  298. IN HANDLE PreferredServer,
  299. IN OUT LPDWORD LastObjectId,
  300. OUT LPSTR QueueName
  301. );
  302. DWORD
  303. NwAttachToNetwareServer(
  304. IN LPWSTR ServerName,
  305. OUT LPHANDLE phandleServer
  306. );
  307. //
  308. // Functions from enum.c
  309. //
  310. DWORD
  311. NwOpenEnumPrintServers(
  312. OUT LPNWWKSTA_CONTEXT_HANDLE EnumHandle
  313. );
  314. DWORD
  315. NwOpenEnumPrintQueues(
  316. IN LPWSTR ServerName,
  317. OUT LPNWWKSTA_CONTEXT_HANDLE EnumHandle
  318. );
  319. DWORD
  320. NwWriteNetResourceEntry(
  321. IN OUT LPBYTE * FixedPortion,
  322. IN OUT LPWSTR * EndOfVariableData,
  323. IN LPWSTR ContainerName OPTIONAL,
  324. IN LPWSTR LocalName OPTIONAL,
  325. IN LPWSTR RemoteName,
  326. IN DWORD ScopeFlags,
  327. IN DWORD DisplayFlags,
  328. IN DWORD UsageFlags,
  329. IN DWORD ResourceType,
  330. IN LPWSTR SystemPath OPTIONAL,
  331. OUT LPWSTR * lppSystem OPTIONAL,
  332. OUT LPDWORD BytesNeeded
  333. );
  334. DWORD
  335. NwCloseAllConnections(
  336. VOID
  337. );
  338. DWORD
  339. NwWritePrinterInfoEntry(
  340. IN OUT LPBYTE *FixedPortion,
  341. IN OUT LPWSTR *EndOfVariableData,
  342. IN LPWSTR ContainerName OPTIONAL,
  343. IN LPWSTR RemoteName,
  344. IN DWORD Flags,
  345. OUT LPDWORD BytesNeeded
  346. );
  347. //
  348. // Functions from credentl.c
  349. //
  350. VOID
  351. NwInitializeLogon(
  352. VOID
  353. );
  354. VOID
  355. NwGetLogonCredential(
  356. VOID
  357. );
  358. DWORD
  359. NwGatewayLogon(
  360. VOID
  361. );
  362. DWORD
  363. NwGatewayLogoff(
  364. VOID
  365. );
  366. //
  367. // Functions from util.c
  368. //
  369. DWORD
  370. NwMapStatus(
  371. IN NTSTATUS NtStatus
  372. );
  373. DWORD
  374. NwMapBinderyCompletionCode(
  375. IN NTSTATUS NtStatus
  376. );
  377. DWORD
  378. NwImpersonateClient(
  379. VOID
  380. );
  381. DWORD
  382. NwRevertToSelf(
  383. VOID
  384. );
  385. VOID
  386. NwLogEvent(
  387. DWORD MessageId,
  388. DWORD NumberOfSubStrings,
  389. LPWSTR *SubStrings,
  390. DWORD ErrorCode
  391. );
  392. BOOL
  393. NwConvertToUnicode(
  394. OUT LPWSTR *UnicodeOut,
  395. IN LPSTR OemIn
  396. );
  397. VOID
  398. DeleteAllConnections(
  399. VOID
  400. );
  401. //
  402. // Functions from connect.c
  403. //
  404. DWORD
  405. NwCreateSymbolicLink(
  406. IN LPWSTR Local,
  407. IN LPWSTR TreeConnectStr,
  408. IN BOOL bGateway, //Multi-user changes.
  409. IN BOOL ImpersonatingClient
  410. );
  411. VOID
  412. NwDeleteSymbolicLink(
  413. IN LPWSTR LocalDeviceName,
  414. IN LPWSTR TreeConnectStr,
  415. IN LPWSTR SessionDeviceName, //Terminal Server Addition
  416. IN BOOL ImpersonatingClient
  417. );
  418. DWORD
  419. NwOpenHandleToDeleteConn(
  420. IN LPWSTR UncName,
  421. IN LPWSTR LocalName OPTIONAL,
  422. IN DWORD UseForce,
  423. IN BOOL IsStopWksta,
  424. IN BOOL ImpersonatingClient
  425. );
  426. DWORD
  427. NwCreateConnection(
  428. IN LPWSTR LocalName OPTIONAL,
  429. IN LPWSTR RemoteName,
  430. IN DWORD Type,
  431. IN LPWSTR Password OPTIONAL,
  432. IN LPWSTR UserName OPTIONAL
  433. );
  434. //
  435. // Functions from gateway.c
  436. //
  437. DWORD
  438. NwEnumerateGWDevices(
  439. LPDWORD Index,
  440. LPBYTE Buffer,
  441. DWORD BufferSize,
  442. LPDWORD BytesNeeded,
  443. LPDWORD EntriesRead
  444. ) ;
  445. DWORD
  446. NwCreateGWDevice(
  447. LPWSTR DeviceName,
  448. LPWSTR RemoteName,
  449. DWORD Flags
  450. ) ;
  451. DWORD
  452. NwRemoveGWDevice(
  453. LPWSTR DeviceName,
  454. DWORD Flags
  455. ) ;
  456. DWORD
  457. NwQueryGWAccount(
  458. LPWSTR AccountName,
  459. DWORD AccountNameLen,
  460. LPDWORD AccountCharsNeeded,
  461. LPWSTR Password,
  462. DWORD PasswordLen,
  463. LPDWORD PasswordCharsNeeded
  464. ) ;
  465. DWORD
  466. NwSetGWAccount(
  467. LPWSTR AccountName,
  468. LPWSTR Password
  469. ) ;
  470. DWORD
  471. NwGetGatewayResource(
  472. IN LPWSTR LocalName,
  473. OUT LPWSTR RemoteName,
  474. IN DWORD RemoteNameLen,
  475. OUT LPDWORD CharsRequired
  476. );
  477. DWORD
  478. NwCreateRedirections(
  479. LPWSTR Account,
  480. LPWSTR Password
  481. );
  482. DWORD
  483. NwDeleteRedirections(
  484. VOID
  485. );
  486. DWORD
  487. NwCreateGWConnection(
  488. IN LPWSTR RemoteName,
  489. IN LPWSTR UserName,
  490. IN LPWSTR Password,
  491. IN BOOL KeepConnection
  492. );
  493. DWORD
  494. NwDeleteGWConnection(
  495. IN LPWSTR RemoteName
  496. );
  497. //
  498. // (Functions from citrix.c)
  499. // Terminal Server Addition
  500. //
  501. BOOL
  502. SendMessageToLogonIdW(
  503. IN LUID LogonId,
  504. IN LPWSTR pMessage,
  505. IN LPWSTR pTitle
  506. );
  507. NTSTATUS
  508. NwGetSessionId(
  509. OUT PULONG pSessionId
  510. );
  511. #endif // _NW_INCLUDED_