Line | |
---|
1 | /* $Id: libDosAllocMemEx.c,v 1.2 2000-02-26 17:48:22 bird Exp $
|
---|
2 | *
|
---|
3 | * DosAllocMemEx - Extened Edition of DosAllocMem.
|
---|
4 | * Allows you to suggest an address of the memory.
|
---|
5 | *
|
---|
6 | * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
|
---|
7 | *
|
---|
8 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
9 | *
|
---|
10 | */
|
---|
11 |
|
---|
12 |
|
---|
13 | /*******************************************************************************
|
---|
14 | * Header Files *
|
---|
15 | *******************************************************************************/
|
---|
16 | #define INCL_DOSERRORS
|
---|
17 | #define INCL_DOSFILEMGR
|
---|
18 | #define INCL_DOSDEVICES
|
---|
19 | #define INCL_WIN32K_LIB
|
---|
20 |
|
---|
21 |
|
---|
22 | /*******************************************************************************
|
---|
23 | * Internal Functions *
|
---|
24 | *******************************************************************************/
|
---|
25 | #include <os2.h>
|
---|
26 | #include <win32k.h>
|
---|
27 |
|
---|
28 |
|
---|
29 | /*******************************************************************************
|
---|
30 | * Global Variables *
|
---|
31 | *******************************************************************************/
|
---|
32 | extern BOOL fInited = FALSE;
|
---|
33 | extern HFILE hWin32k = NULLHANDLE;
|
---|
34 |
|
---|
35 |
|
---|
36 |
|
---|
37 |
|
---|
38 | APIRET APIENTRY DosAllocMemEx(PPVOID ppv, ULONG cb, ULONG flag)
|
---|
39 | {
|
---|
40 | APIRET rc;
|
---|
41 |
|
---|
42 | if (fInited)
|
---|
43 | {
|
---|
44 | K32ALLOCMEMEX Param;
|
---|
45 | ULONG cbParam = sizeof(Param);
|
---|
46 | ULONG cbData = 0UL;
|
---|
47 | Param.pv = *ppv;
|
---|
48 | Param.cb = cb;
|
---|
49 | Param.flFlags = flag;
|
---|
50 | Param.rc = 0;
|
---|
51 | Param.ulCS = -1;
|
---|
52 | Param.ulEIP = -1;
|
---|
53 |
|
---|
54 | rc = DosDevIOCtl(hWin32k,
|
---|
55 | IOCTL_W32K_K32,
|
---|
56 | K32_ALLOCMEMEX,
|
---|
57 | &Param, sizeof(Param), &cbParam,
|
---|
58 | "", 1, &cbData);
|
---|
59 | if (rc == NO_ERROR)
|
---|
60 | {
|
---|
61 | ppv = Param.pv;
|
---|
62 | rc = Param.rc;
|
---|
63 | }
|
---|
64 | }
|
---|
65 | else
|
---|
66 | rc = ERROR_INIT_ROUTINE_FAILED;
|
---|
67 |
|
---|
68 | return rc;
|
---|
69 | }
|
---|
70 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.