| Line 3... |
Line 3... |
| 3 |
|
3 |
|
| 4 |
#include "OsFile.h"
|
4 |
#include "OsFile.h"
|
| 5 |
|
5 |
|
| 6 |
|
6 |
|
| 7 |
//===========================================================================
|
7 |
//===========================================================================
|
| 8 |
bool OsFileExists (char *fileName) {
|
8 |
bool OsFileExists (char* fileName) {
|
| 9 |
DWORD dwFileAttributes = GetFileAttributesA(fileName);
|
9 |
DWORD dwFileAttributes = GetFileAttributesA(fileName);
|
| 10 |
return (dwFileAttributes != INVALID_FILE_ATTRIBUTES && !(dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY));
|
10 |
return (dwFileAttributes != INVALID_FILE_ATTRIBUTES && !(dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY));
|
| 11 |
}
|
11 |
}
|
| 12 |
|
12 |
|
| 13 |
//===========================================================================
|
13 |
//===========================================================================
|
| 14 |
bool OsDirectoryExists (char *directory) {
|
14 |
bool OsDirectoryExists (char* directory) {
|
| 15 |
DWORD dwFileAttributes = GetFileAttributesA(directory);
|
15 |
DWORD dwFileAttributes = GetFileAttributesA(directory);
|
| 16 |
return (dwFileAttributes != INVALID_FILE_ATTRIBUTES && (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY));
|
16 |
return (dwFileAttributes != INVALID_FILE_ATTRIBUTES && (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY));
|
| 17 |
}
|
17 |
}
|
| 18 |
|
18 |
|
| 19 |
//===========================================================================
|
19 |
//===========================================================================
|
| 20 |
HANDLE OsCreateFile (char *fileName,
|
20 |
HANDLE OsCreateFile (char* fileName,
|
| 21 |
DWORD desiredAccess,
|
21 |
DWORD desiredAccess,
|
| 22 |
DWORD shareMode,
|
22 |
DWORD shareMode,
|
| 23 |
DWORD createDisposition,
|
23 |
DWORD createDisposition,
|
| 24 |
DWORD flagsAndAttributes,
|
24 |
DWORD flagsAndAttributes,
|
| 25 |
HANDLE extendedFileType) {
|
25 |
HANDLE extendedFileType) {
|
| Line 32... |
Line 32... |
| 32 |
delete[] fileNameW;
|
32 |
delete[] fileNameW;
|
| 33 |
return result;
|
33 |
return result;
|
| 34 |
}
|
34 |
}
|
| 35 |
|
35 |
|
| 36 |
//===========================================================================
|
36 |
//===========================================================================
|
| 37 |
BOOL OsReadFile (HANDLE hFile, void *buffer, DWORD bytesToRead, DWORD *bytesRead) {
|
37 |
BOOL OsReadFile (HANDLE hFile, void* buffer, DWORD bytesToRead, DWORD* bytesRead) {
|
| 38 |
return ReadFile(hFile, buffer, bytesToRead, bytesRead, 0);
|
38 |
return ReadFile(hFile, buffer, bytesToRead, bytesRead, 0);
|
| 39 |
}
|
39 |
}
|
| 40 |
|
40 |
|
| 41 |
//===========================================================================
|
41 |
//===========================================================================
|
| 42 |
DWORD OsSetFilePointer (HANDLE hFile, DWORD moveMethod, LONG distanceToMove) {
|
42 |
DWORD OsSetFilePointer (HANDLE hFile, DWORD moveMethod, LONG distanceToMove) {
|
| Line 52... |
Line 52... |
| 52 |
}
|
52 |
}
|
| 53 |
return result;
|
53 |
return result;
|
| 54 |
}
|
54 |
}
|
| 55 |
|
55 |
|
| 56 |
//===========================================================================
|
56 |
//===========================================================================
|
| 57 |
BOOL OsWriteFile (HANDLE hFile, const void *buffer, DWORD bytesToWrite, DWORD *bytesWritten) {
|
57 |
BOOL OsWriteFile (HANDLE hFile, void const* buffer, DWORD bytesToWrite, DWORD* bytesWritten) {
|
| 58 |
return WriteFile(hFile, buffer, bytesToWrite, bytesWritten, 0);
|
58 |
return WriteFile(hFile, buffer, bytesToWrite, bytesWritten, 0);
|
| 59 |
}
|
59 |
}
|
| 60 |
|
60 |
|
| 61 |
//===========================================================================
|
61 |
//===========================================================================
|
| 62 |
void OsCloseFile (HANDLE hFile) {
|
62 |
void OsCloseFile (HANDLE hFile) {
|
| 63 |
CloseHandle(hFile);
|
63 |
CloseHandle(hFile);
|
| 64 |
}
|
64 |
}
|
| - |
|
65 |
|