| 1 | /* $Id: dos.c,v 1.3 2000-12-11 06:53:57 bird Exp $
 | 
|---|
| 2 |  *
 | 
|---|
| 3 |  * Thunkers for OS/2 APIs.
 | 
|---|
| 4 |  *
 | 
|---|
| 5 |  * Some APIs requires Linear Stack, some have to overridden to
 | 
|---|
| 6 |  * emulate different things.
 | 
|---|
| 7 |  *
 | 
|---|
| 8 |  * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
 | 
|---|
| 9 |  *
 | 
|---|
| 10 |  * Project Odin Software License can be found in LICENSE.TXT
 | 
|---|
| 11 |  *
 | 
|---|
| 12 |  */
 | 
|---|
| 13 | 
 | 
|---|
| 14 | /*******************************************************************************
 | 
|---|
| 15 | *   Defined Constants And Macros                                               *
 | 
|---|
| 16 | *******************************************************************************/
 | 
|---|
| 17 | #define INCL_BASE
 | 
|---|
| 18 | #define INCL_NO_FAKE
 | 
|---|
| 19 | 
 | 
|---|
| 20 | /*******************************************************************************
 | 
|---|
| 21 | *   Header Files                                                               *
 | 
|---|
| 22 | *******************************************************************************/
 | 
|---|
| 23 | #include <os2.h>
 | 
|---|
| 24 | 
 | 
|---|
| 25 | #include "devSegDf.h"                   /* Win32k segment definitions. */
 | 
|---|
| 26 | 
 | 
|---|
| 27 | #include "test.h"
 | 
|---|
| 28 | 
 | 
|---|
| 29 | 
 | 
|---|
| 30 | /*******************************************************************************
 | 
|---|
| 31 | *   External Functions                                                         *
 | 
|---|
| 32 | * (These are prototypes for functions in the IMPORTS section of the def-file.) *
 | 
|---|
| 33 | *******************************************************************************/
 | 
|---|
| 34 | APIRET  APIENTRY        _DosWrite(HFILE hFile, PVOID pBuffer, ULONG cbWrite, PULONG pcbActual);
 | 
|---|
| 35 | 
 | 
|---|
| 36 | 
 | 
|---|
| 37 | /**
 | 
|---|
| 38 |  * DosWrite overload. Ensures that the stack is 32-bit!
 | 
|---|
| 39 |  */
 | 
|---|
| 40 | APIRET  APIENTRY        DosWrite(HFILE hFile, PVOID pBuffer, ULONG cbWrite, PULONG pcbActual)
 | 
|---|
| 41 | {
 | 
|---|
| 42 |     BOOL    f32Stack = ((int)&hFile > 0x10000);
 | 
|---|
| 43 |     APIRET  rc;
 | 
|---|
| 44 |     if (!f32Stack)
 | 
|---|
| 45 |         ThunkStack16To32();
 | 
|---|
| 46 | 
 | 
|---|
| 47 |     rc = _DosWrite(hFile, pBuffer, cbWrite, pcbActual);
 | 
|---|
| 48 | 
 | 
|---|
| 49 |     if (!f32Stack)
 | 
|---|
| 50 |         ThunkStack32To16();
 | 
|---|
| 51 | 
 | 
|---|
| 52 |     return rc;
 | 
|---|
| 53 | }
 | 
|---|
| 54 | 
 | 
|---|