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