CeFindFirstDatabaseEx (EDB)

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

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.

Syntax

HANDLE CeFindFirstDatabaseEx(
  PCEGUID pGuid,
  DWORD dwDbaseType
);

Parameters

  • 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

ERROR_NOT_ENOUGH_MEMORY

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

ERROR_NOT_FOUND

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.

Remarks

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.

Note

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.

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
CeFindNextDatabaseEx (EDB)
CeSetDatabaseInfoEx (EDB)
CeCreateDatabaseWithProps (EDB)
CloseHandle