mirror of
https://github.com/reactos/reactos.git
synced 2025-01-05 22:12:46 +00:00
[RTL]
Implement RtlCreateBootStatusDataFile, RtlGetSetBootStatusData, RtlLockBootStatusData and RtlUnlockBootStatusData. [SYSSETUP] Call RtlCreateBootStatusDataFile as part of the install process. svn path=/trunk/; revision=56332
This commit is contained in:
parent
4c6cc26667
commit
4f80488ca3
2 changed files with 165 additions and 17 deletions
|
@ -1750,6 +1750,9 @@ RegistrationProc(LPVOID Parameter)
|
||||||
SetupTermDefaultQueueCallback(RegistrationData->DefaultContext);
|
SetupTermDefaultQueueCallback(RegistrationData->DefaultContext);
|
||||||
HeapFree(GetProcessHeap(), 0, RegistrationData);
|
HeapFree(GetProcessHeap(), 0, RegistrationData);
|
||||||
|
|
||||||
|
// FIXME: Move this call to a separate cleanup page!
|
||||||
|
RtlCreateBootStatusDataFile();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2051,6 +2054,8 @@ FinishDlgProc(HWND hwndDlg,
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
ProcessUnattendInf(HINF hUnattendedInf)
|
ProcessUnattendInf(HINF hUnattendedInf)
|
||||||
{
|
{
|
||||||
|
@ -2260,8 +2265,9 @@ GetRosInstallCD(WCHAR *pwszPath, DWORD cchPathMax)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
ProcessUnattendSetup()
|
ProcessUnattendSetup(VOID)
|
||||||
{
|
{
|
||||||
WCHAR szPath[MAX_PATH];
|
WCHAR szPath[MAX_PATH];
|
||||||
HINF hUnattendedInf;
|
HINF hUnattendedInf;
|
||||||
|
@ -2312,7 +2318,6 @@ InstallWizard(VOID)
|
||||||
|
|
||||||
ProcessUnattendSetup();
|
ProcessUnattendSetup();
|
||||||
|
|
||||||
|
|
||||||
/* Create the Welcome page */
|
/* Create the Welcome page */
|
||||||
psp.dwSize = sizeof(PROPSHEETPAGE);
|
psp.dwSize = sizeof(PROPSHEETPAGE);
|
||||||
psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
|
psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
|
||||||
|
|
|
@ -12,10 +12,18 @@
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
typedef struct _RTL_BSD_ITEM
|
||||||
|
{
|
||||||
|
ULONG Offset;
|
||||||
|
ULONG Size;
|
||||||
|
} RTL_BSD_ITEM, *PRTL_BSD_ITEM;
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
static SID_IDENTIFIER_AUTHORITY LocalSystemAuthority = {SECURITY_NT_AUTHORITY};
|
static SID_IDENTIFIER_AUTHORITY LocalSystemAuthority = {SECURITY_NT_AUTHORITY};
|
||||||
|
|
||||||
|
static RTL_BSD_ITEM BsdItemTable[6] = {{0, 4}, {4, 4,}, {8, 1}, {9, 1}, {10, 1}, {11, 1}};
|
||||||
|
|
||||||
static NTSTATUS
|
static NTSTATUS
|
||||||
RtlpSysVolCreateSecurityDescriptor(OUT PISECURITY_DESCRIPTOR *SecurityDescriptor,
|
RtlpSysVolCreateSecurityDescriptor(OUT PISECURITY_DESCRIPTOR *SecurityDescriptor,
|
||||||
OUT PSID *SystemSid)
|
OUT PSID *SystemSid)
|
||||||
|
@ -671,52 +679,187 @@ RtlCreateSystemVolumeInformationFolder(IN PUNICODE_STRING VolumeRootPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
RtlCreateBootStatusDataFile(VOID)
|
RtlCreateBootStatusDataFile(VOID)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
|
LARGE_INTEGER AllocationSize;
|
||||||
|
LARGE_INTEGER ByteOffset;
|
||||||
|
UNICODE_STRING FileName;
|
||||||
|
HANDLE FileHandle;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
/* Initialize the file name */
|
||||||
|
RtlInitUnicodeString(&FileName,
|
||||||
|
L"\\SystemRoot\\bootstat.dat");
|
||||||
|
|
||||||
|
/* Initialize the object attributes */
|
||||||
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
|
&FileName,
|
||||||
|
OBJ_CASE_INSENSITIVE,
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
AllocationSize.QuadPart = 0x800;
|
||||||
|
|
||||||
|
/* Create the boot status data file */
|
||||||
|
Status = ZwCreateFile(&FileHandle,
|
||||||
|
FILE_GENERIC_READ | FILE_GENERIC_WRITE,
|
||||||
|
&ObjectAttributes,
|
||||||
|
&IoStatusBlock,
|
||||||
|
NULL, //&AllocationSize,
|
||||||
|
FILE_ATTRIBUTE_SYSTEM,
|
||||||
|
0,
|
||||||
|
FILE_CREATE,
|
||||||
|
FILE_SYNCHRONOUS_IO_NONALERT,
|
||||||
|
NULL,
|
||||||
|
0);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
// FIXME: Initialize the buffer in a better way.
|
||||||
|
UCHAR Buffer[12] = {0xC,0,0,0, 1,0,0,0, 1, 0x1e, 1, 0};
|
||||||
|
|
||||||
|
ByteOffset.QuadPart = 0;
|
||||||
|
Status = ZwWriteFile(FileHandle,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
&IoStatusBlock,
|
||||||
|
&Buffer,
|
||||||
|
12, //BufferSize,
|
||||||
|
&ByteOffset,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Close the file */
|
||||||
|
ZwClose(FileHandle);
|
||||||
|
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
RtlGetSetBootStatusData(IN HANDLE Filehandle,
|
RtlGetSetBootStatusData(IN HANDLE FileHandle,
|
||||||
IN BOOLEAN WriteMode,
|
IN BOOLEAN WriteMode,
|
||||||
IN RTL_BSD_ITEM_TYPE DataClass,
|
IN RTL_BSD_ITEM_TYPE DataClass,
|
||||||
IN PVOID Buffer,
|
IN PVOID Buffer,
|
||||||
IN ULONG BufferSize,
|
IN ULONG BufferSize,
|
||||||
OUT PULONG ReturnLength)
|
OUT PULONG ReturnLength)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
LARGE_INTEGER ByteOffset;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
DPRINT("RtlGetSetBootStatusData (%p %u %u %p %lu %p)\n",
|
||||||
|
FileHandle, WriteMode, DataClass, Buffer, BufferSize, ReturnLength);
|
||||||
|
|
||||||
|
if (DataClass >= RtlBsdItemMax)
|
||||||
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
if (BufferSize > BsdItemTable[DataClass].Size)
|
||||||
|
return STATUS_BUFFER_TOO_SMALL;
|
||||||
|
|
||||||
|
ByteOffset.HighPart = 0;
|
||||||
|
ByteOffset.LowPart = BsdItemTable[DataClass].Offset;
|
||||||
|
|
||||||
|
if (WriteMode)
|
||||||
|
{
|
||||||
|
Status = ZwReadFile(FileHandle,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
&IoStatusBlock,
|
||||||
|
Buffer,
|
||||||
|
BufferSize,
|
||||||
|
&ByteOffset,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Status = ZwWriteFile(FileHandle,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
&IoStatusBlock,
|
||||||
|
Buffer,
|
||||||
|
BufferSize,
|
||||||
|
&ByteOffset,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
if (ReturnLength)
|
||||||
|
*ReturnLength = BsdItemTable[DataClass].Size;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
RtlLockBootStatusData(OUT PHANDLE Filehandle)
|
RtlLockBootStatusData(OUT PHANDLE FileHandle)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
|
UNICODE_STRING FileName;
|
||||||
|
HANDLE LocalFileHandle;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
/* Intialize the file handle */
|
||||||
|
*FileHandle = NULL;
|
||||||
|
|
||||||
|
/* Initialize the file name */
|
||||||
|
RtlInitUnicodeString(&FileName,
|
||||||
|
L"\\SystemRoot\\bootstat.dat");
|
||||||
|
|
||||||
|
/* Initialize the object attributes */
|
||||||
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
|
&FileName,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
/* Open the boot status data file */
|
||||||
|
Status = ZwOpenFile(&LocalFileHandle,
|
||||||
|
FILE_ALL_ACCESS,
|
||||||
|
&ObjectAttributes,
|
||||||
|
&IoStatusBlock,
|
||||||
|
0,
|
||||||
|
FILE_SYNCHRONOUS_IO_NONALERT);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
/* Return the file handle */
|
||||||
|
*FileHandle = LocalFileHandle;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
RtlUnlockBootStatusData(IN HANDLE Filehandle)
|
RtlUnlockBootStatusData(IN HANDLE FileHandle)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
|
||||||
|
/* Flush the file and close it */
|
||||||
|
ZwFlushBuffersFile(FileHandle,
|
||||||
|
&IoStatusBlock);
|
||||||
|
|
||||||
|
return ZwClose(FileHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
Loading…
Reference in a new issue