ReactOS  0.4.14-dev-50-g13bb5e2
autochk.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS AutoChk
3  * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4  * PURPOSE: FileSystem checker in Native mode.
5  * COPYRIGHT: Copyright 2002-2018 Eric Kohl
6  * Copyright 2006-2018 Aleksey Bragin
7  * Copyright 2006-2018 HervĂ© Poussineau
8  * Copyright 2008-2018 Pierre Schweitzer
9  * Copyright 2018 Hermes Belusca-Maito
10  */
11 
12 /* INCLUDES *****************************************************************/
13 
14 #include <stdio.h>
15 
16 #define WIN32_NO_STATUS
17 #include <windef.h>
18 #include <winbase.h>
19 #include <ntddkbd.h>
20 
21 #define NTOS_MODE_USER
22 #include <ndk/exfuncs.h>
23 #include <ndk/iofuncs.h>
24 #include <ndk/obfuncs.h>
25 #include <ndk/psfuncs.h>
26 #include <ndk/rtlfuncs.h>
27 #include <fmifs/fmifs.h>
28 
29 #include <fslib/vfatlib.h>
30 #include <fslib/ntfslib.h>
31 #include <fslib/ext2lib.h>
32 #include <fslib/btrfslib.h>
33 #include <fslib/reiserfslib.h>
34 #include <fslib/ffslib.h>
35 #include <fslib/cdfslib.h>
36 
37 #define NDEBUG
38 #include <debug.h>
39 
40 /* DEFINES ******************************************************************/
41 
42 typedef struct _FILESYSTEM_CHKDSK
43 {
44  WCHAR Name[10];
47 
49 {
50  { L"FAT", VfatChkdsk },
51  { L"FAT32", VfatChkdsk },
52  { L"NTFS", NtfsChkdsk },
53  { L"EXT2", Ext2Chkdsk },
54  { L"EXT3", Ext2Chkdsk },
55  { L"EXT4", Ext2Chkdsk },
56  { L"Btrfs", BtrfsChkdskEx },
57  { L"RFSD", ReiserfsChkdsk },
58  { L"FFS", FfsChkdsk },
59  { L"CDFS", CdfsChkdsk },
60 };
61 
63 
64 /* FUNCTIONS ****************************************************************/
65 
66 //
67 // FMIFS function
68 //
69 
70 static INT
71 PrintString(char* fmt,...)
72 {
73  INT Len;
74  char buffer[512];
75  va_list ap;
78 
79  va_start(ap, fmt);
80  Len = vsprintf(buffer, fmt, ap);
81  va_end(ap);
82 
85  &AnsiString,
86  TRUE);
89 
90  return Len;
91 }
92 
93 static VOID
95  IN INT LineLength)
96 {
97  INT Len;
99  WCHAR buffer[512];
100 
101  if (LineLength <= 0)
102  return;
103 
104  /* Go to the beginning of the line */
107 
108  /* Fill the buffer chunk with spaces */
109  Len = min(LineLength, ARRAYSIZE(buffer));
110  while (Len > 0) buffer[--Len] = L' ';
111 
112  RtlInitEmptyUnicodeString(&UnicodeString, buffer, sizeof(buffer));
113  while (LineLength > 0)
114  {
115  /* Display the buffer */
116  Len = min(LineLength, ARRAYSIZE(buffer));
117  LineLength -= Len;
118  UnicodeString.Length = Len * sizeof(WCHAR);
120  }
121 
122  /* Go to the beginning of the line */
125 }
126 
127 static NTSTATUS
130 {
133  UNICODE_STRING KeyboardName = RTL_CONSTANT_STRING(L"\\Device\\KeyboardClass0");
134 
135  /* Just open the class driver */
137  &KeyboardName,
138  0,
139  NULL,
140  NULL);
141  return NtOpenFile(KeyboardHandle,
144  &IoStatusBlock,
145  FILE_OPEN,
146  0);
147 }
148 
149 static NTSTATUS
152  IN LONG TimeOut)
153 {
157  KEYBOARD_INPUT_DATA InputData;
158  INT Len = 0;
159 
160  /* Skip the wait if there is no timeout */
161  if (TimeOut <= 0)
162  return STATUS_TIMEOUT;
163 
164  /* Attempt to read a down key-press from the keyboard */
165  do
166  {
167  Offset.QuadPart = 0;
169  NULL,
170  NULL,
171  NULL,
172  &IoStatusBlock,
173  &InputData,
174  sizeof(KEYBOARD_INPUT_DATA),
175  &Offset,
176  NULL);
177  if (!NT_SUCCESS(Status))
178  {
179  /* Something failed, bail out */
180  return Status;
181  }
182  if ((Status != STATUS_PENDING) && !(InputData.Flags & KEY_BREAK))
183  {
184  /* We have a down key-press, return */
185  return Status;
186  }
187  } while (Status != STATUS_PENDING);
188 
189  /* Perform the countdown of TimeOut seconds */
191  while (TimeOut > 0)
192  {
193  /*
194  * Display the countdown string.
195  * Note that we only do a carriage return to go back to the
196  * beginning of the line to possibly erase it. Note also that
197  * we display a trailing space to erase any last character
198  * when the string length decreases.
199  */
200  Len = PrintString("Press any key within %d second(s) to cancel and resume startup. \r", TimeOut);
201 
202  /* Decrease the countdown */
203  --TimeOut;
204 
205  /* Wait one second for a key press */
206  Timeout.QuadPart = -10000000;
208  if (Status != STATUS_TIMEOUT)
209  break;
210  }
211 
212  /* Erase the countdown string */
213  EraseLine(Len);
214 
215  if (Status == STATUS_TIMEOUT)
216  {
217  /* The user did not press any key, cancel the read */
219  }
220  else
221  {
222  /* Otherwise, return some status */
224  }
225 
226  return Status;
227 }
228 
229 static NTSTATUS
231  IN PUNICODE_STRING VolumePathU,
232  IN OUT PWSTR FileSystemName,
233  IN SIZE_T FileSystemNameSize)
234 {
239  PFILE_FS_ATTRIBUTE_INFORMATION FileFsAttribute;
241 
242  FileFsAttribute = (PFILE_FS_ATTRIBUTE_INFORMATION)Buffer;
243 
245  VolumePathU,
247  NULL,
248  NULL);
249 
253  &IoStatusBlock,
254  NULL,
255  0,
257  FILE_OPEN,
258  0,
259  NULL,
260  0);
261  if (!NT_SUCCESS(Status))
262  {
263  DPRINT1("Could not open volume '%wZ' to obtain its file system, Status 0x%08lx\n",
264  VolumePathU, Status);
265  return Status;
266  }
267 
269  &IoStatusBlock,
270  FileFsAttribute,
271  sizeof(Buffer),
274 
275  if (!NT_SUCCESS(Status))
276  {
277  DPRINT1("NtQueryVolumeInformationFile() failed, Status 0x%08lx\n", Status);
278  return Status;
279  }
280 
281  if (FileSystemNameSize >= FileFsAttribute->FileSystemNameLength + sizeof(WCHAR))
282  {
283  RtlCopyMemory(FileSystemName,
284  FileFsAttribute->FileSystemName,
285  FileFsAttribute->FileSystemNameLength);
286  FileSystemName[FileFsAttribute->FileSystemNameLength / sizeof(WCHAR)] = UNICODE_NULL;
287  }
288  else
289  {
291  }
292 
293  return STATUS_SUCCESS;
294 }
295 
296 /* This is based on SysInternals' ChkDsk application */
297 static BOOLEAN
298 NTAPI
301  IN ULONG Modifier,
302  IN PVOID Argument)
303 {
304  PDWORD Percent;
307 
308  //
309  // We get other types of commands,
310  // but we don't have to pay attention to them
311  //
312  switch(Command)
313  {
314  case UNKNOWN2:
315  DPRINT("UNKNOWN2\n");
316  break;
317 
318  case UNKNOWN3:
319  DPRINT("UNKNOWN3\n");
320  break;
321 
322  case UNKNOWN4:
323  DPRINT("UNKNOWN4\n");
324  break;
325 
326  case UNKNOWN5:
327  DPRINT("UNKNOWN5\n");
328  break;
329 
330  case UNKNOWN9:
331  DPRINT("UNKNOWN9\n");
332  break;
333 
334  case UNKNOWNA:
335  DPRINT("UNKNOWNA\n");
336  break;
337 
338  case UNKNOWNC:
339  DPRINT("UNKNOWNC\n");
340  break;
341 
342  case UNKNOWND:
343  DPRINT("UNKNOWND\n");
344  break;
345 
346  case INSUFFICIENTRIGHTS:
347  DPRINT("INSUFFICIENTRIGHTS\n");
348  break;
349 
350  case FSNOTSUPPORTED:
351  DPRINT("FSNOTSUPPORTED\n");
352  break;
353 
354  case VOLUMEINUSE:
355  DPRINT("VOLUMEINUSE\n");
356  break;
357 
358  case STRUCTUREPROGRESS:
359  DPRINT("STRUCTUREPROGRESS\n");
360  break;
361 
362  case DONEWITHSTRUCTURE:
363  DPRINT("DONEWITHSTRUCTURE\n");
364  break;
365 
366  case CLUSTERSIZETOOSMALL:
367  DPRINT("CLUSTERSIZETOOSMALL\n");
368  break;
369 
370  case PROGRESS:
371  Percent = (PDWORD) Argument;
372  PrintString("%d percent completed.\r", *Percent);
373  break;
374 
375  case OUTPUT:
376  Output = (PTEXTOUTPUT) Argument;
377  PrintString("%s", Output->Output);
378  break;
379 
380  case DONE:
381  Status = (PBOOLEAN)Argument;
382  if (*Status != FALSE)
383  {
384  PrintString("The file system check was unable to complete successfully.\r\n\r\n");
385  // Error = TRUE;
386  }
387  break;
388  }
389  return TRUE;
390 }
391 
392 static NTSTATUS
394  IN PCWSTR VolumePath,
395  IN LONG TimeOut,
396  IN BOOLEAN CheckOnlyIfDirty)
397 {
399  PCWSTR DisplayName;
400  UNICODE_STRING VolumePathU;
401  ULONG Count;
402  WCHAR FileSystem[128];
403 
404  RtlInitUnicodeString(&VolumePathU, VolumePath);
405 
406  /* Get a drive string for display purposes only */
407  if (wcslen(VolumePath) == 6 &&
408  VolumePath[0] == L'\\' &&
409  VolumePath[1] == L'?' &&
410  VolumePath[2] == L'?' &&
411  VolumePath[3] == L'\\' &&
412  VolumePath[5] == L':')
413  {
414  /* DOS drive */
415  DisplayName = &VolumePath[4];
416  }
417  else
418  {
419  DisplayName = VolumePath;
420  }
421 
422  DPRINT1("AUTOCHK: Checking %wZ\n", &VolumePathU);
423  PrintString("Verifying the file system on %S\r\n", DisplayName);
424 
425  /* Get the file system */
426  Status = GetFileSystem(&VolumePathU,
427  FileSystem,
428  sizeof(FileSystem));
429  if (!NT_SUCCESS(Status))
430  {
431  DPRINT1("GetFileSystem() failed, Status 0x%08lx\n", Status);
432  PrintString(" Unable to detect the file system of volume %S\r\n", DisplayName);
433  goto Quit;
434  }
435 
436  PrintString(" The file system type is %S.\r\n\r\n", FileSystem);
437 
438  /* Find a suitable file system provider */
439  for (Count = 0; Count < RTL_NUMBER_OF(FileSystems); ++Count)
440  {
441  if (wcscmp(FileSystem, FileSystems[Count].Name) == 0)
442  break;
443  }
445  {
446  DPRINT1("File system %S not supported\n", FileSystem);
447  PrintString(" Unable to verify the volume. The %S file system is not supported.\r\n", FileSystem);
449  goto Quit;
450  }
451 
452  /* Check whether the volume is dirty */
453  Status = FileSystems[Count].ChkdskFunc(&VolumePathU,
454  FALSE, // FixErrors
455  TRUE, // Verbose
456  TRUE, // CheckOnlyIfDirty
457  FALSE, // ScanDrive
459 
460  /* Perform the check either when the volume is dirty or a check is forced */
461  if ((Status == STATUS_DISK_CORRUPT_ERROR) || !CheckOnlyIfDirty)
462  {
463  /* Let the user decide whether to repair */
465  {
466  PrintString("The file system on volume %S needs to be checked for problems.\r\n", DisplayName);
467  PrintString("You may cancel this check, but it is recommended that you continue.\r\n");
468  }
469  else
470  {
471  PrintString("A volume check has been scheduled.\r\n");
472  }
473 
475  {
476  PrintString("The system will now check the file system.\r\n\r\n");
477  Status = FileSystems[Count].ChkdskFunc(&VolumePathU,
478  TRUE, // FixErrors
479  TRUE, // Verbose
480  CheckOnlyIfDirty,
481  FALSE, // ScanDrive
483  }
484  else
485  {
486  PrintString("The file system check has been skipped.\r\n");
487  }
488  }
489 
490 Quit:
491  PrintString("\r\n\r\n");
492  return Status;
493 }
494 
495 static VOID
497  IN OUT PLONG TimeOut)
498 {
500 
503  QueryTable[0].Name = L"AutoChkTimeOut";
504  QueryTable[0].EntryContext = TimeOut;
505 
507  /* See: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/autochk */
508  *TimeOut = min(max(*TimeOut, 0), 259200);
509 }
510 
511 INT
512 __cdecl
514  IN INT argc,
515  IN PCHAR argv[],
516  IN PCHAR envp[],
517  IN ULONG DebugFlag)
518 {
520  LONG TimeOut;
521  ULONG i;
522  BOOLEAN CheckAllVolumes = FALSE;
523  BOOLEAN CheckOnlyIfDirty = TRUE;
525  PCHAR SkipDrives = NULL;
526  ANSI_STRING VolumePathA;
527  UNICODE_STRING VolumePathU;
528  WCHAR VolumePath[128] = L"";
529 
530  /*
531  * Parse the command-line: optional command switches,
532  * then the NT volume name (or drive letter) to be analysed.
533  * If "*" is passed this means that we check all the volumes.
534  */
535  if (argc <= 1)
536  {
537  /* Only one parameter (the program name), bail out */
538  return 1;
539  }
540  for (i = 1; i < argc; ++i)
541  {
542  if (argv[i][0] == '/' || argv[i][0] == '-')
543  {
544  DPRINT("Parameter %d: %s\n", i, argv[i]);
545  switch (toupper(argv[i][1]))
546  {
547  case 'K': /* List of drive letters to skip */
548  {
549  /* Check for the separator */
550  if (argv[i][2] != ':')
551  goto Default;
552 
553  SkipDrives = &argv[i][3];
554  break;
555  }
556 
557  case 'R': /* Repair the errors, implies /P */
558  case 'P': /* Check even if not dirty */
559  {
560  if (argv[i][2] != ANSI_NULL)
561  goto Default;
562 
563  CheckOnlyIfDirty = FALSE;
564  break;
565  }
566 
567  default: Default:
568  DPRINT1("Unknown switch %d: %s\n", i, argv[i]);
569  break;
570  }
571  }
572  else
573  {
574  DPRINT("Parameter %d - Volume specification: %s\n", i, argv[i]);
575  if (strcmp(argv[i], "*") == 0)
576  {
577  CheckAllVolumes = TRUE;
578  }
579  else
580  {
581  RtlInitEmptyUnicodeString(&VolumePathU,
582  VolumePath,
583  sizeof(VolumePath));
584  RtlInitAnsiString(&VolumePathA, argv[i]);
585  Status = RtlAnsiStringToUnicodeString(&VolumePathU,
586  &VolumePathA,
587  FALSE);
588  }
589 
590  /* Stop the parsing now */
591  break;
592  }
593  }
594 
595  /*
596  * FIXME: We should probably use here the mount manager to be
597  * able to check volumes which don't have a drive letter.
598  */
601  &DeviceMap.Query,
602  sizeof(DeviceMap.Query),
603  NULL);
604  if (!NT_SUCCESS(Status))
605  {
606  DPRINT1("NtQueryInformationProcess() failed, Status 0x%08lx\n", Status);
607  return 1;
608  }
609 
610  /* Filter out the skipped drives from the map */
611  if (SkipDrives && *SkipDrives)
612  {
613  DPRINT1("Skipping drives:");
614  while (*SkipDrives)
615  {
616 #if DBG
617  DbgPrint(" %c:", *SkipDrives);
618 #endif
619  /* Retrieve the index and filter the drive out */
620  i = toupper(*SkipDrives) - 'A';
621  if (0 <= i && i <= 'Z'-'A')
622  DeviceMap.Query.DriveMap &= ~(1 << i);
623 
624  /* Go to the next drive letter */
625  ++SkipDrives;
626  }
627  DbgPrint("\n");
628  }
629 
630  /* Query the timeout */
631  TimeOut = 3;
632  QueryTimeout(&TimeOut);
633 
634  /* Open the keyboard */
636  if (!NT_SUCCESS(Status))
637  {
638  DPRINT1("OpenKeyboard() failed, Status 0x%08lx\n", Status);
639  /* Ignore keyboard interaction */
640  }
641 
642  if (CheckAllVolumes)
643  {
644  /* Enumerate and check each of the available volumes */
645  for (i = 0; i <= 'Z'-'A'; i++)
646  {
647  if ((DeviceMap.Query.DriveMap & (1 << i)) &&
648  (DeviceMap.Query.DriveType[i] == DOSDEVICE_DRIVE_FIXED))
649  {
650  swprintf(VolumePath, L"\\??\\%c:", L'A' + i);
651  CheckVolume(VolumePath, TimeOut, CheckOnlyIfDirty);
652  }
653  }
654  }
655  else
656  {
657  /* Retrieve our index and analyse the volume */
658  if (wcslen(VolumePath) == 6 &&
659  VolumePath[0] == L'\\' &&
660  VolumePath[1] == L'?' &&
661  VolumePath[2] == L'?' &&
662  VolumePath[3] == L'\\' &&
663  VolumePath[5] == L':')
664  {
665  i = toupper(VolumePath[4]) - 'A';
666  if ((DeviceMap.Query.DriveMap & (1 << i)) &&
667  (DeviceMap.Query.DriveType[i] == DOSDEVICE_DRIVE_FIXED))
668  {
669  CheckVolume(VolumePath, TimeOut, CheckOnlyIfDirty);
670  }
671  }
672  else
673  {
674  /* Just perform the check on the specified volume */
675  // TODO: Check volume type using NtQueryVolumeInformationFile(FileFsDeviceInformation)
676  CheckVolume(VolumePath, TimeOut, CheckOnlyIfDirty);
677  }
678  }
679 
680  /* Close the keyboard */
681  if (KeyboardHandle)
683 
684  // PrintString("Done\r\n\r\n");
685  return 0;
686 }
687 
688 /* EOF */
signed char * PCHAR
Definition: retypes.h:7
#define FILE_GENERIC_READ
Definition: nt_native.h:653
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
static int argc
Definition: ServiceArgs.c:12
const uint16_t * PCWSTR
Definition: typedefs.h:55
_In_ PCWSTR _Inout_ _At_ QueryTable _Pre_unknown_ PRTL_QUERY_REGISTRY_TABLE QueryTable
Definition: rtlfuncs.h:4004
#define IN
Definition: typedefs.h:38
#define max(a, b)
Definition: svc.c:63
static NTSTATUS WaitForKeyboard(IN HANDLE KeyboardHandle, IN LONG TimeOut)
Definition: autochk.c:150
CHKDSKEX ChkdskFunc
Definition: autochk.c:45
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
Definition: fmifs.h:71
NTSTATUS NTAPI NtfsChkdsk(IN PUNICODE_STRING DriveRoot, IN BOOLEAN FixErrors, IN BOOLEAN Verbose, IN BOOLEAN CheckOnlyIfDirty, IN BOOLEAN ScanDrive, IN PFMIFSCALLBACK Callback)
Definition: ntfslib.c:27
*BytesInUnicodeString PWCH UnicodeString
Definition: rtlfuncs.h:1980
Definition: fmifs.h:72
PWCHAR FileSystem
Definition: format.c:72
struct _FILESYSTEM_CHKDSK FILESYSTEM_CHKDSK
#define FILE_ALL_ACCESS
Definition: nt_native.h:651
NTSTATUS(NTAPI * CHKDSKEX)(IN PUNICODE_STRING DriveRoot, IN BOOLEAN FixErrors, IN BOOLEAN Verbose, IN BOOLEAN CheckOnlyIfDirty, IN BOOLEAN ScanDrive, IN PFMIFSCALLBACK Callback)
Definition: fmifs.h:207
#define __cdecl
Definition: accygwin.h:79
#define DbgPrint
Definition: loader.c:25
Definition: fmifs.h:70
uint16_t * PWSTR
Definition: typedefs.h:54
NTSTATUS NTAPI ReiserfsChkdsk(IN PUNICODE_STRING DriveRoot, IN BOOLEAN FixErrors, IN BOOLEAN Verbose, IN BOOLEAN CheckOnlyIfDirty, IN BOOLEAN ScanDrive, IN PFMIFSCALLBACK Callback)
Definition: reiserfslib.c:27
HANDLE KeyboardHandle
Definition: autochk.c:62
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI NtQueryInformationProcess(IN HANDLE ProcessHandle, IN PROCESSINFOCLASS ProcessInformationClass, OUT PVOID ProcessInformation, IN ULONG ProcessInformationLength, OUT PULONG ReturnLength OPTIONAL)
Definition: query.c:59
static INT PrintString(char *fmt,...)
Definition: autochk.c:71
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
Definition: fmifs.h:68
Definition: fmifs.h:78
Definition: fmifs.h:73
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
GLuint buffer
Definition: glext.h:5915
Definition: shell.h:41
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define RTL_REGISTRY_CONTROL
Definition: nt_native.h:163
#define KEY_BREAK
Definition: ntddkbd.h:71
CALLBACKCOMMAND
Definition: fmifs.h:66
#define argv
Definition: mplay32.c:18
struct _FILE_FS_ATTRIBUTE_INFORMATION FILE_FS_ATTRIBUTE_INFORMATION
struct TEXTOUTPUT * PTEXTOUTPUT
Definition: fmifs.h:77
int32_t INT
Definition: typedefs.h:56
#define FILE_SHARE_READ
Definition: compat.h:125
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
static BOOLEAN NTAPI ChkdskCallback(IN CALLBACKCOMMAND Command, IN ULONG Modifier, IN PVOID Argument)
Definition: autochk.c:299
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
#define STATUS_TIMEOUT
Definition: ntstatus.h:81
HANDLE FileHandle
Definition: stats.c:38
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: fmifs.h:80
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define va_end(ap)
Definition: acmsvcex.h:90
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
#define UNICODE_NULL
#define ANSI_NULL
long LONG
Definition: pedump.c:60
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS NTAPI NtQueryVolumeInformationFile(IN HANDLE FileHandle, OUT PIO_STATUS_BLOCK IoStatusBlock, OUT PVOID FsInformation, IN ULONG Length, IN FS_INFORMATION_CLASS FsInformationClass)
Definition: iofunc.c:4084
char * va_list
Definition: acmsvcex.h:78
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
static VOID QueryTimeout(IN OUT PLONG TimeOut)
Definition: autochk.c:496
NTSTATUS NTAPI BtrfsChkdskEx(IN PUNICODE_STRING DriveRoot, IN BOOLEAN FixErrors, IN BOOLEAN Verbose, IN BOOLEAN CheckOnlyIfDirty, IN BOOLEAN ScanDrive, IN PFMIFSCALLBACK Callback)
#define NtCurrentProcess()
Definition: nt_native.h:1657
NTSYSAPI NTSTATUS NTAPI NtOpenFile(OUT PHANDLE phFile, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG ShareMode, IN ULONG OpenMode)
Definition: file.c:3951
int toupper(int c)
Definition: utclib.c:881
#define DOSDEVICE_DRIVE_FIXED
Definition: obtypes.h:166
NTSTATUS NTAPI NtCreateFile(OUT PHANDLE FileHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK IoStatusBlock, IN PLARGE_INTEGER AllocationSize OPTIONAL, IN ULONG FileAttributes, IN ULONG ShareAccess, IN ULONG CreateDisposition, IN ULONG CreateOptions, IN PVOID EaBuffer OPTIONAL, IN ULONG EaLength)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
static VOID EraseLine(IN INT LineLength)
Definition: autochk.c:94
#define MAX_PATH
Definition: compat.h:26
#define swprintf(buf, format,...)
Definition: sprintf.c:56
#define Len
Definition: deflate.h:82
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
struct _FILE_FS_ATTRIBUTE_INFORMATION * PFILE_FS_ATTRIBUTE_INFORMATION
NTSYSAPI NTSTATUS WINAPI RtlQueryRegistryValues(ULONG, PCWSTR, PRTL_QUERY_REGISTRY_TABLE, PVOID, PVOID)
FILESYSTEM_CHKDSK FileSystems[10]
Definition: autochk.c:48
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
unsigned char UCHAR
Definition: xmlstorage.h:181
char * PBOOLEAN
Definition: retypes.h:11
static const WCHAR L[]
Definition: oid.c:1250
Definition: arc.h:85
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:414
Status
Definition: gdiplustypes.h:24
#define FILE_OPEN
Definition: from_kernel.h:54
struct _FILESYSTEM_CHKDSK * PFILESYSTEM_CHKDSK
static NTSTATUS GetFileSystem(IN PUNICODE_STRING VolumePathU, IN OUT PWSTR FileSystemName, IN SIZE_T FileSystemNameSize)
Definition: autochk.c:230
NTSTATUS NTAPI FfsChkdsk(IN PUNICODE_STRING DriveRoot, IN BOOLEAN FixErrors, IN BOOLEAN Verbose, IN BOOLEAN CheckOnlyIfDirty, IN BOOLEAN ScanDrive, IN PFMIFSCALLBACK Callback)
Definition: ffslib.c:27
NTSTATUS NTAPI NtDisplayString(PUNICODE_STRING String)
ULONG_PTR SIZE_T
Definition: typedefs.h:78
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
static ULONG Timeout
Definition: ping.c:61
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
#define STATUS_DLL_NOT_FOUND
Definition: ntstatus.h:531
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
int __cdecl vsprintf(char *_Dest, const char *_Format, va_list _Args)
Definition: sprintf.c:733
static NTSTATUS OpenKeyboard(OUT PHANDLE KeyboardHandle)
Definition: autochk.c:128
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define min(a, b)
Definition: monoChain.cc:55
#define va_start(ap, A)
Definition: acmsvcex.h:91
NTSTATUS NTAPI Ext2Chkdsk(IN PUNICODE_STRING DriveRoot, IN BOOLEAN FixErrors, IN BOOLEAN Verbose, IN BOOLEAN CheckOnlyIfDirty, IN BOOLEAN ScanDrive, IN PFMIFSCALLBACK Callback)
Definition: Mke2fs.c:1008
DWORD * PDWORD
Definition: pedump.c:68
#define DPRINT1
Definition: precomp.h:8
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
Definition: fmifs.h:81
#define OUT
Definition: typedefs.h:39
#define STATUS_DISK_CORRUPT_ERROR
Definition: udferr_usr.h:147
NTSTATUS NTAPI NtCancelIoFile(IN HANDLE FileHandle, OUT PIO_STATUS_BLOCK IoStatusBlock)
Definition: file.c:4018
unsigned int ULONG
Definition: retypes.h:1
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define DONE
Definition: rnr20lib.h:14
INT __cdecl _main(IN INT argc, IN PCHAR argv[], IN PCHAR envp[], IN ULONG DebugFlag)
Definition: autochk.c:513
Definition: fmifs.h:82
return STATUS_SUCCESS
Definition: btrfs.c:2966
signed int * PLONG
Definition: retypes.h:5
NTSTATUS NTAPI VfatChkdsk(IN PUNICODE_STRING DriveRoot, IN BOOLEAN FixErrors, IN BOOLEAN Verbose, IN BOOLEAN CheckOnlyIfDirty, IN BOOLEAN ScanDrive, IN PFMIFSCALLBACK Callback)
Definition: vfatlib.c:375
Definition: dsound.c:943
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
NTSTATUS NTAPI CdfsChkdsk(IN PUNICODE_STRING DriveRoot, IN BOOLEAN FixErrors, IN BOOLEAN Verbose, IN BOOLEAN CheckOnlyIfDirty, IN BOOLEAN ScanDrive, IN PFMIFSCALLBACK Callback)
Definition: cdfslib.c:16
#define RTL_QUERY_REGISTRY_DIRECT
Definition: nt_native.h:144
NTSTATUS NTAPI NtReadFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, PVOID Buffer, ULONG Length, PLARGE_INTEGER ByteOffset, PULONG Key)
static NTSTATUS CheckVolume(IN PCWSTR VolumePath, IN LONG TimeOut, IN BOOLEAN CheckOnlyIfDirty)
Definition: autochk.c:393
struct _PROCESS_DEVICEMAP_INFORMATION::@3781::@3783 Query
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
NTSYSAPI NTSTATUS NTAPI NtWaitForSingleObject(IN HANDLE hObject, IN BOOLEAN bAlertable, IN PLARGE_INTEGER Timeout)