CeMountDBVol (CEDB) (Compact 2013)

3/26/2014

This function issues a mount request for a database volume that contains both data and an integrity log. The function fills a buffer with a CEGUID that is the globally unique identifier (GUID) of a mounted database.

Syntax

BOOL CeMountDBVol( 
  PCEGUID pceguid, 
  LPWSTR lpszDBVol,
  DWORD dwFlags
);

Parameters

  • pceguid
    [out] Pointer to a buffer that is filled in with the CEGUID of the globally unique identifier of a mounted database.
  • lpszDBVol
    [in] Pointer to the null-terminated string that contains the file name of the database volume to be mounted. The path is limited to MAX_PATH characters and includes the NULL character.
  • dwFlags
    [in] Specification for opening the database volume. The following table shows possible values.

    Value

    Description

    CREATE_ALWAYS

    Creates a new database volume. The function overwrites the database volume if it exists.

    CREATE_NEW

    Creates a new database volume. The function fails if the specified database volume already exists.

    OPEN_ALWAYS

    Opens the database volume if it exists. If the database volume does not exist, the function creates the database volume as if CREATE_NEW were specified.

    OPEN_EXISTING

    Opens the database volume. The function fails if the database volume does not exist.

    TRUNCATE_EXISTING

    Deletes all data on the volume, including databases and records, and resets the volume locale identifier (LCID). This has the same result as calling the DeleteFile function on a volume, and then calling CeMountDBVol with the CREATE_NEW flag set. The specified volume must not be mounted by an application, or an access denied error occurs.

Return Value

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

Value

Description

ERROR_ACCESS_DENIED

Returned if dwFlags is set to CREATE_ALWAYS or TRUNCATE_EXISTING and a database volume with the given name is currently mounted by an application. This error is also returned if the file name refers to a file that is not a valid database volume.

ERROR_ALREADY_EXISTS

Returned if dwFlags is set to CREATE_NEW and a database volume with the specified name already exists. This error is also returned if a database volume is already mounted with the same CEGUID as the new volume that is being mounted.

ERROR_DISK_FULL

Returned if the mounted volume does not have enough space to create the new database.

ERROR_NOT_ENOUGH_MEMORY

Returned if there was not enough memory available to create the volume. If the database volume already exists before the function call and the dwFlags parameter is set to CREATE_ALWAYS or OPEN_ALWAYS, GetLastError returns ERROR_ALREADY_EXISTS, even though the function has succeeded.

ERROR_PATH_NOT_FOUND

Returned if the specified path was not found.

Note

If the database volume already exists before this function is called and dwFlags is set to CREATE_ALWAYS or OPEN_ALWAYS, CeGetLastError returns ERROR_ALREADY_EXISTS, even though the function has succeeded.

Remarks

This function creates a database volume that contains both data and an integrity log. The function can accept any path including Uniform Naming Convention (UNC) names for files on a LAN.

This function is not supported for emulated storage cards created for the Device Emulator through folder sharing.

A single database volume can be mounted more than once by a different application. Each time the volume is mounted, a reference count is incremented. A mounted database volume does not unmount until all applications that mounted the volume call the CeUnmountDBVol (CEDB) function. CeUnmountDBVol must be called to free system resources.

The database volume to be mounted cannot be read-only, and the file system that contains the volume must support paging.

It is not necessary to call this function to access the object store. The object store can be regarded as a special database volume that is always mounted.

All data written to a mounted database volume is cached until one of the following occurs:

  • The volume is explicitly flushed. See CeFlushDBVol (CEDB).
  • The volume is flushed by the operating system because of a low memory condition.
  • The volume is unmounted.

Requirements

Header

windbase.h

Library

coredll.lib

See Also

Reference

CEDB Functions
CeFlushDBVol (CEDB)
CeUnmountDBVol (CEDB)
CHECK_INVALIDGUID