Export (0) Print
Expand All
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Mounting and Unmounting a Database Volume

Windows CE 3.0

In order to create and use a database volume with Windows CE 2.10 and later, you first must mount, or open, the volume. This does not include the object store, which is mounted and identified always by a system CEGUID. After all operations are complete, you must unmount, or close, the volume. Mounting and unmounting add a level of complexity to your database programming, but allow you to store a database elsewhere on a device other than the object store. Note that you still can use the original database API in Windows CE 2.10 and later to gain access to a database in the object store. However, the earlier API exists for backward compatibility only; every new application should use the new API.

Call the CeMountDBVol function to mount a volume that can store Windows CE databases on any file system, including the object store or an installed file system, such as the FAT file system on a PC Card. CeMountDBVol acts as a specialized version of the CreateFile function; instead of opening or creating a generic file, CeMountDBVol opens or creates a database volume. CeMountDBVol accepts the location of the file that is the database volume and returns a PCEGUID structure. Functions that are designed to manipulate mounted database volumes use PCEGUID as a handle to identify a given volume.

Call the CeUnmountDBVol function to unmount a database volume. Like the CloseHandle function, CeUnmountDBVol returns to the system any resources that the database volume was using. The act of unmounting flushes the database volume so you do not have to call CeFlushDBVol to save any data. Windows CE automatically flushes the cache on a periodic basis; in the event of a power failure or reset you will lose only data altered since the last cache flush. Also, a power failure or reset does not alter the volume itself.

Note that more than one process can mount the same database volume. Windows CE keeps track of how many processes have access to a given database volume. When the last process unmounts the database, Windows CE closes the file.

The following code example shows how to unmount a database volume. For an example that shows how to mount a database volume, see Mounted Database Example.

void UnmountingDBs (PCEGUID pceguid)
{
  TCHAR szMsg[100];

  if (!CeUnmountDBVol (pceguid))
  {
    wsprintf (szMsg, TEXT("Failed unmounting the database."));

    // Your error-handling code goes here.
  }
} // End of UnmountingDBs example code

Show:
© 2014 Microsoft