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