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.

1279 lines
31 KiB

  1. /*++
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. usrmddav.h
  5. Abstract:
  6. This module defines the data structures which are shared by the user mode
  7. and the kernel mode components of the WebDav miniredirector.
  8. Author:
  9. Rohan Kumar [RohanK] 30-March-1999
  10. Revision History:
  11. --*/
  12. #ifndef _USRMDDAV_H
  13. #define _USRMDDAV_H
  14. //
  15. // The subset of DAV file attributes (common with NTFS attributes) which get
  16. // returned on a PROPFIND call. The structure also include the properties that
  17. // get returned when a LOCK or any other DAV request is issued.
  18. //
  19. typedef struct _DAV_FILE_ATTRIBUTES {
  20. BOOL InvalidNode;
  21. ULONG FileIndex;
  22. DWORD dwFileAttributes;
  23. LARGE_INTEGER CreationTime;
  24. LARGE_INTEGER LastAccessTime;
  25. LARGE_INTEGER LastModifiedTime;
  26. LARGE_INTEGER DavCreationTime;
  27. LARGE_INTEGER DavLastModifiedTime;
  28. LARGE_INTEGER FileSize;
  29. LIST_ENTRY NextEntry;
  30. BOOL isHidden;
  31. BOOLEAN isCollection;
  32. ULONG FileNameLength;
  33. PWCHAR FileName;
  34. PWCHAR Status;
  35. BOOL fReportsAvailableSpace;
  36. LARGE_INTEGER TotalSpace;
  37. LARGE_INTEGER AvailableSpace;
  38. ULONG LockTimeout;
  39. PWCHAR OpaqueLockToken;
  40. PWCHAR LockOwner;
  41. } DAV_FILE_ATTRIBUTES, *PDAV_FILE_ATTRIBUTES;
  42. #ifndef __cplusplus
  43. //
  44. // The fileinfo that gets filled in by the user mode process and returned to the
  45. // kernel mode miniredir.
  46. //
  47. typedef struct _DAV_USERMODE_CREATE_RETURNED_FILEINFO {
  48. //
  49. // File's Basic Info.
  50. //
  51. union {
  52. ULONG ForceAlignment1;
  53. FILE_BASIC_INFORMATION BasicInformation;
  54. };
  55. //
  56. // File's Standard Info.
  57. //
  58. union {
  59. ULONG ForceAlignment2;
  60. FILE_STANDARD_INFORMATION StandardInformation;
  61. };
  62. } DAV_USERMODE_CREATE_RETURNED_FILEINFO,*PDAV_USERMODE_CREATE_RETURNED_FILEINFO;
  63. //
  64. // Structure used in create/close requests.
  65. //
  66. typedef struct _DAV_HANDLE_AND_USERMODE_KEY {
  67. //
  68. // The handle of the file being opened.
  69. //
  70. HANDLE Handle;
  71. //
  72. // This is set to the handle value and is used for debugging purposes.
  73. //
  74. PVOID UserModeKey;
  75. } DAV_HANDLE_AND_USERMODE_KEY, *PDAV_HANDLE_AND_USERMODE_KEY;
  76. //
  77. // The Dav create request flags and buffer.
  78. //
  79. #define DAV_SECURITY_DYNAMIC_TRACKING 0x01
  80. #define DAV_SECURITY_EFFECTIVE_ONLY 0x02
  81. typedef struct _DAV_USERMODE_CREATE_REQUEST {
  82. //
  83. // The complete path name of the create request. The user mode process
  84. // parses this path name and creates a URL to be sent to the server.
  85. //
  86. PWCHAR CompletePathName;
  87. //
  88. // The server's unique id which was got during the CreateSrvCall.
  89. //
  90. ULONG ServerID;
  91. //
  92. // The user/session's LogonID.
  93. //
  94. LUID LogonID;
  95. PSECURITY_DESCRIPTOR SecurityDescriptor;
  96. ULONG SdLength;
  97. SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
  98. ULONG SecurityFlags;
  99. ACCESS_MASK DesiredAccess;
  100. LARGE_INTEGER AllocationSize;
  101. ULONG FileAttributes;
  102. ULONG ShareAccess;
  103. ULONG CreateDisposition;
  104. ULONG CreateOptions;
  105. PVOID EaBuffer;
  106. ULONG EaLength;
  107. BOOLEAN FileInformationCached;
  108. BOOLEAN FileNotExists;
  109. BOOLEAN ParentDirInfomationCached;
  110. BOOLEAN ParentDirIsEncrypted;
  111. } DAV_USERMODE_CREATE_REQUEST, *PDAV_USERMODE_CREATE_REQUEST;
  112. //
  113. // The create response returned by the user mode.
  114. //
  115. typedef struct _DAV_USERMODE_CREATE_RESPONSE {
  116. //
  117. // The filename of the local file that represents the file on the DAV server
  118. // which got created/opened. Locally, the files are cached in the IE cache.
  119. //
  120. WCHAR FileName[MAX_PATH];
  121. WCHAR Url[MAX_PATH * 2];
  122. //
  123. // If this was a new file created on the server, do we need to set the
  124. // attributes on Close ?
  125. //
  126. BOOL NewFileCreatedAndSetAttributes;
  127. //
  128. // If a new file or directory is created, we need to PROPPATCH the time
  129. // values on close. This is because we use the time values from the client
  130. // when the name cache entry is created for this new file. The same time
  131. // value needs to be on the server.
  132. //
  133. BOOL PropPatchTheTimeValues;
  134. //
  135. // If this is TRUE, it means that the file exists on the server, but
  136. // "FILE_OVERWRITE_IF" was specified as the CreateDisposition. So, the file
  137. // was created locally and the new file needs to be PUT (overwrite) over the
  138. // old file on the server on close.
  139. //
  140. BOOL ExistsAndOverWriteIf;
  141. //
  142. // Was "FILE_DELETE_ON_CLOSE" specified as one of the CreateOptions ?
  143. //
  144. BOOL DeleteOnClose;
  145. //
  146. // We haven't really opened the file as the caller is either deleting or
  147. // reading/setting attributes.
  148. //
  149. BOOL fPsuedoOpen;
  150. BOOL LocalFileIsEncrypted;
  151. //
  152. // If the file is LOCKed on the server during the create, the LockKoken
  153. // returned by the server is filled here.
  154. //
  155. WCHAR OpaqueLockToken[MAX_PATH];
  156. //
  157. // If the Create fails because the file is LOCKed on the server, the LockOwner
  158. // returned by the server is filled here. Maximum length of the LockOwner
  159. // field. The worst case is <User>@<DnsDomain>.
  160. //
  161. WCHAR LockOwner[(256 + 1 + 256)];
  162. //
  163. // If the file is LOCKed on the server during the create, the Lock Timeout
  164. // returned by the server is filled here.
  165. //
  166. ULONG LockTimeout;
  167. //
  168. // This is set to TRUE if this create involved taking a LOCK on the file
  169. // on the server and the LOCK was successfully taken.
  170. //
  171. BOOL LockWasTakenOnThisCreate;
  172. //
  173. // This is set to TRUE if this create involved taking a LOCK on the file
  174. // on the server and the LOCK request failed because someone else has
  175. // already locked the file.
  176. //
  177. BOOL FileWasAlreadyLocked;
  178. union {
  179. DAV_HANDLE_AND_USERMODE_KEY;
  180. DAV_HANDLE_AND_USERMODE_KEY HandleAndUserModeKey;
  181. };
  182. union {
  183. DAV_USERMODE_CREATE_RETURNED_FILEINFO;
  184. DAV_USERMODE_CREATE_RETURNED_FILEINFO CreateReturnedFileInfo;
  185. };
  186. } DAV_USERMODE_CREATE_RESPONSE, *PDAV_USERMODE_CREATE_RESPONSE;
  187. //
  188. // Create SrvCall request buffer.
  189. //
  190. typedef struct _DAV_USERMODE_CREATE_SRVCALL_REQUEST {
  191. //
  192. // The name of the server for which a SrvCall is being created. The user
  193. // mode process verifies whether this server exists and whether it speaks
  194. // DAV.
  195. //
  196. PWCHAR ServerName;
  197. //
  198. // The user/session's LogonID.
  199. //
  200. LUID LogonID;
  201. //
  202. // Am I the thread that is creating and initializing this ServerHashEntry?
  203. //
  204. BOOL didICreateThisSrvCall;
  205. //
  206. // Am I a thread that did a wait and took a reference while some other
  207. // thread was creating and initializing this ServerHashEntry?
  208. //
  209. BOOL didIWaitAndTakeReference;
  210. } DAV_USERMODE_CREATE_SRVCALL_REQUEST, *PDAV_USERMODE_CREATE_SRVCALL_REQUEST;
  211. //
  212. // The Create SrvCall response.
  213. //
  214. typedef struct _DAV_USERMODE_CREATE_SRVCALL_RESPONSE {
  215. //
  216. // The Server ID is generated in the user mode when a create srvcall
  217. // request comes up. This is stored in the mini-redir's portion of the
  218. // srvcall structure and is sent up along with future reflections against
  219. // this server.
  220. //
  221. ULONG ServerID;
  222. } DAV_USERMODE_CREATE_SRVCALL_RESPONSE, *PDAV_USERMODE_CREATE_SRVCALL_RESPONSE;
  223. //
  224. // Finalize SrvCall request buffer.
  225. //
  226. typedef struct _DAV_USERMODE_FINALIZE_SRVCALL_REQUEST {
  227. //
  228. // The server whose entry is being finalized.
  229. //
  230. PWCHAR ServerName;
  231. //
  232. // The ServerID for the server.
  233. //
  234. ULONG ServerID;
  235. } DAV_USERMODE_FINALIZE_SRVCALL_REQUEST, *PDAV_USERMODE_FINALIZE_SRVCALL_REQUEST;
  236. //
  237. // The QueryDirectory request buffer.
  238. //
  239. typedef struct _DAV_USERMODE_QUERYDIR_REQUEST {
  240. //
  241. // Is the DavFileAttributes list for this directory created ? This is set
  242. // to TRUE after the fisrt call to QueryDirectory gets satisfied.
  243. //
  244. BOOL AlreadyDone;
  245. //
  246. // The template that came with the QueryDirectory request does not contain
  247. // wild cards.
  248. //
  249. BOOL NoWildCards;
  250. //
  251. // LogonID of this session.
  252. //
  253. LUID LogonID;
  254. //
  255. // The server being queried.
  256. //
  257. PWCHAR ServerName;
  258. //
  259. // The ID of the server being queried.
  260. //
  261. ULONG ServerID;
  262. //
  263. // The path of the direcotry being queried on the server.
  264. //
  265. PWCHAR PathName;
  266. } DAV_USERMODE_QUERYDIR_REQUEST, *PDAV_USERMODE_QUERYDIR_REQUEST;
  267. //
  268. // The QueryDirectory response buffer.
  269. //
  270. typedef struct _DAV_USERMODE_QUERYDIR_RESPONSE {
  271. //
  272. // The list of DavFileAttributes for the files under the directory being
  273. // queried.
  274. //
  275. PDAV_FILE_ATTRIBUTES DavFileAttributes;
  276. //
  277. // Number of entries in the DavFileAttributes list.
  278. //
  279. ULONG NumOfFileEntries;
  280. } DAV_USERMODE_QUERYDIR_RESPONSE, *PDAV_USERMODE_QUERYDIR_RESPONSE;
  281. //
  282. // The Close request buffer.
  283. //
  284. typedef struct _DAV_USERMODE_CLOSE_REQUEST {
  285. union {
  286. DAV_HANDLE_AND_USERMODE_KEY;
  287. DAV_HANDLE_AND_USERMODE_KEY HandleAndUserModeKey;
  288. };
  289. //
  290. // LogonID of this session.
  291. //
  292. LUID LogonID;
  293. //
  294. // The server being queried.
  295. //
  296. PWCHAR ServerName;
  297. //
  298. // The ID of the server being queried.
  299. //
  300. ULONG ServerID;
  301. //
  302. // The path of the direcotry being queried on the server.
  303. //
  304. PWCHAR PathName;
  305. //
  306. // The OpaqueLockToken returned by the server when the file was LOCKed
  307. // during the CreateFile call.
  308. //
  309. PWCHAR OpaqueLockToken;
  310. //
  311. // Should this file be deleted on Close ?
  312. //
  313. BOOL DeleteOnClose;
  314. //
  315. // Was the file modified ? If it was, then we need to PUT the modified
  316. // file back to the server.
  317. //
  318. BOOL FileWasModified;
  319. //
  320. // Was the handle to this file created in the kernel.
  321. //
  322. BOOL createdInKernel;
  323. //
  324. // Is this a Directory ?
  325. //
  326. BOOL isDirectory;
  327. //
  328. // Basic Information change
  329. //
  330. BOOLEAN fCreationTimeChanged;
  331. BOOLEAN fLastAccessTimeChanged;
  332. BOOLEAN fLastModifiedTimeChanged;
  333. BOOLEAN fFileAttributesChanged;
  334. LARGE_INTEGER CreationTime;
  335. LARGE_INTEGER LastAccessTime;
  336. LARGE_INTEGER LastModifiedTime;
  337. LARGE_INTEGER AvailableSpace;
  338. DWORD dwFileAttributes;
  339. ULONG FileSize;
  340. //
  341. // The local file name of the file created/opened on the DAV server.
  342. //
  343. WCHAR FileName[MAX_PATH];
  344. WCHAR Url[MAX_PATH * 2];
  345. } DAV_USERMODE_CLOSE_REQUEST, *PDAV_USERMODE_CLOSE_REQUEST;
  346. //
  347. // The Finalize Fobx request buffer.
  348. //
  349. typedef struct _DAV_USERMODE_FINALIZE_FOBX_REQUEST {
  350. //
  351. // The list of DavFileAttributes for the files under the directory being
  352. // queried.
  353. //
  354. PDAV_FILE_ATTRIBUTES DavFileAttributes;
  355. } DAV_USERMODE_FINALIZE_FOBX_REQUEST, *PDAV_USERMODE_FINALIZE_FOBX_REQUEST;
  356. //
  357. // The request buffer.
  358. //
  359. typedef struct _DAV_USERMODE_SETFILEINFORMATION_REQUEST {
  360. //
  361. // LogonID of this session.
  362. //
  363. LUID LogonID;
  364. //
  365. // The ID of the server being queried.
  366. //
  367. ULONG ServerID;
  368. //
  369. // The server name on which the file/dir resides
  370. //
  371. PWCHAR ServerName;
  372. //
  373. // The path name of the file or directory
  374. //
  375. PWCHAR PathName;
  376. //
  377. // The OpaqueLockToken returned by the server when the file was LOCKed
  378. // during the CreateFile call.
  379. //
  380. PWCHAR OpaqueLockToken;
  381. //
  382. // Basic Information change
  383. //
  384. BOOLEAN fCreationTimeChanged;
  385. BOOLEAN fLastAccessTimeChanged;
  386. BOOLEAN fLastModifiedTimeChanged;
  387. BOOLEAN fFileAttributesChanged;
  388. //
  389. // For now we will set only the basic info. In future we may want to expand
  390. // this filed to FILE_ALL_INFORMATION.
  391. //
  392. FILE_BASIC_INFORMATION FileBasicInformation;
  393. } DAV_USERMODE_SETFILEINFORMATION_REQUEST, *PDAV_USERMODE_SETFILEINFORMATION_REQUEST;
  394. typedef struct _DAV_USERMODE_RENAME_REQUEST {
  395. //
  396. // LogonID of this session.
  397. //
  398. LUID LogonID;
  399. //
  400. // The ID of the server being queried.
  401. //
  402. ULONG ServerID;
  403. //
  404. // If the destination file exists, replace it if this is TRUE. If its FALSE,
  405. // fail.
  406. //
  407. BOOLEAN ReplaceIfExists;
  408. //
  409. // The server name on which the file being renamed resides.
  410. //
  411. PWCHAR ServerName;
  412. //
  413. // The old path name of the file.
  414. //
  415. PWCHAR OldPathName;
  416. //
  417. // The new path name of the file.
  418. //
  419. PWCHAR NewPathName;
  420. //
  421. // The OpaqueLockToken returned by the server when the file was LOCKed
  422. // during the CreateFile call.
  423. //
  424. PWCHAR OpaqueLockToken;
  425. WCHAR Url[MAX_PATH * 2];
  426. } DAV_USERMODE_RENAME_REQUEST, *PDAV_USERMODE_RENAME_REQUEST;
  427. //
  428. // The Create V_NET_ROOT request buffer.
  429. //
  430. typedef struct _DAV_USERMODE_CREATE_V_NET_ROOT_REQUEST {
  431. //
  432. // ServerName.
  433. //
  434. PWCHAR ServerName;
  435. //
  436. // ShareName. We need to find out if this share exists or not.
  437. //
  438. PWCHAR ShareName;
  439. //
  440. // LogonID of this session.
  441. //
  442. LUID LogonID;
  443. //
  444. // The ID of the server being queried.
  445. //
  446. ULONG ServerID;
  447. } DAV_USERMODE_CREATE_V_NET_ROOT_REQUEST, *PDAV_USERMODE_CREATE_V_NET_ROOT_REQUEST;
  448. //
  449. // The CreateVNetRoot response buffer.
  450. //
  451. typedef struct _DAV_USERMODE_CREATE_V_NET_ROOT_RESPONSE {
  452. //
  453. // Is this an Office Web Server share?
  454. //
  455. BOOL isOfficeShare;
  456. //
  457. // Is this a Tahoe share?
  458. //
  459. BOOL isTahoeShare;
  460. //
  461. // OK to do PROPPATCH?
  462. //
  463. BOOL fAllowsProppatch;
  464. //
  465. // Does it report available space?
  466. //
  467. BOOL fReportsAvailableSpace;
  468. } DAV_USERMODE_CREATE_V_NET_ROOT_RESPONSE, *PDAV_USERMODE_CREATE_V_NET_ROOT_RESPONSE;
  469. //
  470. // The finalize VNetRoot request buffer.
  471. //
  472. typedef struct _DAV_USERMODE_FINALIZE_V_NET_ROOT_REQUEST {
  473. //
  474. // ServerName.
  475. //
  476. PWCHAR ServerName;
  477. //
  478. // LogonID of this session.
  479. //
  480. LUID LogonID;
  481. //
  482. // The ID of the server being queried.
  483. //
  484. ULONG ServerID;
  485. } DAV_USERMODE_FINALIZE_V_NET_ROOT_REQUEST, *PDAV_USERMODE_FINALIZE_V_NET_ROOT_REQUEST;
  486. //
  487. // The QueryVolumeInformation request buffer.
  488. //
  489. typedef struct _DAV_USERMODE_QUERYVOLUMEINFORMATION_REQUEST {
  490. //
  491. // ServerName.
  492. //
  493. PWCHAR ServerName;
  494. //
  495. // ShareName. We need to find out if this share exists or not.
  496. //
  497. PWCHAR ShareName;
  498. //
  499. // LogonID of this session.
  500. //
  501. LUID LogonID;
  502. //
  503. // The ID of the server being queried.
  504. //
  505. ULONG ServerID;
  506. } DAV_USERMODE_QUERYVOLUMEINFORMATION_REQUEST, *PDAV_USERMODE_QUERYVOLUMEINFORMATION_REQUEST;
  507. //
  508. // The QueryVolumeInformation response buffer.
  509. //
  510. typedef struct _DAV_USERMODE_QUERYVOLUMEINFORMATION_RESPONSE {
  511. //
  512. // If someone reports available space, keep it.
  513. //
  514. LARGE_INTEGER TotalSpace;
  515. LARGE_INTEGER AvailableSpace;
  516. } DAV_USERMODE_QUERYVOLUMEINFORMATION_RESPONSE, *PDAV_USERMODE_QUERYVOLUMEINFORMATION_RESPONSE;
  517. //
  518. // The LockRefresh request buffer.
  519. //
  520. typedef struct _DAV_USERMODE_LOCKREFRESH_REQUEST {
  521. //
  522. // ServerName of the server on which the LOCKed file is shared.
  523. //
  524. PWCHAR ServerName;
  525. //
  526. // PathName on which the LOCK was taken.
  527. //
  528. PWCHAR PathName;
  529. //
  530. // The LockToken (returned by the server) which needs to be refreshed.
  531. //
  532. PWCHAR OpaqueLockToken;
  533. //
  534. // The server's unique id which was got during the CreateSrvCall.
  535. //
  536. ULONG ServerID;
  537. //
  538. // The user/session's LogonID.
  539. //
  540. LUID LogonID;
  541. } DAV_USERMODE_LOCKREFRESH_REQUEST, *PDAV_USERMODE_LOCKREFRESH_REQUEST;
  542. //
  543. // The LockRefresh response buffer.
  544. //
  545. typedef struct _DAV_USERMODE_LOCKREFRESH_RESPONSE {
  546. //
  547. // The new timeout value returned by the server when this request is
  548. // refreshed.
  549. //
  550. ULONG NewTimeOutInSec;
  551. } DAV_USERMODE_LOCKREFRESH_RESPONSE, *PDAV_USERMODE_LOCKREFRESH_RESPONSE;
  552. //
  553. // The various types of usermode work requests handled by the reflector. These
  554. // requests are filled in by the kernel.
  555. //
  556. typedef union _DAV_USERMODE_WORK_REQUEST {
  557. DAV_USERMODE_CREATE_SRVCALL_REQUEST CreateSrvCallRequest;
  558. DAV_USERMODE_CREATE_V_NET_ROOT_REQUEST CreateVNetRootRequest;
  559. DAV_USERMODE_FINALIZE_SRVCALL_REQUEST FinalizeSrvCallRequest;
  560. DAV_USERMODE_FINALIZE_V_NET_ROOT_REQUEST FinalizeVNetRootRequest;
  561. DAV_USERMODE_CREATE_REQUEST CreateRequest;
  562. DAV_USERMODE_QUERYDIR_REQUEST QueryDirRequest;
  563. DAV_USERMODE_CLOSE_REQUEST CloseRequest;
  564. DAV_USERMODE_FINALIZE_FOBX_REQUEST FinalizeFobxRequest;
  565. DAV_USERMODE_RENAME_REQUEST ReNameRequest;
  566. DAV_USERMODE_SETFILEINFORMATION_REQUEST SetFileInformationRequest;
  567. DAV_USERMODE_QUERYVOLUMEINFORMATION_REQUEST QueryVolumeInformationRequest;
  568. DAV_USERMODE_LOCKREFRESH_REQUEST LockRefreshRequest;
  569. } DAV_USERMODE_WORK_REQUEST, *PDAV_USERMODE_WORK_REQUEST;
  570. //
  571. // The various types of usermode work responses send down to the kernel by the
  572. // reflector.
  573. //
  574. typedef union _DAV_USERMODE_WORK_RESPONSE {
  575. DAV_USERMODE_CREATE_SRVCALL_RESPONSE CreateSrvCallResponse;
  576. DAV_USERMODE_CREATE_RESPONSE CreateResponse;
  577. DAV_USERMODE_QUERYDIR_RESPONSE QueryDirResponse;
  578. DAV_USERMODE_CREATE_V_NET_ROOT_RESPONSE CreateVNetRootResponse;
  579. DAV_USERMODE_QUERYVOLUMEINFORMATION_RESPONSE QueryVolumeInformationResponse;
  580. DAV_USERMODE_LOCKREFRESH_RESPONSE LockRefreshResponse;
  581. } DAV_USERMODE_WORK_RESPONSE, *PDAV_USERMODE_WORK_RESPONSE;
  582. //
  583. // The DAV operations which need callbacks. These are the operations which are
  584. // performed asynchronously. NOTE!!!! The order of these is important. Do not
  585. // change them. If you need to add an operation, add it at the end.
  586. //
  587. typedef enum _DAV_OPERATION {
  588. DAV_CALLBACK_INTERNET_CONNECT = 0,
  589. DAV_CALLBACK_HTTP_OPEN,
  590. DAV_CALLBACK_HTTP_SEND,
  591. DAV_CALLBACK_HTTP_END,
  592. DAV_CALLBACK_HTTP_READ,
  593. DAV_CALLBACK_MAX
  594. } DAV_OPERATION;
  595. typedef enum _DAV_WORKITEM_TYPES {
  596. UserModeCreate = 0,
  597. UserModeCreateVNetRoot,
  598. UserModeQueryDirectory,
  599. UserModeClose,
  600. UserModeCreateSrvCall,
  601. UserModeFinalizeSrvCall,
  602. UserModeFinalizeFobx,
  603. UserModeFinalizeVNetRoot,
  604. UserModeReName,
  605. UserModeSetFileInformation,
  606. UserModeQueryVolumeInformation,
  607. UserModeLockRefresh,
  608. UserModeMaximum
  609. } DAV_WORKITEM_TYPES;
  610. //
  611. // We expose the signatures of the HASH_SERVER_ENTRY and PER_USER_ENTRY structs
  612. // in this file. This is done so that we can use these names (for type checking
  613. // by the compiler) in the DavWorkItem structure instead of using PVOID.
  614. //
  615. typedef struct _HASH_SERVER_ENTRY *PHASH_SERVER_ENTRY;
  616. typedef struct _PER_USER_ENTRY *PPER_USER_ENTRY;
  617. //
  618. // A Create call is mapped to two DAV calls. A PROPFIND, followed by the GET of
  619. // the file. This is a list of calls that could be sent to the server during
  620. // create.
  621. //
  622. typedef enum _DAV_ASYNC_CREATE_STATES {
  623. AsyncCreatePropFind = 0,
  624. AsyncCreateQueryParentDirectory,
  625. AsyncCreateGet,
  626. AsyncCreateMkCol,
  627. AsyncCreatePut
  628. } DAV_ASYNC_CREATE_STATES;
  629. typedef enum _DAV_MINOR_OPERATION {
  630. DavMinorQueryInfo = 0,
  631. DavMinorReadData,
  632. DavMinorPushData,
  633. DavMinorWriteData,
  634. DavMinorDeleteFile,
  635. DavMinorPutFile,
  636. DavMinorProppatchFile
  637. } DAV_MINOR_OPERATION;
  638. //
  639. // The Dav usermode workitem that gets passed between user and kernel mode.
  640. // This structure also gets used as a callback context in async DAV operations.
  641. //
  642. typedef struct _DAV_USERMODE_WORKITEM {
  643. //
  644. // WorkItem Header. This header is used by the reflector library and is
  645. // shared across miniredirs.
  646. //
  647. union {
  648. UMRX_USERMODE_WORKITEM_HEADER;
  649. UMRX_USERMODE_WORKITEM_HEADER Header;
  650. };
  651. //
  652. // The kernel mode operation that got reflected upto the user mode.
  653. //
  654. DAV_WORKITEM_TYPES WorkItemType;
  655. //
  656. // The DAV operation for which this callback is being returned.
  657. //
  658. DAV_OPERATION DavOperation;
  659. //
  660. // The Minor operation. Used for handling Async reads.
  661. //
  662. DAV_MINOR_OPERATION DavMinorOperation;
  663. //
  664. // This restart routine is called after we've finished doing an async
  665. // operation on a worker thread. Type: LPTHREAD_START_ROUTINE.
  666. //
  667. LPVOID RestartRoutine;
  668. //
  669. // The Handle used to impersonate the user thread which initiated the
  670. // request.
  671. //
  672. HANDLE ImpersonationHandle;
  673. //
  674. // This keeps the list of InternetStatus the callback function was called
  675. // with for this workitem. This is just for debugging purposes.
  676. //
  677. USHORT InternetStatusList[200];
  678. //
  679. // This is the index of the above array.
  680. //
  681. ULONG InternetStatusIndex;
  682. //
  683. // The thread that is handling this request. This is helpful in debugging
  684. // the threads that get stuck in WinInet.
  685. //
  686. ULONG ThisThreadId;
  687. //
  688. // Pointer to the structure that contains the handles created by the
  689. // asynchronous calls.
  690. //
  691. #ifdef WEBDAV_KERNEL
  692. LPVOID AsyncResult;
  693. #else
  694. LPINTERNET_ASYNC_RESULT AsyncResult;
  695. #endif
  696. //
  697. // Union of structs used in Async operations.
  698. //
  699. union {
  700. //
  701. // Async Create SrvCall.
  702. //
  703. struct {
  704. //
  705. // The per user entry which hangs of the server entry in the
  706. // hash table.
  707. //
  708. PPER_USER_ENTRY PerUserEntry;
  709. //
  710. // The server entry in the hash table.
  711. //
  712. PHASH_SERVER_ENTRY ServerHashEntry;
  713. //
  714. // The InternetConnect handle.
  715. //
  716. #ifdef WEBDAV_KERNEL
  717. LPVOID DavConnHandle;
  718. #else
  719. HINTERNET DavConnHandle;
  720. #endif
  721. //
  722. // Handle returned by HttpOpen and is used in http send, end etc.
  723. // calls.
  724. //
  725. #ifdef WEBDAV_KERNEL
  726. LPVOID DavOpenHandle;
  727. #else
  728. HINTERNET DavOpenHandle;
  729. #endif
  730. } AsyncCreateSrvCall;
  731. //
  732. // Async Create CreateVNetRoot.
  733. //
  734. struct {
  735. //
  736. // The per user entry which hangs of the server entry in the
  737. // hash table.
  738. //
  739. PPER_USER_ENTRY PerUserEntry;
  740. //
  741. // The server entry in the hash table.
  742. //
  743. PHASH_SERVER_ENTRY ServerHashEntry;
  744. //
  745. // If a reference was taken on the PerUserEntry while creating the
  746. // VNetRoot, this is set to TRUE. If we fail and this is TRUE, we
  747. // decrement the reference.
  748. //
  749. BOOL didITakeReference;
  750. //
  751. // Handle returned by HttpOpen and is used in http send, end etc.
  752. // calls.
  753. //
  754. #ifdef WEBDAV_KERNEL
  755. LPVOID DavOpenHandle;
  756. #else
  757. HINTERNET DavOpenHandle;
  758. #endif
  759. } AsyncCreateVNetRoot;
  760. //
  761. // AsyncQueryDirectoryCall.
  762. //
  763. struct {
  764. //
  765. // The per user entry which hangs of the server entry in the
  766. // hash table.
  767. //
  768. PPER_USER_ENTRY PerUserEntry;
  769. //
  770. // The server entry in the hash table.
  771. //
  772. PHASH_SERVER_ENTRY ServerHashEntry;
  773. //
  774. // Does the template that came with the QueryDirectory request
  775. // contain wildcards ?
  776. //
  777. BOOL NoWildCards;
  778. //
  779. // Data Buffer for reads.
  780. //
  781. PCHAR DataBuff;
  782. //
  783. // DWORD for storing the number of bytes read.
  784. //
  785. LPDWORD didRead;
  786. //
  787. // The context pointers used for parsing the XML data.
  788. //
  789. PVOID Context1;
  790. PVOID Context2;
  791. //
  792. // Handle returned by HttpOpen and is used in http send, end etc.
  793. // calls.
  794. //
  795. #ifdef WEBDAV_KERNEL
  796. LPVOID DavOpenHandle;
  797. #else
  798. HINTERNET DavOpenHandle;
  799. #endif
  800. } AsyncQueryDirectoryCall;
  801. //
  802. // Async AsyncQueryVolumeInformation
  803. //
  804. struct {
  805. //
  806. // The per user entry which hangs of the server entry in the
  807. // hash table.
  808. //
  809. PPER_USER_ENTRY PerUserEntry;
  810. //
  811. // The server entry in the hash table.
  812. //
  813. PHASH_SERVER_ENTRY ServerHashEntry;
  814. //
  815. // Handle returned by HttpOpen and is used in http send, end etc.
  816. // calls.
  817. //
  818. #ifdef WEBDAV_KERNEL
  819. LPVOID DavOpenHandle;
  820. #else
  821. HINTERNET DavOpenHandle;
  822. #endif
  823. } AsyncQueryVolumeInformation;
  824. //
  825. // Async Close.
  826. //
  827. struct {
  828. //
  829. // The per user entry which hangs of the server entry in the
  830. // hash table.
  831. //
  832. PPER_USER_ENTRY PerUserEntry;
  833. //
  834. // The server entry in the hash table.
  835. //
  836. PHASH_SERVER_ENTRY ServerHashEntry;
  837. //
  838. // The modified file is copied into this buffer and is "PUT" on the
  839. // server
  840. //
  841. PBYTE DataBuff;
  842. //
  843. // LocalAlloc takes the ULONG allocation size, no reason to declare ULONGLONG
  844. //
  845. ULONG DataBuffSizeInBytes;
  846. ULONG DataBuffAllocationSize;
  847. #ifdef WEBDAV_KERNEL
  848. LPVOID InternetBuffers;
  849. #else
  850. LPINTERNET_BUFFERS InternetBuffers;
  851. #endif
  852. //
  853. // Handle returned by HttpOpen and is used in http send, end etc.
  854. // calls.
  855. //
  856. #ifdef WEBDAV_KERNEL
  857. LPVOID DavOpenHandle;
  858. #else
  859. HINTERNET DavOpenHandle;
  860. #endif
  861. } AsyncClose;
  862. //
  863. // Async ReName.
  864. //
  865. struct {
  866. //
  867. // The per user entry which hangs of the server entry in the
  868. // hash table.
  869. //
  870. PPER_USER_ENTRY PerUserEntry;
  871. //
  872. // The server entry in the hash table.
  873. //
  874. PHASH_SERVER_ENTRY ServerHashEntry;
  875. //
  876. // The header which is added to the "MOVE" request to be sent to
  877. // the server and contains the destination URI.
  878. //
  879. PWCHAR HeaderBuff;
  880. //
  881. // Handle returned by HttpOpen and is used in http send, end etc.
  882. // calls.
  883. //
  884. #ifdef WEBDAV_KERNEL
  885. LPVOID DavOpenHandle;
  886. #else
  887. HINTERNET DavOpenHandle;
  888. #endif
  889. } AsyncReName;
  890. //
  891. // Async Create.
  892. //
  893. struct {
  894. //
  895. // The per user entry which hangs of the server entry in the
  896. // hash table.
  897. //
  898. PPER_USER_ENTRY PerUserEntry;
  899. //
  900. // The server entry in the hash table.
  901. //
  902. PHASH_SERVER_ENTRY ServerHashEntry;
  903. //
  904. // Is this a PROPFIND or a GET call.
  905. //
  906. DAV_ASYNC_CREATE_STATES AsyncCreateState;
  907. //
  908. // Data Buffer for reads.
  909. //
  910. PCHAR DataBuff;
  911. //
  912. // DWORD for storing the number of bytes read.
  913. //
  914. LPDWORD didRead;
  915. //
  916. // The FileHandle used in writing the file locally.
  917. //
  918. HANDLE FileHandle;
  919. //
  920. // Does the file being created exist on the server ?
  921. //
  922. BOOL doesTheFileExist;
  923. //
  924. // The context pointers used for parsing the XML data.
  925. //
  926. PVOID Context1;
  927. PVOID Context2;
  928. //
  929. // The remaining path name. For example in \\server\share\dir\f.txt
  930. // this would correspond to dir\f.txt.
  931. //
  932. PWCHAR RemPathName;
  933. //
  934. // The file name being created. From the above example, this would
  935. // correspond to f.txt.
  936. //
  937. PWCHAR FileName;
  938. //
  939. // The URL used to create an entry in the WinInet cache.
  940. //
  941. PWCHAR UrlBuffer;
  942. //
  943. // Handle returned by HttpOpen and is used in http send, end etc.
  944. // calls.
  945. //
  946. #ifdef WEBDAV_KERNEL
  947. LPVOID DavOpenHandle;
  948. #else
  949. HINTERNET DavOpenHandle;
  950. #endif
  951. LPVOID lpCEI; // cache entry info
  952. } AsyncCreate;
  953. struct {
  954. //
  955. // The per user entry which hangs of the server entry in the
  956. // hash table.
  957. //
  958. PPER_USER_ENTRY PerUserEntry;
  959. //
  960. // The server entry in the hash table.
  961. //
  962. PHASH_SERVER_ENTRY ServerHashEntry;
  963. } ServerUserEntry;
  964. //
  965. // Async SetFileInformation
  966. //
  967. struct {
  968. //
  969. // The per user entry which hangs of the server entry in the
  970. // hash table.
  971. //
  972. PPER_USER_ENTRY PerUserEntry;
  973. //
  974. // The server entry in the hash table.
  975. //
  976. PHASH_SERVER_ENTRY ServerHashEntry;
  977. //
  978. // The header which is added to the "MOVE" request to be sent to
  979. // the server and contains the destination URI.
  980. //
  981. PWCHAR HeaderBuff;
  982. //
  983. // Handle returned by HttpOpen and is used in http send, end etc.
  984. // calls.
  985. //
  986. #ifdef WEBDAV_KERNEL
  987. LPVOID DavOpenHandle;
  988. #else
  989. HINTERNET DavOpenHandle;
  990. #endif
  991. } AsyncSetFileInformation;
  992. };
  993. //
  994. // The request and response types.
  995. //
  996. struct {
  997. union {
  998. DAV_USERMODE_WORK_REQUEST;
  999. DAV_USERMODE_WORK_REQUEST WorkRequest;
  1000. };
  1001. union {
  1002. DAV_USERMODE_WORK_RESPONSE;
  1003. DAV_USERMODE_WORK_RESPONSE WorkResponse;
  1004. };
  1005. };
  1006. WCHAR UserName[MAX_PATH];
  1007. WCHAR Password[MAX_PATH];
  1008. } DAV_USERMODE_WORKITEM, *PDAV_USERMODE_WORKITEM;
  1009. //
  1010. // The default HTTP/DAV port.
  1011. //
  1012. #define DEFAULT_HTTP_PORT 80
  1013. //
  1014. // The number of bytes to read in a single InternetReadFile call.
  1015. //
  1016. #define NUM_OF_BYTES_TO_READ 4096
  1017. #define EA_NAME_USERNAME "UserName"
  1018. #define EA_NAME_PASSWORD "Password"
  1019. #define EA_NAME_TYPE "Type"
  1020. #define EA_NAME_WEBDAV_SIGNATURE "mrxdav"
  1021. #endif // no __cplusplus
  1022. #endif // _USRMDDAV_H