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.

583 lines
16 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. mpr.h
  5. Abstract:
  6. Standard MPR Header File for NT-WIN32
  7. Author:
  8. John Ludeman (Johnl) 10-Dec-1991
  9. Environment:
  10. User Mode -Win32
  11. Notes:
  12. This is a private header file specific to the multiple provider and
  13. the windows shell.
  14. Revision History:
  15. 10-Dec-1991 Johnl
  16. Created
  17. 13-Jan-1992 Johnl
  18. Moved return codes specific to WNetRestoreConnection from winnet32.h
  19. to here.
  20. 24-Jan-1992 Johnl
  21. Added additional APIs for support of Filemanager's toolbar
  22. 19-Mar-1992 JohnL
  23. Added WNetNukeConnections
  24. 12-May-1992 Johnl
  25. Removed "I_" from I_WNetConnect/DisconnectDialog,
  26. Added WNNC_DLG_Disconnect and WNNC_DLG_Connect manifests
  27. 05-Aug-1992 AlbertT
  28. Added extra BOOL bFlushCache to WNetGetDirectoryType{A,W}
  29. 26-Aug-1992 Johnl
  30. Renamed WNetNukeConnections to WNetClearConnections
  31. Nov-5-1992 CongpaY
  32. Add structures _CONNECT_INFO, PARAMETERS, ERRORDLGPARAMETERS
  33. and functions DoPassordDialog, DoProfileErrorDialog
  34. and ShowReconnectDialog. They are used by restoring connection.
  35. 07-Nov-1992 ChuckC
  36. Added WNetDisconnectDialog2 and WNetConnectionDialog2 for help
  37. support.
  38. 12-Nov-1992 Yi-HsinS
  39. Added WNetBrowsePrinterDialog, WNetBrowseDialog
  40. 20-Dec-1992 Yi-HsinS
  41. Added WNetGetFormatNameProc
  42. 29-Dec-1992 Johnl
  43. Added WNetGetConnection2
  44. 07-Jan-1993 Danl
  45. Added Credential Management API
  46. 29-Jun-1994 JonN
  47. Added parameter to DoProfileErrorDialog
  48. 23-Mar-1995 AnirudhS
  49. Added WNFMT_* manifests
  50. 12-Jul-1995 Anirudhs
  51. Removed things defined in winnetwk.h and winnetp.h
  52. 21-Feb-1997 AnirudhS
  53. Added I_MprSaveConn for use by setup (Win95->NT upgrade)
  54. --*/
  55. #include <lmcons.h>
  56. #include <wincred.h>
  57. #ifndef _MPR_H_INCLUDED
  58. #define _MPR_H_INCLUDED
  59. //For restoring connection stuff. Add by congpay.
  60. // const used by connect.c
  61. #define SHOW_CONNECTION (WM_USER+200)
  62. #define DO_PASSWORD_DIALOG (WM_USER + 201)
  63. #define DO_ERROR_DIALOG (WM_USER + 202)
  64. // Used by I_MprSaveConn
  65. #define DEFER_EXPLICIT_PASSWORD 0x00000001
  66. #define DEFER_UNKNOWN 0x00000002
  67. #define DEFER_DEFAULT_CRED 0x00000004
  68. // Errors that can be repaired by popping up a
  69. // username/password dialog
  70. #define IS_USERNAME_PASSWORD_ERROR(x) \
  71. CREDUI_IS_AUTHENTICATION_ERROR(x)
  72. // types used by connect.c
  73. typedef struct _CONNECTION_INFO *LPCONNECTION_INFO;
  74. // The following two structures are used by two threads in mpr.dll and
  75. // mprui.dll to share data.
  76. typedef struct _PARAMETERS
  77. {
  78. HWND hDlg;
  79. HANDLE hDlgCreated; // Initialized in WNetRestoreConnection
  80. HANDLE hDlgFailed; // Initialized in WNetRestoreConnection
  81. HANDLE hDonePassword; // Initialized in WNetRestoreConnection
  82. TCHAR * pchResource; // ShowReconnectDialog, DoRestoreConnection
  83. TCHAR * pchUserName; // For DoPasswordDialog
  84. TCHAR passwordBuffer[UNLEN+1]; // Used by WNetRestoreThisConnection
  85. BOOL fSuccess; // For the DoPasswordDialog
  86. BOOL fDidCancel; // For the DoPasswordDialog
  87. DWORD dwError; // Error from the connection attempt
  88. LONG fDoCleanup; // TRUE if the current thread should clean up
  89. HINSTANCE hDll; // Handle to mpr.dll to prevent unload
  90. DWORD status; // return value from DoRestoreConnection
  91. DWORD numSubKeys; // Initialized in WNetRestoreConnection
  92. DWORD RegMaxWait;
  93. LPCONNECTION_INFO ConnectArray; // Initialized in WNetRestoreConnection
  94. DWORD dwRestoreFlags; // WNRC_ flags - modify the behavior of WNetRestoreConnection
  95. BOOL fReconnectFailed; // set to TRUE if any reconnect fails
  96. }
  97. PARAMETERS;
  98. #ifdef __cplusplus
  99. extern "C" {
  100. #endif
  101. //function load from mprui.dll.
  102. DWORD
  103. MPRUI_DoPasswordDialog(
  104. HWND hwndOwner,
  105. TCHAR * pchResource,
  106. TCHAR * pchUserName,
  107. TCHAR * pchPasswordReturnBuffer,
  108. DWORD cbPasswordReturnBuffer, // bytes!
  109. BOOL * pfDidCancel,
  110. DWORD dwError
  111. );
  112. DWORD
  113. MPRUI_DoProfileErrorDialog(
  114. HWND hwndOwner,
  115. const TCHAR * pchDevice,
  116. const TCHAR * pchResource,
  117. const TCHAR * pchProvider,
  118. DWORD dwError,
  119. BOOL fAllowCancel, // ask whether to stop reconnecting devices
  120. // this time?
  121. BOOL * pfDidCancel, // stop reconnecting devices this time?
  122. // active iff fAllowCancel
  123. BOOL * pfDisconnect, // do not reconnect this device in future?
  124. BOOL * pfHideErrors // stop displaying error dialogs this time?
  125. // active iff fAllowCancel
  126. );
  127. DWORD
  128. MPRUI_ShowReconnectDialog(
  129. HWND hwndParent,
  130. PARAMETERS * Params
  131. );
  132. //
  133. // Return codes from WNetRestoreConnection
  134. //
  135. #define WN_CONTINUE 0x00000BB9
  136. DWORD APIENTRY
  137. RestoreConnectionA0(
  138. HWND hWnd,
  139. LPSTR lpDevice
  140. );
  141. DWORD APIENTRY
  142. MPRUI_WNetClearConnections(
  143. HWND hWnd
  144. );
  145. DWORD
  146. MPRUI_WNetConnectionDialog(
  147. HWND hwnd,
  148. DWORD dwType
  149. );
  150. DWORD
  151. MPRUI_WNetConnectionDialog1A(
  152. LPCONNECTDLGSTRUCTA lpConnDlgStruct
  153. );
  154. DWORD
  155. MPRUI_WNetConnectionDialog1W(
  156. LPCONNECTDLGSTRUCTW lpConnDlgStruct
  157. );
  158. DWORD
  159. MPRUI_WNetDisconnectDialog(
  160. HWND hwnd,
  161. DWORD dwType
  162. );
  163. DWORD
  164. MPRUI_WNetDisconnectDialog1A(
  165. LPDISCDLGSTRUCTA lpDiscDlgStruct
  166. );
  167. DWORD
  168. MPRUI_WNetDisconnectDialog1W(
  169. LPDISCDLGSTRUCTW lpDiscDlgStruct
  170. );
  171. //
  172. // Authentication Provider (Credential Management) Functions
  173. //
  174. DWORD APIENTRY
  175. WNetLogonNotify(
  176. LPCWSTR lpPrimaryAuthenticator,
  177. PLUID lpLogonId,
  178. LPCWSTR lpAuthentInfoType,
  179. LPVOID lpAuthentInfo,
  180. LPCWSTR lpPreviousAuthentInfoType,
  181. LPVOID lpPreviousAuthentInfo,
  182. LPWSTR lpStationName,
  183. LPVOID StationHandle,
  184. LPWSTR *lpLogonScripts
  185. );
  186. typedef DWORD
  187. (APIENTRY *PF_WNetLogonNotify) (
  188. LPCWSTR lpPrimaryAuthenticator,
  189. PLUID lpLogonId,
  190. LPCWSTR lpAuthentInfoType,
  191. LPVOID lpAuthentInfo,
  192. LPCWSTR lpPreviousAuthentInfoType,
  193. LPVOID lpPreviousAuthentInfo,
  194. LPWSTR lpStationName,
  195. LPVOID StationHandle,
  196. LPWSTR *lpLogonScripts
  197. );
  198. DWORD APIENTRY
  199. WNetPasswordChangeNotify(
  200. LPCWSTR lpPrimaryAuthenticator,
  201. LPCWSTR lpAuthentInfoType,
  202. LPVOID lpAuthentInfo,
  203. LPCWSTR lpPreviousAuthentInfoType,
  204. LPVOID lpPreviousAuthentInfo,
  205. LPWSTR lpStationName,
  206. LPVOID StationHandle,
  207. DWORD dwChangeInfo
  208. );
  209. //
  210. // Directory functions
  211. //
  212. DWORD
  213. WNetGetDirectoryTypeA (
  214. LPSTR lpName,
  215. LPINT lpType,
  216. BOOL bFlushCache
  217. );
  218. DWORD
  219. WNetGetDirectoryTypeW (
  220. LPTSTR lpName,
  221. LPINT lpType,
  222. BOOL bFlushCache
  223. );
  224. #ifdef UNICODE
  225. #define WNetGetDirectoryType WNetGetDirectoryTypeW
  226. #else
  227. #define WNetGetDirectoryType WNetGetDirectoryTypeA
  228. #endif // UNICODE
  229. DWORD
  230. WNetDirectoryNotifyA (
  231. HWND hwnd,
  232. LPSTR lpDir,
  233. DWORD dwOper
  234. );
  235. DWORD
  236. WNetDirectoryNotifyW (
  237. HWND hwnd,
  238. LPTSTR lpDir,
  239. DWORD dwOper
  240. );
  241. #ifdef UNICODE
  242. #define WNetDirectoryNotify WNetDirectoryNotifyW
  243. #else
  244. #define WNetDirectoryNotify WNetDirectoryNotifyA
  245. #endif // UNICODE
  246. DWORD
  247. WNetPropertyDialogA (
  248. HWND hwndParent,
  249. DWORD iButton,
  250. DWORD nPropSel,
  251. LPSTR lpszName,
  252. DWORD nType
  253. );
  254. DWORD
  255. WNetPropertyDialogW (
  256. HWND hwndParent,
  257. DWORD iButton,
  258. DWORD nPropSel,
  259. LPTSTR lpszName,
  260. DWORD nType
  261. );
  262. #ifdef UNICODE
  263. #define WNetPropertyDialog WNetPropertyDialogW
  264. #else
  265. #define WNetPropertyDialog WNetPropertyDialogA
  266. #endif // UNICODE
  267. DWORD
  268. WNetGetPropertyTextA (
  269. DWORD iButton,
  270. DWORD nPropSel,
  271. LPSTR lpszName,
  272. LPSTR lpszButtonName,
  273. DWORD nButtonNameLength,
  274. DWORD nType
  275. );
  276. DWORD
  277. WNetGetPropertyTextW (
  278. DWORD iButton,
  279. DWORD nPropSel,
  280. LPTSTR lpszName,
  281. LPTSTR lpszButtonName,
  282. DWORD nButtonNameLength,
  283. DWORD nType
  284. );
  285. #ifdef UNICODE
  286. #define WNetGetPropertyText WNetGetPropertyTextW
  287. #else
  288. #define WNetGetPropertyText WNetGetPropertyTextA
  289. #endif // UNICODE
  290. typedef struct _WNET_CONNECTINFOA
  291. {
  292. LPSTR lpRemoteName ;
  293. LPSTR lpProvider ;
  294. } WNET_CONNECTIONINFOA, *LPWNET_CONNECTIONINFOA ;
  295. typedef struct _WNET_CONNECTINFOW
  296. {
  297. LPWSTR lpRemoteName ;
  298. LPWSTR lpProvider ;
  299. } WNET_CONNECTIONINFOW, *LPWNET_CONNECTIONINFOW ;
  300. #ifdef UNICODE
  301. #define WNET_CONNECTIONINFO WNET_CONNECTIONINFOW
  302. #define LPWNET_CONNECTIONINFO LPWNET_CONNECTIONINFOW
  303. #else
  304. #define WNET_CONNECTIONINFO WNET_CONNECTIONINFOA
  305. #define LPWNET_CONNECTIONINFO LPWNET_CONNECTIONINFOA
  306. #endif // UNICODE
  307. //
  308. // Used in conjunction with WNET_CONNECTIONINFO, gets the net provider name
  309. // in addition to the remote name for this connection.
  310. //
  311. DWORD
  312. WNetGetConnection2A(
  313. LPSTR lpLocalName,
  314. LPVOID lpBuffer, // Contains WNET_CONNECTIONINFOA struct
  315. LPDWORD lpBufferSize // In bytes!
  316. ) ;
  317. DWORD
  318. WNetGetConnection2W(
  319. LPWSTR lpLocalName,
  320. LPVOID lpBuffer, // Contains WNET_CONNECTIONINFOW struct
  321. LPDWORD lpBufferSize // In bytes!
  322. ) ;
  323. #ifdef UNICODE
  324. #define WNetGetConnection2 WNetGetConnection2W
  325. #else
  326. #define WNetGetConnection2 WNetGetConnection2A
  327. #endif // UNICODE
  328. //
  329. // Used by winlogon to close all net connections at logoff
  330. //
  331. DWORD APIENTRY WNetClearConnections(HWND hWnd);
  332. //
  333. // This entry point is used by setup when converting a Win9x user hive to NT
  334. //
  335. DWORD
  336. I_MprSaveConn(
  337. IN HKEY HiveRoot,
  338. IN LPCWSTR ProviderName,
  339. IN DWORD ProviderType,
  340. IN LPCWSTR UserName,
  341. IN LPCWSTR LocalName,
  342. IN LPCWSTR RemoteName,
  343. IN DWORD ConnectionType,
  344. IN BYTE ProviderFlags,
  345. IN DWORD DeferFlags
  346. );
  347. //
  348. // Browse dialog
  349. //
  350. // Type of the callback routine used by the browse dialog to validate
  351. // the path input by the user
  352. typedef BOOL (*PFUNC_VALIDATION_CALLBACK)( LPWSTR pszName );
  353. // WNetBrowseDialog and WNetBrowsePrinterDialog
  354. // NOTE: WNetBrowsePrintDialog =
  355. // WNetBrowseDialog with dwType RESOURCETYPE_PRINT
  356. //
  357. /*******************************************************************
  358. NAME: WNetBrowseDialog, WNetBrowsePrinterDialog
  359. SYNOPSIS: Presents a dialog to the user from which the user can
  360. browse the network for disk or print shares.
  361. ENTRY: hwndParent - Parent window handle
  362. dwType - ( Only in WNetBrowseDialog )
  363. RESOURCETYPE_DISK or RESOURCETYPE_PRINT
  364. lpszName - The path name typed by the user. It will be
  365. undefined if the user hits the CANCEL button.
  366. cchBufSize - The buffer size of the lpszName in characters
  367. lpszHelpFile- The helpfile to use when the user hits F1.
  368. nHelpContext- The helpcontext to use for the helpfile above
  369. pfuncValidation - Callback method to validate the path typed
  370. by the user. If NULL, no validation will
  371. be done.
  372. RETURNS: WN_CANCEL when the user cancels the dialog. NO_ERROR
  373. on success, standard ERROR_* error code otherwise
  374. NOTES: This is a UNICODE only API.
  375. HISTORY:
  376. Yi-HsinS 22-Nov-1992 Created
  377. ********************************************************************/
  378. DWORD WNetBrowseDialog(
  379. HWND hwndParent,
  380. DWORD dwType,
  381. WCHAR *lpszName,
  382. DWORD cchBufSize,
  383. WCHAR *lpszHelpFile,
  384. DWORD nHelpContext,
  385. PFUNC_VALIDATION_CALLBACK pfuncValidation );
  386. DWORD WNetBrowsePrinterDialog(
  387. HWND hwndParent,
  388. WCHAR *lpszName,
  389. DWORD cchBufSize,
  390. WCHAR *lpszHelpFile,
  391. DWORD nHelpContext,
  392. PFUNC_VALIDATION_CALLBACK pfuncValidation );
  393. //
  394. // stuff in user, not driver, for shell apps
  395. //
  396. DWORD APIENTRY WNetErrorText(DWORD,LPTSTR,DWORD);
  397. //
  398. // used by MPRUI.DLL to determine if a provider supports
  399. // NpSearchDialog() and obtain to a pointer to it.
  400. //
  401. FARPROC WNetGetSearchDialog(LPWSTR lpProvider) ;
  402. //
  403. // used by MPRUI.DLL to determine if a provider supports
  404. // NPFormatNetworkName() and obtain a pointer to it.
  405. //
  406. FARPROC WNetGetFormatNameProc(LPWSTR lpProvider) ;
  407. //
  408. // used by MPRUI.DLL to determine if a provider supports
  409. // WNNC_ENUM_GLOBAL
  410. //
  411. BOOL WNetSupportGlobalEnum(LPWSTR lpProvider) ;
  412. //
  413. // used by ACLEDIT.DLL to get provider-specific permission editor
  414. //
  415. DWORD WNetFMXGetPermCaps( LPWSTR lpDriveName ) ;
  416. DWORD WNetFMXEditPerm( LPWSTR lpDriveName, HWND hwndFMX, DWORD nDialogType );
  417. DWORD WNetFMXGetPermHelp( LPWSTR lpDriveName,
  418. DWORD nDialogType,
  419. BOOL fDirectory,
  420. LPVOID lpFileNameBuffer,
  421. LPDWORD lpBufferSize,
  422. LPDWORD lpnHelpContext );
  423. //
  424. // sections and keys used for persistent connections
  425. //
  426. #define WNNC_DLG_DISCONNECT 0x0008
  427. #define WNNC_DLG_CONNECT 0x0004
  428. #ifdef UNICODE
  429. #define MPR_MRU_FILE_SECTION L"NET_Files"
  430. #define MPR_MRU_PRINT_SECTION L"NET_Printers"
  431. #define MPR_MRU_ORDER_KEY L"Order"
  432. #define MPR_NETWORK_SECTION L"Network"
  433. #define MPR_SAVECONNECTION_KEY L"SaveConnections"
  434. #define MPR_RESTORECONNECTION_KEY L"RestoreConnections"
  435. #define MPR_EXPANDLOGONDOMAIN_KEY L"ExpandLogonDomain"
  436. #define MPR_YES_VALUE L"yes"
  437. #define MPR_NO_VALUE L"no"
  438. #else
  439. #define MPR_MRU_FILE_SECTION "NET_Files"
  440. #define MPR_MRU_PRINT_SECTION "NET_Printers"
  441. #define MPR_MRU_ORDER_KEY "Order"
  442. #define MPR_NETWORK_SECTION "Network"
  443. #define MPR_SAVECONNECTION_KEY "SaveConnections"
  444. #define MPR_RESTORECONNECTION_KEY "RestoreConnections"
  445. #define MPR_EXPANDLOGONDOMAIN_KEY "ExpandLogonDomain"
  446. #define MPR_YES_VALUE "yes"
  447. #define MPR_NO_VALUE "no"
  448. #endif // UNICODE
  449. //
  450. // Internal NP interface used to help the NTLM provider remember
  451. // whether a persistent connection is a DFS connection or not
  452. //
  453. DWORD APIENTRY
  454. NPGetReconnectFlags (
  455. IN LPWSTR lpLocalName,
  456. OUT LPBYTE lpPersistFlags
  457. );
  458. typedef DWORD (*PF_NPGetReconnectFlags) (
  459. LPWSTR lpLocalName,
  460. LPBYTE lpPersistFlags
  461. );
  462. // This macro operates on the dwFlags parameter of NPAddConnection3
  463. #define CONNECT_PROVIDER_FLAGS(dwFlags) ((BYTE) (((dwFlags) & 0xFF000000) >> 24))
  464. #ifdef __cplusplus
  465. }
  466. #endif
  467. #endif // _MPR_H_INCLUDED