ReactOS  0.4.13-dev-563-g0561610
fs.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tagDEVVTBL
 

Macros

#define FS_FAT   1
 
#define FS_NTFS   2
 
#define FS_EXT2   3
 
#define FS_ISO9660   5
 
#define PFILE   ULONG
 
#define MAX_FDS   60
 

Typedefs

typedef struct tagDEVVTBL DEVVTBL
 

Functions

ARC_STATUS ArcOpen (CHAR *Path, OPENMODE OpenMode, ULONG *FileId)
 
ARC_STATUS ArcClose (ULONG FileId)
 
ARC_STATUS ArcRead (ULONG FileId, VOID *Buffer, ULONG N, ULONG *Count)
 
ARC_STATUS ArcSeek (ULONG FileId, LARGE_INTEGER *Position, SEEKMODE SeekMode)
 
ARC_STATUS ArcGetFileInformation (ULONG FileId, FILEINFORMATION *Information)
 
VOID FileSystemError (PCSTR ErrorString)
 
PFILE FsOpenFile (PCSTR FileName)
 
VOID FsCloseFile (PFILE FileHandle)
 
BOOLEAN FsReadFile (PFILE FileHandle, ULONG BytesToRead, ULONG *BytesRead, PVOID Buffer)
 
BOOLEAN FsGetFileInformation (PFILE FileHandle, FILEINFORMATION *Information)
 
ULONG FsGetFileSize (PFILE FileHandle)
 
VOID FsSetFilePointer (PFILE FileHandle, ULONG NewFilePointer)
 
ULONG FsGetNumPathParts (PCSTR Path)
 
VOID FsGetFirstNameFromPath (PCHAR Buffer, PCSTR Path)
 
VOID FsRegisterDevice (CHAR *Prefix, const DEVVTBL *FuncTable)
 
LPCWSTR FsGetServiceName (ULONG FileId)
 
VOID FsSetDeviceSpecific (ULONG FileId, VOID *Specific)
 
VOIDFsGetDeviceSpecific (ULONG FileId)
 
ULONG FsGetDeviceId (ULONG FileId)
 
VOID FsInit (VOID)
 

Macro Definition Documentation

◆ FS_EXT2

#define FS_EXT2   3

Definition at line 34 of file fs.h.

◆ FS_FAT

#define FS_FAT   1

Definition at line 32 of file fs.h.

◆ FS_ISO9660

#define FS_ISO9660   5

Definition at line 35 of file fs.h.

◆ FS_NTFS

#define FS_NTFS   2

Definition at line 33 of file fs.h.

◆ MAX_FDS

#define MAX_FDS   60

Definition at line 62 of file fs.h.

◆ PFILE

#define PFILE   ULONG

Definition at line 37 of file fs.h.

Typedef Documentation

◆ DEVVTBL

Function Documentation

◆ ArcClose()

ARC_STATUS ArcClose ( ULONG  FileId)

Definition at line 219 of file fs.c.

220 {
222 
223  if (FileId >= MAX_FDS || !FileData[FileId].FuncTable)
224  return EBADF;
225 
226  Status = FileData[FileId].FuncTable->Close(FileId);
227 
228  if (Status == ESUCCESS)
229  {
230  FileData[FileId].FuncTable = NULL;
231  FileData[FileId].Specific = NULL;
232  FileData[FileId].DeviceId = -1;
233  }
234  return Status;
235 }
static FILEDATA FileData[MAX_FDS]
Definition: fs.c:52
VOID * Specific
Definition: fs.c:40
Definition: arc.h:32
ULONG ARC_STATUS
Definition: arc.h:4
Definition: arc.h:36
ARC_CLOSE Close
Definition: fs.h:24
smooth NULL
Definition: ftsmooth.c:416
#define MAX_FDS
Definition: fs.h:62
ULONG DeviceId
Definition: fs.c:36
const DEVVTBL * FuncTable
Definition: fs.c:38
Status
Definition: gdiplustypes.h:24

Referenced by FsCloseFile(), InfOpenFile(), IniFileInitialize(), LoadOperatingSystem(), SpiScanDevice(), WinLdrLoadImage(), WinLdrLoadModule(), WinLdrLoadNLSData(), and WinLdrLoadSystemHive().

◆ ArcGetFileInformation()

ARC_STATUS ArcGetFileInformation ( ULONG  FileId,
FILEINFORMATION Information 
)

