Line | |
---|
1 | /* $Id: libDosAllocMemEx.c,v 1.8 2001-02-21 07:47:58 bird Exp $
|
---|
2 | *
|
---|
3 | * DosAllocMemEx - Extened Edition of DosAllocMem.
|
---|
4 | * Allows you to suggest an address of the memory.
|
---|
5 | *
|
---|
6 | * Copyright (c) 2000-2001 knut st. osmundsen (knut.stange.osmundsen@mynd.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 |
|
---|
20 |
|
---|
21 | /*******************************************************************************
|
---|
22 | * Internal Functions *
|
---|
23 | *******************************************************************************/
|
---|
24 | #include <os2.h>
|
---|
25 | #include "win32k.h"
|
---|
26 | #include "libPrivate.h"
|
---|
27 |
|
---|
28 |
|
---|
29 |
|
---|
30 | APIRET APIENTRY DosAllocMemEx(PPVOID ppv, ULONG cb, ULONG flag)
|
---|
31 | {
|
---|
32 | APIRET rc;
|
---|
33 |
|
---|
34 | if (fInited)
|
---|
35 | {
|
---|
36 | K32ALLOCMEMEX Param;
|
---|
37 | ULONG cbParam = sizeof(Param);
|
---|
38 | ULONG cbData = 0UL;
|
---|
39 |
|
---|
40 | Param.hdr.cb = sizeof(Param);
|
---|
41 | Param.hdr.rc = ERROR_NOT_SUPPORTED;
|
---|
42 | Param.ppv = ppv;
|
---|
43 | Param.cb = cb;
|
---|
44 | Param.flFlags = flag;
|
---|
45 | Param.ulCS = libHelperGetCS();
|
---|
46 | Param.ulEIP = *(PULONG)((int)(&ppv) - 4);
|
---|
47 |
|
---|
48 | if (usCGSelector)
|
---|
49 | return libCallThruCallGate(K32_ALLOCMEMEX, &Param);
|
---|
50 | rc = DosDevIOCtl(hWin32k,
|
---|
51 | IOCTL_W32K_K32,
|
---|
52 | K32_ALLOCMEMEX,
|
---|
53 | &Param, sizeof(Param), &cbParam,
|
---|
54 | "", 1, &cbData);
|
---|
55 | if (rc == NO_ERROR)
|
---|
56 | rc = Param.hdr.rc;
|
---|
57 | }
|
---|
58 | else
|
---|
59 | rc = ERROR_INIT_ROUTINE_FAILED;
|
---|
60 |
|
---|
61 | return rc;
|
---|
62 | }
|
---|
63 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.