ReactOS 0.4.16-dev-1946-g52006dd
fs.c
Go to the documentation of this file.
1/*
2 * FreeLoader
3 * Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com>
4 * Copyright (C) 2008-2009 Hervé Poussineau <hpoussin@reactos.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21/* INCLUDES *******************************************************************/
22
23#include <freeldr.h>
24
25#include <debug.h>
27
28/* GLOBALS ********************************************************************/
29
30#define TAG_DEVICE_NAME 'NDsF'
31#define TAG_DEVICE 'vDsF'
32
33typedef struct tagDEVICE
34{
42
43typedef struct tagFILEDATA
44{
50
53
54#define IS_VALID_FILEID(FileId) \
55 ((ULONG)(FileId) < _countof(FileData) && FileData[(ULONG)(FileId)].FuncTable)
56
57typedef const DEVVTBL* (*PFS_MOUNT)(ULONG DeviceId);
58
60{
61#ifndef _M_ARM
63#endif
66#ifndef _M_ARM
69#endif
70#if defined(_M_IX86) || defined(_M_AMD64)
71#ifndef UEFIBOOT
73#endif
74#endif
75};
76
77
78/* DEBUGGING HELPERS **********************************************************/
79
80#if DBG && 0
81static VOID
82DumpDeviceList(VOID)
83{
85
86 DbgPrint("\n== Dumping ARC devices ==\n");
87
91 {
93 ULONG DeviceId = pDevice->DeviceId;
94 const DEVVTBL* FuncTable;
95
96 DbgPrint("\n"
97 "DeviceId %lu\n"
98 " RefCount: %lu\n"
99 " DeviceName : '%s'\n",
100 DeviceId, pDevice->ReferenceCount, pDevice->DeviceName);
101
102 FuncTable = pDevice->FuncTable;
103 DbgPrint(" DevFuncTable: 0x%p (In array: 0x%p) ; Name: '%S'\n",
104 FuncTable,
105 (DeviceId != INVALID_FILE_ID ? FileData[DeviceId].FuncTable : NULL),
106 (FuncTable && FuncTable->ServiceName)
107 ? FuncTable->ServiceName : L"n/a");
108
109 FuncTable = pDevice->FileFuncTable;
110 DbgPrint(" FileFuncTable: 0x%p ; Name: '%S'\n",
111 FuncTable,
112 (FuncTable && FuncTable->ServiceName)
113 ? FuncTable->ServiceName : L"n/a");
114 }
115
116 DbgPrint("\n== END Dumping ARC devices ==\n\n");
117}
118
119static VOID
120DumpFileTable(VOID)
121{
122 ULONG i;
123
124 DbgPrint("\n== Dumping ARC files table ==\n");
125
126 for (i = 0; i < _countof(FileData); ++i)
127 {
128 FILEDATA* pFileData = &FileData[i];
129 const DEVVTBL* FuncTable;
130
131 /* Show only occupied slots */
132 if (!pFileData->FuncTable)
133 continue;
134
135 DbgPrint("\n"
136 "FileId %lu\n"
137 " RefCount: %lu\n"
138 " ParentDeviceId: %lu\n"
139 /*" FileName : '%s'\n"*/
140 " Specific: 0x%p\n",
141 i, pFileData->ReferenceCount,
142 pFileData->DeviceId, pFileData->Specific);
143
144 FuncTable = pFileData->FuncTable;
145 DbgPrint(" FuncTable: 0x%p ; Name: '%S'\n",
146 FuncTable,
147 (FuncTable && FuncTable->ServiceName)
148 ? FuncTable->ServiceName : L"n/a");
149 }
150
151 DbgPrint("\n== END Dumping ARC files table ==\n\n");
152}
153#endif // DBG
154
155
156/* ARC FUNCTIONS **************************************************************/
157
179PCHAR
183{
184 ULONG Count;
185 SIZE_T NameLength;
186 PCCH p, End;
187 PCHAR q, NormName;
188
189 NameLength = *Length;
190 End = DeviceName + NameLength;
191
192 /* Count the number of "()", which needs to be replaced by "(0)" */
193 Count = 0;
194 for (p = DeviceName; p < End; ++p)
195 {
196 if ((p + 1) < End && *p == '(' && *(p + 1) == ')')
197 ++Count; //, ++p;
198 }
199
200 if (Count == 0) /* No need to duplicate the device name */
201 return (PCHAR)DeviceName;
202
203 /* Return the updated length */
204 *Length = NameLength + Count;
205
206 /* Duplicate the device name and replace "()" by "(0)" */
208 if (!NormName)
209 return NULL;
210 for (p = DeviceName, q = NormName; p < End; ++p)
211 {
212 *q++ = *p;
213 if ((p + 1) < End && *p == '(' && *(p + 1) == ')')
214 *q++ = '0'; //, *q++ = *++p;
215 }
216 return NormName;
217}
218
220{
222 ULONG i;
228 OPENMODE DeviceOpenMode;
229 ULONG DeviceId;
230
231 /* Print status message */
232 TRACE("Opening file '%s'...\n", Path);
233
234 *FileId = INVALID_FILE_ID;
235
236 /* Search last ')', which delimits device and path */
237 FileName = strrchr(Path, ')');
238 if (!FileName)
239 return EINVAL;
240 ++FileName;
241
242 /* Normalize the device name, replacing "()" by "(0)" if necessary */
243 Length = FileName - Path;
245 if (!DeviceName)
246 return ENOMEM;
247
248 if (OpenMode == OpenReadOnly || OpenMode == OpenWriteOnly)
249 DeviceOpenMode = OpenMode;
250 else
251 DeviceOpenMode = OpenReadWrite;
252
253 /* Search for the registered device */
254 pDevice = NULL;
258 {
259 pDevice = CONTAINING_RECORD(pEntry, DEVICE, ListEntry);
260 if ((strlen(pDevice->DeviceName) == Length) && (strncmp(pDevice->DeviceName, DeviceName, Length) == 0))
261 break;
262 }
263
264 /* Cleanup */
265 if (DeviceName != Path)
268
269 if (pEntry == &DeviceListHead)
270 return ENODEV;
271
272 /* OK, device found. Is it already opened? */
273 if (pDevice->ReferenceCount == 0)
274 {
275 /* Find some room for the device */
276 for (DeviceId = 0; ; ++DeviceId)
277 {
278 if (DeviceId >= _countof(FileData))
279 return EMFILE;
280 if (!FileData[DeviceId].FuncTable)
281 break;
282 }
283
284 /* Try to open the device */
285 FileData[DeviceId].ReferenceCount = 0;
286 FileData[DeviceId].FuncTable = pDevice->FuncTable;
287 Status = pDevice->FuncTable->Open(pDevice->DeviceName, DeviceOpenMode, &DeviceId);
288 if (Status != ESUCCESS)
289 {
290 FileData[DeviceId].FuncTable = NULL;
291 return Status;
292 }
293 pDevice->DeviceId = DeviceId;
294 }
295 else
296 {
297 /* Reuse the existing entry */
298 DeviceId = pDevice->DeviceId;
299 ASSERT(FileData[DeviceId].FuncTable == pDevice->FuncTable);
300 }
301
302 /* Done, increase the device reference count */
303 pDevice->ReferenceCount++;
304 FileData[DeviceId].ReferenceCount++;
305
306 if (!*FileName)
307 {
308 /* The caller wanted to open the raw device: return its ID */
309 *FileId = DeviceId;
310 return ESUCCESS;
311 }
312
313
314 /*
315 * We are opening a file.
316 */
317
318 /* Find some room for the file */
319 for (i = 0; ; ++i)
320 {
321 if (i >= _countof(FileData))
322 {
323 Status = EMFILE;
324 goto Done;
325 }
326 if (!FileData[i].FuncTable)
327 break;
328 }
329
330 /* The device is accessed using filesystem semantics.
331 * Try to detect the file system if not already done. */
332 if (!pDevice->FileFuncTable && (pDevice->ReferenceCount <= 1))
333 {
334 for (ULONG fs = 0; fs < _countof(FileSystems); ++fs)
335 {
336 pDevice->FileFuncTable = FileSystems[fs](DeviceId);
337 if (pDevice->FileFuncTable)
338 break;
339 }
340 }
341 if (!pDevice->FileFuncTable)
342 {
343 /* Error, unable to detect the file system */
344 Status = ENOENT; // ENXIO;
345 goto Done;
346 }
347
348 /*
349 * At this point, the device is found and opened. Its file ID is stored
350 * in DeviceId, and pDevice->FileFuncTable contains what needs to be
351 * called to manipulate the file.
352 */
353
354 /* Open the file */
355 FileData[i].DeviceId = DeviceId;
357 FileData[i].FuncTable = pDevice->FileFuncTable;
358 *FileId = i;
359 Status = FileData[i].FuncTable->Open(FileName, OpenMode, FileId);
360 if (Status != ESUCCESS)
361 {
365 *FileId = INVALID_FILE_ID;
366 }
367 else
368 {
369 /* Reference the file */
371 }
372
373Done:
374 /* If we failed somewhere, dereference the device as well */
375 if (Status != ESUCCESS)
376 {
377 // ArcClose(DeviceId);
378 if (--FileData[DeviceId].ReferenceCount == 0)
379 {
380 (void)FileData[DeviceId].FuncTable->Close(DeviceId);
382 FileData[DeviceId].FuncTable = NULL;
383 FileData[DeviceId].Specific = NULL;
384 }
385 if (--pDevice->ReferenceCount == 0)
386 pDevice->DeviceId = INVALID_FILE_ID;
387 }
388
389 return Status;
390}
391
392static DEVICE*
394{
396
400 {
402 if (pDevice->DeviceId == DeviceId)
403 return pDevice;
404 }
405 return NULL;
406}
407
410 _In_ ULONG FileId)
411{
412 ULONG DeviceId;
414
415 if (!IS_VALID_FILEID(FileId))
416 return EBADF;
417
418 /* Retrieve the parent device's ID if any, for later */
419 DeviceId = FileData[FileId].DeviceId;
420
421 /* Dereference the file and close it if needed */
422 ASSERT(FileData[FileId].ReferenceCount > 0);
423 if (--FileData[FileId].ReferenceCount == 0)
424 {
425 (void)FileData[FileId].FuncTable->Close(FileId);
427 FileData[FileId].FuncTable = NULL;
428 FileData[FileId].Specific = NULL;
429 }
430
431 /* Check whether this file actually references a device */
432 pDevice = FsGetDeviceById(FileId);
433 if (pDevice)
434 {
435 /* It does, dereference it */
436 ASSERT(pDevice->ReferenceCount > 0);
437 if (--pDevice->ReferenceCount == 0)
438 pDevice->DeviceId = INVALID_FILE_ID;
439 }
440
441 /* And dereference the parent device too, if there is one */
442 if (IS_VALID_FILEID(DeviceId))
443 ArcClose(DeviceId);
444
445 return ESUCCESS;
446}
447
449{
450 if (!IS_VALID_FILEID(FileId))
451 return EBADF;
452 return FileData[FileId].FuncTable->Read(FileId, Buffer, N, Count);
453}
454
456{
457 if (!IS_VALID_FILEID(FileId))
458 return EBADF;
459 return FileData[FileId].FuncTable->Seek(FileId, Position, SeekMode);
460}
461
463{
464 if (!IS_VALID_FILEID(FileId))
465 return EBADF;
466 return FileData[FileId].FuncTable->GetFileInformation(FileId, Information);
467}
468
469/* FUNCTIONS ******************************************************************/
470
472{
473 ERR("%s\n", ErrorString);
474 UiMessageBox(ErrorString);
475}
476
480 IN PCSTR DefaultPath OPTIONAL,
481 IN OPENMODE OpenMode,
482 OUT PULONG FileId)
483{
485 SIZE_T cchPathLen;
486 CHAR FullPath[MAX_PATH] = "";
487
488 /*
489 * Check whether FileName is a full path and if not, create a full
490 * file name using the user-provided default path (if present).
491 *
492 * See ArcOpen(): Search last ')', which delimits device and path.
493 */
494 if (strrchr(FileName, ')') == NULL)
495 {
496 /* This is not a full path: prepend the user-provided default path */
497 if (DefaultPath)
498 {
499 Status = RtlStringCbCopyA(FullPath, sizeof(FullPath), DefaultPath);
500 if (!NT_SUCCESS(Status))
501 return ENAMETOOLONG;
502 }
503
504 /* Append a path separator if needed */
505
506 cchPathLen = min(sizeof(FullPath)/sizeof(CHAR), strlen(FullPath));
507 if (cchPathLen >= sizeof(FullPath)/sizeof(CHAR))
508 return ENAMETOOLONG;
509
510 if ((*FileName != '\\' && *FileName != '/') &&
511 cchPathLen > 0 && (FullPath[cchPathLen-1] != '\\' && FullPath[cchPathLen-1] != '/'))
512 {
513 /* FileName does not start with '\' and FullPath does not end with '\' */
514 Status = RtlStringCbCatA(FullPath, sizeof(FullPath), "\\");
515 if (!NT_SUCCESS(Status))
516 return ENAMETOOLONG;
517 }
518 else if ((*FileName == '\\' || *FileName == '/') &&
519 cchPathLen > 0 && (FullPath[cchPathLen-1] == '\\' || FullPath[cchPathLen-1] == '/'))
520 {
521 /* FileName starts with '\' and FullPath ends with '\' */
522 while (*FileName == '\\' || *FileName == '/')
523 ++FileName; // Skip any backslash
524 }
525 }
526 /* Append (or just copy) the remaining file name */
527 Status = RtlStringCbCatA(FullPath, sizeof(FullPath), FileName);
528 if (!NT_SUCCESS(Status))
529 return ENAMETOOLONG;
530
531 /* Open the file */
532 return ArcOpen(FullPath, OpenMode, FileId);
533}
534
542 _In_ ULONG DeviceId,
543 _Out_ PULONGLONG VolumeSize)
544{
546 const DEVVTBL* FuncTable;
548 ULONGLONG (*pFsGetVolumeSize)(_In_ ULONG DeviceId);
549
550 /* Check whether this file actually references a device */
551 pDevice = FsGetDeviceById(DeviceId);
552 if (!pDevice)
553 return EBADF; /* It doesn't, fail */
554
555 *VolumeSize = 0;
556
557 // TODO: Mount the device, if not already done?
558#if 1 // FIXME: TEMP HACK!
559 if (!pDevice->FileFuncTable && (pDevice->ReferenceCount <= 1))
560 {
561 for (ULONG fs = 0; fs < _countof(FileSystems); ++fs)
562 {
563 pDevice->FileFuncTable = FileSystems[fs](DeviceId);
564 if (pDevice->FileFuncTable)
565 break;
566 }
567 }
568#endif
569 // TODO: Use a virtual table function member for easily handling other file systems.
570
571 /* Check that the device is mounted (non-NULL FileFuncTable)
572 * and there is an associated "service" (file-system) name. */
573 FuncTable = pDevice->FileFuncTable;
574 ServiceName = (FuncTable && FuncTable->ServiceName)
575 ? FuncTable->ServiceName : NULL;
576 if (!ServiceName)
577 {
578 ERR("Non-mounted device %lu\n", DeviceId);
579 return ENXIO;
580 }
581
582 /* HACK: Since we don't currently use a virtual table function member,
583 * we instead do a manual lookup over the file-system name.
584 * The ordering follows that of the FileSystems[] table. */
585#ifndef _M_ARM
586 if (!_wcsicmp(ServiceName, L"cdfs"))
587 pFsGetVolumeSize = IsoGetVolumeSize;
588 else
589#endif
590 if (!_wcsicmp(ServiceName, L"fastfat") || !_wcsicmp(ServiceName, L"vfatfs"))
591 pFsGetVolumeSize = FatGetVolumeSize;
592 else
593 if (!_wcsicmp(ServiceName, L"btrfs"))
594 pFsGetVolumeSize = BtrFsGetVolumeSize;
595 else
596#ifndef _M_ARM
597 if (!_wcsicmp(ServiceName, L"ntfs"))
598 pFsGetVolumeSize = NtfsGetVolumeSize;
599 else
600 if (!_wcsicmp(ServiceName, L"ext2fs"))
601 pFsGetVolumeSize = ExtGetVolumeSize;
602 else
603#endif
604 {
605 ERR("Unsupported file system '%S' on storage device %lu\n", ServiceName, DeviceId);
606 return EIO; // ENXIO;
607 }
608 *VolumeSize = pFsGetVolumeSize(DeviceId);
609 return ESUCCESS;
610}
611
612/*
613 * FsGetNumPathParts()
614 * This function parses a path in the form of dir1\dir2\file1.ext
615 * and returns the number of parts it has (i.e. 3 - dir1,dir2,file1.ext).
616 */
618{
619 size_t i;
620 size_t len;
621 ULONG num;
622
623 len = strlen(Path);
624
625 for (i = 0, num = 0; i < len; i++)
626 {
627 if ((Path[i] == '\\') || (Path[i] == '/'))
628 {
629 num++;
630 }
631 }
632 num++;
633
634 TRACE("FsGetNumPathParts() Path = %s NumPathParts = %d\n", Path, num);
635
636 return num;
637}
638
639/*
640 * FsGetFirstNameFromPath()
641 * This function parses a path in the form of dir1\dir2\file1.ext
642 * and puts the first name of the path (e.g. "dir1") in buffer
643 * compatible with the MSDOS directory structure.
644 */
646{
647 size_t i;
648 size_t len;
649
650 len = strlen(Path);
651
652 // Copy all the characters up to the end of the
653 // string or until we hit a '\' character
654 // and put them in Buffer
655 for (i = 0; i < len; i++)
656 {
657 if ((Path[i] == '\\') || (Path[i] == '/'))
658 {
659 break;
660 }
661 else
662 {
663 Buffer[i] = Path[i];
664 }
665 }
666
667 Buffer[i] = 0;
668
669 TRACE("FsGetFirstNameFromPath() Path = %s FirstName = %s\n", Path, Buffer);
670}
671
672VOID
675 _In_ const DEVVTBL* FuncTable)
676{
677 DEVICE* pNewEntry;
679
680 TRACE("FsRegisterDevice(%s)\n", DeviceName);
681
682 Length = strlen(DeviceName) + 1;
683 pNewEntry = FrLdrTempAlloc(sizeof(DEVICE) + Length, TAG_DEVICE);
684 if (!pNewEntry)
685 return;
686 pNewEntry->FuncTable = FuncTable;
687 pNewEntry->DeviceId = INVALID_FILE_ID;
688 pNewEntry->ReferenceCount = 0;
689 pNewEntry->DeviceName = (PSTR)(pNewEntry + 1);
691
693}
694
696{
697 if (!IS_VALID_FILEID(FileId))
698 return NULL;
699 return FileData[FileId].FuncTable->ServiceName;
700}
701
703{
704 if (!IS_VALID_FILEID(FileId))
705 return;
706 FileData[FileId].Specific = Specific;
707}
708
710{
711 if (!IS_VALID_FILEID(FileId))
712 return NULL;
713 return FileData[FileId].Specific;
714}
715
717{
718 if (FileId >= _countof(FileData)) // !IS_VALID_FILEID(FileId)
719 return INVALID_FILE_ID;
720 return FileData[FileId].DeviceId;
721}
722
724{
725 ULONG i;
726
728 for (i = 0; i < _countof(FileData); ++i)
729 FileData[i].DeviceId = INVALID_FILE_ID;
730
732}
#define N
Definition: crc32.c:57
PRTL_UNICODE_STRING_BUFFER Path
#define ENOENT
Definition: acclib.h:79
#define EINVAL
Definition: acclib.h:90
#define ENOMEM
Definition: acclib.h:84
#define EIO
Definition: acclib.h:81
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
#define ENODEV
Definition: acclib.h:89
#define EBADF
Definition: acclib.h:82
LONG NTSTATUS
Definition: precomp.h:26
static WCHAR ServiceName[]
Definition: browser.c:20
#define ERR(fmt,...)
Definition: precomp.h:57
NTSTATUS FatMount(_In_ ULONG DeviceId, _In_ ULONG Unknown, _Out_ PBL_FILE_ENTRY *FileEntry)
Definition: fat.c:23
#define DBG_DEFAULT_CHANNEL(ch)
Definition: debug.h:106
ULONGLONG BtrFsGetVolumeSize(_In_ ULONG DeviceId)
Returns the size of the BTRFS volume laid on the storage media device opened via DeviceId.
Definition: btrfs.c:1342
const DEVVTBL * BtrFsMount(ULONG DeviceId)
Definition: btrfs.c:1363
ULONGLONG ExtGetVolumeSize(_In_ ULONG DeviceId)
Returns the size of the EXT2/3/4 volume laid on the storage media device opened via DeviceId.
Definition: ext.c:1404
const DEVVTBL * ExtMount(ULONG DeviceId)
Definition: ext.c:1431
ULONGLONG FatGetVolumeSize(_In_ ULONG DeviceId)
Returns the size of the FAT volume laid on the storage media device opened via DeviceId.
Definition: fat.c:1616
ULONGLONG NtfsGetVolumeSize(_In_ ULONG DeviceId)
Returns the size of the NTFS volume laid on the storage media device opened via DeviceId.
Definition: ntfs.c:919
const DEVVTBL * NtfsMount(ULONG DeviceId)
Definition: ntfs.c:938
#define MAX_FDS
Definition: fs.h:34
#define INVALID_FILE_ID
Definition: fs.h:35
VOID FrLdrTempFree(PVOID Allocation, ULONG Tag)
Definition: heap.c:553
PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
Definition: heap.c:545
VOID UiMessageBox(_In_ PCSTR Format,...)
Definition: ui.c:359
#define IS_VALID_FILEID(FileId)
Definition: fs.c:54
ARC_STATUS ArcGetFileInformation(ULONG FileId, FILEINFORMATION *Information)
Definition: fs.c:462
#define TAG_DEVICE
Definition: fs.c:31
ARC_STATUS ArcSeek(ULONG FileId, LARGE_INTEGER *Position, SEEKMODE SeekMode)
Definition: fs.c:455
PFS_MOUNT FileSystems[]
Definition: fs.c:59
ARC_STATUS ArcOpen(CHAR *Path, OPENMODE OpenMode, ULONG *FileId)
Definition: fs.c:219
static LIST_ENTRY DeviceListHead
Definition: fs.c:52
PVOID FsGetDeviceSpecific(ULONG FileId)
Definition: fs.c:709
ULONG FsGetNumPathParts(PCSTR Path)
Definition: fs.c:617
VOID FsSetDeviceSpecific(ULONG FileId, PVOID Specific)
Definition: fs.c:702
ARC_STATUS FsOpenFile(IN PCSTR FileName, IN PCSTR DefaultPath OPTIONAL, IN OPENMODE OpenMode, OUT PULONG FileId)
Definition: fs.c:478
ARC_STATUS ArcClose(_In_ ULONG FileId)
Definition: fs.c:409
VOID FileSystemError(PCSTR ErrorString)
Definition: fs.c:471
struct tagFILEDATA FILEDATA
PCHAR NormalizeArcDeviceName(_In_ PCCH DeviceName, _Inout_ PSIZE_T Length)
Replace "()" by "(0)" in the given ARC device name, if necessary.
Definition: fs.c:180
ULONG FsGetDeviceId(ULONG FileId)
Definition: fs.c:716
#define TAG_DEVICE_NAME
Definition: fs.c:30
PCWSTR FsGetServiceName(ULONG FileId)
Definition: fs.c:695
struct tagDEVICE DEVICE
static DEVICE * FsGetDeviceById(ULONG DeviceId)
Definition: fs.c:393
static FILEDATA FileData[MAX_FDS]
Definition: fs.c:51
VOID FsRegisterDevice(_In_ PCSTR DeviceName, _In_ const DEVVTBL *FuncTable)
Definition: fs.c:673
const DEVVTBL *(* PFS_MOUNT)(ULONG DeviceId)
Definition: fs.c:57
ARC_STATUS FsGetVolumeSize(_In_ ULONG DeviceId, _Out_ PULONGLONG VolumeSize)
Returns the (useful) size of a file-system volume laid on the storage media device opened via DeviceI...
Definition: fs.c:541
ARC_STATUS ArcRead(ULONG FileId, VOID *Buffer, ULONG N, ULONG *Count)
Definition: fs.c:448
VOID FsInit(VOID)
Definition: fs.c:723
VOID FsGetFirstNameFromPath(PCHAR Buffer, PCSTR Path)
Definition: fs.c:645
Definition: bufpool.h:45
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define MAX_PATH
Definition: compat.h:34
#define L(x)
Definition: resources.c:13
#define ENXIO
Definition: errno.h:12
#define EMFILE
Definition: errno.h:30
#define InsertHeadList(ListHead, Entry)
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
struct _FileName FileName
Definition: fatprocs.h:897
const DEVVTBL * PxeMount(ULONG DeviceId)
Definition: pxe.c:312
FxDevice * pDevice
PLIST_ENTRY pEntry
Definition: fxioqueue.cpp:4484
Status
Definition: gdiplustypes.h:25
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
GLfloat GLfloat p
Definition: glext.h:8902
GLuint GLuint num
Definition: glext.h:9618
GLenum GLsizei len
Definition: glext.h:6722
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 DbgPrint
Definition: hal.h:12
#define fs
Definition: i386-dis.c:444
const DEVVTBL * IsoMount(ULONG DeviceId)
Definition: iso.c:602
ULONGLONG IsoGetVolumeSize(_In_ ULONG DeviceId)
Returns the size of the ISO-9660 volume laid on the storage media device opened via DeviceId.
Definition: iso.c:583
if(dx< 0)
Definition: linetemp.h:194
#define ASSERT(a)
Definition: mode.c:44
#define min(a, b)
Definition: monoChain.cc:55
#define _Inout_
Definition: no_sal2.h:162
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
int Count
Definition: noreturn.cpp:7
__GNU_EXTENSION typedef unsigned __int64 * PULONGLONG
Definition: ntbasedef.h:395
CONST CHAR * PCCH
Definition: ntbasedef.h:404
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
NTSTRSAFEAPI RtlStringCbCatA(_Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCSTR pszSrc)
Definition: ntstrsafe.h:625
NTSTRSAFEAPI RtlStringCbCopyA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCSTR pszSrc)
Definition: ntstrsafe.h:156
#define ENAMETOOLONG
Definition: errno.h:55
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_CRT_RESTORE_GCC_WARNINGS _CRT_DISABLE_GCC_WARNINGS _Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
@ ESUCCESS
Definition: arc.h:32
ULONG ARC_STATUS
Definition: arc.h:4
enum _OPENMODE OPENMODE
enum _SEEKMODE SEEKMODE
@ OpenWriteOnly
Definition: arc.h:66
@ OpenReadWrite
Definition: arc.h:67
@ OpenReadOnly
Definition: arc.h:65
#define _countof(array)
Definition: sndvol32.h:70
#define TRACE(s)
Definition: solgame.cpp:4
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
Definition: ffs.h:70
Definition: fs.c:34
PSTR DeviceName
Definition: fs.c:38
ULONG DeviceId
Entry ID in FileData when the device gets referenced.
Definition: fs.c:39
const DEVVTBL * FuncTable
Driver function table.
Definition: fs.c:36
LIST_ENTRY ListEntry
Definition: fs.c:35
ULONG ReferenceCount
Definition: fs.c:40
const DEVVTBL * FileFuncTable
Used only by mounted storage devices.
Definition: fs.c:37
Definition: fs.h:25
ARC_SEEK Seek
Definition: fs.h:30
PCWSTR ServiceName
Definition: fs.h:31
ARC_GET_FILE_INFORMATION GetFileInformation
Definition: fs.h:27
ARC_OPEN Open
Definition: fs.h:28
ARC_READ Read
Definition: fs.h:29
ARC_CLOSE Close
Definition: fs.h:26
Definition: fs.c:44
ULONG ReferenceCount
Definition: fs.c:46
PVOID Specific
Definition: fs.c:48
const DEVVTBL * FuncTable
Definition: fs.c:47
ULONG DeviceId
Parent device's ID.
Definition: fs.c:45
static COORD Position
Definition: mouse.c:34
ULONG_PTR * PSIZE_T
Definition: typedefs.h:80
uint32_t * PULONG
Definition: typedefs.h:59
char * PSTR
Definition: typedefs.h:51
const uint16_t * PCWSTR
Definition: typedefs.h:57
ULONG_PTR SIZE_T
Definition: typedefs.h:80
const char * PCSTR
Definition: typedefs.h:52
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define IN
Definition: typedefs.h:39
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
uint64_t ULONGLONG
Definition: typedefs.h:67
#define OUT
Definition: typedefs.h:40
char * PCHAR
Definition: typedefs.h:51
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3281
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
Definition: wdfrequest.h:1049
char CHAR
Definition: xmlstorage.h:175