Definition at line 251 of file fs.c.

252 {
253  if (FileId >= MAX_FDS || !FileData[FileId].FuncTable)
254  return EBADF;
255  return FileData[FileId].FuncTable->GetFileInformation(FileId, Information);
256 }
static FILEDATA FileData[MAX_FDS]
Definition: fs.c:52
Definition: arc.h:36
#define MAX_FDS
Definition: fs.h:62
const DEVVTBL * FuncTable
Definition: fs.c:38
ARC_GET_FILE_INFORMATION GetFileInformation
Definition: fs.h:25
Iosb Information
Definition: create.c:4377

Referenced by FatMount(), FsGetFileInformation(), FsGetFileSize(), InfOpenFile(), IniFileInitialize(), RamDiskLoadVirtualFile(), WinLdrLoadModule(), WinLdrLoadNLSData(), and WinLdrLoadSystemHive().

◆ ArcOpen()

ARC_STATUS ArcOpen ( CHAR Path,
OPENMODE  OpenMode,
ULONG FileId 
)

Definition at line 57 of file fs.c.

58 {
60  ULONG Count, i;
61  PLIST_ENTRY pEntry;
62  DEVICE* pDevice;
64  CHAR* FileName;
65  CHAR* p;
66  CHAR* q;
67  SIZE_T Length;
68  OPENMODE DeviceOpenMode;
69  ULONG DeviceId;
70 
71  /* Print status message */
72  TRACE("Opening file '%s'...\n", Path);
73 
74  *FileId = MAX_FDS;
75 
76  /* Search last ')', which delimits device and path */
77  FileName = strrchr(Path, ')');
78  if (!FileName)
79  return EINVAL;
80  FileName++;
81 
82  /* Count number of "()", which needs to be replaced by "(0)" */
83  Count = 0;
84  for (p = Path; p != FileName; p++)
85  {
86  if (*p == '(' && *(p + 1) == ')')
87  Count++;
88  }
89 
90  /* Duplicate device name, and replace "()" by "(0)" (if required) */
91  Length = FileName - Path + Count;
92  if (Count != 0)
93  {
95  if (!DeviceName)
96  return ENOMEM;
97  for (p = Path, q = DeviceName; p != FileName; p++)
98  {
99  *q++ = *p;
100  if (*p == '(' && *(p + 1) == ')')
101  *q++ = '0';
102  }
103  }
104  else
105  {
106  DeviceName = Path;
107  }
108 
109  /* Search for the device */
110  if (OpenMode == OpenReadOnly || OpenMode == OpenWriteOnly)
111  DeviceOpenMode = OpenMode;
112  else
113  DeviceOpenMode = OpenReadWrite;
114 
115  pEntry = DeviceListHead.Flink;
116  while (pEntry != &DeviceListHead)
117  {
118  pDevice = CONTAINING_RECORD(pEntry, DEVICE, ListEntry);
119  if (strncmp(pDevice->Prefix, DeviceName, Length) == 0)
120  {
121  /* OK, device found. It is already opened? */
122  if (pDevice->ReferenceCount == 0)
123  {
124  /* Search some room for the device */
125  for (DeviceId = 0; DeviceId < MAX_FDS; DeviceId++)
126  {
127  if (!FileData[DeviceId].FuncTable)
128  break;
129  }
130  if (DeviceId == MAX_FDS)
131  return EMFILE;
132 
133  /* Try to open the device */
134  FileData[DeviceId].FuncTable = pDevice->FuncTable;
135  Status = pDevice->FuncTable->Open(pDevice->Prefix, DeviceOpenMode, &DeviceId);
136  if (Status != ESUCCESS)
137  {
138  FileData[DeviceId].FuncTable = NULL;
139  return Status;
140  }
141  else if (!*FileName)
142  {
143  /* Done, caller wanted to open the raw device */
144  *FileId = DeviceId;
145  pDevice->ReferenceCount++;
146  return ESUCCESS;
147  }
148 
149  /* Try to detect the file system */
150 #ifndef _M_ARM
151  FileData[DeviceId].FileFuncTable = IsoMount(DeviceId);
152  if (!FileData[DeviceId].FileFuncTable)
153 #endif
154  FileData[DeviceId].FileFuncTable = FatMount(DeviceId);
155  if (!FileData[DeviceId].FileFuncTable)
156  FileData[DeviceId].FileFuncTable = BtrFsMount(DeviceId);
157 #ifndef _M_ARM
158  if (!FileData[DeviceId].FileFuncTable)
159  FileData[DeviceId].FileFuncTable = NtfsMount(DeviceId);
160  if (!FileData[DeviceId].FileFuncTable)
161  FileData[DeviceId].FileFuncTable = Ext2Mount(DeviceId);
162 #endif
163 #if defined(_M_IX86) || defined(_M_AMD64)
164  if (!FileData[DeviceId].FileFuncTable)
165  FileData[DeviceId].FileFuncTable = PxeMount(DeviceId);
166 #endif
167  if (!FileData[DeviceId].FileFuncTable)
168  {
169  /* Error, unable to detect file system */
170  pDevice->FuncTable->Close(DeviceId);
171  FileData[DeviceId].FuncTable = NULL;
172  return ENODEV;
173  }
174 
175  pDevice->DeviceId = DeviceId;
176  }
177  else
178  {
179  DeviceId = pDevice->DeviceId;
180  }
181  pDevice->ReferenceCount++;
182  break;
183  }
184  pEntry = pEntry->Flink;
185  }
186  if (pEntry == &DeviceListHead)
187  return ENODEV;
188 
189  /* At this point, device is found and opened. Its file id is stored
190  * in DeviceId, and FileData[DeviceId].FileFuncTable contains what
191  * needs to be called to open the file */
192 
193  /* Search some room for the device */
194  for (i = 0; i < MAX_FDS; i++)
195  {
196  if (!FileData[i].FuncTable)
197  break;
198  }
199  if (i == MAX_FDS)
200  return EMFILE;
201 
202  /* Skip leading backslash, if any */
203  if (*FileName == '\\')
204  FileName++;
205 
206  /* Open the file */
208  FileData[i].DeviceId = DeviceId;
209  *FileId = i;
210  Status = FileData[i].FuncTable->Open(FileName, OpenMode, FileId);
211  if (Status != ESUCCESS)
212  {
214  *FileId = MAX_FDS;
215  }
216  return Status;
217 }
const DEVVTBL * FileFuncTable
Definition: fs.c:39
static FILEDATA FileData[MAX_FDS]
Definition: fs.c:52
#define TAG_DEVICE_NAME
Definition: fs.c:31
ULONG ReferenceCount
Definition: fs.c:49
static LIST_ENTRY DeviceListHead
Definition: fs.c:53
Definition: arc.h:32
Definition: arc.h:39
char CHAR
Definition: xmlstorage.h:175
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
ULONG ARC_STATUS
Definition: arc.h:4
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
WCHAR DeviceName[]
Definition: adapter.cpp:21
ARC_CLOSE Close
Definition: fs.h:24
Definition: arc.h:48
const DEVVTBL * NtfsMount(ULONG DeviceId)
Definition: ntfs.c:875
NTSTATUS FatMount(_In_ ULONG DeviceId, _In_ ULONG Unknown, _Out_ PBL_FILE_ENTRY *FileEntry)
Definition: fat.c:23
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
FORCEINLINE PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
Definition: mm.h:177
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
#define TRACE(s)
Definition: solgame.cpp:4
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
ARC_OPEN Open
Definition: fs.h:26
const DEVVTBL * FuncTable
Definition: fs.c:46
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
CHAR * Prefix
Definition: fs.c:47
#define MAX_FDS
Definition: fs.h:62
ULONG DeviceId
Definition: fs.c:36
const DEVVTBL * FuncTable
Definition: fs.c:38
Definition: typedefs.h:117
Status
Definition: gdiplustypes.h:24
Definition: arc.h:45
ULONG_PTR SIZE_T
Definition: typedefs.h:78
struct _FileName FileName
Definition: fatprocs.h:884
PRTL_UNICODE_STRING_BUFFER Path
const DEVVTBL * BtrFsMount(ULONG DeviceId)
Definition: btrfs.c:1231
Definition: arc.h:42
const DEVVTBL * IsoMount(ULONG DeviceId)
Definition: iso.c:491
const DEVVTBL * PxeMount(ULONG DeviceId)
Definition: pxe.c:307
const DEVVTBL * Ext2Mount(ULONG DeviceId)
Definition: ext2.c:1300
unsigned int ULONG
Definition: retypes.h:1
Definition: fs.c:43
ULONG DeviceId
Definition: fs.c:48
GLfloat GLfloat p
Definition: glext.h:8902
enum _OPENMODE OPENMODE

