Using the File System

The Windows CE file system supports files that are stored in RAM, ROM, and installed file systems. Like Windows-based platforms, Windows CE employs handle-based file access. The CreateFile function returns a handle that references the created or opened file. The read, write, and information functions all use that handle to determine which file to act on. The read and write functions also use a file pointer to determine where in the file they read and write.

Windows CE uses a variety of techniques to simplify memory management and to reduce memory overhead. First, Windows CE does not use the current directory concept. Instead, all references to an object are given in the full path name. Further, Windows CE automatically compresses all files in the object store; therefore, no file has a flag to indicate compression. Of course, a flag does exist that distinguishes between a file in ROM and a file in RAM.

One of the sections of RAM on a Windows CE–based device is called the object store. The object store is where the directory, databases, registry, and file objects in volatile memory exist. The object store can be up to 16 megabytes (MB) in size. On Windows CE version 2.0 and earlier, a file can be up to 4 MB in size. Directories, databases, the registry, and files on Windows CE 2.10 and later are not limited to the 4-MB size restriction. Windows CE stores each database in the object store in a separate database volume. A database volume is a file that contains all of the data that is necessary for a database. Like the object store, a database volume can be up to 16 MB. All of the data in the object store is transactioned, which protects against data loss. If a Windows CE–based device loses power during a data transaction, Windows CE reverts all partial operations to the last known good state.

In addition to the object store, a user can install a file system such as the file allocation table (FAT) file system. An installed file system can provide access to a PC Card or to other external storage devices. You can divide an external storage device into multiple volumes, each of which is mounted separately. Each mounted volume is visible to the user as a folder in the root directory of the installed file system. Like the object store, a mounted volume is limited to 16 MB, and is transactioned to avoid data loss. While you can back up data to an external storage device, the working registry and RAM file system can only exist in the object store.

Note For programming purposes, Windows CE considers the object store as a special type of volume.