ReadRegistryFromOEM (Windows CE 5.0)

Send Feedback

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

DWORD ReadRegistryFromOEM(DWORDdwFlags,LPBYTElpData,DWORDcbData );


  • 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 cbData.

  • cbData
    [in] Size, in bytes, of the buffer to which lpData points.

    This value 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.


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 can implement this function so 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.


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

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.