Referenced by FsOpenFile(), InfOpenFile(), IniOpenIniFile(), LoadOperatingSystem(), SpiScanDevice(), WinLdrLoadImage(), WinLdrLoadModule(), WinLdrLoadNLSData(), and WinLdrLoadSystemHive().

◆ ArcRead()

ARC_STATUS ArcRead ( ULONG  FileId,
VOID Buffer,
ULONG  N,
ULONG Count 
)

Definition at line 237 of file fs.c.

238 {
239  if (FileId >= MAX_FDS || !FileData[FileId].FuncTable)
240  return EBADF;
241  return FileData[FileId].FuncTable->Read(FileId, Buffer, N, Count);
242 }
static FILEDATA FileData[MAX_FDS]
Definition: fs.c:52
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
Definition: arc.h:36
Definition: bufpool.h:45
ARC_READ Read
Definition: fs.h:27
#define MAX_FDS
Definition: fs.h:62
const DEVVTBL * FuncTable
Definition: fs.c:38

Referenced by disk_read(), Ext2Mount(), FatMount(), FatReadVolumeSectors(), FsReadFile(), InfOpenFile(), IniFileInitialize(), IopReadBootRecord(), IsoBufferDirectory(), IsoLookupFile(), IsoMount(), IsoRead(), NtfsDiskRead(), NtfsMount(), RamDiskLoadVirtualFile(), WinLdrLoadImage(), WinLdrLoadModule(), WinLdrLoadNLSData(), and WinLdrLoadSystemHive().

