Fix indentation and codig style. No code changes!

svn path=/trunk/; revision=63694
This commit is contained in:
Eric Kohl 2014-07-06 14:03:04 +00:00
parent e6a306946d
commit 6fe19b5048
8 changed files with 264 additions and 259 deletions

View file

@ -10,25 +10,25 @@
#include "precomp.h"
/* FMIFS.1 */
VOID NTAPI
VOID
NTAPI
Chkdsk(
IN PWCHAR DriveRoot,
IN PWCHAR Format,
IN BOOLEAN CorrectErrors,
IN BOOLEAN Verbose,
IN BOOLEAN CheckOnlyIfDirty,
IN BOOLEAN ScanDrive,
IN PVOID Unused2,
IN PVOID Unused3,
IN PFMIFSCALLBACK Callback)
IN PWCHAR DriveRoot,
IN PWCHAR Format,
IN BOOLEAN CorrectErrors,
IN BOOLEAN Verbose,
IN BOOLEAN CheckOnlyIfDirty,
IN BOOLEAN ScanDrive,
IN PVOID Unused2,
IN PVOID Unused3,
IN PFMIFSCALLBACK Callback)
{
BOOLEAN Argument = FALSE;
BOOLEAN Argument = FALSE;
/* FAIL immediately */
Callback(
DONE, /* Command */
0, /* DWORD Modifier */
&Argument);/* Argument */
/* FAIL immediately */
Callback(DONE, /* Command */
0, /* DWORD Modifier */
&Argument);/* Argument */
}
/* EOF */

View file

@ -12,40 +12,38 @@
/*
* @implemented
*/
BOOLEAN NTAPI
BOOLEAN
NTAPI
EnableVolumeCompression(
IN PWCHAR DriveRoot,
IN USHORT Compression)
IN PWCHAR DriveRoot,
IN USHORT Compression)
{
HANDLE hFile;
DWORD RetBytes;
BOOL Ret;
HANDLE hFile;
DWORD RetBytes;
BOOL Ret;
hFile = CreateFileW(
DriveRoot,
FILE_READ_DATA | FILE_WRITE_DATA,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS,
NULL);
hFile = CreateFileW(DriveRoot,
FILE_READ_DATA | FILE_WRITE_DATA,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS,
NULL);
if (hFile == INVALID_HANDLE_VALUE)
return FALSE;
if (hFile == INVALID_HANDLE_VALUE)
return FALSE;
Ret = DeviceIoControl(hFile,
FSCTL_SET_COMPRESSION,
&Compression,
sizeof(USHORT),
NULL,
0,
&RetBytes,
NULL);
Ret = DeviceIoControl(
hFile,
FSCTL_SET_COMPRESSION,
&Compression,
sizeof(USHORT),
NULL,
0,
&RetBytes,
NULL);
CloseHandle(hFile);
CloseHandle(hFile);
return (Ret != 0);
return (Ret != 0);
}
/* EOF */

View file

@ -10,7 +10,8 @@
#include "precomp.h"
/* FMIFS.3 */
VOID NTAPI
VOID
NTAPI
DiskCopy(void)
{
}

View file

