source: trunk/src/win32k/lib/libDosAllocMemEx.c@ 4164

Last change on this file since 4164 was 4164, checked in by bird, 25 years ago

Merged in the Grace branch. New Win32k!

File size: 2.0 KB
Line 
1/* $Id: libDosAllocMemEx.c,v 1.4 2000-09-02 21:08:11 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
20
21/*******************************************************************************
22* Internal Functions *
23*******************************************************************************/
24#include <os2.h>
25#include "win32k.h"
26
27
28/*******************************************************************************
29* Global Variables *
30*******************************************************************************/
31extern BOOL fInited;
32extern HFILE hWin32k;
33
34
35
36
37APIRET APIENTRY DosAllocMemEx(PPVOID ppv, ULONG cb, ULONG flag)
38{
39 APIRET rc;
40
41 if (fInited)
42 {
43 K32ALLOCMEMEX Param;
44 ULONG cbParam = sizeof(Param);
45 ULONG cbData = 0UL;
46 Param.pv = *ppv;
47 Param.cb = cb;
48 Param.flFlags = flag;
49 Param.rc = 0;
50 Param.ulCS = libHelperGetCS();
51 Param.ulEIP = *(PULONG)((int)(&ppv) - 4);
52
53 rc = DosDevIOCtl(hWin32k,
54 IOCTL_W32K_K32,
55 K32_ALLOCMEMEX,
56 &Param, sizeof(Param), &cbParam,
57 "", 1, &cbData);
58 if (rc == NO_ERROR)
59 {
60 ppv = Param.pv;
61 rc = Param.rc;
62 }
63 }
64 else
65 rc = ERROR_INIT_ROUTINE_FAILED;
66
67 return rc;
68}
69
Note: See TracBrowser for help on using the repository browser.