◆ ArcSeek()

ARC_STATUS ArcSeek ( ULONG  FileId,
LARGE_INTEGER Position,
SEEKMODE  SeekMode 
)

Definition at line 244 of file fs.c.

245 {
246  if (FileId >= MAX_FDS || !FileData[FileId].FuncTable)
247  return EBADF;
248  return FileData[FileId].FuncTable->Seek(FileId, Position, SeekMode);
249 }
static FILEDATA FileData[MAX_FDS]
Definition: fs.c:52
static COORD Position
Definition: mouse.c:34
Definition: arc.h:36
#define MAX_FDS
Definition: fs.h:62
const DEVVTBL * FuncTable
Definition: fs.c:38
ARC_SEEK Seek
Definition: fs.h:28

Referenced by disk_read(), Ext2Mount(), FatMount(), FatReadVolumeSectors(), FsSetFilePointer(), IopReadBootRecord(), IsoBufferDirectory(), IsoLookupFile(), IsoMount(), IsoRead(), NtfsDiskRead(), NtfsMount(), RamDiskLoadVirtualFile(), and WinLdrLoadImage().

◆ FileSystemError()

VOID FileSystemError ( PCSTR  ErrorString)

Definition at line 260 of file fs.c.

261 {
262  ERR("%s\n", ErrorString);
263  UiMessageBox(ErrorString);
264 }
VOID UiMessageBox(PCSTR Format,...)
Definition: ui.c:347
#define ERR(fmt,...)
Definition: debug.h:109

Referenced by Ext2LookupFile(), Ext2ReadBlock(), Ext2ReadDirectory(), Ext2ReadFileBig(), Ext2ReadGroupDescriptors(), Ext2ReadInode(), Ext2ReadSuperBlock(), Ext2SearchDirectoryBufferForFile(), FatOpenVolume(), and NtfsMount().

◆ FsCloseFile()

VOID FsCloseFile ( PFILE  FileHandle)

Definition at line 309 of file fs.c.

310 {
311  ULONG FileId = (ULONG)FileHandle;
312 
313  //
314  // Close the handle. Do not check for error,
315  // this function is supposed to always succeed.
316  //
317  ArcClose(FileId);
318 }
ARC_STATUS ArcClose(ULONG FileId)
Definition: fs.c:219
HANDLE FileHandle
Definition: stats.c:38
unsigned int ULONG
Definition: retypes.h:1

Referenced by RamDiskLoadVirtualFile().

◆ FsGetDeviceId()

ULONG FsGetDeviceId ( ULONG  FileId)

Definition at line 481 of file fs.c.