@ -14,69 +14,69 @@
#include <debug.h>
/* FMIFS.6 */
VOID NTAPI
VOID
NTAPI
Format(VOID)
{
}
/* FMIFS.7 */
VOID NTAPI
VOID
NTAPI
FormatEx(
IN PWCHAR DriveRoot,
IN FMIFS_MEDIA_FLAG MediaFlag,
IN PWCHAR Format,
IN PWCHAR Label,
IN BOOLEAN QuickFormat,
IN ULONG ClusterSize,
IN PFMIFSCALLBACK Callback)
IN PWCHAR DriveRoot,
IN FMIFS_MEDIA_FLAG MediaFlag,
IN PWCHAR Format,
IN PWCHAR Label,
IN BOOLEAN QuickFormat,
IN ULONG ClusterSize,
IN PFMIFSCALLBACK Callback)
{
PIFS_PROVIDER Provider;
UNICODE_STRING usDriveRoot;
UNICODE_STRING usLabel;
BOOLEAN Argument = FALSE;
WCHAR VolumeName[MAX_PATH];
//CURDIR CurDir;
PIFS_PROVIDER Provider;
UNICODE_STRING usDriveRoot;
UNICODE_STRING usLabel;
BOOLEAN Argument = FALSE;
WCHAR VolumeName[MAX_PATH];
//CURDIR CurDir;
Provider = GetProvider(Format);
if (!Provider)
{
/* Unknown file system */
Callback(
DONE, /* Command */
0, /* DWORD Modifier */
&Argument); /* Argument */
return;
}
Provider = GetProvider(Format);
if (!Provider)
{
/* Unknown file system */
Callback(DONE, /* Command */
0, /* DWORD Modifier */
&Argument); /* Argument */
return;
}
#if 1
DPRINT1("Warning: use GetVolumeNameForVolumeMountPointW() instead!\n");
swprintf(VolumeName, L"\\??\\%c:", towupper(DriveRoot[0]));
RtlCreateUnicodeString(&usDriveRoot, VolumeName);
/* Code disabled as long as our storage stack doesn't understand IOCTL_MOUNTDEV_QUERY_DEVICE_NAME */
DPRINT1("Warning: use GetVolumeNameForVolumeMountPointW() instead!\n");
swprintf(VolumeName, L"\\??\\%c:", towupper(DriveRoot[0]));
RtlCreateUnicodeString(&usDriveRoot, VolumeName);
/* Code disabled as long as our storage stack doesn't understand IOCTL_MOUNTDEV_QUERY_DEVICE_NAME */
#else
if (!GetVolumeNameForVolumeMountPointW(DriveRoot, VolumeName, MAX_PATH)
|| !RtlDosPathNameToNtPathName_U(VolumeName, &usDriveRoot, NULL, &CurDir))
{
/* Report an error. */
Callback(
DONE, /* Command */
0, /* DWORD Modifier */
&Argument); /* Argument */
return;
}
if (!GetVolumeNameForVolumeMountPointW(DriveRoot, VolumeName, MAX_PATH) ||
!RtlDosPathNameToNtPathName_U(VolumeName, &usDriveRoot, NULL, &CurDir))
{
/* Report an error. */
Callback(DONE, /* Command */
0, /* DWORD Modifier */
&Argument); /* Argument */
return;
}
#endif
RtlInitUnicodeString(&usLabel, Label);
RtlInitUnicodeString(&usLabel, Label);
DPRINT("FormatEx - %S\n", Format);
Provider->FormatEx(
&usDriveRoot,
MediaFlag,
&usLabel,
QuickFormat,
ClusterSize,
Callback);
RtlFreeUnicodeString(&usDriveRoot);
DPRINT("FormatEx - %S\n", Format);
Provider->FormatEx(&usDriveRoot,
MediaFlag,
&usLabel,
QuickFormat,
ClusterSize,
Callback);
RtlFreeUnicodeString(&usDriveRoot);
}
/* EOF */

View file

