Partager via


CeEnumDBVolumes (EDB)

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function enumerates the file names and GUIDs of all mounted volumes.

Syntax

BOOL CeEnumDBVolumes(
  PCEGUID pGuid,
  LPWSTR pwszName,
  DWORD cchMaxName
);

Parameters

  • pGuid
    [in, out] On return, this parameter contains the CEGUID of the volume. Use this CEGUID in successive calls to this function to continue enumeration.
  • pwszName
    [out] On successful return, contains the file name of the volume identified by the CEGUID returned in pGuid.

    For shared volumes, this value returns SystemHeap.

  • cchMaxName
    [in] Size of the pwszName buffer. To ensure a large enough buffer, set this value to at least CEDB_MAXDBASENAMELEN. This parameter is specified in characters and includes the space needed for the null terminator.

Return Value

TRUE indicates success. FALSE indicates failure. To get extended error information, call GetLastError. The following table lists possible values.

Return Value Description

ERROR_INSUFFICIENT_BUFFER

The cchMaxName parameter does not specify a length large enough to hold the file name of the volume.

ERROR_INVALID_PARAMETER

Indicates one of the following:

  • The pGUID parameter is set to NULL.
  • The pwszName parameter is set to NULL.

ERROR_KEY_DELETED

Enumeration can only start with an invalid GUID or a mounted volume. Any other GUID fails. For example, deleting a volume, and then attempting to enumerate from the deleted volume's GUID causes this error.

ERROR_NO_MORE_ITEMS

There are no more volumes to enumerate.

Remarks

Enumeration follows these general steps:

  1. To begin the enumeration, the caller sets pGuid to the value returned by CREATE_INVALIDEDBGUID. For each call to this function, it returns the file name and GUID of the mounted volume in pwszName and pGuid respectively.
  2. To continue enumeration, call CeEnumDBVolumes with the CEGUID value returned from the previous call.
  3. When there are no more volumes to enumerate, this function returns FALSE, and GetLastError returns ERROR_NO_MORE_ITEMS.

If the return value is ERROR_INSUFFICIENT_BUFFER, reallocate the buffer, and use the CEGUID that was returned from the failure to resume the enumeration. This avoids the necessity of restarting the process.

The following are the differences between this function and the CEDB equivalent function:

  • Enumeration can start only with an invalid GUID and continue from the GUID of a mounted volume.
  • CREATE_INVALIDEDBGUID is used to enumerate CEDB and EDB volumes.
  • An additional error is available to check completion of enumeration: ERROR_KEY_DELETED.

Requirements

Header windbase.h
Library coredll.lib
Windows Embedded CE Windows CE 5.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

EDB Functions