Share via


IOCTL_HAL_GET_HIVE_RAM_REGION (Compact 2013)

10/16/2014

This I/O control message allows you to specify a region of RAM to hold the registry hive instead of using it as a memory-mapped file on a file system. It is implemented by the OEM in the OAL, and called by Filesys.exe. Send this message with OEMIoControl.

Syntax

BOOL OEMIoControl(
    DWORD dwIoControlCode,    // use IOCTL_HAL_GET_HIVE_RAM_REGION
    LPVOID lpInBuffer,        // pointer to input buffer
    DWORD nInBufferSize,      // input buffer size
    LPVOID lpOutBuffer,       // pointer to output buffer
    DWORD nOutBufferSize,     // output buffer size
    LPDWORD lpBytesReturned   // number of bytes returned
);

Parameters

  • dwIoControlCode
    [in] Control code for the operation. Use IOCTL_HAL_GET_HIVE_RAM_REGION for this operation.
  • lpInBuffer
    [in] Set to NULL.
  • nInBufferSize
    [in] Set to zero.
  • lpOutBuffer
    [out] Pointer to a HiveRAMInfo structure.
  • nOutBufferSize
    [in] Size of a HiveRAMInfo structure; for example, sizeof(HiveRAMInfo).
  • lpBytesReturned
    [in] Address of a DWORD that receives the size, in bytes, of the data structure that contains the Hive RAM Information. This parameter is optional. If you do not need this value, set this parameter to NULL.

Return Values

Returns TRUE if successful; otherwise, returns FALSE.

Remarks

The registry calls the IOCTL_HAL_GET_HIVE_RAM_REGION IOCTL during the first boot phase to determine if a region of RAM is suitable to store the data. The registry data is stored in the specified region of RAM and persists as long as RAM persists. When registry data is stored in a RAM region, the user hive and system hive are stored together. There is no separate user hive, so there is no way to maintain separate copies of HKEY_CURRENT_USER for each user. Therefore, all users share the same registry.

User profile directories are created for each user, and are placed in the object store, as specified by the ProfileDir registry subkey.

The following code example shows an implementation of this I/O control.

    case IOCTL_HAL_GET_HIVE_RAM_REGION : {
        HiveRAMInfo *pRAMInfo = (HiveRAMInfo*) lpOutBuf;
        
        //Set required size if pointer isn't NULL
        if (lpBytesReturned != NULL) {
            *lpBytesReturned = sizeof(HiveRAMInfo);
        }
        //Validate inputs
        if ((!lpOutBuf) && (nOutBufSize > 0)) {
            SetLastError(ERROR_INVALID_PARAMETER);
            return(FALSE);
        }
        
        if ((!lpOutBuf) || (nOutBufSize < sizeof(HiveRAMInfo))) {
            SetLastError(ERROR_INSUFFICIENT_BUFFER);
            return(FALSE);
        }
        
        //Copy the Hive RAM Info
        pRAMInfo->wVersion = 1;
        pRAMInfo->wFlags = HIVE_REGION_COMBINED;
        pRAMInfo->SystemRegion.lpStart = (LPVOID)0x80100000;
        pRAMInfo->SystemRegion.dwLength = 0x00020000;
        pRAMInfo->SystemRegion.dwVirtCopyFlags = PAGE_NOCACHE;
        
        return TRUE;
    }

The SystemRegion.lpStart and SystemRegion.dwLength members are editable; the values shown here are examples.

Header: Pkfuncs.h.

Requirements

Header

pkfuncs.h

See Also

Reference

Filesys.exe IOCTLs
IOCTL_HAL_SAVE_HIVE_RAM_REGION