@ -19,167 +19,171 @@ LIST_ENTRY ProviderListHead;
PIFS_PROVIDER
GetProvider(
IN PWCHAR FileSystem)
IN PWCHAR FileSystem)
{
PLIST_ENTRY ListEntry;
PIFS_PROVIDER Provider;
PLIST_ENTRY ListEntry;
PIFS_PROVIDER Provider;
ListEntry = ProviderListHead.Flink;
while (ListEntry != &ProviderListHead)
{
Provider = CONTAINING_RECORD(ListEntry, IFS_PROVIDER, ListEntry);
if (_wcsicmp(Provider->Name, FileSystem) == 0)
return Provider;
ListEntry = ListEntry->Flink;
}
ListEntry = ProviderListHead.Flink;
while (ListEntry != &ProviderListHead)
{
Provider = CONTAINING_RECORD(ListEntry, IFS_PROVIDER, ListEntry);
if (_wcsicmp(Provider->Name, FileSystem) == 0)
return Provider;
ListEntry = ListEntry->Flink;
}
/* Provider not found */
return NULL;
/* Provider not found */
return NULL;
}
static BOOLEAN
static
BOOLEAN
AddProvider(
IN PCUNICODE_STRING FileSystem,
IN PWCHAR DllFile)
IN PCUNICODE_STRING FileSystem,
IN PWCHAR DllFile)
{
PIFS_PROVIDER Provider = NULL;
ULONG RequiredSize;
HMODULE hMod = NULL;
BOOLEAN ret = FALSE;
PIFS_PROVIDER Provider = NULL;
ULONG RequiredSize;
HMODULE hMod = NULL;
BOOLEAN ret = FALSE;
hMod = LoadLibraryW(DllFile);
if (!hMod)
goto cleanup;
hMod = LoadLibraryW(DllFile);
if (!hMod)
goto cleanup;
RequiredSize = FIELD_OFFSET(IFS_PROVIDER, Name)
+ FileSystem->Length + sizeof(UNICODE_NULL);
Provider = (PIFS_PROVIDER)RtlAllocateHeap(
RtlGetProcessHeap(),
0,
RequiredSize);
if (!Provider)
goto cleanup;
RtlZeroMemory(Provider, RequiredSize);
RequiredSize = FIELD_OFFSET(IFS_PROVIDER, Name)
+ FileSystem->Length + sizeof(UNICODE_NULL);
Provider = (PIFS_PROVIDER)RtlAllocateHeap(
RtlGetProcessHeap(),
0,
RequiredSize);
if (!Provider)
goto cleanup;
RtlZeroMemory(Provider, RequiredSize);
/* Get function pointers */
Provider->ChkdskEx = (CHKDSKEX)GetProcAddress(hMod, "ChkdskEx");
//Provider->Extend = (EXTEND)GetProcAddress(hMod, "Extend");
Provider->FormatEx = (FORMATEX)GetProcAddress(hMod, "FormatEx");
/* Get function pointers */
Provider->ChkdskEx = (CHKDSKEX)GetProcAddress(hMod, "ChkdskEx");
//Provider->Extend = (EXTEND)GetProcAddress(hMod, "Extend");
Provider->FormatEx = (FORMATEX)GetProcAddress(hMod, "FormatEx");
RtlCopyMemory(Provider->Name, FileSystem->Buffer, FileSystem->Length);
RtlCopyMemory(Provider->Name, FileSystem->Buffer, FileSystem->Length);
InsertTailList(&ProviderListHead, &Provider->ListEntry);
ret = TRUE;
InsertTailList(&ProviderListHead, &Provider->ListEntry);
ret = TRUE;
cleanup:
if (!ret)
{
if (hMod)
FreeLibrary(hMod);
if (Provider)
RtlFreeHeap(RtlGetProcessHeap(), 0, Provider);
}
return ret;
if (!ret)
{
if (hMod)
FreeLibrary(hMod);
if (Provider)
RtlFreeHeap(RtlGetProcessHeap(), 0, Provider);
}
return ret;
}
static BOOLEAN
InitializeFmIfsOnce(void)
static
BOOLEAN
InitializeFmIfsOnce(VOID)
{
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING RegistryPath
= RTL_CONSTANT_STRING(L"\\REGISTRY\\Machine\\SOFTWARE\\ReactOS\\ReactOS\\CurrentVersion\\IFS");
HANDLE hKey = NULL;
PKEY_VALUE_FULL_INFORMATION Buffer;
ULONG BufferSize = sizeof(KEY_VALUE_FULL_INFORMATION) + MAX_PATH;
ULONG RequiredSize;
ULONG i = 0;
UNICODE_STRING Name;
UNICODE_STRING Data;
NTSTATUS Status;
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING RegistryPath
= RTL_CONSTANT_STRING(L"\\REGISTRY\\Machine\\SOFTWARE\\ReactOS\\ReactOS\\CurrentVersion\\IFS");
HANDLE hKey = NULL;
PKEY_VALUE_FULL_INFORMATION Buffer;
ULONG BufferSize = sizeof(KEY_VALUE_FULL_INFORMATION) + MAX_PATH;
ULONG RequiredSize;
ULONG i = 0;
UNICODE_STRING Name;
UNICODE_STRING Data;
NTSTATUS Status;
InitializeListHead(&ProviderListHead);
InitializeListHead(&ProviderListHead);
/* Read IFS providers from HKLM\SOFTWARE\ReactOS\ReactOS\CurrentVersion\IFS */
InitializeObjectAttributes(&ObjectAttributes, &RegistryPath, 0, NULL, NULL);
Status = NtOpenKey(&hKey, KEY_QUERY_VALUE, &ObjectAttributes);
if (Status == STATUS_OBJECT_NAME_NOT_FOUND)
return TRUE;
else if (!NT_SUCCESS(Status))
return FALSE;
/* Read IFS providers from HKLM\SOFTWARE\ReactOS\ReactOS\CurrentVersion\IFS */
InitializeObjectAttributes(&ObjectAttributes, &RegistryPath, 0, NULL, NULL);
Status = NtOpenKey(&hKey, KEY_QUERY_VALUE, &ObjectAttributes);
if (Status == STATUS_OBJECT_NAME_NOT_FOUND)
return TRUE;
else if (!NT_SUCCESS(Status))
return FALSE;
Buffer = (PKEY_VALUE_FULL_INFORMATION)RtlAllocateHeap(
RtlGetProcessHeap(),
0,
BufferSize);
if (!Buffer)
{
NtClose(hKey);
return FALSE;
}
Buffer = (PKEY_VALUE_FULL_INFORMATION)RtlAllocateHeap(
RtlGetProcessHeap(),
0,
BufferSize);
if (!Buffer)
{
NtClose(hKey);
return FALSE;
}
while (TRUE)
{
Status = NtEnumerateValueKey(
hKey,
i++,
KeyValueFullInformation,
Buffer,
BufferSize,
&RequiredSize);
if (Status == STATUS_BUFFER_OVERFLOW)
continue;
else if (!NT_SUCCESS(Status))
break;
else if (Buffer->Type != REG_SZ)
continue;
while (TRUE)
{
Status = NtEnumerateValueKey(
hKey,
i++,
KeyValueFullInformation,
Buffer,
BufferSize,
&RequiredSize);
if (Status == STATUS_BUFFER_OVERFLOW)
continue;
else if (!NT_SUCCESS(Status))
break;
else if (Buffer->Type != REG_SZ)
continue;
Name.Length = Name.MaximumLength = Buffer->NameLength;
Name.Buffer = Buffer->Name;
Data.Length = Data.MaximumLength = Buffer->DataLength;
Data.Buffer = (PWCHAR)((ULONG_PTR)Buffer + Buffer->DataOffset);
if (Data.Length > sizeof(WCHAR) && Data.Buffer[Data.Length / sizeof(WCHAR) - 1] == UNICODE_NULL)
Data.Length -= sizeof(WCHAR);
Name.Length = Name.MaximumLength = Buffer->NameLength;
Name.Buffer = Buffer->Name;
Data.Length = Data.MaximumLength = Buffer->DataLength;
Data.Buffer = (PWCHAR)((ULONG_PTR)Buffer + Buffer->DataOffset);
if (Data.Length > sizeof(WCHAR) && Data.Buffer[Data.Length / sizeof(WCHAR) - 1] == UNICODE_NULL)
Data.Length -= sizeof(WCHAR);
AddProvider(&Name, Data.Buffer);
}
AddProvider(&Name, Data.Buffer);
}
NtClose(hKey);
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
return TRUE;
NtClose(hKey);
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
return TRUE;
}
/* FMIFS.8 */
BOOLEAN NTAPI
BOOLEAN
NTAPI
InitializeFmIfs(
IN PVOID hinstDll,
IN DWORD dwReason,
IN PVOID reserved)
IN PVOID hinstDll,
IN DWORD dwReason,
IN PVOID reserved)
{
switch (dwReason)
{
case DLL_PROCESS_ATTACH:
if (FALSE == FmIfsInitialized)
{
if (FALSE == InitializeFmIfsOnce())
{
return FALSE;
}
switch (dwReason)
{
case DLL_PROCESS_ATTACH:
if (FmIfsInitialized == FALSE)
{
if (InitializeFmIfsOnce() == FALSE)
{
return FALSE;
}
FmIfsInitialized = TRUE;
}
break;
FmIfsInitialized = TRUE;
}
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
break;
}
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
return TRUE;
}
/* EOF */

View file

@ -10,14 +10,15 @@
#include "precomp.h"
/* FMIFS.9 */
BOOL NTAPI
BOOL
NTAPI
QuerySupportedMedia(
IN PWCHAR DriveRoot,
OUT FMIFS_MEDIA_FLAG *CurrentMedia OPTIONAL,
IN ULONG Unknown3,
OUT PULONG Unknown4)
IN PWCHAR DriveRoot,
OUT FMIFS_MEDIA_FLAG *CurrentMedia OPTIONAL,
IN ULONG Unknown3,
OUT PULONG Unknown4)
{
return FALSE;
return FALSE;
}
/* EOF */

