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.

501 lines
14 KiB

  1. /*****************************************************************/
  2. /** Microsoft Windows for Workgroups **/
  3. /** Copyright (C) Microsoft Corp., 1991-1995 **/
  4. /*****************************************************************/
  5. /* NETSPI.H -- Network service provider interface definitions.
  6. */
  7. #ifndef _INC_NETSPI
  8. #define _INC_NETSPI
  9. #ifndef _WINNETWK_
  10. #include <winnetwk.h>
  11. #endif
  12. #ifndef _INC_NETMPR_
  13. #include <netmpr.h>
  14. #endif
  15. #ifndef RC_INVOKED
  16. #pragma pack(1) /* Assume byte packing throughout */
  17. #endif /* !RC_INVOKED */
  18. #ifdef __cplusplus
  19. extern "C" { /* Assume C declarations for C++ */
  20. #endif /* __cplusplus */
  21. //
  22. // Capability masks and values.
  23. //
  24. #define WNNC_SPEC_VERSION 0x01
  25. #define WNNC_SPEC_VERSION51 0x00050001
  26. #define WNNC_NET_TYPE 0x02
  27. // Net types defined in Winnetwk.h
  28. #define WNNC_DRIVER_VERSION 0x03
  29. #define WNNC_USER 0x04
  30. #define WNNC_USR_GETUSER 0x01
  31. #define WNNC_CONNECTION 0x06
  32. #define WNNC_CON_ADDCONNECTION 0x01
  33. #define WNNC_CON_CANCELCONNECTION 0x02
  34. #define WNNC_CON_GETCONNECTIONS 0x04
  35. #define WNNC_CON_GETPERFORMANCE 0x08
  36. #define WNNC_CON_GETUNIVERSALNAME 0x10
  37. #define WNNC_CON_FORMATCONNECTION 0x20
  38. #define WNNC_DIALOG 0x08
  39. #define WNNC_DLG_FORMATNETWORKNAME 0x080
  40. #define WNNC_DLG_GETRESOURCEPARENT 0x100
  41. #define WNNC_DLG_GETRESOURCEINFORMATION 0x800
  42. #define WNNC_ERROR 0x0A
  43. #define WNNC_ERR_GETERROR 0x01
  44. #define WNNC_ERR_GETERRORTEXT 0x02
  45. #define WNNC_ENUMERATION 0x0B
  46. #define WNNC_ENUM_GLOBAL 0x01
  47. #define WNNC_ENUM_LOCAL 0x02
  48. #define WNNC_ENUM_CONTEXT 0x04
  49. #define WNNC_START 0x0C
  50. #define WNNC_START_WONT 0x00
  51. #define WNNC_START_UNKNOWN 0xFFFFFFFF
  52. #define WNNC_START_DONE 0x01
  53. #define WNNC_START_INACTIVE 0xFFFFFFFE
  54. #define WNNC_RESOURCE 0x0D
  55. #define WNNC_RES_VALIDLOCALDEVICE 0x80
  56. #define WNNC_AUTHENTICATION 0x0E
  57. #define WNNC_AUTH_LOGON 0x02
  58. #define WNNC_AUTH_LOGOFF 0x04
  59. #define WNNC_AUTH_GETHOMEDIRECTORY 0x10
  60. #define WNNC_AUTH_GETPOLICYPATH 0x20
  61. #define WNNC_MAXCAPNO WNNC_AUTHENTICATION
  62. //
  63. // Profile strings.
  64. //
  65. #define NPProvider "NPProvider"
  66. #define NPName "NPName"
  67. #define NPDescription "NPDescription"
  68. #define NPID "NPID"
  69. //
  70. // Various defines.
  71. //
  72. //Spec version
  73. #define WNNC_DRIVER_MAJOR1 1
  74. #define WNNC_DRIVER_MINOR1 1
  75. #define WNNC_DRIVER(major,minor) (major*0x00010000 + minor)
  76. //
  77. // NP SPI Definitions.
  78. //
  79. #define SPIENTRY DWORD WINAPI
  80. typedef SPIENTRY F_NPGetCaps(
  81. DWORD nIndex
  82. );
  83. F_NPGetCaps NPGetCaps;
  84. typedef F_NPGetCaps FAR *PF_NPGetCaps;
  85. typedef SPIENTRY F_NPGetUniversalName(
  86. LPTSTR lpLocalPath,
  87. DWORD dwInfoLevel,
  88. LPVOID lpBuffer,
  89. LPDWORD lpBufferSize
  90. );
  91. F_NPGetUniversalName NPGetUniversalName;
  92. typedef F_NPGetUniversalName FAR *PF_NPGetUniversalName;
  93. typedef SPIENTRY F_NPGetUser(
  94. LPTSTR lpName,
  95. LPTSTR lpAuthenticationID,
  96. LPDWORD lpBufferSize
  97. );
  98. F_NPGetUser NPGetUser;
  99. typedef F_NPGetUser FAR *PF_NPGetUser;
  100. typedef SPIENTRY F_NPValidLocalDevice(
  101. DWORD dwType,
  102. DWORD dwNumber
  103. );
  104. F_NPValidLocalDevice NPValidLocalDevice;
  105. typedef F_NPValidLocalDevice FAR *PF_NPValidLocalDevice;
  106. typedef SPIENTRY F_NPAddConnection(
  107. HWND hwndOwner,
  108. LPNETRESOURCE lpNetResource,
  109. LPTSTR lpPassword,
  110. LPTSTR lpUserID,
  111. DWORD dwFlags,
  112. LPTSTR lpAccessName,
  113. LPDWORD lpBufferSize,
  114. LPDWORD lpResult
  115. );
  116. F_NPAddConnection NPAddConnection;
  117. typedef F_NPAddConnection FAR *PF_NPAddConnection;
  118. typedef SPIENTRY F_NPCancelConnection(
  119. LPTSTR lpName,
  120. BOOL fForce,
  121. DWORD dwFlags
  122. );
  123. F_NPCancelConnection NPCancelConnection;
  124. typedef F_NPCancelConnection FAR *PF_NPCancelConnection;
  125. typedef SPIENTRY F_NPGetConnection(
  126. LPTSTR lpLocalName,
  127. LPTSTR lpRemoteName,
  128. LPDWORD lpBufferSize
  129. );
  130. F_NPGetConnection NPGetConnection;
  131. typedef F_NPGetConnection FAR *PF_NPGetConnection;
  132. typedef SPIENTRY F_NPGetConnectionPerformance(
  133. LPTSTR lpRemoteName,
  134. LPNETCONNECTINFOSTRUCT lpNetConnectInfoStruct
  135. );
  136. F_NPGetConnectionPerformance NPGetConnectionPerformance;
  137. typedef F_NPGetConnectionPerformance FAR *PF_NPGetConnectionPerformance;
  138. typedef SPIENTRY F_NPFormatNetworkName(
  139. LPTSTR lpRemoteName,
  140. LPTSTR lpFormattedName,
  141. LPDWORD lpnLength,
  142. DWORD dwFlags,
  143. DWORD dwAveCharPerLine
  144. );
  145. F_NPFormatNetworkName NPFormatNetworkName;
  146. typedef F_NPFormatNetworkName FAR *PF_NPFormatNetworkName;
  147. typedef DWORD (FAR PASCAL *NPDISPLAYCALLBACK)(
  148. LPVOID lpUserData,
  149. DWORD dwDisplayType,
  150. LPTSTR lpszHeaders
  151. );
  152. typedef SPIENTRY F_NPOpenEnum(
  153. DWORD dwScope,
  154. DWORD dwType,
  155. DWORD dwUsage,
  156. LPNETRESOURCE lpNetResource,
  157. LPHANDLE lphEnum
  158. );
  159. F_NPOpenEnum NPOpenEnum;
  160. typedef F_NPOpenEnum FAR *PF_NPOpenEnum;
  161. typedef SPIENTRY F_NPEnumResource(
  162. HANDLE hEnum,
  163. LPDWORD lpcCount,
  164. LPVOID lpBuffer,
  165. DWORD cbBuffer,
  166. LPDWORD lpcbFree
  167. );
  168. F_NPEnumResource NPEnumResource;
  169. typedef F_NPEnumResource FAR *PF_NPEnumResource;
  170. typedef SPIENTRY F_NPCloseEnum(
  171. HANDLE hEnum
  172. );
  173. F_NPCloseEnum NPCloseEnum;
  174. typedef F_NPCloseEnum FAR *PF_NPCloseEnum;
  175. typedef SPIENTRY F_NPGetResourceParent(
  176. LPNETRESOURCE lpNetResource,
  177. LPVOID lpBuffer,
  178. LPDWORD cbBuffer
  179. );
  180. F_NPGetResourceParent NPGetResourceParent;
  181. typedef F_NPGetResourceParent FAR *PF_NPGetResourceParent;
  182. typedef SPIENTRY F_NPGetResourceInformation(
  183. LPNETRESOURCE lpNetResource,
  184. LPVOID lpBuffer,
  185. LPDWORD cbBuffer,
  186. LPSTR *lplpSystem
  187. );
  188. F_NPGetResourceInformation NPGetResourceInformation;
  189. typedef F_NPGetResourceInformation FAR *PF_NPGetResourceInformation;
  190. typedef struct _LOGONINFO {
  191. LPTSTR lpUsername;
  192. LPTSTR lpPassword;
  193. DWORD cbUsername;
  194. DWORD cbPassword;
  195. } LOGONINFO, FAR *LPLOGONINFO;
  196. typedef SPIENTRY F_NPLogon(
  197. HWND hwndOwner,
  198. LPLOGONINFO lpAuthentInfo,
  199. LPLOGONINFO lpPreviousAuthentInfo,
  200. LPTSTR lpLogonScript,
  201. DWORD dwBufferSize,
  202. DWORD dwFlags
  203. );
  204. F_NPLogon NPLogon;
  205. typedef F_NPLogon FAR *PF_NPLogon;
  206. typedef SPIENTRY F_NPLogoff(
  207. HWND hwndOwner,
  208. LPLOGONINFO lpAuthentInfo,
  209. DWORD dwReason
  210. );
  211. F_NPLogoff NPLogoff;
  212. typedef F_NPLogoff FAR *PF_NPLogoff;
  213. typedef SPIENTRY F_NPChangePassword(
  214. LPLOGONINFO lpAuthentInfo,
  215. LPLOGONINFO lpPreviousAuthentInfo,
  216. DWORD dwAction
  217. );
  218. F_NPChangePassword NPChangePassword;
  219. typedef F_NPChangePassword FAR *PF_NPChangePassword;
  220. typedef SPIENTRY F_NPChangePasswordHwnd(
  221. HWND hwndOwner
  222. );
  223. F_NPChangePasswordHwnd NPChangePasswordHwnd;
  224. typedef F_NPChangePasswordHwnd FAR *PF_NPChangePasswordHwnd;
  225. typedef SPIENTRY F_NPGetPasswordStatus(
  226. DWORD nIndex
  227. );
  228. F_NPGetPasswordStatus NPGetPasswordStatus;
  229. typedef F_NPGetPasswordStatus FAR *PF_NPGetPasswordStatus;
  230. typedef SPIENTRY F_NPGetHomeDirectory(
  231. LPTSTR lpDirectory,
  232. LPDWORD lpBufferSize
  233. );
  234. F_NPGetHomeDirectory NPGetHomeDirectory;
  235. typedef F_NPGetHomeDirectory FAR *PF_NPGetHomeDirectory;
  236. typedef SPIENTRY F_NPGetPolicyPath(
  237. LPTSTR lpPath,
  238. LPDWORD lpBufferSize,
  239. DWORD dwFlags
  240. );
  241. // flags for NPGetPolicyPath
  242. #define GPP_LOADBALANCE 0x0001
  243. F_NPGetPolicyPath NPGetPolicyPath;
  244. typedef F_NPGetPolicyPath FAR *PF_NPGetPolicyPath;
  245. //
  246. // MPR Services.
  247. //
  248. #define NPSGetProviderHandle NPSGetProviderHandleA
  249. #define NPSGetProviderName NPSGetProviderNameA
  250. #define NPSGetSectionName NPSGetSectionNameA
  251. #define NPSSetExtendedError NPSSetExtendedErrorA
  252. #define NPSSetCustomText NPSSetCustomTextA
  253. #define NPSCopyString NPSCopyStringA
  254. #define NPSDeviceGetNumber NPSDeviceGetNumberA
  255. #define NPSDeviceGetString NPSDeviceGetStringA
  256. #define NPSNotifyRegister NPSNotifyRegisterA
  257. #define NPSNotifyGetContext NPSNotifyGetContextA
  258. #define NPSAuthenticationDialog NPSAuthenticationDialogA
  259. #define NPSERVICE WINAPI
  260. #define HPROVIDER LPVOID
  261. typedef HPROVIDER FAR * PHPROVIDER;
  262. typedef struct {
  263. DWORD cbStructure; /* size of this structure in bytes */
  264. HWND hwndOwner; /* owner window for the authentication dialog */
  265. LPCSTR lpResource; /* remote name of resource being accessed */
  266. LPSTR lpUsername; /* default username to show, NULL to hide field */
  267. DWORD cbUsername; /* size of lpUsername buffer, set to length copied on exit */
  268. LPSTR lpPassword; /* default password to show */
  269. DWORD cbPassword; /* size of lpPassword buffer, set to length copied on exit */
  270. LPSTR lpOrgUnit; /* default org unit to show, NULL to hide field */
  271. DWORD cbOrgUnit; /* size of lpOrgUnit buffer, set to length copied on exit */
  272. LPCSTR lpOUTitle; /* title of org unit field, NULL for default title */
  273. LPCSTR lpExplainText; /* explanatory text at top, NULL for default text */
  274. LPCSTR lpDefaultUserName; /* explanatory text at top, NULL for default text */
  275. DWORD dwFlags; /* flags (see below) */
  276. } AUTHDLGSTRUCTA, FAR *LPAUTHDLGSTRUCTA;
  277. #define AUTHDLGSTRUCT AUTHDLGSTRUCTA
  278. #define LPAUTHDLGSTRUCT LPAUTHDLGSTRUCTA
  279. #define AUTHDLG_ENABLECACHE 0x00000001 /* enable and show PW cache checkbox */
  280. #define AUTHDLG_CHECKCACHE 0x00000002 /* check PW cache checkbox by default */
  281. #define AUTHDLG_CACHEINVALID 0x00000004 /* cached PW was invalid (special text) */
  282. #define AUTHDLG_USE_DEFAULT_NAME 0x00000008 /* enable and show use "guest" box */
  283. #define AUTHDLG_CHECKDEFAULT_NAME 0x00000010 /* check "guest" box */
  284. #define AUTHDLG_LOGON 0x00000020 /* include Windows logo bitmap */
  285. #define AUTHDLG_ENABLECACHE 0x00000001 /* enable and show PW cache checkbox */
  286. #define AUTHDLG_CHECKCACHE 0x00000002 /* check PW cache checkbox by default */
  287. #define AUTHDLG_CACHEINVALID 0x00000004 /* cached PW was invalid (special text) */
  288. #define AUTHDLG_USE_DEFAULT_NAME 0x00000008 /* enable and show use "guest" box */
  289. #define AUTHDLG_CHECKDEFAULT_NAME 0x00000010 /* check "guest" box */
  290. #define AUTHDLG_LOGON 0x00000020 /* include Windows logo bitmap */
  291. DWORD
  292. NPSERVICE
  293. NPSAuthenticationDialog(
  294. LPAUTHDLGSTRUCT lpAuthDlgStruct
  295. );
  296. DWORD
  297. NPSERVICE
  298. NPSGetProviderHandle(
  299. PHPROVIDER phProvider
  300. );
  301. DWORD
  302. NPSERVICE
  303. NPSGetProviderName(
  304. HPROVIDER hProvider,
  305. LPCSTR FAR * lpszProviderName
  306. );
  307. DWORD
  308. NPSERVICE
  309. NPSGetSectionName(
  310. HPROVIDER hProvider,
  311. LPCSTR FAR * lpszSectionName
  312. );
  313. DWORD
  314. NPSERVICE NPSSetExtendedError (
  315. DWORD NetSpecificError,
  316. LPSTR lpExtendedErrorText
  317. );
  318. VOID
  319. NPSERVICE NPSSetCustomText (
  320. LPSTR lpCustomErrorText
  321. );
  322. DWORD
  323. NPSERVICE
  324. NPSCopyString (
  325. LPCTSTR lpString,
  326. LPVOID lpBuffer,
  327. LPDWORD lpdwBufferSize
  328. );
  329. DWORD
  330. NPSERVICE
  331. NPSDeviceGetNumber (
  332. LPTSTR lpLocalName,
  333. LPDWORD lpdwNumber,
  334. LPDWORD lpdwType
  335. );
  336. DWORD
  337. NPSERVICE
  338. NPSDeviceGetString (
  339. DWORD dwNumber,
  340. DWORD dwType,
  341. LPTSTR lpLocalName,
  342. LPDWORD lpdwBufferSize
  343. );
  344. // Notification Service.
  345. enum NOTIFYTYPE { NotifyAddConnection,
  346. NotifyCancelConnection,
  347. NotifyGetConnectionPerformance };
  348. #define NOTIFY_PRE 0x00
  349. #define NOTIFY_POST 0x01
  350. typedef struct _NOTIFYINFO {
  351. DWORD cbStructure; /* size of NOTIFYINFO */
  352. DWORD dwNotifyStatus; /* Pre/post notification status */
  353. DWORD dwOperationStatus; /* Status of operation */
  354. LPVOID lpNPContext; /* NP context */
  355. } NOTIFYINFO, FAR *LPNOTIFYINFO;
  356. typedef struct _NOTIFYADD {
  357. DWORD cbStructure; /* size of NOTIFYADD */
  358. HWND hwndOwner; /* hWnd for UI */
  359. NETRESOURCE NetResource; /* Resource to add */
  360. DWORD dwAddFlags; /* Add flags */
  361. LPTSTR lpAccessName; /* System name for connection */
  362. LPDWORD lpBufferSize; /* Size of AccessName buffer */
  363. DWORD dwResult; /* Info about connection */
  364. DWORD dwAddContext; /* Context of add connection */
  365. } NOTIFYADD, FAR *LPNOTIFYADD;
  366. #define CONNECT_CTXT_RESTORE 0x00000001
  367. #define CONNECT_CTXT_GLOBAL 0x00000002
  368. #define CONNECT_CTXT_PROVIDER 0x00000004
  369. #define CONNECT_CTXT_SINGLE 0x00000008
  370. typedef struct _NOTIFYCANCEL {
  371. DWORD cbStructure; /* size of NOTIFYCANCEL */
  372. LPTSTR lpName; /* Local device name or remote name of resource */
  373. LPTSTR lpProvider; /* Provider name of resource cancelled */
  374. DWORD dwFlags; /* Cancel flags */
  375. BOOL fForce; /* Cancel force */
  376. } NOTIFYCANCEL, FAR *LPNOTIFYCANCEL;
  377. typedef struct _NOTIFYPERFORMANCE {
  378. DWORD cbStructure; /* size of NOTIFYPERFORMANCE */
  379. LPTSTR lpRemoteName; /* network resource name */
  380. LPTSTR lpProviderName; /* provider to try/provider that responded */
  381. LPNETCONNECTINFOSTRUCT lpNetConnectInfo; /* performance information requested/returned */
  382. } NOTIFYPERFORMANCE, FAR *LPNOTIFYPERFORMANCE;
  383. typedef DWORD (FAR PASCAL *NOTIFYCALLBACK)( LPNOTIFYINFO lpNotifyInfo, LPVOID lpOperationInfo );
  384. DWORD
  385. NPSERVICE
  386. NPSNotifyRegister(
  387. enum NOTIFYTYPE NotifyType,
  388. NOTIFYCALLBACK P_FNotifyCallBack
  389. );
  390. LPVOID
  391. NPSERVICE
  392. NPSNotifyGetContext (
  393. NOTIFYCALLBACK P_FNotifyCallBack
  394. );
  395. #ifdef __cplusplus
  396. }
  397. #endif /* __cplusplus */
  398. #ifndef RC_INVOKED
  399. #pragma pack()
  400. #endif /* !RC_INVOKED */
  401. #endif /* !_INC_NETSPI */