mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 09:52:56 +00:00
Don't hardcode the list of available filesystems in fmifs.dll, but store it in the registry.
Adding a filesystem is now only a matter of creating a u{FS}.dll + one registry entry to be able to use normal format.exe/chkdsk.exe/... svn path=/trunk/; revision=24254
This commit is contained in:
parent
9cea0fddde
commit
f1d365f767
2 changed files with 64 additions and 8 deletions
|
@ -734,6 +734,10 @@ HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Tonga Standard Tim
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||||
|
|
||||||
|
; Available file systems
|
||||||
|
HKLM,"SOFTWARE\ReactOS\ReactOS\CurrentVersion\IFS","FAT",0x00000000,"ufat.dll"
|
||||||
|
HKLM,"SOFTWARE\ReactOS\ReactOS\CurrentVersion\IFS","FAT32",0x00000000,"ufat.dll"
|
||||||
|
|
||||||
HKLM,"SOFTWARE\ReactOS\Windows NT\CurrentVersion\Winlogon","ConsoleShell",0x00020000,"%SystemRoot%\system32\cmd.exe"
|
HKLM,"SOFTWARE\ReactOS\Windows NT\CurrentVersion\Winlogon","ConsoleShell",0x00020000,"%SystemRoot%\system32\cmd.exe"
|
||||||
HKLM,"SOFTWARE\ReactOS\Windows NT\CurrentVersion\Winlogon","Shell",0x00020000,"%SystemRoot%\explorer.exe"
|
HKLM,"SOFTWARE\ReactOS\Windows NT\CurrentVersion\Winlogon","Shell",0x00020000,"%SystemRoot%\explorer.exe"
|
||||||
HKLM,"SOFTWARE\ReactOS\Windows NT\CurrentVersion\Winlogon","StartServices",0x00010001,0x00000001
|
HKLM,"SOFTWARE\ReactOS\Windows NT\CurrentVersion\Winlogon","StartServices",0x00010001,0x00000001
|
||||||
|
|
|
@ -35,7 +35,7 @@ GetProvider(
|
||||||
|
|
||||||
static BOOLEAN
|
static BOOLEAN
|
||||||
AddProvider(
|
AddProvider(
|
||||||
IN PWCHAR FileSystem,
|
IN PCUNICODE_STRING FileSystem,
|
||||||
IN PWCHAR DllFile)
|
IN PWCHAR DllFile)
|
||||||
{
|
{
|
||||||
PIFS_PROVIDER Provider = NULL;
|
PIFS_PROVIDER Provider = NULL;
|
||||||
|
@ -48,7 +48,7 @@ AddProvider(
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
RequiredSize = FIELD_OFFSET(IFS_PROVIDER, Name)
|
RequiredSize = FIELD_OFFSET(IFS_PROVIDER, Name)
|
||||||
+ wcslen(FileSystem) * sizeof(WCHAR) + sizeof(UNICODE_NULL);
|
+ FileSystem->Length + sizeof(UNICODE_NULL);
|
||||||
Provider = (PIFS_PROVIDER)RtlAllocateHeap(
|
Provider = (PIFS_PROVIDER)RtlAllocateHeap(
|
||||||
RtlGetProcessHeap(),
|
RtlGetProcessHeap(),
|
||||||
0,
|
0,
|
||||||
|
@ -62,7 +62,7 @@ AddProvider(
|
||||||
//Provider->Extend = (EXTEND)GetProcAddress(hMod, "Extend");
|
//Provider->Extend = (EXTEND)GetProcAddress(hMod, "Extend");
|
||||||
Provider->FormatEx = (FORMATEX)GetProcAddress(hMod, "FormatEx");
|
Provider->FormatEx = (FORMATEX)GetProcAddress(hMod, "FormatEx");
|
||||||
|
|
||||||
wcscpy(Provider->Name, FileSystem);
|
RtlCopyMemory(Provider->Name, FileSystem->Buffer, FileSystem->Length);
|
||||||
|
|
||||||
InsertTailList(&ProviderListHead, &Provider->ListEntry);
|
InsertTailList(&ProviderListHead, &Provider->ListEntry);
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
|
@ -81,14 +81,66 @@ cleanup:
|
||||||
static BOOLEAN
|
static BOOLEAN
|
||||||
InitializeFmIfsOnce(void)
|
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;
|
||||||
|
|
||||||
InitializeListHead(&ProviderListHead);
|
InitializeListHead(&ProviderListHead);
|
||||||
|
|
||||||
/* Add default providers */
|
/* Read IFS providers from HKLM\SOFTWARE\ReactOS\ReactOS\CurrentVersion\IFS */
|
||||||
AddProvider(L"FAT", L"ufat");
|
InitializeObjectAttributes(&ObjectAttributes, &RegistryPath, 0, NULL, NULL);
|
||||||
AddProvider(L"FAT32", L"ufat");
|
Status = NtOpenKey(&hKey, KEY_QUERY_VALUE, &ObjectAttributes);
|
||||||
|
if (Status == STATUS_OBJECT_NAME_NOT_FOUND)
|
||||||
|
return TRUE;
|
||||||
|
else if (!NT_SUCCESS(Status))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
/* TODO: Check how many IFS are installed in the system */
|
Buffer = (PKEY_VALUE_FULL_INFORMATION)RtlAllocateHeap(
|
||||||
/* TODO: and register a descriptor for each one */
|
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;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
NtClose(hKey);
|
||||||
|
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue