jwalmremutl.pas 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. {******************************************************************************}
  2. { }
  3. { Lan Manager Remote API interface Unit for Object Pascal }
  4. { }
  5. { Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft }
  6. { Corporation. All Rights Reserved. }
  7. { }
  8. { The original file is: lmremutl.h, released November 2001. The original Pascal}
  9. { code is: LmRemUtl.pas, released Februari 2002. The initial developer of the }
  10. { Pascal code is Marcel van Brakel (brakelm att chello dott nl). }
  11. { }
  12. { Portions created by Marcel van Brakel are Copyright (C) 1999-2001 }
  13. { Marcel van Brakel. All Rights Reserved. }
  14. { }
  15. { Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI) }
  16. { }
  17. { You may retrieve the latest version of this file at the Project JEDI }
  18. { APILIB home page, located at http://jedi-apilib.sourceforge.net }
  19. { }
  20. { The contents of this file are used with permission, subject to the Mozilla }
  21. { Public License Version 1.1 (the "License"); you may not use this file except }
  22. { in compliance with the License. You may obtain a copy of the License at }
  23. { http://www.mozilla.org/MPL/MPL-1.1.html }
  24. { }
  25. { Software distributed under the License is distributed on an "AS IS" basis, }
  26. { WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
  27. { the specific language governing rights and limitations under the License. }
  28. { }
  29. { Alternatively, the contents of this file may be used under the terms of the }
  30. { GNU Lesser General Public License (the "LGPL License"), in which case the }
  31. { provisions of the LGPL License are applicable instead of those above. }
  32. { If you wish to allow use of your version of this file only under the terms }
  33. { of the LGPL License and not to allow others to use your version of this file }
  34. { under the MPL, indicate your decision by deleting the provisions above and }
  35. { replace them with the notice and other provisions required by the LGPL }
  36. { License. If you do not delete the provisions above, a recipient may use }
  37. { your version of this file under either the MPL or the LGPL License. }
  38. { }
  39. { For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
  40. { }
  41. {******************************************************************************}
  42. // $Id: JwaLmRemUtl.pas,v 1.12 2007/09/05 11:58:50 dezipaitor Exp $
  43. {$IFNDEF JWA_OMIT_SECTIONS_LM}
  44. unit JwaLmRemUtl;
  45. {$WEAKPACKAGEUNIT}
  46. {$ENDIF JWA_OMIT_SECTIONS_LM}
  47. {$HPPEMIT ''}
  48. {$HPPEMIT '#include "lmremutl.h"'}
  49. {$HPPEMIT ''}
  50. {$IFNDEF JWA_OMIT_SECTIONS_LM}
  51. {$I jediapilib.inc}
  52. interface
  53. uses
  54. JwaLmCons, JwaWinType;
  55. {$ENDIF JWA_OMIT_SECTIONS_LM}
  56. {$IFNDEF JWA_IMPLEMENTATIONSECTION}
  57. //
  58. // Type Definitions
  59. //
  60. type
  61. {$IFDEF DESC_CHAR_UNICODE}
  62. DESC_CHAR = WCHAR;
  63. {$EXTERNALSYM DESC_CHAR}
  64. {$ELSE}
  65. DESC_CHAR = Char;
  66. {$EXTERNALSYM DESC_CHAR}
  67. {$ENDIF DESC_CHAR_UNICODE}
  68. TDescChar = DESC_CHAR;
  69. LPDESC = ^DESC_CHAR;
  70. {$EXTERNALSYM LPDESC}
  71. PDesc = LPDESC;
  72. //
  73. // Function Prototypes
  74. //
  75. function NetRemoteTOD(UncServerName: LPCWSTR; var BufferPtr: LPBYTE): NET_API_STATUS; stdcall;
  76. {$EXTERNALSYM NetRemoteTOD}
  77. function NetRemoteComputerSupports(UncServerName: LPCWSTR; OptionsWanted: DWORD; OptionsSupported: LPDWORD): NET_API_STATUS; stdcall;
  78. {$EXTERNALSYM NetRemoteComputerSupports}
  79. {$IFDEF SUPPORTS_VARARGS}
  80. // mvb Delphi 6 and up only (because of the varargs)
  81. function RxRemoteApi(ApiNumber: DWORD; UncServerName: LPCWSTR; ParmDescString, DataDesc16, DataDesc32, DataDescSmb,
  82. AuxDesc16, AuxDesc32, AuxDescSmb: LPDESC; Flags: DWORD{, ...}): NET_API_STATUS; cdecl; varargs;
  83. {$EXTERNALSYM RxRemoteApi}
  84. {$ENDIF SUPPORTS_VARARGS}
  85. //
  86. // Data Structures
  87. //
  88. type
  89. _TIME_OF_DAY_INFO = record
  90. tod_elapsedt: DWORD;
  91. tod_msecs: DWORD;
  92. tod_hours: DWORD;
  93. tod_mins: DWORD;
  94. tod_secs: DWORD;
  95. tod_hunds: DWORD;
  96. tod_timezone: LONG;
  97. tod_tinterval: DWORD;
  98. tod_day: DWORD;
  99. tod_month: DWORD;
  100. tod_year: DWORD;
  101. tod_weekday: DWORD;
  102. end;
  103. {$EXTERNALSYM _TIME_OF_DAY_INFO}
  104. TIME_OF_DAY_INFO = _TIME_OF_DAY_INFO;
  105. {$EXTERNALSYM TIME_OF_DAY_INFO}
  106. PTIME_OF_DAY_INFO = ^TIME_OF_DAY_INFO;
  107. {$EXTERNALSYM PTIME_OF_DAY_INFO}
  108. LPTIME_OF_DAY_INFO = ^TIME_OF_DAY_INFO;
  109. {$EXTERNALSYM LPTIME_OF_DAY_INFO}
  110. TTimeOfDayInfo = TIME_OF_DAY_INFO;
  111. PTimeOfDayInfo = PTIME_OF_DAY_INFO;
  112. //
  113. // Special Values and Constants
  114. //
  115. //
  116. // Mask bits for use with NetRemoteComputerSupports:
  117. //
  118. const
  119. SUPPORTS_REMOTE_ADMIN_PROTOCOL = $00000002;
  120. {$EXTERNALSYM SUPPORTS_REMOTE_ADMIN_PROTOCOL}
  121. SUPPORTS_RPC = $00000004;
  122. {$EXTERNALSYM SUPPORTS_RPC}
  123. SUPPORTS_SAM_PROTOCOL = $00000008;
  124. {$EXTERNALSYM SUPPORTS_SAM_PROTOCOL}
  125. SUPPORTS_UNICODE = $00000010;
  126. {$EXTERNALSYM SUPPORTS_UNICODE}
  127. SUPPORTS_LOCAL = $00000020;
  128. {$EXTERNALSYM SUPPORTS_LOCAL}
  129. SUPPORTS_ANY = DWORD($FFFFFFFF);
  130. {$EXTERNALSYM SUPPORTS_ANY}
  131. //
  132. // Flag bits for RxRemoteApi:
  133. //
  134. const
  135. NO_PERMISSION_REQUIRED = $00000001; // set if use NULL session
  136. {$EXTERNALSYM NO_PERMISSION_REQUIRED}
  137. ALLOCATE_RESPONSE = $00000002; // set if RxRemoteApi allocates response buffer
  138. {$EXTERNALSYM ALLOCATE_RESPONSE}
  139. USE_SPECIFIC_TRANSPORT = DWORD($80000000);
  140. {$EXTERNALSYM USE_SPECIFIC_TRANSPORT}
  141. {$ENDIF JWA_IMPLEMENTATIONSECTION}
  142. {$IFNDEF JWA_OMIT_SECTIONS_LM}
  143. implementation
  144. //uses ...
  145. {$ENDIF JWA_OMIT_SECTIONS_LM}
  146. {$IFNDEF JWA_INTERFACESECTION}
  147. // todo cdecl function so no dynamic linking for the time being...
  148. {$IFDEF SUPPORTS_VARARGS}
  149. function RxRemoteApi; external netapi32 name 'RxRemoteApi';
  150. {$ENDIF SUPPORTS_VARARGS}
  151. {$IFDEF DYNAMIC_LINK}
  152. var
  153. _NetRemoteTOD: Pointer;
  154. function NetRemoteTOD;
  155. begin
  156. GetProcedureAddress(_NetRemoteTOD, netapi32, 'NetRemoteTOD');
  157. asm
  158. MOV ESP, EBP
  159. POP EBP
  160. JMP [_NetRemoteTOD]
  161. end;
  162. end;
  163. var
  164. _NetRemoteComputerSupports: Pointer;
  165. function NetRemoteComputerSupports;
  166. begin
  167. GetProcedureAddress(_NetRemoteComputerSupports, netapi32, 'NetRemoteComputerSupports');
  168. asm
  169. MOV ESP, EBP
  170. POP EBP
  171. JMP [_NetRemoteComputerSupports]
  172. end;
  173. end;
  174. {$ELSE}
  175. function NetRemoteTOD; external netapi32 name 'NetRemoteTOD';
  176. function NetRemoteComputerSupports; external netapi32 name 'NetRemoteComputerSupports';
  177. {$ENDIF DYNAMIC_LINK}
  178. {$ENDIF JWA_INTERFACESECTION}
  179. {$IFNDEF JWA_OMIT_SECTIONS_LM}
  180. end.
  181. {$ENDIF JWA_OMIT_SECTIONS_LM}