Other OS (XP, WIN ME) is stored on disk (floppy disk, hard disk), and Windows CE implements a unique RAM-based file system, which is the legendary
Object Store. In implementation, object storage is more like a database, not a system assigned to disk. Fortunately, for programmers, Win32 API covers all this.
The database API is CE unique, not confused with SQL CE.
So now you can't see what clusters, volumes ... These concepts are gone, although you look at the things in the ROM are one file.
Also, it is important in other Windows systems.
The Current Directory concept is also waters in CE. The file must be indicated by the full path.
Deep Application-Level Security Available Under Windows XP is also not supported in CE. The parameters of all Security in the Win32 API are all pass NULL.
FileSys.exe consists of the following components: • ROM file system • Storage Manager • Object Storage Object Storage is a memory, controlled by FileSys.exe. Object storage includes RAM system registry, RAM file system, and attribute database. They are optional components of the FileSys.exe module. The RAM file system and attribute database are completely optional and can not exist at certain systems. For each Windows CE device, the registry existing in some form is required. It is always residing in object storage until 4.0 version of Windows CE. Using Windows CE .NET, it can be used as a file system (e.g., a disk) that exists outside. Subsequently, we will understand how the registry and file system generates contact. RAM-based file system is typically connected to the root of the unified file system presenting to the application. That is, the file "/myfile.txt" is located in the root of the unified system and the root of the RAM file system. The ROM file system is connected to the "/ windows" folder in the Unified File System. This means that all files in the ROM can be accessed as read-only files in the / windows folder.
Excerpt from "Understanding the File System Architecture in Windows CE .NET"
Http://www.microsoft.com/china/msdn/library/windev/windowsce/art/embedded06172003_fig1.gif
WinCe file system:
Create and open the file:
File name DWORD dwDesiredAccess HANDLE CreateFile (LPCTSTR lpFileName, // to be created, // GENERIC_WRITE allowed to write, GENERIC_READ read DWORD dwShareMode, // permission FILE_SHARE_READ other processes on it, FILE_SHARE_WRITE LPSECURITY_ATTRIBUTES lpSecurityAttributes, // security parameters, NULL DWORD dwCreationDistribution, / / Open or create a file DWord dwflagsandattributes, // file attribute handle htemplatefile; // is ignored in CE, is set to 0. Read and write: 1. Read function:
BOOL ReadFile (HANDLE hFile, // open file handle LPVOID lpBuffer, buffer DWORD nNumberOfBytesToRead // read the file you want to accept the data, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped); // CE does not support overlapped file operations, it is NULL
2. Write a function:
Bool Writefile (Handle Hfile, LPCVOID LPBUFFER, DWORD NNUMBYTESTOWRITE, LPDWORD LPNUMBYTESWRITETEN, LPOVERLAPPED LPOVERLAPPED);
Mobile file pointer: // concept is unchecked
Close the file:
Bool CloseHandle (Handle Hobject); // Close success, return true, failed, call getLastError () Return the cause of failure
Cutting file:? // Concept is unclear
Get file information:
DWORD getFileAttributes (LPCTSTSTR LPFILENAME);
Of course you can:
Bool setFileAttributes (LPCTSTSTSTSTSTSTSTSTSTSTSTS);
Document time: standard Win32 API has three file times:
File creation time, file last access time, file final modification time.
Bool getFileTime (Handle Hfile, LPFileTime LPCREATIONTIME, LPFILETIME LPLASTACCESSTIME, LPFILETIME LPLASTWRITIME); this function is used to get file time. The 3 pointers are the Filetime structure that is to accept time. If you are only interested in some time, the pointers of other time are set to NULL.
When the file times are queried for a file in the object store, Windows CE copies the last write time into all FILETIME structures. This goes against Win32 documentation, which states that any unsupported time fields should be set to 0. For the FAT file system used on storage cards, two times are maintained: the file creation time and the last write time When GetFileTime is called on a file on a storage card, the file creation and last write times are returned and the last access time is set to 0. .
Bool Filetime * LPFileTime (LPSYSTEMTIME LPFILETIME); transitions a FileTime structure into a SystemTIME structure Note: The time is formatted in the SystemTime structure. Bool FileTimetolocalFileTime (Const filetime * lpfiletime); Similarly, you can also:
Bool SetFileTime (Handle Hfile, Const Filetime * LPCREATIONTIME, Const filetime * Lplastaccesstime, Const filetime * Lplastwritetime);
Remember: The file time must be a UTC time, not local time.
However, the above is just in Win32, in CE, if the time is modified, all 3 time parameters will be set. If there is multiple time being set, then the last set time will set three parameters; read is the same, CE puts the last modified time in all Filetime structure.
File size and other information: This gets the size of a file:
DWORD GETFILESIZE (Handle Hfile, LPDWORD LPFILESIGHIGH);
If you don't want the file size to more than 4G, the second parameter is set to NULL.
If you still want to know more, how about the following functions?
Bool getFileinformationByHandle (Handle Hfile, LPBY_HANDLE_FILE_INFORMATION LPFILEINFORMATION);
Typedef struct _by_handle_file_information {
DWORD DWFILEATTRIBUTES; Filetime FTCRETIONTIME;
Filetime ftlastaccesstime;
Filetime ftlastwrittime;
DWORD DWVOLUMESERNUMBER;
DWORD NFILESIGHIGH;
DWORD NFILESZELOW;
DWORD NNUMBEROFLINKS;
DWORD NFILEINDEXHIGH;
DWORD NFILEINDEXLOW;
DWORD DWOID;
} By_Handle_File_Information;
November 2, 2004 21:03:26