482 {
483  if (FileId >= MAX_FDS)
484  return (ULONG)-1;
485  return FileData[FileId].DeviceId;
486 }
static FILEDATA FileData[MAX_FDS]
Definition: fs.c:52
#define MAX_FDS
Definition: fs.h:62
ULONG DeviceId
Definition: fs.c:36
unsigned int ULONG
Definition: retypes.h:1

Referenced by FatOpen(), IsoOpen(), IsoRead(), and NtfsOpen().

◆ FsGetDeviceSpecific()

VOID* FsGetDeviceSpecific ( ULONG  FileId)

Definition at line 474 of file fs.c.

475 {
476  if (FileId >= MAX_FDS || !FileData[FileId].FuncTable)
477  return NULL;
478  return FileData[FileId].Specific;
479 }
static FILEDATA FileData[MAX_FDS]
Definition: fs.c:52
VOID * Specific
Definition: fs.c:40
smooth NULL
Definition: ftsmooth.c:416
#define MAX_FDS
Definition: fs.h:62

Referenced by BtrFsClose(), BtrFsGetFileInformation(), BtrFsRead(), BtrFsSeek(), DiskClose(), DiskGetFileInformation(), DiskRead(), DiskSeek(), Ext2Close(), Ext2GetFileInformation(), Ext2Read(), Ext2Seek(), FatClose(), FatGetFileInformation(), FatRead(), FatSeek(), IsoClose(), IsoGetFileInformation(), IsoRead(), IsoSeek(), NtfsClose(), NtfsGetFileInformation(), NtfsRead(), and NtfsSeek().

◆ FsGetFileInformation()

BOOLEAN FsGetFileInformation ( PFILE  FileHandle,
FILEINFORMATION Information 
)

Definition at line 334 of file fs.c.

335 {
336  ULONG FileId = (ULONG)FileHandle;
337 
338  //
339  // Get file information
340  //
341  return (ArcGetFileInformation(FileId, Information) == ESUCCESS);
342 }
ARC_STATUS ArcGetFileInformation(ULONG FileId, FILEINFORMATION *Information)
Definition: fs.c:251
Definition: arc.h:32
HANDLE FileHandle
Definition: stats.c:38
unsigned int ULONG
Definition: retypes.h:1
Iosb Information
Definition: create.c:4377

◆ FsGetFileSize()

ULONG FsGetFileSize ( PFILE  FileHandle)

Definition at line 344 of file fs.c.

345 {
346  ULONG FileId = (ULONG)FileHandle;
349 
350  //
351  // Query file informations
352  //
354 
355  //
356  // Check for error
357  //
358  if (Status != ESUCCESS || Information.EndingAddress.HighPart != 0)
359  return 0;
360 
361  //
362  // Return file size
363  //
364  return Information.EndingAddress.LowPart;
365 }
ARC_STATUS ArcGetFileInformation(ULONG FileId, FILEINFORMATION *Information)
Definition: fs.c:251
Definition: arc.h:32
ULONG ARC_STATUS
Definition: arc.h:4
HANDLE FileHandle
Definition: stats.c:38
Status
Definition: gdiplustypes.h:24
unsigned int ULONG
Definition: retypes.h:1
Iosb Information
Definition: create.c:4377

Referenced by FrLdrLoadModule().

◆ FsGetFirstNameFromPath()

VOID FsGetFirstNameFromPath ( PCHAR  Buffer,
PCSTR  Path 
)

Definition at line 414 of file fs.c.

