| 1 | /* $Id: libW32kQuerySystemMemInfo.c,v 1.2 2001-02-21 07:47:59 bird Exp $
|
|---|
| 2 | *
|
|---|
| 3 | * libW32kQuerySystemMemInfo - Collects more or less useful information on the
|
|---|
| 4 | * memory state of the system.
|
|---|
| 5 | *
|
|---|
| 6 | * Copyright (c) 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 | * Collects more or less useful information on the memory state of the system.
|
|---|
| 31 | * @returns OS2 returncode.
|
|---|
| 32 | * @param pMemInfo Pointer to memory info.
|
|---|
| 33 | * The cb data member must contain a valid value on
|
|---|
| 34 | * entry. The rest of the structure is output data
|
|---|
| 35 | * and hence will only be valid on successful return.
|
|---|
| 36 | * @status completely implelemented.
|
|---|
| 37 | * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
|
|---|
| 38 | * @remark This function must be backward compatitible if changed.
|
|---|
| 39 | */
|
|---|
| 40 | APIRET APIENTRY W32kQuerySystemMemInfo(PK32SYSTEMMEMINFO pMemInfo)
|
|---|
| 41 | {
|
|---|
| 42 | APIRET rc;
|
|---|
| 43 |
|
|---|
| 44 | if (fInited)
|
|---|
| 45 | {
|
|---|
| 46 | K32QUERYSYSTEMMEMINFO Param;
|
|---|
| 47 | ULONG cbParam = sizeof(Param);
|
|---|
| 48 | ULONG cbData = 0UL;
|
|---|
| 49 |
|
|---|
| 50 | Param.hdr.cb = sizeof(Param);
|
|---|
| 51 | Param.hdr.rc = ERROR_NOT_SUPPORTED;
|
|---|
| 52 | Param.pMemInfo = pMemInfo;
|
|---|
| 53 |
|
|---|
| 54 | if (usCGSelector)
|
|---|
| 55 | return libCallThruCallGate(K32_QUERYSYSTEMMEMINFO, &Param);
|
|---|
| 56 | rc = DosDevIOCtl(hWin32k,
|
|---|
| 57 | IOCTL_W32K_K32,
|
|---|
| 58 | K32_QUERYSYSTEMMEMINFO,
|
|---|
| 59 | &Param, sizeof(Param), &cbParam,
|
|---|
| 60 | "", 1, &cbData);
|
|---|
| 61 |
|
|---|
| 62 | if (rc == NO_ERROR)
|
|---|
| 63 | rc = Param.hdr.rc;
|
|---|
| 64 | }
|
|---|
| 65 | else
|
|---|
| 66 | rc = ERROR_INIT_ROUTINE_FAILED;
|
|---|
| 67 |
|
|---|
| 68 | return rc;
|
|---|
| 69 | }
|
|---|
| 70 |
|
|---|