Share via


ReadRegistryFromOEM (Windows Embedded CE 6.0)

1/5/2010

This function reads a registry file into RAM from persistent storage as defined by the OEM. This function is callable from kernel mode only.

Syntax

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

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

    This value is passed in by the OS.

Return Value

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

Requirements

Header pkfuncs.h
Library OEMMain.lib or OEMMain_StaticKITL.lib
Windows Embedded CE Windows CE 2.10 and later

See Also

Reference

Optional OAL Functions
pReadRegistryFromOEM
WriteRegistryToOEM

Other Resources

Kernel Mode APIs
RegSaveKey
RegReplaceKey
RegCopyFile
RegRestoreFile
Persisting Data with the RAM-Based Registry