#include <windows.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <assert.h>#include "basetype.h"#include "ram.h"#include "vfile.h"#include "vfile._h"#include "fsdos.h"Go to the source code of this file.
Compounds | |
| struct | DosFile |
| struct | DosFinder |
Defines | |
| #define | WIN32_LEAN_AND_MEAN |
| #define | DOSFILE_SIGNATURE 0x31304644 |
| #define | DOSFINDER_SIGNATURE 0x32304644 |
| #define | CHECK_HANDLE(H) assert(H);assert(H->Signature == DOSFILE_SIGNATURE); |
| #define | CHECK_FINDER(F) assert(F);assert(F->Signature == DOSFINDER_SIGNATURE); |
Typedefs | |
| typedef DosFile | DosFile |
| typedef DosFinder | DosFinder |
Functions | |
| geBoolean | BuildFileName (const DosFile *File, const char *Name, char *Buff, char **NamePtr, int MaxLen) |
| void *GENESISCC | FSDos_FinderCreate (geVFile *FS, void *Handle, const char *FileSpec) |
| geBoolean GENESISCC | FSDos_FinderGetNextFile (void *Handle) |
| geBoolean GENESISCC | FSDos_FinderGetProperties (void *Handle, geVFile_Properties *Props) |
| void GENESISCC | FSDos_FinderDestroy (void *Handle) |
| geBoolean | IsRootDirectory (char *Path) |
| void *GENESISCC | FSDos_Open (geVFile *FS, void *Handle, const char *Name, void *Context, unsigned int OpenModeFlags) |
| void *GENESISCC | FSDos_OpenNewSystem (geVFile *FS, const char *Name, void *Context, unsigned int OpenModeFlags) |
| geBoolean GENESISCC | FSDos_UpdateContext (geVFile *FS, void *Handle, void *Context, int ContextSize) |
| void GENESISCC | FSDos_Close (void *Handle) |
| geBoolean GENESISCC | FSDos_GetS (void *Handle, void *Buff, int MaxLen) |
| geBoolean GENESISCC | FSDos_Read (void *Handle, void *Buff, int Count) |
| geBoolean GENESISCC | FSDos_Write (void *Handle, const void *Buff, int Count) |
| geBoolean GENESISCC | FSDos_Seek (void *Handle, int Where, geVFile_Whence Whence) |
| geBoolean GENESISCC | FSDos_EOF (const void *Handle) |
| geBoolean GENESISCC | FSDos_Tell (const void *Handle, long *Position) |
| geBoolean GENESISCC | FSDos_Size (const void *Handle, long *Size) |
| geBoolean GENESISCC | FSDos_GetProperties (const void *Handle, geVFile_Properties *Properties) |
| geBoolean GENESISCC | FSDos_SetSize (void *Handle, long size) |
| geBoolean GENESISCC | FSDos_SetAttributes (void *Handle, geVFile_Attributes Attributes) |
| geBoolean GENESISCC | FSDos_SetTime (void *Handle, const geVFile_Time *Time) |
| geBoolean GENESISCC | FSDos_SetHints (void *Handle, const geVFile_Hints *Hints) |
| geBoolean GENESISCC | FSDos_FileExists (geVFile *FS, void *Handle, const char *Name) |
| geBoolean GENESISCC | FSDos_Disperse (geVFile *FS, void *Handle, const char *Directory, geBoolean Recursive) |
| geBoolean GENESISCC | FSDos_DeleteFile (geVFile *FS, void *Handle, const char *Name) |
| geBoolean GENESISCC | FSDos_RenameFile (geVFile *FS, void *Handle, const char *Name, const char *NewName) |
| const geVFile_SystemAPIs *GENESISCC | FSDos_GetAPIs (void) |
Variables | |
| geVFile_SystemAPIs | FSDos_APIs |
|
|
Definition at line 45 of file fsdos.c. Referenced by FSDos_FinderDestroy(), FSDos_FinderGetNextFile(), FSDos_FinderGetProperties(), FSVFS_FinderDestroy(), FSVFS_FinderGetNextFile(), and FSVFS_FinderGetProperties(). |
|
|
|
Definition at line 39 of file fsdos.c. Referenced by FSDos_Open(). |
|
|
Definition at line 42 of file fsdos.c. Referenced by FSDos_FinderCreate(). |
|
|
|
|
|
|
|
|
|
|
||||||||||||||||||||||||
|
Definition at line 65 of file fsdos.c. References DosFile::FullPath, GE_FALSE, GE_TRUE, geBoolean, and DosFile::IsDirectory. Referenced by FSDos_DeleteFile(), FSDos_FileExists(), FSDos_FinderCreate(), FSDos_Open(), and FSDos_RenameFile().
00071 {
00072 int DirLength;
00073 int NameLength;
00074
00075 if ( ! Name )
00076 return GE_FALSE;
00077
00078 if (File)
00079 {
00080 if (File->IsDirectory == GE_FALSE)
00081 return GE_FALSE;
00082
00083 assert(File->FullPath);
00084 DirLength = strlen(File->FullPath);
00085
00086 if (DirLength > MaxLen)
00087 return GE_FALSE;
00088
00089 memcpy(Buff, File->FullPath, DirLength);
00090 }
00091 else
00092 {
00093 DirLength = 0;
00094 }
00095
00096 NameLength = strlen(Name);
00097 if (DirLength + NameLength + 2 > MaxLen || ! Buff )
00098 return GE_FALSE;
00099
00100 if (DirLength != 0)
00101 {
00102 Buff[DirLength] = '\\';
00103 memcpy(Buff + DirLength + 1, Name, NameLength + 1);
00104 if (NamePtr)
00105 *NamePtr = Buff + DirLength + 1;
00106 }
00107 else
00108 {
00109 memcpy(Buff, Name, NameLength + 1);
00110 if (NamePtr)
00111 *NamePtr = Buff;
00112
00113 // Special case: no directory, no file name. We meant something like ".\"
00114 if (!*Buff)
00115 {
00116 strcpy (Buff, ".\\");
00117 }
00118 }
00119
00120 return GE_TRUE;
00121 }
|
|
|
Definition at line 421 of file fsdos.c. References CHECK_HANDLE, DosFile::FileHandle, DosFile::FullPath, GE_FALSE, GENESISCC, geRam_Free, DosFile::IsDirectory, and DosFile::Signature.
00422 {
00423 DosFile * File;
00424
00425 File = Handle;
00426
00427 CHECK_HANDLE(File);
00428
00429 if (File->IsDirectory == GE_FALSE)
00430 {
00431 assert(File->FileHandle != INVALID_HANDLE_VALUE);
00432
00433 CloseHandle(File->FileHandle);
00434 }
00435
00436 assert(File->FullPath);
00437 File->Signature = 0;
00438 geRam_Free(File->FullPath);
00439 geRam_Free(File);
00440 }
|
|
||||||||||||||||
|
Definition at line 844 of file fsdos.c. References BuildFileName(), FALSE, GE_FALSE, GE_TRUE, geBoolean, GENESISCC, DosFile::IsDirectory, and NULL.
00845 {
00846 DosFile * File;
00847 char Buff[_MAX_PATH];
00848
00849 File = Handle;
00850
00851 if (File && File->IsDirectory == GE_FALSE)
00852 return GE_FALSE;
00853
00854 if (BuildFileName(File, Name, Buff, NULL, sizeof(Buff)) == GE_FALSE)
00855 return GE_FALSE;
00856
00857 if (DeleteFile(Buff) == FALSE)
00858 return GE_FALSE;
00859
00860 return GE_TRUE;
00861 }
|
|
||||||||||||||||||||
|
Definition at line 835 of file fsdos.c. References GE_FALSE, geBoolean, and GENESISCC.
00840 {
00841 return GE_FALSE;
00842 }
|
|
|
Definition at line 625 of file fsdos.c. References CHECK_HANDLE, DWORD, DosFile::FileHandle, GE_FALSE, GE_TRUE, geBoolean, GENESISCC, DosFile::IsDirectory, and NULL.
00626 {
00627 const DosFile * File;
00628 DWORD CurPos;
00629
00630 File = Handle;
00631
00632 CHECK_HANDLE(File);
00633
00634 if (File->IsDirectory == GE_TRUE)
00635 return GE_FALSE;
00636
00637 assert(File->FileHandle != INVALID_HANDLE_VALUE);
00638
00639 CurPos = SetFilePointer(File->FileHandle, 0, NULL, FILE_CURRENT);
00640 assert(CurPos != 0xffffffff);
00641
00642 if (CurPos == GetFileSize(File->FileHandle, NULL))
00643 return GE_TRUE;
00644
00645 return GE_FALSE;
00646 }
|
|
||||||||||||||||
|
Definition at line 816 of file fsdos.c. References BuildFileName(), GE_FALSE, GE_TRUE, geBoolean, GENESISCC, DosFile::IsDirectory, and NULL.
00817 {
00818 DosFile * File;
00819 char Buff[_MAX_PATH];
00820
00821 File = Handle;
00822
00823 if (File && File->IsDirectory == GE_FALSE)
00824 return GE_FALSE;
00825
00826 if (BuildFileName(File, Name, Buff, NULL, sizeof(Buff)) == GE_FALSE)
00827 return GE_FALSE;
00828
00829 if (GetFileAttributes(Buff) == 0xffffffff)
00830 return GE_FALSE;
00831
00832 return GE_TRUE;
00833 }
|
|
||||||||||||||||
|
Definition at line 123 of file fsdos.c. References BuildFileName(), CHECK_HANDLE, DOSFINDER_SIGNATURE, DosFinder::FindData, DosFinder::FindHandle, DosFinder::FirstStillCached, GE_FALSE, GE_TRUE, GENESISCC, geRam_Allocate, geRam_Free, NULL, DosFinder::OffsetToName, and DosFinder::Signature.
00127 {
00128 DosFinder * Finder;
00129 DosFile * File;
00130 char * NamePtr;
00131 char Buff[_MAX_PATH];
00132
00133 assert(FileSpec != NULL);
00134
00135 File = Handle;
00136
00137 CHECK_HANDLE(File);
00138
00139 Finder = geRam_Allocate(sizeof(*Finder));
00140 if (!Finder)
00141 return NULL;
00142
00143 memset(Finder, 0, sizeof(*Finder));
00144
00145 if (BuildFileName(File, FileSpec, Buff, &NamePtr, sizeof(Buff)) == GE_FALSE)
00146 {
00147 geRam_Free(Finder);
00148 return NULL;
00149 }
00150
00151 Finder->OffsetToName = NamePtr - Buff;
00152
00153 Finder->FindHandle = FindFirstFile(Buff, &Finder->FindData);
00154
00155 Finder->FirstStillCached = GE_TRUE;
00156
00157 Finder->Signature = DOSFINDER_SIGNATURE;
00158 return (void *)Finder;
00159 }
|
|
|
Definition at line 226 of file fsdos.c. References CHECK_FINDER, DosFinder::FindHandle, GENESISCC, geRam_Free, and DosFinder::Signature.
00227 {
00228 DosFinder * Finder;
00229
00230 Finder = Handle;
00231
00232 CHECK_FINDER(Finder);
00233
00234 if (Finder->FindHandle != INVALID_HANDLE_VALUE)
00235 FindClose(Finder->FindHandle);
00236
00237 Finder->Signature = 0;
00238 geRam_Free(Finder);
00239 }
|
|
|
Definition at line 161 of file fsdos.c. References CHECK_FINDER, DosFinder::FindData, DosFinder::FindHandle, DosFinder::FirstStillCached, GE_FALSE, GE_TRUE, geBoolean, GENESISCC, and TRUE.
00162 {
00163 DosFinder * Finder;
00164
00165 Finder = Handle;
00166
00167 CHECK_FINDER(Finder);
00168
00169 if (Finder->FindHandle == INVALID_HANDLE_VALUE)
00170 return GE_FALSE;
00171
00172 if (Finder->FirstStillCached == GE_TRUE)
00173 {
00174 Finder->FirstStillCached = GE_FALSE;
00175
00176 if (Finder->FindData.cFileName[0] != '.')
00177 return GE_TRUE;
00178 }
00179
00180 while (FindNextFile(Finder->FindHandle, &Finder->FindData) == TRUE)
00181 {
00182 if (Finder->FindData.cFileName[0] != '.')
00183 return GE_TRUE;
00184 }
00185
00186 return GE_FALSE;
00187 }
|
|
||||||||||||
|
Definition at line 189 of file fsdos.c. References geVFile_Properties::AttributeFlags, CHECK_FINDER, DosFinder::FindData, DosFinder::FindHandle, GE_FALSE, GE_TRUE, GE_VFILE_ATTRIB_DIRECTORY, GE_VFILE_ATTRIB_READONLY, geBoolean, GENESISCC, geVFile_Attributes, geVFile_Hints::HintData, geVFile_Hints::HintDataLength, geVFile_Properties::Hints, geVFile_Properties::Name, NULL, geVFile_Properties::Size, geVFile_Properties::Time, geVFile_Time::Time1, and geVFile_Time::Time2.
00190 {
00191 DosFinder * Finder;
00192 geVFile_Attributes Attribs;
00193 int Length;
00194
00195 assert(Props);
00196
00197 Finder = Handle;
00198
00199 CHECK_FINDER(Finder);
00200
00201 if (Finder->FindHandle == INVALID_HANDLE_VALUE)
00202 return GE_FALSE;
00203
00204 Attribs = 0;
00205 if (Finder->FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
00206 Attribs |= GE_VFILE_ATTRIB_DIRECTORY;
00207 if (Finder->FindData.dwFileAttributes & FILE_ATTRIBUTE_READONLY)
00208 Attribs |= GE_VFILE_ATTRIB_READONLY;
00209
00210 Props->Time.Time1 = Finder->FindData.ftLastWriteTime.dwLowDateTime;
00211 Props->Time.Time2 = Finder->FindData.ftLastWriteTime.dwHighDateTime;
00212
00213 Props->AttributeFlags = Attribs;
00214 Props->Size = Finder->FindData.nFileSizeLow;
00215 Props->Hints.HintData = NULL;
00216 Props->Hints.HintDataLength = 0;
00217
00218 Length = strlen(Finder->FindData.cFileName);
00219 if (Length > sizeof(Props->Name) - 1)
00220 return GE_FALSE;
00221 memcpy(Props->Name, Finder->FindData.cFileName, Length + 1);
00222
00223 return GE_TRUE;
00224 }
|
|
|
Definition at line 918 of file fsdos.c. References FSDos_APIs, and GENESISCC. Referenced by RegisterBuiltInAPIs().
00919 {
00920 return &FSDos_APIs;
00921 }
|
|
||||||||||||
|
Definition at line 688 of file fsdos.c. References geVFile_Properties::AttributeFlags, CHECK_HANDLE, FALSE, DosFile::FileHandle, GE_FALSE, GE_TRUE, GE_VFILE_ATTRIB_DIRECTORY, GE_VFILE_ATTRIB_READONLY, geBoolean, GENESISCC, geVFile_Attributes, geVFile_Hints::HintData, geVFile_Hints::HintDataLength, geVFile_Properties::Hints, DosFile::IsDirectory, geVFile_Properties::Name, DosFile::Name, NULL, geVFile_Properties::Size, geVFile_Properties::Time, geVFile_Time::Time1, and geVFile_Time::Time2.
00689 {
00690 const DosFile * File;
00691 geVFile_Attributes Attribs;
00692 BY_HANDLE_FILE_INFORMATION Info;
00693 int Length;
00694
00695 assert(Properties);
00696
00697 File = Handle;
00698
00699 CHECK_HANDLE(File);
00700
00701 if (File->IsDirectory == GE_TRUE)
00702 {
00703 memset(Properties, 0, sizeof(*Properties));
00704 Properties->AttributeFlags = FILE_ATTRIBUTE_DIRECTORY;
00705 #pragma message ("FSDos_GetProperties: Time support is not there for directories")
00706 }
00707 else
00708 {
00709 assert(File->FileHandle != INVALID_HANDLE_VALUE);
00710
00711 if (GetFileInformationByHandle(File->FileHandle, &Info) == FALSE)
00712 return GE_FALSE;
00713
00714 Attribs = 0;
00715 if (Info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
00716 Attribs |= GE_VFILE_ATTRIB_DIRECTORY;
00717 if (Info.dwFileAttributes & FILE_ATTRIBUTE_READONLY)
00718 Attribs |= GE_VFILE_ATTRIB_READONLY;
00719
00720 Properties->Time.Time1 = Info.ftLastWriteTime.dwLowDateTime;
00721 Properties->Time.Time2 = Info.ftLastWriteTime.dwHighDateTime;
00722
00723 Properties->AttributeFlags = Attribs;
00724 Properties->Size = Info.nFileSizeLow;
00725 Properties->Hints.HintData = NULL;
00726 Properties->Hints.HintDataLength = 0;
00727 }
00728
00729 Length = strlen(File->Name) + 1;
00730 if (Length > sizeof(Properties->Name))
00731 return GE_FALSE;
00732 memcpy(Properties->Name, File->Name, Length);
00733
00734 return GE_TRUE;
00735 }
|
|
||||||||||||||||
|
Definition at line 442 of file fsdos.c. References CHECK_HANDLE, DWORD, FALSE, DosFile::FileHandle, GE_FALSE, GE_TRUE, geBoolean, GENESISCC, DosFile::IsDirectory, NULL, and TRUE.
00443 {
00444 DosFile * File;
00445 DWORD BytesRead;
00446 BOOL Result;
00447 char * p;
00448 char * End;
00449
00450 assert(Buff);
00451 assert(MaxLen != 0);
00452
00453 File = Handle;
00454
00455 CHECK_HANDLE(File);
00456
00457 assert(File->FileHandle != INVALID_HANDLE_VALUE);
00458
00459 if (File->IsDirectory == GE_TRUE)
00460 return GE_FALSE;
00461
00462 Result = ReadFile(File->FileHandle, Buff, MaxLen - 1, &BytesRead, NULL);
00463 if (BytesRead == 0)
00464 {
00465 #if 0
00466 if (Result == FALSE)
00467 return GE_FALSE;
00468
00469 // The Win32 API is vague about this, so we're being weird with the asserts
00470 assert(Result != TRUE);
00471 #endif
00472 return GE_FALSE;
00473 }
00474
00475 End = (char *)Buff + BytesRead;
00476 p = Buff;
00477 while (p < End)
00478 {
00479 /*
00480 This code will terminate a line on one of three conditions:
00481 \r Character changed to \n, next char set to 0
00482 \n Next char set to 0
00483 \r\n First \r changed to \n. \n changed to 0.
00484 */
00485 if (*p == '\r')
00486 {
00487 int Skip = 0;
00488
00489 *p = '\n'; // set end of line
00490 p++; // and skip to next char
00491 // If the next char is a newline, then skip it too (\r\n case)
00492 if (*p == '\n')
00493 {
00494 Skip = 1;
00495 }
00496 *p = '\0';
00497 // Set the file pointer back a bit since we probably overran
00498 SetFilePointer(File->FileHandle, -(int)(BytesRead - ((p + Skip) - (char *)Buff)), NULL, FILE_CURRENT);
00499 assert(p - (char *)Buff <= MaxLen);
00500 return GE_TRUE;
00501 }
00502 else if (*p == '\n')
00503 {
00504 // Set the file pointer back a bit since we probably overran
00505 p++;
00506 SetFilePointer(File->FileHandle, -(int)(BytesRead - (p - (char *)Buff)), NULL, FILE_CURRENT);
00507 *p = '\0';
00508 assert(p - (char *)Buff <= MaxLen);
00509 return GE_TRUE;
00510 }
00511 p++;
00512 }
00513
00514 return GE_FALSE;
00515 }
|
|
||||||||||||||||||||||||
|
Definition at line 271 of file fsdos.c. References BuildFileName(), DOSFILE_SIGNATURE, DWORD, FALSE, DosFile::FileHandle, DosFile::FullPath, GE_FALSE, GE_TRUE, GE_VFILE_OPEN_CREATE, GE_VFILE_OPEN_DIRECTORY, GE_VFILE_OPEN_READONLY, GE_VFILE_OPEN_UPDATE, geBoolean, GENESISCC, geRam_Allocate, geRam_Free, DosFile::IsDirectory, IsRootDirectory(), LastError, DosFile::Name, NULL, and DosFile::Signature. Referenced by FSDos_OpenNewSystem().
00277 {
00278 DosFile * DosFS;
00279 DosFile * NewFile;
00280 char Buff[_MAX_PATH];
00281 int Length;
00282 char * NamePtr;
00283
00284 DosFS = Handle;
00285
00286 if (DosFS && DosFS->IsDirectory != GE_TRUE)
00287 return NULL;
00288
00289 NewFile = geRam_Allocate(sizeof(*NewFile));
00290 if (!NewFile)
00291 return NewFile;
00292
00293 memset(NewFile, 0, sizeof(*NewFile));
00294
00295 if (BuildFileName(DosFS, Name, Buff, &NamePtr, sizeof(Buff)) == GE_FALSE)
00296 goto fail;
00297
00298 Length = strlen(Buff);
00299 NewFile->FullPath = geRam_Allocate(Length + 1);
00300 if (!NewFile->FullPath)
00301 goto fail;
00302
00303 NewFile->Name = NewFile->FullPath + (NamePtr - &Buff[0]);
00304
00305 memcpy(NewFile->FullPath, Buff, Length + 1);
00306
00307 if (OpenModeFlags & GE_VFILE_OPEN_DIRECTORY)
00308 {
00309 WIN32_FIND_DATA FileInfo;
00310 HANDLE FindHandle;
00311 geBoolean IsDirectory;
00312
00313 assert(!DosFS || DosFS->IsDirectory == GE_TRUE);
00314
00315 memset(&FileInfo, 0, sizeof(FileInfo));
00316 FindHandle = FindFirstFile(NewFile->FullPath, &FileInfo);
00317 if (FindHandle != INVALID_HANDLE_VALUE &&
00318 FileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
00319 {
00320 IsDirectory = GE_TRUE;
00321 }
00322 else
00323 {
00324 IsDirectory = IsRootDirectory(NewFile->FullPath);
00325 }
00326
00327 FindClose (FindHandle);
00328
00329 if (OpenModeFlags & GE_VFILE_OPEN_CREATE)
00330 {
00331 if (IsDirectory == GE_TRUE)
00332 goto fail;
00333
00334 if (CreateDirectory(NewFile->FullPath, NULL) == FALSE)
00335 goto fail;
00336 }
00337 else
00338 {
00339 if (IsDirectory != GE_TRUE)
00340 goto fail;
00341 }
00342
00343 NewFile->IsDirectory = GE_TRUE;
00344 NewFile->FileHandle = INVALID_HANDLE_VALUE;
00345 }
00346 else
00347 {
00348 DWORD ShareMode=0;
00349 DWORD CreationMode;
00350 DWORD Access=0;
00351 DWORD LastError;
00352
00353 CreationMode = OPEN_EXISTING;
00354
00355 switch (OpenModeFlags & (GE_VFILE_OPEN_READONLY |
00356 GE_VFILE_OPEN_UPDATE |
00357 GE_VFILE_OPEN_CREATE))
00358 {
00359 case GE_VFILE_OPEN_READONLY:
00360 Access = GENERIC_READ;
00361 ShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
00362 break;
00363
00364 case GE_VFILE_OPEN_CREATE:
00365 CreationMode = CREATE_ALWAYS;
00366 // Fall through
00367
00368 case GE_VFILE_OPEN_UPDATE:
00369 Access = GENERIC_READ | GENERIC_WRITE;
00370 ShareMode = FILE_SHARE_READ;
00371 break;
00372
00373 default:
00374 assert(!"Illegal open mode flags");
00375 break;
00376 }
00377
00378 NewFile->FileHandle = CreateFile(NewFile->FullPath,
00379 Access,
00380 ShareMode,
00381 NULL,
00382 CreationMode,
00383 0,
00384 NULL);
00385 if (NewFile->FileHandle == INVALID_HANDLE_VALUE)
00386 {
00387 LastError = GetLastError();
00388 goto fail;
00389 }
00390 }
00391
00392 NewFile->Signature = DOSFILE_SIGNATURE;
00393
00394 return (void *)NewFile;
00395
00396 fail:
00397 if (NewFile->FullPath)
00398 geRam_Free(NewFile->FullPath);
00399 geRam_Free(NewFile);
00400 return NULL;
00401 }
|
|
||||||||||||||||||||
|
Definition at line 403 of file fsdos.c. References FSDos_Open(), GENESISCC, and NULL.
00408 {
00409 return FSDos_Open(FS, NULL, Name, Context, OpenModeFlags);
00410 }
|
|
||||||||||||||||
|
Definition at line 518 of file fsdos.c. References CHECK_HANDLE, DWORD, FALSE, DosFile::FileHandle, GE_FALSE, GE_TRUE, geBoolean, GENESISCC, DosFile::IsDirectory, and NULL.
00519 {
00520 DosFile * File;
00521 DWORD BytesRead;
00522
00523 assert(Buff);
00524 assert(Count != 0);
00525
00526 File = Handle;
00527
00528 CHECK_HANDLE(File);
00529
00530 if (File->IsDirectory == GE_TRUE)
00531 return GE_FALSE;
00532
00533 #ifdef ELIDEBUG
00534 {
00535 FILE * fp;
00536 long Position;
00537
00538 Position = SetFilePointer(File->FileHandle, 0, NULL, FILE_CURRENT);
00539 fp = fopen("c:\\vfs.eli", "ab+");
00540 fprintf(fp, "FSDos_Read: %-8d bytes @ %-8d\r\n", Count, Position);
00541 fclose(fp);
00542 }
00543 #endif
00544
00545 if (ReadFile(File->FileHandle, Buff, Count, &BytesRead, NULL) == FALSE)
00546 return GE_FALSE;
00547
00548 if (BytesRead == 0)
00549 return GE_FALSE;
00550
00551 return GE_TRUE;
00552 }
|
|
||||||||||||||||||||
|
Definition at line 863 of file fsdos.c. References BuildFileName(), FALSE, GE_FALSE, GE_TRUE, geBoolean, GENESISCC, DosFile::IsDirectory, and NULL.
00864 {
00865 DosFile * File;
00866 char Old[_MAX_PATH];
00867 char New[_MAX_PATH];
00868
00869 File = Handle;
00870
00871 if (File && File->IsDirectory == GE_FALSE)
00872 return GE_FALSE;
00873
00874 if (BuildFileName(File, Name, Old, NULL, sizeof(Old)) == GE_FALSE)
00875 return GE_FALSE;
00876
00877 if (BuildFileName(File, NewName, New, NULL, sizeof(New)) == GE_FALSE)
00878 return GE_FALSE;
00879
00880 if (MoveFile(Old, New) == FALSE)
00881 return GE_FALSE;
00882
00883 return GE_TRUE;
00884 }
|
|
||||||||||||||||
|
Definition at line 590 of file fsdos.c. References CHECK_HANDLE, DosFile::FileHandle, GE_FALSE, GE_TRUE, GE_VFILE_SEEKCUR, GE_VFILE_SEEKEND, GE_VFILE_SEEKSET, geBoolean, GENESISCC, DosFile::IsDirectory, and NULL.
00591 {
00592 int RTLWhence=0;
00593 DosFile * File;
00594
00595 File = Handle;
00596
00597 CHECK_HANDLE(File);
00598
00599 if (File->IsDirectory == GE_TRUE)
00600 return GE_FALSE;
00601
00602 switch (Whence)
00603 {
00604 case GE_VFILE_SEEKCUR:
00605 RTLWhence = FILE_CURRENT;
00606 break;
00607
00608 case GE_VFILE_SEEKEND:
00609 RTLWhence = FILE_END;
00610 break;
00611
00612 case GE_VFILE_SEEKSET:
00613 RTLWhence = FILE_BEGIN;
00614 break;
00615 default:
00616 assert(!"Unknown seek kind");
00617 }
00618
00619 if (SetFilePointer(File->FileHandle, Where, NULL, RTLWhence) == 0xffffffff)
00620 return GE_FALSE;
00621
00622 return GE_TRUE;
00623 }
|
|
||||||||||||
|
Definition at line 759 of file fsdos.c. References CHECK_HANDLE, DWORD, FALSE, DosFile::FileHandle, DosFile::FullPath, GE_FALSE, GE_TRUE, GE_VFILE_ATTRIB_READONLY, geBoolean, GENESISCC, and DosFile::IsDirectory.
00760 {
00761 DosFile * File;
00762 DWORD Win32Attributes;
00763
00764 File = Handle;
00765
00766 CHECK_HANDLE(File);
00767
00768 assert(File->FileHandle != INVALID_HANDLE_VALUE);
00769
00770 if (File->IsDirectory == GE_TRUE)
00771 return GE_FALSE;
00772
00773 if (Attributes & GE_VFILE_ATTRIB_READONLY)
00774 Win32Attributes = FILE_ATTRIBUTE_READONLY;
00775 else
00776 Win32Attributes = FILE_ATTRIBUTE_NORMAL;
00777
00778 if (SetFileAttributes(File->FullPath, Win32Attributes) == FALSE)
00779 return GE_FALSE;
00780
00781 return GE_TRUE;
00782 }
|
|
||||||||||||
|
Definition at line 803 of file fsdos.c. References CHECK_HANDLE, DosFile::FileHandle, GE_FALSE, geBoolean, and GENESISCC.
00804 {
00805 DosFile * File;
00806
00807 File = Handle;
00808
00809 CHECK_HANDLE(File);
00810
00811 assert(File->FileHandle != INVALID_HANDLE_VALUE);
00812
00813 return GE_FALSE;
00814 }
|
|
||||||||||||
|
Definition at line 737 of file fsdos.c. References CHECK_HANDLE, FALSE, DosFile::FileHandle, GE_FALSE, geBoolean, GENESISCC, DosFile::IsDirectory, and NULL.
00738 {
00739 DosFile * File;
00740
00741 File = Handle;
00742
00743 CHECK_HANDLE(File);
00744
00745 if (File->IsDirectory == GE_FALSE)
00746 {
00747 assert(File->FileHandle != INVALID_HANDLE_VALUE);
00748
00749 if (SetFilePointer(File->FileHandle, 0, NULL, FILE_END) == 0xffffffff)
00750 return GE_FALSE;
00751
00752 if (SetEndOfFile(File->FileHandle) == FALSE)
00753 return GE_FALSE;
00754 }
00755
00756 return GE_FALSE;
00757 }
|
|
||||||||||||
|
Definition at line 784 of file fsdos.c. References CHECK_HANDLE, FALSE, DosFile::FileHandle, GE_FALSE, GE_TRUE, geBoolean, GENESISCC, geVFile_Time::Time1, and geVFile_Time::Time2.
00785 {
00786 DosFile * File;
00787 FILETIME Win32Time;
00788
00789 File = Handle;
00790
00791 CHECK_HANDLE(File);
00792
00793 assert(File->FileHandle != INVALID_HANDLE_VALUE);
00794
00795 Win32Time.dwLowDateTime = Time->Time1;
00796 Win32Time.dwHighDateTime = Time->Time2;
00797 if (SetFileTime(File->FileHandle, &Win32Time, &Win32Time, &Win32Time) == FALSE)
00798 return GE_FALSE;
00799
00800 return GE_TRUE;
00801 }
|
|
||||||||||||
|
Definition at line 668 of file fsdos.c. References CHECK_HANDLE, DosFile::FileHandle, GE_FALSE, GE_TRUE, geBoolean, GENESISCC, DosFile::IsDirectory, and NULL.
00669 {
00670 const DosFile * File;
00671
00672 File = Handle;
00673
00674 CHECK_HANDLE(File);
00675
00676 if (File->IsDirectory == GE_TRUE)
00677 return GE_FALSE;
00678
00679 assert(File->FileHandle != INVALID_HANDLE_VALUE);
00680
00681 *Size = GetFileSize(File->FileHandle, NULL);
00682 if (*Size != (long)0xffffffff)
00683 return GE_TRUE;
00684
00685 return GE_FALSE;
00686 }
|
|
||||||||||||
|
Definition at line 648 of file fsdos.c. References CHECK_HANDLE, DosFile::FileHandle, GE_FALSE, GE_TRUE, geBoolean, GENESISCC, DosFile::IsDirectory, and NULL.
00649 {
00650 const DosFile * File;
00651
00652 File = Handle;
00653
00654 CHECK_HANDLE(File);
00655
00656 if (File->IsDirectory == GE_TRUE)
00657 return GE_FALSE;
00658
00659 assert(File->FileHandle != INVALID_HANDLE_VALUE);
00660
00661 *Position = SetFilePointer(File->FileHandle, 0, NULL, FILE_CURRENT);
00662 if (*Position == -1L)
00663 return GE_FALSE;
00664
00665 return GE_TRUE;
00666 }
|
|
||||||||||||||||||||
|
Definition at line 412 of file fsdos.c. References GE_FALSE, geBoolean, and GENESISCC.
00417 {
00418 return GE_FALSE;
00419 }
|
|
||||||||||||||||
|
Definition at line 554 of file fsdos.c. References CHECK_HANDLE, DWORD, FALSE, DosFile::FileHandle, GE_FALSE, GE_TRUE, geBoolean, GENESISCC, DosFile::IsDirectory, and NULL.
00555 {
00556 DosFile * File;
00557 DWORD BytesWritten;
00558
00559 assert(Buff);
00560 assert(Count != 0);
00561
00562 File = Handle;
00563
00564 CHECK_HANDLE(File);
00565
00566 if (File->IsDirectory == GE_TRUE)
00567 return GE_FALSE;
00568
00569 #ifdef ELIDEBUG
00570 {
00571 FILE * fp;
00572 long Position;
00573
00574 Position = SetFilePointer(File->FileHandle, 0, NULL, FILE_CURRENT);
00575 fp = fopen("c:\\vfs.eli", "ab+");
00576 fprintf(fp, "FSDos_Write: %-8d bytes @ %-8d\r\n", Count, Position);
00577 fclose(fp);
00578 }
00579 #endif
00580
00581 if (WriteFile(File->FileHandle, Buff, Count, &BytesWritten, NULL) == FALSE)
00582 return GE_FALSE;
00583
00584 if ((int)BytesWritten != Count)
00585 return GE_FALSE;
00586
00587 return GE_TRUE;
00588 }
|
|
|
Definition at line 242 of file fsdos.c. References GE_FALSE, GE_TRUE, and geBoolean. Referenced by FSDos_Open().
00243 {
00244 int SlashCount;
00245
00246 // Drive letter test
00247 if (Path[1] == ':' && Path[2] == '\\' && Path[3] == '\0')
00248 {
00249 Path[2] = '\0';
00250 return GE_TRUE;
00251 }
00252
00253 // Now UNC path test
00254 SlashCount = 0;
00255 if (Path[0] == '\\' && Path[1] == '\\')
00256 {
00257 Path += 2;
00258 while (*Path)
00259 {
00260 if (*Path++ == '\\')
00261 SlashCount++;
00262 }
00263 }
00264
00265 if (SlashCount == 1)
00266 return GE_TRUE;
00267
00268 return GE_FALSE;
00269 }
|
|
|
Definition at line 886 of file fsdos.c. Referenced by FSDos_GetAPIs(). |
1.3.2