PageRenderTime 36ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/WinNetLib/Src/LmUse.pas

http://xplib.googlecode.com/
Pascal | 193 lines | 80 code | 28 blank | 85 comment | 0 complexity | 6d2cf5e440b1624621aba6e5b383ff4e MD5 | raw file
Possible License(s): LGPL-2.1
  1. {******************************************************************}
  2. { }
  3. { Borland Delphi Runtime Library }
  4. { LanManager share functions for Windows NT interface unit }
  5. { }
  6. { Portions created by Microsoft are }
  7. { Copyright (C) 1995-1999 Microsoft Corporation. }
  8. { All Rights Reserved. }
  9. { }
  10. { The original file is: lmuse.h, released 24 Nov 1998. }
  11. { The original Pascal code is: LmUse.pas, released 14 Jan 2000. }
  12. { The initial developer of the Pascal code is Petr Vones }
  13. { (petr.v@mujmail.cz). }
  14. { }
  15. { Portions created by Petr Vones are }
  16. { Copyright (C) 2000 Petr Vones }
  17. { }
  18. { Obtained through: }
  19. { }
  20. { Joint Endeavour of Delphi Innovators (Project JEDI) }
  21. { }
  22. { You may retrieve the latest version of this file at the Project }
  23. { JEDI home page, located at http://delphi-jedi.org }
  24. { }
  25. { The contents of this file are used with permission, subject to }
  26. { the Mozilla Public License Version 1.1 (the "License"); you may }
  27. { not use this file except in compliance with the License. You may }
  28. { obtain a copy of the License at }
  29. { http://www.mozilla.org/MPL/MPL-1.1.html }
  30. { }
  31. { Software distributed under the License is distributed on an }
  32. { "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or }
  33. { implied. See the License for the specific language governing }
  34. { rights and limitations under the License. }
  35. { }
  36. {******************************************************************}
  37. unit LmUse;
  38. {$I LANMAN.INC}
  39. {$ALIGN ON}
  40. {$MINENUMSIZE 4}
  41. {$WEAKPACKAGEUNIT}
  42. interface
  43. uses
  44. Windows, LmCons, LmUseflg;
  45. (*$HPPEMIT '#include <netcons.h>'*)
  46. (*$HPPEMIT '#include <lmcons.h>'*)
  47. (*$HPPEMIT '#include <lmuseflg.h>'*)
  48. (*$HPPEMIT '#include <lmuse.h>'*)
  49. function NetUseAdd(UncServerName: LPWSTR; Level: DWORD; Buf: Pointer;
  50. ParmError: PDWORD): NET_API_STATUS; stdcall;
  51. {$EXTERNALSYM NetUseAdd}
  52. function NetUseDel(UncServerName, UseName: LPWSTR; ForceCond: DWORD): NET_API_STATUS; stdcall;
  53. {$EXTERNALSYM NetUseDel}
  54. function NetUseEnum(UncServerName: LPWSTR; Level: DWORD; BufPtr: Pointer;
  55. PreferedMaximumSize: DWORD; var EntriesRead: DWORD; var TotalEntries: DWORD;
  56. ResumeHandle: PDWORD): NET_API_STATUS; stdcall;
  57. {$EXTERNALSYM NetUseEnum}
  58. function NetUseGetInfo(UncServerName: LPWSTR; UseName: LPWSTR; Level: DWORD;
  59. BufPtr: Pointer): NET_API_STATUS; stdcall;
  60. {$EXTERNALSYM NetUseGetInfo}
  61. type
  62. PUseInfo0 = ^TUseInfo0;
  63. _USE_INFO_0 = record
  64. ui0_local: LPWSTR;
  65. ui0_remote: LPWSTR;
  66. end;
  67. {$EXTERNALSYM _USE_INFO_0}
  68. TUseInfo0 = _USE_INFO_0;
  69. USE_INFO_0 = _USE_INFO_0;
  70. {$EXTERNALSYM USE_INFO_0}
  71. PUseInfo1 = ^TUseInfo1;
  72. _USE_INFO_1 = record
  73. ui1_local: LPWSTR;
  74. ui1_remote: LPWSTR;
  75. ui1_password: LPWSTR;
  76. ui1_status: DWORD;
  77. ui1_asg_type: DWORD;
  78. ui1_refcount: DWORD;
  79. ui1_usecount: DWORD;
  80. end;
  81. {$EXTERNALSYM _USE_INFO_1}
  82. TUseInfo1 = _USE_INFO_1;
  83. USE_INFO_1 = _USE_INFO_1;
  84. {$EXTERNALSYM USE_INFO_1}
  85. PUseInfo2 = ^TUseInfo2;
  86. _USE_INFO_2 = record
  87. ui2_local: LPWSTR;
  88. ui2_remote: LPWSTR;
  89. ui2_password: LPWSTR;
  90. ui2_status: DWORD;
  91. ui2_asg_type: DWORD;
  92. ui2_refcount: DWORD;
  93. ui2_usecount: DWORD;
  94. ui2_username: LPWSTR;
  95. ui2_domainname: LPWSTR;
  96. end;
  97. {$EXTERNALSYM _USE_INFO_2}
  98. TUseInfo2 = _USE_INFO_2;
  99. USE_INFO_2 = _USE_INFO_2;
  100. {$EXTERNALSYM USE_INFO_2}
  101. PUseInfo3 = ^TUseInfo3;
  102. _USE_INFO_3 = record
  103. ui3_ui2: USE_INFO_2;
  104. ui3_flags: ULONG;
  105. end;
  106. {$EXTERNALSYM _USE_INFO_3}
  107. TUseInfo3 = _USE_INFO_3;
  108. USE_INFO_3 = _USE_INFO_3;
  109. {$EXTERNALSYM USE_INFO_3}
  110. // One of these values indicates the parameter within an information
  111. // structure that is invalid when ERROR_INVALID_PARAMETER is returned by
  112. // NetUseAdd.
  113. const
  114. USE_LOCAL_PARMNUM = 1;
  115. {$EXTERNALSYM USE_LOCAL_PARMNUM}
  116. USE_REMOTE_PARMNUM = 2;
  117. {$EXTERNALSYM USE_REMOTE_PARMNUM}
  118. USE_PASSWORD_PARMNUM = 3;
  119. {$EXTERNALSYM USE_PASSWORD_PARMNUM}
  120. USE_ASGTYPE_PARMNUM = 4;
  121. {$EXTERNALSYM USE_ASGTYPE_PARMNUM}
  122. USE_USERNAME_PARMNUM = 5;
  123. {$EXTERNALSYM USE_USERNAME_PARMNUM}
  124. USE_DOMAINNAME_PARMNUM = 6;
  125. {$EXTERNALSYM USE_DOMAINNAME_PARMNUM}
  126. // Values appearing in the ui1_status field of use_info_1 structure.
  127. // Note that USE_SESSLOST and USE_DISCONN are synonyms.
  128. USE_OK = 0;
  129. {$EXTERNALSYM USE_OK}
  130. USE_PAUSED = 1;
  131. {$EXTERNALSYM USE_PAUSED}
  132. USE_SESSLOST = 2;
  133. {$EXTERNALSYM USE_SESSLOST}
  134. USE_DISCONN = 2;
  135. {$EXTERNALSYM USE_DISCONN}
  136. USE_NETERR = 3;
  137. {$EXTERNALSYM USE_NETERR}
  138. USE_CONN = 4;
  139. {$EXTERNALSYM USE_CONN}
  140. USE_RECONN = 5;
  141. {$EXTERNALSYM USE_RECONN}
  142. // Values of the ui1_asg_type field of use_info_1 structure
  143. USE_WILDCARD = DWORD(-1);
  144. {$EXTERNALSYM USE_WILDCARD}
  145. USE_DISKDEV = 0;
  146. {$EXTERNALSYM USE_DISKDEV}
  147. USE_SPOOLDEV = 1;
  148. {$EXTERNALSYM USE_SPOOLDEV}
  149. USE_CHARDEV = 2;
  150. {$EXTERNALSYM USE_CHARDEV}
  151. USE_IPC = 3;
  152. {$EXTERNALSYM USE_IPC}
  153. // Flags defined in the use_info_3 structure
  154. CREATE_NO_CONNECT = $1; // creation flags
  155. {$EXTERNALSYM CREATE_NO_CONNECT}
  156. CREATE_BYPASS_CSC = $2; // force connection to server, bypassing CSC
  157. // all ops on this connection go to the server,
  158. // never to the cache
  159. {$EXTERNALSYM CREATE_BYPASS_CSC}
  160. implementation
  161. function NetUseAdd; external netapi32lib name 'NetUseAdd';
  162. function NetUseDel; external netapi32lib name 'NetUseDel';
  163. function NetUseEnum; external netapi32lib name 'NetUseEnum';
  164. function NetUseGetInfo; external netapi32lib name 'NetUseGetInfo';
  165. end.