jwalmmsg.pas 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. {******************************************************************************}
  2. { }
  3. { Lan Manager Messages 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: lmmsg.h, released November 2001. The original Pascal }
  9. { code is: LmMsg.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: JwaLmMsg.pas,v 1.9 2005/09/07 09:54:54 marquardt Exp $
  43. {$IFNDEF JWA_INCLUDEMODE}
  44. unit JwaLmMsg;
  45. {$WEAKPACKAGEUNIT}
  46. {$I jediapilib.inc}
  47. interface
  48. uses
  49. JwaWindows, JwaLmCons;
  50. {$ENDIF !JWA_INCLUDEMODE}
  51. {$IFDEF JWA_INTERFACESECTION}
  52. {$HPPEMIT ''}
  53. {$HPPEMIT '#include "lmmsg.h"'}
  54. {$HPPEMIT ''}
  55. //
  56. // Function Prototypes
  57. //
  58. function NetMessageNameAdd(servername, msgname: LPCWSTR): NET_API_STATUS; stdcall;
  59. {$EXTERNALSYM NetMessageNameAdd}
  60. function NetMessageNameEnum(servername: LPCWSTR; level: DWORD; var bufptr: LPBYTE; prefmaxlen: DWORD; entriesread, totalentries: LPDWORD; resume_handle: LPDWORD): NET_API_STATUS; stdcall;
  61. {$EXTERNALSYM NetMessageNameEnum}
  62. function NetMessageNameGetInfo(servername, msgname: LPCWSTR; level: DWORD; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
  63. {$EXTERNALSYM NetMessageNameGetInfo}
  64. function NetMessageNameDel(servername, msgname: LPCWSTR): NET_API_STATUS; stdcall;
  65. {$EXTERNALSYM NetMessageNameDel}
  66. function NetMessageBufferSend(servername, msgname, fromname: LPCWSTR; buf: LPBYTE; buflen: DWORD): NET_API_STATUS; stdcall;
  67. {$EXTERNALSYM NetMessageBufferSend}
  68. //
  69. // Data Structures
  70. //
  71. type
  72. _MSG_INFO_0 = record
  73. msgi0_name: LPWSTR;
  74. end;
  75. {$EXTERNALSYM _MSG_INFO_0}
  76. MSG_INFO_0 = _MSG_INFO_0;
  77. {$EXTERNALSYM MSG_INFO_0}
  78. PMSG_INFO_0 = ^MSG_INFO_0;
  79. {$EXTERNALSYM PMSG_INFO_0}
  80. LPMSG_INFO_0 = ^MSG_INFO_0;
  81. {$EXTERNALSYM LPMSG_INFO_0}
  82. TMsgInfo0 = MSG_INFO_0;
  83. PMsgInfo0 = PMSG_INFO_0;
  84. _MSG_INFO_1 = record
  85. msgi1_name: LPWSTR;
  86. msgi1_forward_flag: DWORD;
  87. msgi1_forward: LPWSTR;
  88. end;
  89. {$EXTERNALSYM _MSG_INFO_1}
  90. MSG_INFO_1 = _MSG_INFO_1;
  91. {$EXTERNALSYM MSG_INFO_1}
  92. PMSG_INFO_1 = ^MSG_INFO_1;
  93. {$EXTERNALSYM PMSG_INFO_1}
  94. LPMSG_INFO_1 = ^MSG_INFO_1;
  95. {$EXTERNALSYM LPMSG_INFO_1}
  96. TMsgInfo1 = MSG_INFO_1;
  97. PMsgInfo1 = PMSG_INFO_1;
  98. //
  99. // Special Values and Constants
  100. //
  101. //
  102. // Values for msgi1_forward_flag.
  103. //
  104. const
  105. MSGNAME_NOT_FORWARDED = 0; // Name not forwarded
  106. {$EXTERNALSYM MSGNAME_NOT_FORWARDED}
  107. MSGNAME_FORWARDED_TO = $04; // Name forward to remote station
  108. {$EXTERNALSYM MSGNAME_FORWARDED_TO}
  109. MSGNAME_FORWARDED_FROM = $10; // Name forwarded from remote station
  110. {$EXTERNALSYM MSGNAME_FORWARDED_FROM}
  111. {$ENDIF JWA_INTERFACESECTION}
  112. {$IFNDEF JWA_INCLUDEMODE}
  113. implementation
  114. uses
  115. JwaWinDLLNames;
  116. {$ENDIF !JWA_INCLUDEMODE}
  117. {$IFDEF JWA_IMPLEMENTATIONSECTION}
  118. {$IFDEF DYNAMIC_LINK}
  119. var
  120. _NetMessageNameAdd: Pointer;
  121. function NetMessageNameAdd;
  122. begin
  123. GetProcedureAddress(_NetMessageNameAdd, netapi32, 'NetMessageNameAdd');
  124. asm
  125. MOV ESP, EBP
  126. POP EBP
  127. JMP [_NetMessageNameAdd]
  128. end;
  129. end;
  130. var
  131. _NetMessageNameEnum: Pointer;
  132. function NetMessageNameEnum;
  133. begin
  134. GetProcedureAddress(_NetMessageNameEnum, netapi32, 'NetMessageNameEnum');
  135. asm
  136. MOV ESP, EBP
  137. POP EBP
  138. JMP [_NetMessageNameEnum]
  139. end;
  140. end;
  141. var
  142. _NetMessageNameGetInfo: Pointer;
  143. function NetMessageNameGetInfo;
  144. begin
  145. GetProcedureAddress(_NetMessageNameGetInfo, netapi32, 'NetMessageNameGetInfo');
  146. asm
  147. MOV ESP, EBP
  148. POP EBP
  149. JMP [_NetMessageNameGetInfo]
  150. end;
  151. end;
  152. var
  153. _NetMessageNameDel: Pointer;
  154. function NetMessageNameDel;
  155. begin
  156. GetProcedureAddress(_NetMessageNameDel, netapi32, 'NetMessageNameDel');
  157. asm
  158. MOV ESP, EBP
  159. POP EBP
  160. JMP [_NetMessageNameDel]
  161. end;
  162. end;
  163. var
  164. _NetMessageBufferSend: Pointer;
  165. function NetMessageBufferSend;
  166. begin
  167. GetProcedureAddress(_NetMessageBufferSend, netapi32, 'NetMessageBufferSend');
  168. asm
  169. MOV ESP, EBP
  170. POP EBP
  171. JMP [_NetMessageBufferSend]
  172. end;
  173. end;
  174. {$ELSE}
  175. function NetMessageNameAdd; external netapi32 name 'NetMessageNameAdd';
  176. function NetMessageNameEnum; external netapi32 name 'NetMessageNameEnum';
  177. function NetMessageNameGetInfo; external netapi32 name 'NetMessageNameGetInfo';
  178. function NetMessageNameDel; external netapi32 name 'NetMessageNameDel';
  179. function NetMessageBufferSend; external netapi32 name 'NetMessageBufferSend';
  180. {$ENDIF DYNAMIC_LINK}
  181. {$ENDIF JWA_IMPLEMENTATIONSECTION}
  182. {$IFNDEF JWA_INCLUDEMODE}
  183. end.
  184. {$ENDIF !JWA_INCLUDEMODE}