1 {******************************************************************************}
2 {                                                                              }
3 { Lan Manager Buffer 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: lmapibuf.h, released November 2001. The original       }
9 { Pascal code is: LmApiBuf.pas, released Februari 2002. The initial developer  }
10 { of the 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 
43 // $Id: JwaLmApiBuf.pas,v 1.11 2007/09/05 11:58:50 dezipaitor Exp $
44 
45 {$IFNDEF JWA_OMIT_SECTIONS_LM}
46 unit JwaLmApiBuf;
47 
48 {$WEAKPACKAGEUNIT}
49 {$ENDIF JWA_OMIT_SECTIONS_LM}
50 
51 {$HPPEMIT ''}
52 {$HPPEMIT '#include "lmapibuf.h"'}
53 {$HPPEMIT ''}
54 
55 {$IFNDEF JWA_OMIT_SECTIONS_LM}
56 {$I jediapilib.inc}
57 
58 interface
59 
60 uses
61   JwaLmCons, JwaWinType;
62 {$ENDIF JWA_OMIT_SECTIONS_LM}
63 
64 {$IFNDEF JWA_IMPLEMENTATIONSECTION}
65 //
Prototypesnull66 // Function Prototypes
67 //
68 
69 function NetApiBufferAllocate(ByteCount: DWORD; var Buffer: LPVOID): NET_API_STATUS; stdcall;
70 {$EXTERNALSYM NetApiBufferAllocate}
NetApiBufferFreenull71 function NetApiBufferFree(Buffer: LPVOID): NET_API_STATUS; stdcall;
72 {$EXTERNALSYM NetApiBufferFree}
NetApiBufferReallocatenull73 function NetApiBufferReallocate(OldBuffer: LPVOID; NewByteCount: DWORD; var NewBuffer: LPVOID): NET_API_STATUS; stdcall;
74 {$EXTERNALSYM NetApiBufferReallocate}
NetApiBufferSizenull75 function NetApiBufferSize(Buffer: LPVOID; var ByteCount: DWORD): NET_API_STATUS; stdcall;
76 {$EXTERNALSYM NetApiBufferSize}
77 
78 //
willnull79 // The following private function will go away eventually.
80 // Call NetApiBufferAllocate instead.
81 //
82 
83 function NetapipBufferAllocate(ByteCount: DWORD; var Buffer: LPVOID): NET_API_STATUS; stdcall;
84 {$EXTERNALSYM NetapipBufferAllocate}
85 
86 {$ENDIF JWA_IMPLEMENTATIONSECTION}
87 
88 {$IFNDEF JWA_OMIT_SECTIONS_LM}
89 implementation
90 //uses ...
91 {$ENDIF JWA_OMIT_SECTIONS_LM}
92 
93 {$IFNDEF JWA_INTERFACESECTION}
94 
95 {$IFDEF DYNAMIC_LINK}
96 
97 var
98   _NetApiBufferAllocate: Pointer;
99 
NetApiBufferAllocatenull100 function NetApiBufferAllocate;
101 begin
102   GetProcedureAddress(_NetApiBufferAllocate, netapi32, 'NetApiBufferAllocate');
103   asm
104         MOV     ESP, EBP
105         POP     EBP
106         JMP     [_NetApiBufferAllocate]
107   end;
108 end;
109 
110 var
111   _NetApiBufferFree: Pointer;
112 
NetApiBufferFreenull113 function NetApiBufferFree;
114 begin
115   GetProcedureAddress(_NetApiBufferFree, netapi32, 'NetApiBufferFree');
116   asm
117         MOV     ESP, EBP
118         POP     EBP
119         JMP     [_NetApiBufferFree]
120   end;
121 end;
122 
123 var
124   _NetApiBufferReallocate: Pointer;
125 
NetApiBufferReallocatenull126 function NetApiBufferReallocate;
127 begin
128   GetProcedureAddress(_NetApiBufferReallocate, netapi32, 'NetApiBufferReallocate');
129   asm
130         MOV     ESP, EBP
131         POP     EBP
132         JMP     [_NetApiBufferReallocate]
133   end;
134 end;
135 
136 var
137   _NetApiBufferSize: Pointer;
138 
NetApiBufferSizenull139 function NetApiBufferSize;
140 begin
141   GetProcedureAddress(_NetApiBufferSize, netapi32, 'NetApiBufferSize');
142   asm
143         MOV     ESP, EBP
144         POP     EBP
145         JMP     [_NetApiBufferSize]
146   end;
147 end;
148 
149 var
150   _NetapipBufferAllocate: Pointer;
151 
NetapipBufferAllocatenull152 function NetapipBufferAllocate;
153 begin
154   GetProcedureAddress(_NetapipBufferAllocate, netapi32, 'NetapipBufferAllocate');
155   asm
156         MOV     ESP, EBP
157         POP     EBP
158         JMP     [_NetapipBufferAllocate]
159   end;
160 end;
161 
162 {$ELSE}
163 
NetApiBufferAllocatenull164 function NetApiBufferAllocate; external netapi32 name 'NetApiBufferAllocate';
NetApiBufferFreenull165 function NetApiBufferFree; external netapi32 name 'NetApiBufferFree';
NetApiBufferReallocatenull166 function NetApiBufferReallocate; external netapi32 name 'NetApiBufferReallocate';
NetApiBufferSizenull167 function NetApiBufferSize; external netapi32 name 'NetApiBufferSize';
NetapipBufferAllocatenull168 function NetapipBufferAllocate; external netapi32 name 'NetapipBufferAllocate';
169 
170 {$ENDIF DYNAMIC_LINK}
171 
172 {$ENDIF JWA_INTERFACESECTION}
173 
174 {$IFNDEF JWA_OMIT_SECTIONS_LM}
175 end.
176 {$ENDIF JWA_OMIT_SECTIONS_LM}
177