415 {
416  size_t i;
417  size_t len;
418 
419  len = strlen(Path);
420 
421  // Copy all the characters up to the end of the
422  // string or until we hit a '\' character
423  // and put them in Buffer
424  for (i = 0; i < len; i++)
425  {
426  if ((Path[i] == '\\') || (Path[i] == '/'))
427  {
428  break;
429  }
430  else
431  {
432  Buffer[i] = Path[i];
433  }
434  }
435 
436  Buffer[i] = 0;
437 
438  TRACE("FsGetFirstNameFromPath() Path = %s FirstName = %s\n", Path, Buffer);
439 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
Definition: bufpool.h:45
#define TRACE(s)
Definition: solgame.cpp:4
GLenum GLsizei len
Definition: glext.h:6722
PRTL_UNICODE_STRING_BUFFER Path

Referenced by Ext2LookupFile(), FatLookupFile(), IsoLookupFile(), and NtfsLookupFile().

◆ FsGetNumPathParts()

ULONG FsGetNumPathParts ( PCSTR  Path)

Definition at line 386 of file fs.c.

387 {
388  size_t i;
389  size_t len;
390  ULONG num;
391 
392  len = strlen(Path);
393 
394  for (i = 0, num = 0; i < len; i++)
395  {
396  if ((Path[i] == '\\') || (Path[i] == '/'))
397  {
398  num++;
399  }
400  }
401  num++;
402 
403  TRACE("FsGetNumPathParts() Path = %s NumPathParts = %d\n", Path, num);
404 
405  return num;
406 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define TRACE(s)
Definition: solgame.cpp:4
GLuint GLuint num
Definition: glext.h:9618
GLenum GLsizei len
Definition: glext.h:6722
PRTL_UNICODE_STRING_BUFFER Path
unsigned int ULONG
Definition: retypes.h:1

Referenced by Ext2LookupFile(), FatLookupFile(), IsoLookupFile(), and NtfsLookupFile().

◆ FsGetServiceName()

LPCWSTR FsGetServiceName ( ULONG  FileId)

Definition at line 460 of file fs.c.

461 {
462  if (FileId >= MAX_FDS || !FileData[FileId].FuncTable)
463  return NULL;
464  return FileData[FileId].FuncTable->ServiceName;
465 }
LPCWSTR ServiceName
Definition: fs.h:29
static FILEDATA FileData[MAX_FDS]
Definition: fs.c:52
smooth NULL
Definition: ftsmooth.c:416
#define MAX_FDS
Definition: fs.h:62
const DEVVTBL * FuncTable
Definition: fs.c:38

Referenced by WinLdrLoadSystemHive().

◆ FsInit()

VOID FsInit ( VOID  )

Definition at line 488 of file fs.c.

489 {
490  ULONG i;
491 
492  RtlZeroMemory(FileData, sizeof(FileData));
493  for (i = 0; i < MAX_FDS; i++)
494  FileData[i].DeviceId = (ULONG)-1;
495 
497 
498  // FIXME: Retrieve the current boot device with MachDiskGetBootPath
499  // and store it somewhere in order to not call again and again this
500  // function.
501 }
static FILEDATA FileData[MAX_FDS]
Definition: fs.c:52
static LIST_ENTRY DeviceListHead
Definition: fs.c:53
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define MAX_FDS
Definition: fs.h:62
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261

Referenced by BootMain().

◆ FsOpenFile()

PFILE FsOpenFile ( PCSTR  FileName)

Definition at line 266 of file fs.c.

267 {
268  CHAR FullPath[MAX_PATH] = "";
269  ULONG FileId;
271 
272  //
273  // Print status message
274  //
275  TRACE("Opening file '%s'...\n", FileName);
276 
277  //
278  // Check whether FileName is a full path
279  // and if not, create a full file name.
280  //
281  // See ArcOpen: Search last ')', which delimits device and path.
282  //
283  if (strrchr(FileName, ')') == NULL)
284  {
285  /* This is not a full path. Use the current (i.e. boot) device. */
286  MachDiskGetBootPath(FullPath, sizeof(FullPath));
287 
288  /* Append a path separator if needed */
289  if (FileName[0] != '\\' && FileName[0] != '/')
290  strcat(FullPath, "\\");
291  }
292  // Append (or just copy) the remaining file name.
293  strcat(FullPath, FileName);
294 
295  //
296  // Open the file
297  //
298  Status = ArcOpen(FullPath, OpenReadOnly, &FileId);
299 
300  //
301  // Check for success
302  //
303  if (Status == ESUCCESS)
304  return (PFILE)FileId;
305  else
306  return (PFILE)0;
307 }
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
Definition: arc.h:32
char CHAR
Definition: xmlstorage.h:175
ULONG ARC_STATUS
Definition: arc.h:4
ARC_STATUS ArcOpen(CHAR *Path, OPENMODE OpenMode, ULONG *FileId)
Definition: fs.c:57
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define MAX_PATH
Definition: compat.h:26
Status
Definition: gdiplustypes.h:24
#define MachDiskGetBootPath(Path, Size)
Definition: machine.h:118
unsigned int ULONG
Definition: retypes.h:1
#define PFILE
Definition: fs.h:37

Referenced by RamDiskLoadVirtualFile().

◆ FsReadFile()

BOOLEAN FsReadFile ( PFILE  FileHandle,
ULONG  BytesToRead,
ULONG BytesRead,
PVOID  Buffer 
)

Definition at line 324 of file fs.c.

325 {
326  ULONG FileId = (ULONG)FileHandle;
327 
328  //
329  // Read the file
330  //
331  return (ArcRead(FileId, Buffer, BytesToRead, BytesRead) == ESUCCESS);
332 }
Definition: arc.h:32
HANDLE FileHandle
Definition: stats.c:38
ARC_STATUS ArcRead(ULONG FileId, VOID *Buffer, ULONG N, ULONG *Count)
Definition: fs.c:237
Definition: bufpool.h:45
unsigned int ULONG
Definition: retypes.h:1
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesRead
Definition: fltkernel.h:1255

Referenced by FrLdrLoadModule(), and FrLdrMapModule().

◆ FsRegisterDevice()

VOID FsRegisterDevice ( CHAR Prefix,
const DEVVTBL FuncTable 
)

Definition at line 441 of file fs.c.

442 {
443  DEVICE* pNewEntry;
444  SIZE_T Length;
445 
446  TRACE("FsRegisterDevice() Prefix = %s\n", Prefix);
447 
448  Length = strlen(Prefix) + 1;
449  pNewEntry = FrLdrTempAlloc(sizeof(DEVICE) + Length, TAG_DEVICE);
450  if (!pNewEntry)
451  return;
452  pNewEntry->FuncTable = FuncTable;
453  pNewEntry->ReferenceCount = 0;
454  pNewEntry->Prefix = (CHAR*)(pNewEntry + 1);
455  memcpy(pNewEntry->Prefix, Prefix, Length);
456 
457  InsertHeadList(&DeviceListHead, &pNewEntry->ListEntry);
458 }
_In_ __drv_aliasesMem PSTRING Prefix
Definition: rtlfuncs.h:1631
ULONG ReferenceCount
Definition: fs.c:49
static LIST_ENTRY DeviceListHead
Definition: fs.c:53
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
FORCEINLINE VOID InsertHeadList(_Inout_ PLIST_ENTRY ListHead, _Inout_ __drv_aliasesMem PLIST_ENTRY Entry)
Definition: rtlfuncs.h:201
char CHAR
Definition: xmlstorage.h:175
FORCEINLINE PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
Definition: mm.h:177
LIST_ENTRY ListEntry
Definition: fs.c:45
#define TRACE(s)
Definition: solgame.cpp:4
const DEVVTBL * FuncTable
Definition: fs.c:46
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
CHAR * Prefix
Definition: fs.c:47
#define TAG_DEVICE
Definition: fs.c:32
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
ULONG_PTR SIZE_T
Definition: typedefs.h:78
Definition: fs.c:43

Referenced by GetHarddiskInformation(), PcInitializeBootDevices(), PxeInit(), RamDiskInitialize(), SpiScanAdapter(), and SpiScanDevice().

◆ FsSetDeviceSpecific()

VOID FsSetDeviceSpecific ( ULONG  FileId,
VOID Specific 
)

Definition at line 467 of file fs.c.

468 {
469  if (FileId >= MAX_FDS || !FileData[FileId].FuncTable)
470  return;
471  FileData[FileId].Specific = Specific;
472 }
static FILEDATA FileData[MAX_FDS]
Definition: fs.c:52
VOID * Specific
Definition: fs.c:40
#define MAX_FDS
Definition: fs.h:62

Referenced by BtrFsOpen(), DiskOpen(), Ext2Open(), FatOpen(), IsoOpen(), and NtfsOpen().

◆ FsSetFilePointer()

VOID FsSetFilePointer ( PFILE  FileHandle,
ULONG  NewFilePointer 
)

Definition at line 367 of file fs.c.

368 {
369  ULONG FileId = (ULONG)FileHandle;
371 
372  //
373  // Set file position. Do not check for error,
374  // this function is supposed to always succeed.
375  //
376  Position.HighPart = 0;
377  Position.LowPart = NewFilePointer;
378  ArcSeek(FileId, &Position, SeekAbsolute);
379 }
static COORD Position
Definition: mouse.c:34
HANDLE FileHandle
Definition: stats.c:38
ARC_STATUS ArcSeek(ULONG FileId, LARGE_INTEGER *Position, SEEKMODE SeekMode)
Definition: fs.c:244
unsigned int ULONG
Definition: retypes.h:1

Referenced by FrLdrMapModule().