FreePage

Frees memory pages allocated by AllocPage.

32-bit API

#include "scnsm.h"

BOOL DeviceIoControl(
    HANDLE hDevice, // handle to SCNSM driver
    DWORD dwControlCode, // control code of operation to perform
    LPVOID pInBuffer // pointer to input data buffer
    DWORD cbInBuffer // (Unused) size of input buffer
    LPVOID pOutBuffer // (Unused) pointer to output data buffer
    DWORD cbOutBuffer // (Unused) size of output buffer
    LPDWORD pcbReturned // (Unused) pointer to receive output byte count
    LPOVERLAPPED pOverlapped // (Unused)
);

16-bit API

include scnsm.inc

    mov ax, dwControlCode
    lea bx, pInBuffer
    call [hDevice]

Uses EAX, EBX, Flags.

Parameters

hDevice
[in] Handle to SCNSM driver. For 32-bit API, returned by CreateFile. For 16-bit API, returned by int 2fh.
dwControlCode
[in] Must be NSM_FREEPAGE.
pInBuffer
[in] A pointer to the memory page. For 32-bit API, pInBuffer is the memory pointer returned by AllocPage. For 16-bit API, pInBuffer is the memory handle returned by AllocPage.

Return Values

32-bit API

If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call GetLastError for error codes defined below.

16-bit API

If the function succeeds, the EAX register is zero. If the function fails, the EAX register holds an error code defined below.

Error Codes

ERROR_INVALID_FUNCTION (1)
An unsupported control code was entered.
ERROR_GEN_FAILURE (31)
An unknown error has occurred.
ERROR_INVALID_PARAMETER (87)
An input parameter is invalid.