CeFindFirstDatabaseEx (EDB)

A version of this page is also available for

Windows Embedded CE 6.0 R3


This function creates a handle that can be used with the CeFindNextDatabaseEx (EDB) function to enumerate databases in a volume or all databases across all mounted volumes.


HANDLE CeFindFirstDatabaseEx(
  PCEGUID pGuid,
  DWORD dwDbaseType


  • pGuid
    [in] If this parameter is set to NULL or is a value generated with this parameter set to CREATE_INVALIDEDBGUID, this function enumerates all mounted volumes. If this parameter is not set to NULL or an invalid GUID, this function searches the specified mounted volume.
  • dwDbaseType
    [in] Type of database to enumerate. If this parameter is not set to zero, this function enumerates all databases whose type matches the value of this parameter. A value of zero causes all databases to be enumerated. The type of a database is set when creating a database by using the CeCreateDatabaseWithProps (EDB) function, or when setting database information by using the CeSetDatabaseInfoEx (EDB) function.

Return Value

INVALID_HANDLE_VALUE indicates failure. To get extended error information, call GetLastError. The following table shows possible values.

Return Value Description


There is not enough memory available to create the enumeration context.


Indicates one of the following:

  • The pGuid parameter is not an invalid GUID, and the specified mounted volume does not exist.
  • The pGuid parameter is set to CREATE_INVALIDEDBGUID, and there are no mounted volumes.


This function returns only the handle to an enumeration context. To begin enumerating databases, an application must first call CeFindNextDatabaseEx. The handle returned from this function can be used on multiple threads at the same time.


If you call this function by passing NULL, it enumerates all volumes on the device, including CEDB volumes. Therefore, the handle returned by this function may be to a CEDB volume that cannot be used with EDB functions.

If a new database volume is mounted after calling this function, that new database volume is not included in the enumeration because this function takes a snapshot of the currently mounted volumes. If a volume is unmounted after calling this function, the enumeration skips that volume.

The handle returned from this function must be closed by calling the CloseHandle function.

The following list highlights the differences between this function and the CEDB equivalent function:

  • If pGuid has no mounted volume associated with it, EDB returns ERROR_NOT_FOUND, whereas CEDB returns ERROR_INVALID_PARAMETER. NULL and INVALIDGUID are exceptions.
  • CREATE_INVALIDEDBGUID is used to enumerate CEDB and EDB volumes.


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


EDB Functions
CeFindNextDatabaseEx (EDB)
CeSetDatabaseInfoEx (EDB)
CeCreateDatabaseWithProps (EDB)