SnapRestore (Compact 2013)

3/28/2014

This function is sample code that restores a snapshot image by using an OEM-provided snapshot reader function.

Syntax

LPVOID SnapRestore(
    [in] PFN_SnapReadAtOffset pfnRead,
    [in] DWORD dwBufferAddr,
    [in] DWORD cbBufferSize,
    [out] LPDWORD pdwErr);

Parameters

  • pfnRead
    Pointer to the OEM-provided OEMReadSnapshot function that reads the snapshot. PFN_ SnapReadAtOffset is defined as typedef BOOL (*PFN_SnapReadAtOffset) (LPVOID pBuf, DWORD cbSize, DWORD dwOfst);
  • dwBufferAddr
    Starting address of the snapshot buffer. Must be page-aligned on a 4-KB address boundary.
  • cbBufferSize
    Size of the snapshot buffer in bytes. Must be a multiple of 4 KB.
  • pdwErr
    On exit, will be 0 (zero) if the calls succeeds; otherwise, it will be set to one of the error codes in the table shown in the Remarks section.

Return Value

A pointer to the CPU context that the IPL/bootloader must restore. This CPU context is the context saved by OEMTakeCPUSnapshot. The CPU context is NULL if this function fails, in which case *pdwErr will be set to one of the error codes in the table shown in the Remarks section.

Remarks

This function is sample code that demonstrates how to restore a snapshot. It is designed to be called from an ARM Initial Program Loader/Boot Loader. The sample code is located at %_WINCEROOT%\platform\common\src\common\boot\blcommon\snapboot.c

If pfnRead is NULL, dwBufferAddr and cbBufferSize encompass the entire snapshot image. This behavior typically occurs if you write the snapshot image to NOR Flash memory.

The value of pdwErr may be set to one of the following codes:

Error code

Error description

SNAP_ERR_INVALID_ARGUMENT

An argument is invalid or not page-aligned correctly.

SNAP_ERR_INSUFFICIENT_BUFFER

The buffer size is too small to restore the snapshot.

SNAP_ERR_CHECKSUM_FAILURE

The function failed to verify the snapshot checksum. The saved snapshot is invalid.

SNAP_ERR_READ_FAILURE

The function could not read the image when trying to restore the snapshot.

SNAP_ERR_NOT_SUPPORTED

The OEM does not support snapshot boot.

S_OK or NOERROR

The function succeeded.

Requirements

Header

snapboot.h

Library

iplcommon.lib

See Also

Reference

Snapshot Boot Functions
Snapshot Boot Reference

Other Resources

Snapshot Boot Development
Snapshot Boot Sample Code