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

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

CallGate changes.

File size: 1.8 KB
RevLine 
[5224]1/* $Id: libDosAllocMemEx.c,v 1.8 2001-02-21 07:47:58 bird Exp $
[2823]2 *
3 * DosAllocMemEx - Extened Edition of DosAllocMem.
4 * Allows you to suggest an address of the memory.
5 *
[5224]6 * Copyright (c) 2000-2001 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
[2823]7 *
8 * Project Odin Software License can be found in LICENSE.TXT
9 *
10 */
11
12
13/*******************************************************************************
14* Header Files *
15*******************************************************************************/
[2904]16#define INCL_DOSERRORS
[2823]17#define INCL_DOSFILEMGR
18#define INCL_DOSDEVICES
19
20
21/*******************************************************************************
22* Internal Functions *
23*******************************************************************************/
24#include <os2.h>
[2914]25#include "win32k.h"
[5224]26#include "libPrivate.h"
[2823]27
28
29
30APIRET APIENTRY DosAllocMemEx(PPVOID ppv, ULONG cb, ULONG flag)
31{
32 APIRET rc;
33
34 if (fInited)
35 {
36 K32ALLOCMEMEX Param;
[2904]37 ULONG cbParam = sizeof(Param);
38 ULONG cbData = 0UL;
[5201]39
[5224]40 Param.hdr.cb = sizeof(Param);
41 Param.hdr.rc = ERROR_NOT_SUPPORTED;
[5201]42 Param.ppv = ppv;
[2823]43 Param.cb = cb;
44 Param.flFlags = flag;
[2914]45 Param.ulCS = libHelperGetCS();
46 Param.ulEIP = *(PULONG)((int)(&ppv) - 4);
[2823]47
[5224]48 if (usCGSelector)
49 return libCallThruCallGate(K32_ALLOCMEMEX, &Param);
[2823]50 rc = DosDevIOCtl(hWin32k,
51 IOCTL_W32K_K32,
52 K32_ALLOCMEMEX,
53 &Param, sizeof(Param), &cbParam,
54 "", 1, &cbData);
55 if (rc == NO_ERROR)
[5224]56 rc = Param.hdr.rc;
[2823]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.