ReadRegistryFromOEM

This function reads a registry file into RAM from persistent storage as defined by the OEM.

DWORD ReadRegistryFromOEM(
  DWORD dwFlags, 
  LPBYTE lpData, 
  DWORD cbData 
);

Parameters

  • dwFlags
    [in] Read options specified by the OS. REG_READ_BYTES_START indicates reading must start from the beginning of the registry file.
  • lpData
    [in] Pointer to a buffer allocated by the OS. You must load the buffer with registry bytes up to a maximum of lpcbData.
  • cbData
    [in] Size in bytes of the buffer to which lpData points. It is passed in by the OS.

Return Values

Returns the number of bytes added to lpData. If 0 is returned, the end of file (EOF) has been reached. If -1 is returned, then your function's read functionality has faulted and the OS should load the default registry.

Remarks

The OS exposes a pReadRegistryFromOEM global variable that is available in the OAL. To support restoring the registry from persistent storage, implement the ReadRegistryFromOEM function and assign the address of the function to pReadRegistryFromOEM. During registry initialization, the OS checks for a valid pReadRegistryFromOEM. If it is valid, the OS continues to call pReadRegistryFromOEM to retrieve bytes until pReadRegistryFromOEM returns 0, for end of file, or -1. If there are severe problems or conditions under which the initialization cannot continue, you may implement this function so that it does not return. For example, you can inform the user of the problem and possible solutions. Because the OS is running a single thread at this stage of initialization, no other OS activity occurs unless this function returns.

The WriteRegistryToOEM function and ReadRegistryFromOEM mechanism is only supported by the object store-based registry. To save and restore data in the hive-based registry, see the RegSaveKey and RegReplaceKey functions.

The data file saved by the function RegCopyFile cannot be imported directly by ReadRegistryFromOEM. Use RegCopyFile to save the data to be restored by the function RegRestoreFile, or use WriteRegistryToOEM to save the data to be imported by ReadRegistryFromOEM.

Requirements

OS Versions: Windows CE 2.10 and later.
Header: Pkfuncs.h.
Link Library: Nk.lib.

See Also

pReadRegistryFromOEM | WriteRegistryToOEM | RegSaveKey | RegReplaceKey | RegCopyFile | RegRestoreFile | Persisting Data with the RAM-based Registry

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.