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.

507 lines
15 KiB

  1. /*
  2. * Windows/Network Interface
  3. * Copyright (C) Microsoft 1989-1993
  4. *
  5. * Standard WINNET Driver Header File, spec version 3.10
  6. */
  7. #ifndef _INC_WINNET
  8. #define _INC_WINNET /* #defined if windows.h has been included */
  9. #ifndef RC_INVOKED
  10. #pragma pack(1) /* Assume byte packing throughout */
  11. #endif /* RC_INVOKED */
  12. #ifdef __cplusplus
  13. extern "C" { /* Assume C declarations for C++ */
  14. #endif /* __cplusplus */
  15. typedef WORD far * LPWORD;
  16. #ifndef API
  17. #define API WINAPI
  18. #endif
  19. /*
  20. * SPOOLING - CONTROLLING JOBS
  21. */
  22. #define WNJ_NULL_JOBID 0
  23. WORD API WNetOpenJob(LPSTR,LPSTR,WORD,LPINT);
  24. WORD API WNetCloseJob(WORD,LPINT,LPSTR);
  25. WORD API WNetWriteJob(HANDLE,LPSTR,LPINT);
  26. WORD API WNetAbortJob(WORD,LPSTR);
  27. WORD API WNetHoldJob(LPSTR,WORD);
  28. WORD API WNetReleaseJob(LPSTR,WORD);
  29. WORD API WNetCancelJob(LPSTR,WORD);
  30. WORD API WNetSetJobCopies(LPSTR,WORD,WORD);
  31. /*
  32. * SPOOLING - QUEUE AND JOB INFO
  33. */
  34. typedef struct _queuestruct {
  35. WORD pqName;
  36. WORD pqComment;
  37. WORD pqStatus;
  38. WORD pqJobcount;
  39. WORD pqPrinters;
  40. } QUEUESTRUCT;
  41. typedef QUEUESTRUCT far * LPQUEUESTRUCT;
  42. #define WNPRQ_ACTIVE 0x0
  43. #define WNPRQ_PAUSE 0x1
  44. #define WNPRQ_ERROR 0x2
  45. #define WNPRQ_PENDING 0x3
  46. #define WNPRQ_PROBLEM 0x4
  47. typedef struct _jobstruct {
  48. WORD pjId;
  49. WORD pjUsername;
  50. WORD pjParms;
  51. WORD pjPosition;
  52. WORD pjStatus;
  53. DWORD pjSubmitted;
  54. DWORD pjSize;
  55. WORD pjCopies;
  56. WORD pjComment;
  57. } JOBSTRUCT;
  58. typedef JOBSTRUCT far * LPJOBSTRUCT;
  59. #define WNPRJ_QSTATUS 0x0007
  60. #define WNPRJ_QS_QUEUED 0x0000
  61. #define WNPRJ_QS_PAUSED 0x0001
  62. #define WNPRJ_QS_SPOOLING 0x0002
  63. #define WNPRJ_QS_PRINTING 0x0003
  64. #define WNPRJ_DEVSTATUS 0x0FF8
  65. #define WNPRJ_DS_COMPLETE 0x0008
  66. #define WNPRJ_DS_INTERV 0x0010
  67. #define WNPRJ_DS_ERROR 0x0020
  68. #define WNPRJ_DS_DESTOFFLINE 0x0040
  69. #define WNPRJ_DS_DESTPAUSED 0x0080
  70. #define WNPRJ_DS_NOTIFY 0x0100
  71. #define WNPRJ_DS_DESTNOPAPER 0x0200
  72. #define WNPRJ_DS_DESTFORMCHG 0x0400
  73. #define WNPRJ_DS_DESTCRTCHG 0x0800
  74. #define WNPRJ_DS_DESTPENCHG 0x1000
  75. #define SP_QUEUECHANGED 0x0500
  76. WORD API WNetWatchQueue(HWND,LPSTR,LPSTR,WORD);
  77. WORD API WNetUnwatchQueue(LPSTR);
  78. WORD API WNetLockQueueData(LPSTR,LPSTR,LPQUEUESTRUCT FAR *);
  79. WORD API WNetUnlockQueueData(LPSTR);
  80. /*
  81. * CONNECTIONS
  82. */
  83. UINT API WNetAddConnection(LPSTR,LPSTR,LPSTR);
  84. UINT API WNetCancelConnection(LPSTR,BOOL);
  85. UINT API WNetGetConnection(LPSTR,LPSTR, UINT FAR *);
  86. UINT API WNetRestoreConnection(HWND,LPSTR);
  87. /*
  88. * CAPABILITIES
  89. */
  90. #define WNNC_SPEC_VERSION 0x0001
  91. #define WNNC_NET_TYPE 0x0002
  92. #define WNNC_NET_NONE 0x0000
  93. #define WNNC_NET_MSNet 0x0100
  94. #define WNNC_NET_LanMan 0x0200
  95. #define WNNC_NET_NetWare 0x0300
  96. #define WNNC_NET_Vines 0x0400
  97. #define WNNC_NET_10NET 0x0500
  98. #define WNNC_NET_Locus 0x0600
  99. #define WNNC_NET_Sun_PC_NFS 0x0700
  100. #define WNNC_NET_LANstep 0x0800
  101. #define WNNC_NET_9TILES 0x0900
  102. #define WNNC_NET_LANtastic 0x0A00
  103. #define WNNC_NET_AS400 0x0B00
  104. #define WNNC_NET_FTP_NFS 0x0C00
  105. #define WNNC_NET_PATHWORKS 0x0D00
  106. #define WNNC_NET_MultiNet 0x8000
  107. #define WNNC_SUBNET_NONE 0x0000
  108. #define WNNC_SUBNET_MSNet 0x0001
  109. #define WNNC_SUBNET_LanMan 0x0002
  110. #define WNNC_SUBNET_WinWorkgroups 0x0004
  111. #define WNNC_SUBNET_NetWare 0x0008
  112. #define WNNC_SUBNET_Vines 0x0010
  113. #define WNNC_SUBNET_Other 0x0080
  114. #define WNNC_DRIVER_VERSION 0x0003
  115. #define WNNC_USER 0x0004
  116. #define WNNC_USR_GetUser 0x0001
  117. #define WNNC_CONNECTION 0x0006
  118. #define WNNC_CON_AddConnection 0x0001
  119. #define WNNC_CON_CancelConnection 0x0002
  120. #define WNNC_CON_GetConnections 0x0004
  121. #define WNNC_CON_AutoConnect 0x0008
  122. #define WNNC_CON_BrowseDialog 0x0010
  123. #define WNNC_CON_RestoreConnection 0x0020
  124. #define WNNC_PRINTING 0x0007
  125. #define WNNC_PRT_OpenJob 0x0002
  126. #define WNNC_PRT_CloseJob 0x0004
  127. #define WNNC_PRT_HoldJob 0x0010
  128. #define WNNC_PRT_ReleaseJob 0x0020
  129. #define WNNC_PRT_CancelJob 0x0040
  130. #define WNNC_PRT_SetJobCopies 0x0080
  131. #define WNNC_PRT_WatchQueue 0x0100
  132. #define WNNC_PRT_UnwatchQueue 0x0200
  133. #define WNNC_PRT_LockQueueData 0x0400
  134. #define WNNC_PRT_UnlockQueueData 0x0800
  135. #define WNNC_PRT_ChangeMsg 0x1000
  136. #define WNNC_PRT_AbortJob 0x2000
  137. #define WNNC_PRT_NoArbitraryLock 0x4000
  138. #define WNNC_PRT_WriteJob 0x8000
  139. #define WNNC_DIALOG 0x0008
  140. #define WNNC_DLG_DeviceMode 0x0001
  141. #define WNNC_DLG_BrowseDialog 0x0002
  142. #define WNNC_DLG_ConnectDialog 0x0004
  143. #define WNNC_DLG_DisconnectDialog 0x0008
  144. #define WNNC_DLG_ViewQueueDialog 0x0010
  145. #define WNNC_DLG_PropertyDialog 0x0020
  146. #define WNNC_DLG_ConnectionDialog 0x0040
  147. #define WNNC_DLG_PrinterConnectDialog 0x0080
  148. #define WNNC_DLG_SharesDialog 0x0100
  149. #define WNNC_DLG_ShareAsDialog 0x0200
  150. #define WNNC_ADMIN 0x0009
  151. #define WNNC_ADM_GetDirectoryType 0x0001
  152. #define WNNC_ADM_DirectoryNotify 0x0002
  153. #define WNNC_ADM_LongNames 0x0004
  154. #define WNNC_ADM_SetDefaultDrive 0x0008
  155. #define WNNC_ERROR 0x000A
  156. #define WNNC_ERR_GetError 0x0001
  157. #define WNNC_ERR_GetErrorText 0x0002
  158. WORD API WNetGetCaps(WORD);
  159. /*
  160. * OTHER
  161. */
  162. WORD API WNetGetUser(LPSTR,LPINT);
  163. /*
  164. * BROWSE DIALOG
  165. */
  166. #define WNBD_CONN_UNKNOWN 0x0
  167. #define WNBD_CONN_DISKTREE 0x1
  168. #define WNBD_CONN_PRINTQ 0x3
  169. #define WNBD_MAX_LENGTH 0x80 // path length, includes the NULL
  170. #define WNTYPE_DRIVE 1
  171. #define WNTYPE_FILE 2
  172. #define WNTYPE_PRINTER 3
  173. #define WNTYPE_COMM 4
  174. #define WNPS_FILE 0
  175. #define WNPS_DIR 1
  176. #define WNPS_MULT 2
  177. WORD API WNetDeviceMode(HWND);
  178. WORD API WNetBrowseDialog(HWND,WORD,LPSTR);
  179. WORD API WNetConnectDialog(HWND,WORD);
  180. WORD API WNetDisconnectDialog(HWND,WORD);
  181. WORD API WNetConnectionDialog(HWND,WORD);
  182. WORD API WNetViewQueueDialog(HWND,LPSTR);
  183. WORD API WNetPropertyDialog(HWND hwndParent, WORD iButton, WORD nPropSel,
  184. LPSTR lpszName, WORD nType);
  185. WORD API WNetGetPropertyText(WORD iButton, WORD nPropSel, LPSTR lpszName,
  186. LPSTR lpszButtonName, WORD cbButtonName, WORD nType);
  187. /*
  188. The following APIs are not exported from USER.EXE. They must be
  189. loaded from the active network driver like this:
  190. HINSTANCE hinstNetDriver;
  191. LPWNETSERVERBROWSEDIALOG lpDialogAPI;
  192. hinstNetDriver = (HINSTANCE)WNetGetCaps(0xFFFF);
  193. if (hinstNetDriver == NULL) {
  194. // no network driver loaded
  195. }
  196. else {
  197. lpDialogAPI = (LPWNETSERVERBROWSEDIALOG)GetProcAddress(hinstNetDriver,
  198. (LPSTR)ORD_WNETSERVERBROWSEDIALOG);
  199. if (lpDialogAPI == NULL) {
  200. // currently installed network doesn't support this API
  201. }
  202. else {
  203. (*lpDialogAPI)(hwndParent, lpszSectionName, lpszBuffer, cbBuffer, 0L);
  204. }
  205. }
  206. */
  207. typedef WORD (API *LPWNETSHAREASDIALOG)(HWND hwndParent, WORD iType,
  208. LPSTR lpszPath);
  209. typedef WORD (API *LPWNETSTOPSHAREDIALOG)(HWND hwndParent, WORD iType,
  210. LPSTR lpszPath);
  211. typedef WORD (API *LPWNETSETDEFAULTDRIVE)(WORD idriveDefault);
  212. typedef WORD (API *LPWNETGETSHARECOUNT)(WORD iType);
  213. typedef WORD (API *LPWNETGETSHARENAME)(LPSTR lpszPath, LPSTR lpszBuf,
  214. WORD cbBuf);
  215. typedef WORD (API *LPWNETSERVERBROWSEDIALOG)(HWND hwndParent,
  216. LPSTR lpszSectionName,
  217. LPSTR lpszBuffer,
  218. WORD cbBuffer,
  219. DWORD flFlags);
  220. typedef WORD (API *LPWNETGETSHAREPATH)(LPSTR lpszName, LPSTR lpszBuf,
  221. WORD cbBuf);
  222. typedef WORD (API *LPWNETGETLASTCONNECTION)(WORD iType, LPWORD lpwConnIndex);
  223. typedef WORD (API *LPWNETEXITCONFIRM)(HWND hwndOwner, WORD iExitType);
  224. typedef BOOL (API *LPI_AUTOLOGON)(HWND hwndOwner, LPSTR lpszReserved,
  225. BOOL fPrompt, BOOL FAR *lpfLoggedOn);
  226. typedef BOOL (API *LPI_LOGOFF)(HWND hwndOwner, LPSTR lpszReserved);
  227. typedef VOID (API *LPI_CHANGEPASSWORD)(HWND hwndOwner);
  228. typedef VOID (API *LPI_CHANGECACHEPASSWORD)(HWND hwndOwner);
  229. typedef WORD (API *LPI_CONNECTDIALOG)(HWND hwndParent, WORD iType);
  230. typedef WORD (API *LPI_CONNECTIONDIALOG)(HWND hwndParent, WORD iType);
  231. typedef struct tagPASSWORD_CACHE_ENTRY {
  232. WORD cbEntry;
  233. WORD cbResource;
  234. WORD cbPassword;
  235. BYTE iEntry;
  236. BYTE nType;
  237. BYTE abResource[1]; /* resource name, cbResource bytes long */
  238. /* password follows immediately after */
  239. } PASSWORD_CACHE_ENTRY;
  240. typedef PASSWORD_CACHE_ENTRY FAR *LPPASSWORD_CACHE_ENTRY;
  241. typedef WORD (API *LPWNETCACHEPASSWORD)(LPSTR pbResource, WORD cbResource,
  242. LPSTR pbPassword, WORD cbPassword,
  243. BYTE nType);
  244. typedef WORD (API *LPWNETGETCACHEDPASSWORD)(LPSTR pbResource, WORD cbResource,
  245. LPSTR pbPassword, LPWORD pcbPassword,
  246. BYTE nType);
  247. typedef WORD (API *LPWNETREMOVECACHEDPASSWORD)(LPSTR pbResource,
  248. WORD cbResource,
  249. BYTE nType);
  250. /*
  251. Typedef for the callback routine passed to WNetEnumCachedPasswords.
  252. It will be called once for each entry that matches the criteria
  253. requested. It should return TRUE if it wants the enumeration to
  254. continue, FALSE to stop.
  255. */
  256. typedef BOOL (API *CACHECALLBACK)( LPPASSWORD_CACHE_ENTRY pce );
  257. typedef WORD (API *LPWNETENUMCACHEDPASSWORDS)(LPSTR pbPrefix, WORD cbPrefix,
  258. BYTE nType,
  259. CACHECALLBACK pfnCallback);
  260. /*
  261. * Ordinals in the network driver for APIs not exported by USER.
  262. */
  263. #define ORD_I_AUTOLOGON 530
  264. #define ORD_I_CHANGEPASSWORD 531
  265. #define ORD_I_LOGOFF 532
  266. #define ORD_I_CONNECTIONDIALOG 533
  267. #define ORD_I_CHANGECACHEPASSWORD 534
  268. #define ORD_I_CONNECTDIALOG 535
  269. #define ORD_WNETSHARESDIALOG 140
  270. #define ORD_WNETSHAREASDIALOG 141
  271. #define ORD_WNETSTOPSHAREDIALOG 142
  272. #define ORD_WNETSETDEFAULTDRIVE 143
  273. #define ORD_WNETGETSHARECOUNT 144
  274. #define ORD_WNETGETSHARENAME 145
  275. #define ORD_WNETSERVERBROWSEDIALOG 146
  276. #define ORD_WNETGETSHAREPATH 147
  277. #define ORD_WNETGETLASTCONNECTION 148
  278. #define ORD_WNETEXITCONFIRM 149
  279. #define ORD_WNETCACHEPASSWORD 150
  280. #define ORD_WNETGETCACHEDPASSWORD 151
  281. #define ORD_WNETREMOVECACHEDPASSWORD 152
  282. #define ORD_WNETENUMCACHEDPASSWORDS 153
  283. /*
  284. * the following nType values are only for the purposes of enumerating
  285. * entries from the cache. note that PCE_ALL is reserved and should not
  286. * be the nType value for any entry.
  287. */
  288. #define PCE_DOMAIN 0x01 /* entry is for a domain */
  289. #define PCE_SERVER 0x02 /* entry is for a server */
  290. #define PCE_UNC 0x03 /* entry is for a server/share combo */
  291. #define PCE_NOTMRU 0x80 /* bit set if entry is exempt from MRU aging */
  292. #define PCE_ALL 0xff /* retrieve all entries */
  293. /*
  294. * Defines for iExitType on WNetExitConfirm
  295. */
  296. #define EXIT_CONFIRM 0
  297. #define EXIT_EXITING 1
  298. #define EXIT_CANCELED 2
  299. /*
  300. * ADMIN
  301. */
  302. #define WNDT_NORMAL 0
  303. #define WNDT_NETWORK 1
  304. #define WNDN_MKDIR 1
  305. #define WNDN_RMDIR 2
  306. #define WNDN_MVDIR 3
  307. WORD API WNetGetDirectoryType(LPSTR,LPINT);
  308. WORD API WNetDirectoryNotify(HWND,LPSTR,WORD);
  309. /*
  310. * ERRORS
  311. */
  312. WORD API WNetGetError(LPINT);
  313. WORD API WNetGetErrorText(WORD,LPSTR,LPINT);
  314. /*
  315. * STATUS CODES
  316. */
  317. /* General */
  318. #define WN_SUCCESS 0x0000
  319. #define WN_NOT_SUPPORTED 0x0001
  320. #define WN_NET_ERROR 0x0002
  321. #define WN_MORE_DATA 0x0003
  322. #define WN_BAD_POINTER 0x0004
  323. #define WN_BAD_VALUE 0x0005
  324. #define WN_BAD_PASSWORD 0x0006
  325. #define WN_ACCESS_DENIED 0x0007
  326. #define WN_FUNCTION_BUSY 0x0008
  327. #define WN_WINDOWS_ERROR 0x0009
  328. #define WN_BAD_USER 0x000A
  329. #define WN_OUT_OF_MEMORY 0x000B
  330. #define WN_CANCEL 0x000C
  331. #define WN_CONTINUE 0x000D
  332. /* Connection */
  333. #define WN_NOT_CONNECTED 0x0030
  334. #define WN_OPEN_FILES 0x0031
  335. #define WN_BAD_NETNAME 0x0032
  336. #define WN_BAD_LOCALNAME 0x0033
  337. #define WN_ALREADY_CONNECTED 0x0034
  338. #define WN_DEVICE_ERROR 0x0035
  339. #define WN_CONNECTION_CLOSED 0x0036
  340. /* Printing */
  341. #define WN_BAD_JOBID 0x0040
  342. #define WN_JOB_NOT_FOUND 0x0041
  343. #define WN_JOB_NOT_HELD 0x0042
  344. #define WN_BAD_QUEUE 0x0043
  345. #define WN_BAD_FILE_HANDLE 0x0044
  346. #define WN_CANT_SET_COPIES 0x0045
  347. #define WN_ALREADY_LOCKED 0x0046
  348. #define WN_NO_ERROR 0x0050
  349. /* stuff in user, not driver, for shell apps ;Internal */
  350. WORD API WNetErrorText(WORD,LPSTR,WORD); /* ;Internal */
  351. #ifdef LFN
  352. /* this is the data structure returned from LFNFindFirst and
  353. * LFNFindNext. The last field, achName, is variable length. The size
  354. * of the name in that field is given by cchName, plus 1 for the zero
  355. * terminator.
  356. */
  357. typedef struct _filefindbuf2
  358. {
  359. WORD fdateCreation;
  360. WORD ftimeCreation;
  361. WORD fdateLastAccess;
  362. WORD ftimeLastAccess;
  363. WORD fdateLastWrite;
  364. WORD ftimeLastWrite;
  365. DWORD cbFile;
  366. DWORD cbFileAlloc;
  367. WORD attr;
  368. DWORD cbList;
  369. BYTE cchName;
  370. BYTE achName[1];
  371. } FILEFINDBUF2, FAR * PFILEFINDBUF2;
  372. typedef BOOL (API *PQUERYPROC)( void );
  373. WORD API LFNFindFirst(LPSTR,WORD,LPINT,LPINT,WORD,PFILEFINDBUF2);
  374. WORD API LFNFindNext(HANDLE,LPINT,WORD,PFILEFINDBUF2);
  375. WORD API LFNFindClose(HANDLE);
  376. WORD API LFNGetAttribute(LPSTR,LPINT);
  377. WORD API LFNSetAttribute(LPSTR,WORD);
  378. WORD API LFNCopy(LPSTR,LPSTR,PQUERYPROC);
  379. WORD API LFNMove(LPSTR,LPSTR);
  380. WORD API LFNDelete(LPSTR);
  381. WORD API LFNMKDir(LPSTR);
  382. WORD API LFNRMDir(LPSTR);
  383. WORD API LFNGetVolumeLabel(WORD,LPSTR);
  384. WORD API LFNSetVolumeLabel(WORD,LPSTR);
  385. WORD API LFNParse(LPSTR,LPSTR,LPSTR);
  386. WORD API LFNVolumeType(WORD,LPINT);
  387. /* return values from LFNParse
  388. */
  389. #define FILE_83_CI 0
  390. #define FILE_83_CS 1
  391. #define FILE_LONG 2
  392. /* volumes types from LFNVolumeType
  393. */
  394. #define VOLUME_STANDARD 0
  395. #define VOLUME_LONGNAMES 1
  396. // will add others later, == DOS int 21h error codes.
  397. // this error code causes a call to WNetGetError, WNetGetErrorText
  398. // to get the error text.
  399. #define ERROR_NETWORKSPECIFIC 0xFFFF
  400. #endif
  401. #ifndef RC_INVOKED
  402. #pragma pack() /* Revert to default packing */
  403. #endif /* RC_INVOKED */
  404. #ifdef __cplusplus
  405. } /* End of extern "C" { */
  406. #endif /* __cplusplus */
  407. #endif /* _INC_WINDOWS */