View file

@ -32,18 +32,18 @@ extern LIST_ENTRY ProviderListHead;
typedef struct _IFS_PROVIDER
{
LIST_ENTRY ListEntry;
LIST_ENTRY ListEntry;
CHKDSKEX ChkdskEx;
PVOID Extend;
FORMATEX FormatEx;
CHKDSKEX ChkdskEx;
PVOID Extend;
FORMATEX FormatEx;
WCHAR Name[1];
WCHAR Name[1];
} IFS_PROVIDER, *PIFS_PROVIDER;
/* init.c */
PIFS_PROVIDER
GetProvider(
IN PWCHAR FileSytem);
IN PWCHAR FileSytem);
#endif /* _FMIFS_PCH_ */

View file

@ -9,36 +9,37 @@
#include "precomp.h"
BOOLEAN NTAPI
BOOLEAN
NTAPI
QueryAvailableFileSystemFormat(
IN DWORD Index,
IN OUT PWCHAR FileSystem, /* FIXME: Probably one minimal size is mandatory, but which one? */
OUT UCHAR* Major,
OUT UCHAR* Minor,
OUT BOOLEAN* LatestVersion)
IN DWORD Index,
IN OUT PWCHAR FileSystem, /* FIXME: Probably one minimal size is mandatory, but which one? */
OUT UCHAR *Major,
OUT UCHAR *Minor,
OUT BOOLEAN *LatestVersion)
{
PLIST_ENTRY ListEntry;
PIFS_PROVIDER Provider;
PLIST_ENTRY ListEntry;
PIFS_PROVIDER Provider;
if (!FileSystem || !Major ||!Minor ||!LatestVersion)
return FALSE;
if (!FileSystem || !Major ||!Minor ||!LatestVersion)
return FALSE;
ListEntry = ProviderListHead.Flink;
while (TRUE)
{
if (ListEntry == &ProviderListHead)
return FALSE;
if (Index == 0)
break;
ListEntry = ListEntry->Flink;
Index--;
}
ListEntry = ProviderListHead.Flink;
while (TRUE)
{
if (ListEntry == &ProviderListHead)
return FALSE;
if (Index == 0)
break;
ListEntry = ListEntry->Flink;
Index--;
}
Provider = CONTAINING_RECORD(ListEntry, IFS_PROVIDER, ListEntry);
wcscpy(FileSystem, Provider->Name);
*Major = 0; /* FIXME */
*Minor = 0; /* FIXME */
*LatestVersion = TRUE; /* FIXME */
Provider = CONTAINING_RECORD(ListEntry, IFS_PROVIDER, ListEntry);
wcscpy(FileSystem, Provider->Name);
*Major = 0; /* FIXME */
*Minor = 0; /* FIXME */
*LatestVersion = TRUE; /* FIXME */
return TRUE;
return TRUE;
}