1 {******************************************************************************}
2 {                                                                              }
3 { 32 bit Generic Thunks 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: wownt32.h, released June 2000. The original Pascal     }
9 { code is: WowNT32.pas, released December 2000. 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 
43 // $Id: JwaWowNT32.pas,v 1.9 2007/09/05 11:58:54 dezipaitor Exp $
44 
45 {$IFNDEF JWA_OMIT_SECTIONS}
46 unit JwaWowNT32;
47 
48 {$WEAKPACKAGEUNIT}
49 {$ENDIF JWA_OMIT_SECTIONS}
50 
51 {$HPPEMIT ''}
52 {$HPPEMIT '#include "wownt32.h"'}
53 {$HPPEMIT ''}
54 
55 {$IFNDEF JWA_OMIT_SECTIONS}
56 {$I jediapilib.inc}
57 
58 interface
59 
60 uses
61   JwaWinType;
62 {$ENDIF JWA_OMIT_SECTIONS}
63 
64 {$IFNDEF JWA_IMPLEMENTATIONSECTION}
65 
66 //
67 // 16:16 -> 0:32 Pointer translation.
68 //
69 // WOWGetVDMPointer will convert the passed in 16-bit address
70 // to the equivalent 32-bit flat pointer.  If fProtectedMode
treatsnull71 // is TRUE, the function treats the upper 16 bits as a selector
72 // in the local descriptor table.  If fProtectedMode is FALSE,
73 // the upper 16 bits are treated as a real-mode segment value.
74 // In either case the lower 16 bits are treated as the offset.
75 //
76 // The return value is NULL if the selector is invalid.
77 //
78 // NOTE:  Limit checking is not performed in the retail build
79 // of Windows NT.  It is performed in the checked (debug) build
80 // of WOW32.DLL, which will cause NULL to be returned when the
81 // limit is exceeded by the supplied offset.
82 //
83 
84 function WOWGetVDMPointer(vp, dwBytes: DWORD; fProtectedMode: BOOL): LPVOID; stdcall;
85 {$EXTERNALSYM WOWGetVDMPointer}
86 
87 //
88 // The following two functions are here for compatibility with
89 // Windows 95.  On Win95, the global heap can be rearranged,
90 // invalidating flat pointers returned by WOWGetVDMPointer, while
91 // a thunk is executing.  On Windows NT, the 16-bit VDM is completely
92 // halted while a thunk executes, so the only way the heap will
93 // be rearranged is if a callback is made to Win16 code.
94 //
95 // The Win95 versions of these functions call GlobalFix to
96 // lock down a segment's flat address, and GlobalUnfix to
97 // release the segment.
98 //
99 // The Windows NT implementations of these functions do *not*
100 // call GlobalFix/GlobalUnfix on the segment, because there
101 // will not be any heap motion unless a callback occurs.
102 // If your thunk does callback to the 16-bit side, be sure
103 // to discard flat pointers and call WOWGetVDMPointer again
104 // to be sure the flat address is correct.
105 //
106 
107 function WOWGetVDMPointerFix(vp, dwBytes: DWORD; fProtectedMode: BOOL): LPVOID; stdcall;
108 {$EXTERNALSYM WOWGetVDMPointerFix}
109 procedure WOWGetVDMPointerUnfix(vp: DWORD); stdcall;
110 {$EXTERNALSYM WOWGetVDMPointerUnfix}
111 
112 //
113 // Win16 memory management.
114 //
115 // These functions can be used to manage memory in the Win16
116 // heap.  The following four functions are identical to their
117 // Win16 counterparts, except that they are called from Win32
118 // code.
119 //
120 
121 function WOWGlobalAlloc16(wFlags: WORD; cb: DWORD): WORD; stdcall;
122 {$EXTERNALSYM WOWGlobalAlloc16}
123 function WOWGlobalFree16(hMem: WORD): WORD; stdcall;
124 {$EXTERNALSYM WOWGlobalFree16}
125 function WOWGlobalLock16(hMem: WORD): DWORD; stdcall;
126 {$EXTERNALSYM WOWGlobalLock16}
127 function WOWGlobalUnlock16(hMem: WORD): BOOL; stdcall;
128 {$EXTERNALSYM WOWGlobalUnlock16}
129 
130 //
131 // The following three functions combine two common operations in
132 // one switch to 16-bit mode.
133 //
134 
135 function WOWGlobalAllocLock16(wFlags: WORD; cb: DWORD; var phMem: WORD): DWORD; stdcall;
136 {$EXTERNALSYM WOWGlobalAllocLock16}
137 function WOWGlobalUnlockFree16(vpMem: DWORD): WORD; stdcall;
138 {$EXTERNALSYM WOWGlobalUnlockFree16}
139 function WOWGlobalLockSize16(hMem: WORD; pcb: PDWORD): DWORD; stdcall;
140 {$EXTERNALSYM WOWGlobalLockSize16}
141 
142 //
143 // Yielding the Win16 nonpreemptive scheduler
144 //
145 // The following two functions are provided for Win32 code called
146 // via Generic Thunks which needs to yield the Win16 scheduler so
147 // that tasks in that VDM can execute while the thunk waits for
148 // something to complete.  These two functions are functionally
149 // identical to calling back to 16-bit code which calls Yield or
150 // DirectedYield.
151 //
152 
153 procedure WOWYield16; stdcall;
154 {$EXTERNALSYM WOWYield16}
155 procedure WOWDirectedYield16(htask16: WORD); stdcall;
156 {$EXTERNALSYM WOWDirectedYield16}
157 
158 //
159 // 16 <--> 32 Handle mapping functions.
160 //
161 // NOTE:  While some of these functions perform trivial
162 // conversions, these functions must be used to maintain
163 // compatibility with future versions of Windows NT which
164 // may require different handle mapping.
165 //
166 
167 type
168   _WOW_HANDLE_TYPE = (
169     WOW_TYPE_HWND,
170     WOW_TYPE_HMENU,
171     WOW_TYPE_HDWP,
172     WOW_TYPE_HDROP,
173     WOW_TYPE_HDC,
174     WOW_TYPE_HFONT,
175     WOW_TYPE_HMETAFILE,
176     WOW_TYPE_HRGN,
177     WOW_TYPE_HBITMAP,
178     WOW_TYPE_HBRUSH,
179     WOW_TYPE_HPALETTE,
180     WOW_TYPE_HPEN,
181     WOW_TYPE_HACCEL,
182     WOW_TYPE_HTASK,
183     WOW_TYPE_FULLHWND);
184   {$EXTERNALSYM _WOW_HANDLE_TYPE}
185   WOW_HANDLE_TYPE = _WOW_HANDLE_TYPE;
186   {$EXTERNALSYM WOW_HANDLE_TYPE}
187   TWowHandleType = WOW_HANDLE_TYPE;
188 
189 function WOWHandle32(Handle: WORD; Type_: WOW_HANDLE_TYPE): HANDLE; stdcall;
190 {$EXTERNALSYM WOWHandle32}
191 function WOWHandle16(Handle: HANDLE; Type_: WOW_HANDLE_TYPE): WORD; stdcall;
192 {$EXTERNALSYM WOWHandle16}
193 
194 function HWND_32(h16: WORD): HANDLE;
195 {$EXTERNALSYM HWND_32}
196 function HMENU_32(h16: WORD): HANDLE;
197 {$EXTERNALSYM HMENU_32}
198 function HDWP_32(h16: WORD): HANDLE;
199 {$EXTERNALSYM HDWP_32}
200 function HDROP_32(h16: WORD): HANDLE;
201 {$EXTERNALSYM HDROP_32}
202 function HDC_32(h16: WORD): HANDLE;
203 {$EXTERNALSYM HDC_32}
204 function HFONT_32(h16: WORD): HANDLE;
205 {$EXTERNALSYM HFONT_32}
206 function HMETAFILE_32(h16: WORD): HANDLE;
207 {$EXTERNALSYM HMETAFILE_32}
208 function HRGN_32(h16: WORD): HANDLE;
209 {$EXTERNALSYM HRGN_32}
210 function HBITMAP_32(h16: WORD): HANDLE;
211 {$EXTERNALSYM HBITMAP_32}
212 function HBRUSH_32(h16: WORD): HANDLE;
213 {$EXTERNALSYM HBRUSH_32}
214 function HPALETTE_32(h16: WORD): HANDLE;
215 {$EXTERNALSYM HPALETTE_32}
216 function HPEN_32(h16: WORD): HANDLE;
217 {$EXTERNALSYM HPEN_32}
218 function HACCEL_32(h16: WORD): HANDLE;
219 {$EXTERNALSYM HACCEL_32}
220 function HTASK_32(h16: WORD): HANDLE;
221 {$EXTERNALSYM HTASK_32}
222 function FULLHWND_32(h16: WORD): HANDLE;
223 {$EXTERNALSYM FULLHWND_32}
224 function HWND_16(h32: HANDLE): WORD;
225 {$EXTERNALSYM HWND_16}
226 function HMENU_16(h32: HANDLE): WORD;
227 {$EXTERNALSYM HMENU_16}
228 function HDWP_16(h32: HANDLE): WORD;
229 {$EXTERNALSYM HDWP_16}
230 function HDROP_16(h32: HANDLE): WORD;
231 {$EXTERNALSYM HDROP_16}
232 function HDC_16(h32: HANDLE): WORD;
233 {$EXTERNALSYM HDC_16}
234 function HFONT_16(h32: HANDLE): WORD;
235 {$EXTERNALSYM HFONT_16}
236 function HMETAFILE_16(h32: HANDLE): WORD;
237 {$EXTERNALSYM HMETAFILE_16}
238 function HRGN_16(h32: HANDLE): WORD;
239 {$EXTERNALSYM HRGN_16}
240 function HBITMAP_16(h32: HANDLE): WORD;
241 {$EXTERNALSYM HBITMAP_16}
242 function HBRUSH_16(h32: HANDLE): WORD;
243 {$EXTERNALSYM HBRUSH_16}
244 function HPALETTE_16(h32: HANDLE): WORD;
245 {$EXTERNALSYM HPALETTE_16}
246 function HPEN_16(h32: HANDLE): WORD;
247 {$EXTERNALSYM HPEN_16}
248 function HACCEL_16(h32: HANDLE): WORD;
249 {$EXTERNALSYM HACCEL_16}
250 function HTASK_16(h32: HANDLE): WORD;
251 {$EXTERNALSYM HTASK_16}
252 
253 //
254 // Generic Callbacks.
255 //
256 // WOWCallback16 can be used in Win32 code called
257 // from 16-bit (such as by using Generic Thunks) to call back to
258 // the 16-bit side.  The function called must be declared similarly
259 // to the following:
260 //
261 // LONG FAR PASCAL CallbackRoutine(DWORD dwParam);
262 //
263 // If you are passing a pointer, declare the parameter as such:
264 //
265 // LONG FAR PASCAL CallbackRoutine(VOID FAR *vp);
266 //
267 // NOTE: If you are passing a pointer, you'll need to get the
268 // pointer using WOWGlobalAlloc16 or WOWGlobalAllocLock16
269 //
270 // If the function called returns a WORD instead of a DWORD, the
271 // upper 16 bits of the return value is undefined.  Similarly, if
272 // the function called has no return value, the entire return value
273 // is undefined.
274 //
275 // WOWCallback16Ex allows any combination of arguments up to
276 // WCB16_MAX_CBARGS bytes total to be passed to the 16-bit routine.
277 // cbArgs is used to properly clean up the 16-bit stack after calling
278 // the routine.  Regardless of the value of cbArgs, WCB16_MAX_CBARGS
279 // bytes will always be copied from pArgs to the 16-bit stack.  If
280 // pArgs is less than WCB16_MAX_CBARGS bytes from the end of a page,
281 // and the next page is inaccessible, WOWCallback16Ex will incur an
282 // access violation.
283 //
284 // If cbArgs is larger than the WCB16_MAX_ARGS which the running
285 // system supports, the function returns FALSE and GetLastError
286 // returns ERROR_INVALID_PARAMETER.  Otherwise the function
287 // returns TRUE and the DWORD pointed to by pdwRetCode contains
288 // the return code from the callback routine.  If the callback
289 // routine returns a WORD, the HIWORD of the return code is
290 // undefined and should be ignored using LOWORD(dwRetCode).
291 //
292 // WOWCallback16Ex can call routines using the PASCAL and CDECL
293 // calling conventions.  The default is to use the PASCAL
294 // calling convention.  To use CDECL, pass WCB16_CDECL in the
295 // dwFlags parameter.
296 //
297 // The arguments pointed to by pArgs must be in the correct
298 // order for the callback routine's calling convention.
299 // To call the PASCAL routine SetWindowText,
300 //
301 // LONG FAR PASCAL SetWindowText(HWND hwnd, LPCSTR lpsz);
302 //
303 // pArgs would point to an array of words:
304 //
305 // WORD SetWindowTextArgs[] = {OFFSETOF(lpsz), SELECTOROF(lpsz), hwnd};
306 //
307 // In other words, the arguments are placed in the array in reverse
308 // order with the least significant word first for DWORDs and offset
309 // first for FAR pointers.
310 //
311 // To call the CDECL routine wsprintf, for example
312 //
313 // LPSTR lpszFormat = "%d %s";
314 // int _cdecl wsprintf(lpsz, lpszFormat, nValue. lpszString);
315 //
316 // pArgs would point to the array:
317 //
318 // WORD wsprintfArgs[] = {OFFSETOF(lpsz), SELECTOROF(lpsz),
319 //                        OFFSETOF(lpszFormat), SELECTOROF(lpszFormat),
320 //                        nValue,
321 //                        OFFSETOF(lpszString), SELECTOROF(lpszString)};
322 //
323 // In other words, the arguments are placed in the array in the order
324 // listed in the function prototype with the least significant word
325 // first for DWORDs and offset first for FAR pointers.
326 //
327 
328 function WOWCallback16(vpfn16: DWORD; dwParam: DWORD): DWORD; stdcall;
329 {$EXTERNALSYM WOWCallback16}
330 
331 const
332   WCB16_MAX_CBARGS = 16;
333   {$EXTERNALSYM WCB16_MAX_CBARGS}
334 
335   WCB16_PASCAL     = $0;
336   {$EXTERNALSYM WCB16_PASCAL}
337   WCB16_CDECL      = $1;
338   {$EXTERNALSYM WCB16_CDECL}
339 
340 function WOWCallback16Ex(vpfn16, dwFlags, cbArgs: DWORD; pArgs: PVOID; pdwRetCode: PDWORD): BOOL; stdcall;
341 {$EXTERNALSYM WOWCallback16Ex}
342 
343 {$ENDIF JWA_IMPLEMENTATIONSECTION}
344 
345 {$IFNDEF JWA_OMIT_SECTIONS}
346 implementation
347 //uses ...
348 {$ENDIF JWA_OMIT_SECTIONS}
349 
350 {$IFNDEF JWA_INTERFACESECTION}
351 
352 {$IFNDEF JWA_INCLUDEMODE}
353 const
354   wow32lib = 'wow32.dll';
355 {$ENDIF JWA_INCLUDEMODE}
356 
357 function HWND_32(h16: WORD): HANDLE;
358 begin
359   Result := WOWHandle32(h16, WOW_TYPE_HWND);
360 end;
361 
362 function HMENU_32(h16: WORD): HANDLE;
363 begin
364   Result := WOWHandle32(h16, WOW_TYPE_HMENU);
365 end;
366 
367 function HDWP_32(h16: WORD): HANDLE;
368 begin
369   Result := WOWHandle32(h16, WOW_TYPE_HDWP);
370 end;
371 
372 function HDROP_32(h16: WORD): HANDLE;
373 begin
374   Result := WOWHandle32(h16, WOW_TYPE_HDROP);
375 end;
376 
377 function HDC_32(h16: WORD): HANDLE;
378 begin
379   Result := WOWHandle32(h16, WOW_TYPE_HDC);
380 end;
381 
382 function HFONT_32(h16: WORD): HANDLE;
383 begin
384   Result := WOWHandle32(h16, WOW_TYPE_HFONT);
385 end;
386 
387 function HMETAFILE_32(h16: WORD): HANDLE;
388 begin
389   Result := WOWHandle32(h16, WOW_TYPE_HMETAFILE);
390 end;
391 
392 function HRGN_32(h16: WORD): HANDLE;
393 begin
394   Result := WOWHandle32(h16, WOW_TYPE_HRGN);
395 end;
396 
397 function HBITMAP_32(h16: WORD): HANDLE;
398 begin
399   Result := WOWHandle32(h16, WOW_TYPE_HBITMAP);
400 end;
401 
402 function HBRUSH_32(h16: WORD): HANDLE;
403 begin
404   Result := WOWHandle32(h16, WOW_TYPE_HBRUSH);
405 end;
406 
407 function HPALETTE_32(h16: WORD): HANDLE;
408 begin
409   Result := WOWHandle32(h16, WOW_TYPE_HPALETTE);
410 end;
411 
412 function HPEN_32(h16: WORD): HANDLE;
413 begin
414   Result := WOWHandle32(h16, WOW_TYPE_HPEN);
415 end;
416 
417 function HACCEL_32(h16: WORD): HANDLE;
418 begin
419   Result := WOWHandle32(h16, WOW_TYPE_HACCEL);
420 end;
421 
422 function HTASK_32(h16: WORD): HANDLE;
423 begin
424   Result := WOWHandle32(h16, WOW_TYPE_HTASK);
425 end;
426 
427 function FULLHWND_32(h16: WORD): HANDLE;
428 begin
429   Result := WOWHandle32(h16, WOW_TYPE_FULLHWND);
430 end;
431 
432 function HWND_16(h32: HANDLE): WORD;
433 begin
434   Result := WOWHandle16(h32, WOW_TYPE_HWND);
435 end;
436 
437 function HMENU_16(h32: HANDLE): WORD;
438 begin
439   Result := WOWHandle16(h32, WOW_TYPE_HMENU);
440 end;
441 
442 function HDWP_16(h32: HANDLE): WORD;
443 begin
444   Result := WOWHandle16(h32, WOW_TYPE_HDWP);
445 end;
446 
447 function HDROP_16(h32: HANDLE): WORD;
448 begin
449   Result := WOWHandle16(h32, WOW_TYPE_HDROP);
450 end;
451 
452 function HDC_16(h32: HANDLE): WORD;
453 begin
454   Result := WOWHandle16(h32, WOW_TYPE_HDC);
455 end;
456 
457 function HFONT_16(h32: HANDLE): WORD;
458 begin
459   Result := WOWHandle16(h32, WOW_TYPE_HFONT);
460 end;
461 
462 function HMETAFILE_16(h32: HANDLE): WORD;
463 begin
464   Result := WOWHandle16(h32, WOW_TYPE_HMETAFILE);
465 end;
466 
467 function HRGN_16(h32: HANDLE): WORD;
468 begin
469   Result := WOWHandle16(h32, WOW_TYPE_HRGN);
470 end;
471 
472 function HBITMAP_16(h32: HANDLE): WORD;
473 begin
474   Result := WOWHandle16(h32, WOW_TYPE_HBITMAP);
475 end;
476 
477 function HBRUSH_16(h32: HANDLE): WORD;
478 begin
479   Result := WOWHandle16(h32, WOW_TYPE_HBRUSH);
480 end;
481 
482 function HPALETTE_16(h32: HANDLE): WORD;
483 begin
484   Result := WOWHandle16(h32, WOW_TYPE_HPALETTE);
485 end;
486 
487 function HPEN_16(h32: HANDLE): WORD;
488 begin
489   Result := WOWHandle16(h32, WOW_TYPE_HPEN);
490 end;
491 
492 function HACCEL_16(h32: HANDLE): WORD;
493 begin
494   Result := WOWHandle16(h32, WOW_TYPE_HACCEL);
495 end;
496 
497 function HTASK_16(h32: HANDLE): WORD;
498 begin
499   Result := WOWHandle16(h32, WOW_TYPE_HTASK);
500 end;
501 
502 {$IFDEF DYNAMIC_LINK}
503 
504 var
505   _WOWGetVDMPointer: Pointer;
506 
507 function WOWGetVDMPointer;
508 begin
509   GetProcedureAddress(_WOWGetVDMPointer, wow32lib, 'WOWGetVDMPointer');
510   asm
511         MOV     ESP, EBP
512         POP     EBP
513         JMP     [_WOWGetVDMPointer]
514   end;
515 end;
516 
517 var
518   _WOWGetVDMPointerFix: Pointer;
519 
520 function WOWGetVDMPointerFix;
521 begin
522   GetProcedureAddress(_WOWGetVDMPointerFix, wow32lib, 'WOWGetVDMPointerFix');
523   asm
524         MOV     ESP, EBP
525         POP     EBP
526         JMP     [_WOWGetVDMPointerFix]
527   end;
528 end;
529 
530 var
531   _WOWGetVDMPointerUnfix: Pointer;
532 
533 procedure WOWGetVDMPointerUnfix;
534 begin
535   GetProcedureAddress(_WOWGetVDMPointerUnfix, wow32lib, 'WOWGetVDMPointerUnfix');
536   asm
537         MOV     ESP, EBP
538         POP     EBP
539         JMP     [_WOWGetVDMPointerUnfix]
540   end;
541 end;
542 
543 var
544   _WOWGlobalAlloc16: Pointer;
545 
546 function WOWGlobalAlloc16;
547 begin
548   GetProcedureAddress(_WOWGlobalAlloc16, wow32lib, 'WOWGlobalAlloc16');
549   asm
550         MOV     ESP, EBP
551         POP     EBP
552         JMP     [_WOWGlobalAlloc16]
553   end;
554 end;
555 
556 var
557   _WOWGlobalFree16: Pointer;
558 
559 function WOWGlobalFree16;
560 begin
561   GetProcedureAddress(_WOWGlobalFree16, wow32lib, 'WOWGlobalFree16');
562   asm
563         MOV     ESP, EBP
564         POP     EBP
565         JMP     [_WOWGlobalFree16]
566   end;
567 end;
568 
569 var
570   _WOWGlobalLock16: Pointer;
571 
572 function WOWGlobalLock16;
573 begin
574   GetProcedureAddress(_WOWGlobalLock16, wow32lib, 'WOWGlobalLock16');
575   asm
576         MOV     ESP, EBP
577         POP     EBP
578         JMP     [_WOWGlobalLock16]
579   end;
580 end;
581 
582 var
583   _WOWGlobalUnlock16: Pointer;
584 
585 function WOWGlobalUnlock16;
586 begin
587   GetProcedureAddress(_WOWGlobalUnlock16, wow32lib, 'WOWGlobalUnlock16');
588   asm
589         MOV     ESP, EBP
590         POP     EBP
591         JMP     [_WOWGlobalUnlock16]
592   end;
593 end;
594 
595 var
596   _WOWGlobalAllocLock16: Pointer;
597 
598 function WOWGlobalAllocLock16;
599 begin
600   GetProcedureAddress(_WOWGlobalAllocLock16, wow32lib, 'WOWGlobalAllocLock16');
601   asm
602         MOV     ESP, EBP
603         POP     EBP
604         JMP     [_WOWGlobalAllocLock16]
605   end;
606 end;
607 
608 var
609   _WOWGlobalUnlockFree16: Pointer;
610 
611 function WOWGlobalUnlockFree16;
612 begin
613   GetProcedureAddress(_WOWGlobalUnlockFree16, wow32lib, 'WOWGlobalUnlockFree16');
614   asm
615         MOV     ESP, EBP
616         POP     EBP
617         JMP     [_WOWGlobalUnlockFree16]
618   end;
619 end;
620 
621 var
622   _WOWGlobalLockSize16: Pointer;
623 
624 function WOWGlobalLockSize16;
625 begin
626   GetProcedureAddress(_WOWGlobalLockSize16, wow32lib, 'WOWGlobalLockSize16');
627   asm
628         MOV     ESP, EBP
629         POP     EBP
630         JMP     [_WOWGlobalLockSize16]
631   end;
632 end;
633 
634 var
635   _WOWYield16: Pointer;
636 
637 procedure WOWYield16;
638 begin
639   GetProcedureAddress(_WOWYield16, wow32lib, 'WOWYield16');
640   asm
641         MOV     ESP, EBP
642         POP     EBP
643         JMP     [_WOWYield16]
644   end;
645 end;
646 
647 var
648   _WOWDirectedYield16: Pointer;
649 
650 procedure WOWDirectedYield16;
651 begin
652   GetProcedureAddress(_WOWDirectedYield16, wow32lib, 'WOWDirectedYield16');
653   asm
654         MOV     ESP, EBP
655         POP     EBP
656         JMP     [_WOWDirectedYield16]
657   end;
658 end;
659 
660 var
661   _WOWHandle32: Pointer;
662 
663 function WOWHandle32;
664 begin
665   GetProcedureAddress(_WOWHandle32, wow32lib, 'WOWHandle32');
666   asm
667         MOV     ESP, EBP
668         POP     EBP
669         JMP     [_WOWHandle32]
670   end;
671 end;
672 
673 var
674   _WOWHandle16: Pointer;
675 
676 function WOWHandle16;
677 begin
678   GetProcedureAddress(_WOWHandle16, wow32lib, 'WOWHandle16');
679   asm
680         MOV     ESP, EBP
681         POP     EBP
682         JMP     [_WOWHandle16]
683   end;
684 end;
685 
686 var
687   _WOWCallback16: Pointer;
688 
689 function WOWCallback16;
690 begin
691   GetProcedureAddress(_WOWCallback16, wow32lib, 'WOWCallback16');
692   asm
693         MOV     ESP, EBP
694         POP     EBP
695         JMP     [_WOWCallback16]
696   end;
697 end;
698 
699 var
700   _WOWCallback16Ex: Pointer;
701 
702 function WOWCallback16Ex;
703 begin
704   GetProcedureAddress(_WOWCallback16Ex, wow32lib, 'WOWCallback16Ex');
705   asm
706         MOV     ESP, EBP
707         POP     EBP
708         JMP     [_WOWCallback16Ex]
709   end;
710 end;
711 
712 {$ELSE}
713 
714 function WOWGetVDMPointer; external wow32lib name 'WOWGetVDMPointer';
715 function WOWGetVDMPointerFix; external wow32lib name 'WOWGetVDMPointerFix';
716 procedure WOWGetVDMPointerUnfix; external wow32lib name 'WOWGetVDMPointerUnfix';
717 function WOWGlobalAlloc16; external wow32lib name 'WOWGlobalAlloc16';
718 function WOWGlobalFree16; external wow32lib name 'WOWGlobalFree16';
719 function WOWGlobalLock16; external wow32lib name 'WOWGlobalLock16';
720 function WOWGlobalUnlock16; external wow32lib name 'WOWGlobalUnlock16';
721 function WOWGlobalAllocLock16; external wow32lib name 'WOWGlobalAllocLock16';
722 function WOWGlobalUnlockFree16; external wow32lib name 'WOWGlobalUnlockFree16';
723 function WOWGlobalLockSize16; external wow32lib name 'WOWGlobalLockSize16';
724 procedure WOWYield16; external wow32lib name 'WOWYield16';
725 procedure WOWDirectedYield16; external wow32lib name 'WOWDirectedYield16';
726 function WOWHandle32; external wow32lib name 'WOWHandle32';
727 function WOWHandle16; external wow32lib name 'WOWHandle16';
728 function WOWCallback16; external wow32lib name 'WOWCallback16';
729 function WOWCallback16Ex; external wow32lib name 'WOWCallback16Ex';
730 
731 {$ENDIF DYNAMIC_LINK}
732 
733 {$ENDIF JWA_INTERFACESECTION}
734 
735 
736 {$IFNDEF JWA_OMIT_SECTIONS}
737 end.
738 {$ENDIF JWA_OMIT_SECTIONS}
739