Reverted latest changes.
[reactos.git] / reactos / subsys / system / autochk / autochk.c
1 /*
2 * ReactOS kernel
3 * Copyright (C) 2002 ReactOS Team
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19 /* $Id: autochk.c,v 1.3 2002/09/08 10:23:46 chorns Exp $
20 *
21 * COPYRIGHT: See COPYING in the top level directory
22 * PROJECT: ReactOS kernel
23 * FILE: apps/system/autochk/autochk.c
24 * PURPOSE: Filesystem checker
25 * PROGRAMMER: Eric Kohl
26 */
27
28 /* INCLUDES *****************************************************************/
29
30 #include <ddk/ntddk.h>
31 #include <napi/shared_data.h>
32
33 /* FUNCTIONS ****************************************************************/
34
35 void
36 DisplayString(LPCWSTR lpwString)
37 {
38 UNICODE_STRING us;
39
40 RtlInitUnicodeString(&us, lpwString);
41 NtDisplayString(&us);
42 }
43
44
45 void
46 PrintString(char* fmt,...)
47 {
48 char buffer[512];
49 va_list ap;
50 UNICODE_STRING UnicodeString;
51 ANSI_STRING AnsiString;
52
53 va_start(ap, fmt);
54 vsprintf(buffer, fmt, ap);
55 va_end(ap);
56
57 RtlInitAnsiString(&AnsiString, buffer);
58 RtlAnsiStringToUnicodeString(&UnicodeString,
59 &AnsiString,
60 TRUE);
61 NtDisplayString(&UnicodeString);
62 RtlFreeUnicodeString(&UnicodeString);
63 }
64
65
66 /* Native image's entry point */
67
68 VOID
69 NtProcessStartup(PPEB Peb)
70 {
71 ULONG i;
72
73 PrintString("Autochk 0.0.1\n");
74
75 for (i = 0; i < 26; i++)
76 {
77 if ((SharedUserData->DosDeviceMap & (1 << i)) &&
78 (SharedUserData->DosDeviceDriveType[i] == DOSDEVICE_DRIVE_FIXED))
79 {
80 PrintString(" Checking drive %c:", 'A'+i);
81 PrintString(" OK\n");
82 }
83 }
84 PrintString("\n");
85
86 NtTerminateProcess(NtCurrentProcess(), 0);
87 }
88
89 /* EOF */