Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
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 pwszNamebuffer. 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 cchMaxNameparameter does not specify a length large enough to hold the file name of the volume.

ERROR_INVALID_PARAMETER

Indicates one of the following:

  • The pGUIDparameter is set to NULL.

  • The pwszNameparameter 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 pGuidto the value returned by CREATE_INVALIDEDBGUID. For each call to this function, it returns the file name and GUID of the mounted volume in pwszNameand pGuidrespectively.

  2. To continue enumeration, call CeEnumDBVolumeswith the CEGUID value returned from the previous call.

  3. When there are no more volumes to enumerate, this function returns FALSE, and GetLastErrorreturns 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_INVALIDEDBGUIDis 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