ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
May 2007
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
17 participants
322 discussions
Start a n
N
ew thread
[tkreuzer] 26706: make caption font bold again
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sat May 12 02:57:21 2007 New Revision: 26706 URL:
http://svn.reactos.org/svn/reactos?rev=26706&view=rev
Log: make caption font bold again Modified: trunk/reactos/boot/bootdata/hivedef.inf Modified: trunk/reactos/boot/bootdata/hivedef.inf URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/hivedef.inf?…
============================================================================== --- trunk/reactos/boot/bootdata/hivedef.inf (original) +++ trunk/reactos/boot/bootdata/hivedef.inf Sat May 12 02:57:21 2007 @@ -92,7 +92,7 @@ ; GUI Setup HKCU, "Control Panel\Desktop\WindowMetrics","CaptionFont",0x00000001,f5,ff,ff,ff,00,00,00,\ -00,00,00,00,00,00,00,00,00,90,01,00,00,00,00,00,00,00,00,00,00,44,00,65,00,6a,00,61,00,56,\ +00,00,00,00,00,00,00,00,00,bc,02,00,00,00,00,00,00,00,00,00,00,44,00,65,00,6a,00,61,00,56,\ 00,75,00,20,00,53,00,61,00,6e,00,73,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\ 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 HKCU, "Control Panel\Desktop\WindowMetrics","IconFont",0x00000001,f5,ff,ff,ff,00,00,00,00,\
17 years, 7 months
1
0
0
0
[ion] 26705: - Copy CmOpenHiveFiles to cminit.c and rename to CmpOpenHiveFiles. Extend the functionality of the routine: - Allow caller to have full power over handles and filenames being used instead of hard-coding a pointer to the registry hive. - Setup proper I/O flags to disable compression and open for random access, backup-intent and allow disabling buffering. - Allow proper access mask/share mode when booting off read-only media. - Call the FS driver with FSCTL_MARK_AS_SYSTEM_HIVE if inst
by ion@svn.reactos.org
Author: ion Date: Sat May 12 02:51:11 2007 New Revision: 26705 URL:
http://svn.reactos.org/svn/reactos?rev=26705&view=rev
Log: - Copy CmOpenHiveFiles to cminit.c and rename to CmpOpenHiveFiles. Extend the functionality of the routine: - Allow caller to have full power over handles and filenames being used instead of hard-coding a pointer to the registry hive. - Setup proper I/O flags to disable compression and open for random access, backup-intent and allow disabling buffering. - Allow proper access mask/share mode when booting off read-only media. - Call the FS driver with FSCTL_MARK_AS_SYSTEM_HIVE if instructed. - Call with FSCTL_SET_COMPRESSION to make sure compression is off. - Allow creating the hive if it doesn't exist already. - Consider 0-byte opened hives as new hives. - Allow caller to request volume sector size and validate with hive cluster size. - Make .log hives hidden. - Implemement CmpCreateEvent to allowed for overlapped I/O registry operations. - Move more globals to cmdata.c. Modified: trunk/reactos/ntoskrnl/cm/cm.h trunk/reactos/ntoskrnl/cm/regfile.c trunk/reactos/ntoskrnl/config/cm.h trunk/reactos/ntoskrnl/config/cmdata.c trunk/reactos/ntoskrnl/config/cminit.c trunk/reactos/ntoskrnl/config/cmsysini.c trunk/reactos/ntoskrnl/config/cmwraprs.c Modified: trunk/reactos/ntoskrnl/cm/cm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/cm.h?rev=26705…
============================================================================== --- trunk/reactos/ntoskrnl/cm/cm.h (original) +++ trunk/reactos/ntoskrnl/cm/cm.h Sat May 12 02:51:11 2007 @@ -496,6 +496,19 @@ NTAPI CmpCreateRegistryRoot(VOID); +NTSTATUS +NTAPI +CmpOpenHiveFiles(IN PUNICODE_STRING BaseName, + IN PWCHAR Extension OPTIONAL, + IN PHANDLE Primary, + IN PHANDLE Log, + IN PULONG PrimaryDisposition, + IN PULONG LogDisposition, + IN BOOLEAN CreateAllowed, + IN BOOLEAN MarkAsSystemHive, + IN BOOLEAN NoBuffering, + OUT PULONG ClusterSize OPTIONAL); + #if 0 static __inline PVOID xHvGetCell(char *file, int line, PHHIVE Hive, HCELL_INDEX Cell) { Modified: trunk/reactos/ntoskrnl/cm/regfile.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/regfile.c?rev=…
============================================================================== --- trunk/reactos/ntoskrnl/cm/regfile.c (original) +++ trunk/reactos/ntoskrnl/cm/regfile.c Sat May 12 02:51:11 2007 @@ -283,63 +283,6 @@ return STATUS_SUCCESS; } - -NTSTATUS -CmOpenHiveFiles(PEREGISTRY_HIVE RegistryHive) -{ - OBJECT_ATTRIBUTES ObjectAttributes; - IO_STATUS_BLOCK IoStatusBlock; - NTSTATUS Status; - - InitializeObjectAttributes(&ObjectAttributes, - &RegistryHive->HiveFileName, - OBJ_CASE_INSENSITIVE, - NULL, - NULL); - - Status = ZwCreateFile(&RegistryHive->HiveHandle, - FILE_ALL_ACCESS, - &ObjectAttributes, - &IoStatusBlock, - NULL, - FILE_ATTRIBUTE_NORMAL, - 0, - FILE_OPEN, - FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT, - NULL, - 0); - if (!NT_SUCCESS(Status)) - { - return(Status); - } - - InitializeObjectAttributes(&ObjectAttributes, - &RegistryHive->LogFileName, - OBJ_CASE_INSENSITIVE, - NULL, - NULL); - - Status = ZwCreateFile(&RegistryHive->LogHandle, - FILE_ALL_ACCESS, - &ObjectAttributes, - &IoStatusBlock, - NULL, - FILE_ATTRIBUTE_NORMAL, - 0, - FILE_SUPERSEDE, - FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT, - NULL, - 0); - if (!NT_SUCCESS(Status)) - { - ZwClose(RegistryHive->HiveHandle); - return(Status); - } - - return STATUS_SUCCESS; -} - - VOID CmCloseHiveFiles(PEREGISTRY_HIVE RegistryHive) { @@ -353,6 +296,7 @@ { BOOLEAN Success; NTSTATUS Status; + ULONG Disposition; ASSERT(!IsNoFileHive(RegistryHive)); @@ -361,7 +305,16 @@ return(STATUS_SUCCESS); } - Status = CmOpenHiveFiles(RegistryHive); + Status = CmpOpenHiveFiles(&RegistryHive->HiveFileName, + L".LOG", + &RegistryHive->HiveHandle, + &RegistryHive->LogHandle, + &Disposition, + &Disposition, + FALSE, + FALSE, + TRUE, + NULL); if (!NT_SUCCESS(Status)) { return Status; Modified: trunk/reactos/ntoskrnl/config/cm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cm.h?rev=2…
============================================================================== --- trunk/reactos/ntoskrnl/config/cm.h (original) +++ trunk/reactos/ntoskrnl/config/cm.h Sat May 12 02:51:11 2007 @@ -1007,6 +1007,14 @@ // // Wrapper Routines // +NTSTATUS +NTAPI +CmpCreateEvent( + IN EVENT_TYPE EventType, + OUT PHANDLE EventHandle, + OUT PKEVENT *Event +); + PVOID NTAPI CmpAllocate( @@ -1060,6 +1068,8 @@ // extern BOOLEAN CmpSpecialBootCondition; extern BOOLEAN CmpFlushOnLockRelease; +extern BOOLEAN CmpShareSystemHives; +extern BOOLEAN CmpMiniNTBoot; extern EX_PUSH_LOCK CmpHiveListHeadLock; extern LIST_ENTRY CmpHiveListHead; extern POBJECT_TYPE CmpKeyObjectType; @@ -1080,6 +1090,14 @@ extern ULONG CmpConfigurationAreaSize; extern PCM_FULL_RESOURCE_DESCRIPTOR CmpConfigurationData; extern UNICODE_STRING CmTypeName[]; +extern HIVE_LIST_ENTRY CmpMachineHiveList[5]; +extern UNICODE_STRING CmSymbolicLinkValueName; +extern UNICODE_STRING CmpSystemStartOptions; +extern UNICODE_STRING CmpLoadOptions; +extern BOOLEAN CmSelfHeal; +extern BOOLEAN CmpSelfHeal; +extern ULONG CmpBootType; +extern HANDLE CmpRegistryRootHandle; extern BOOLEAN ExpInTextModeSetup; // Modified: trunk/reactos/ntoskrnl/config/cmdata.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmdata.c?r…
============================================================================== --- trunk/reactos/ntoskrnl/config/cmdata.c (original) +++ trunk/reactos/ntoskrnl/config/cmdata.c Sat May 12 02:51:11 2007 @@ -37,6 +37,22 @@ PCM_FULL_RESOURCE_DESCRIPTOR CmpConfigurationData; EX_PUSH_LOCK CmpHiveListHeadLock; + +HIVE_LIST_ENTRY CmpMachineHiveList[5]; + +UNICODE_STRING CmSymbolicLinkValueName = + RTL_CONSTANT_STRING(L"SymbolicLinkValue"); + +UNICODE_STRING CmpSystemStartOptions; +UNICODE_STRING CmpLoadOptions; + +BOOLEAN CmpShareSystemHives; +BOOLEAN CmSelfHeal = TRUE; +BOOLEAN CmpSelfHeal = TRUE; +BOOLEAN CmpMiniNTBoot; +ULONG CmpBootType; + +HANDLE CmpRegistryRootHandle; UNICODE_STRING CmTypeName[MaximumType + 1] = { Modified: trunk/reactos/ntoskrnl/config/cminit.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cminit.c?r…
============================================================================== --- trunk/reactos/ntoskrnl/config/cminit.c (original) +++ trunk/reactos/ntoskrnl/config/cminit.c Sat May 12 02:51:11 2007 @@ -226,3 +226,357 @@ *RegistryHive = (PCMHIVE)Hive; return STATUS_SUCCESS; } + +NTSTATUS +NTAPI +CmpOpenHiveFiles(IN PUNICODE_STRING BaseName, + IN PWCHAR Extension OPTIONAL, + IN PHANDLE Primary, + IN PHANDLE Log, + IN PULONG PrimaryDisposition, + IN PULONG LogDisposition, + IN BOOLEAN CreateAllowed, + IN BOOLEAN MarkAsSystemHive, + IN BOOLEAN NoBuffering, + OUT PULONG ClusterSize OPTIONAL) +{ + HANDLE EventHandle; + PKEVENT Event; + NTSTATUS Status; + UNICODE_STRING FullName, ExtensionName; + PWCHAR NameBuffer; + USHORT Length; + OBJECT_ATTRIBUTES ObjectAttributes; + IO_STATUS_BLOCK IoStatusBlock; + ULONG AttributeFlags, ShareMode, DesiredAccess, CreateDisposition, IoFlags; + USHORT CompressionState; + FILE_STANDARD_INFORMATION FileInformation; + FILE_FS_SIZE_INFORMATION FsSizeInformation; + + /* Create event */ + Status = CmpCreateEvent(NotificationEvent, &EventHandle, &Event); + if (!NT_SUCCESS(Status)) return Status; + + /* Initialize the full name */ + RtlInitEmptyUnicodeString(&FullName, NULL, 0); + Length = BaseName->Length; + + /* Check if we have an extension */ + if (Extension) + { + /* Update the name length */ + Length += wcslen(Extension) * sizeof(WCHAR) + sizeof(UNICODE_NULL); + + /* Allocate the buffer for the full name */ + NameBuffer = ExAllocatePoolWithTag(PagedPool, Length, TAG_CM); + if (!NameBuffer) + { + /* Fail */ + ObDereferenceObject(Event); + ZwClose(EventHandle); + return STATUS_NO_MEMORY; + } + + /* Build the full name */ + FullName.Buffer = NameBuffer; + FullName.MaximumLength = Length; + RtlAppendUnicodeStringToString(&FullName, BaseName); + } + else + { + /* The base name is the full name */ + FullName = *BaseName; + NameBuffer = NULL; + } + + /* Initialize the attributes */ + InitializeObjectAttributes(&ObjectAttributes, + &FullName, + OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, + NULL, + NULL); + + /* Check if we can create the hive */ + if ((CreateAllowed) && !(CmpShareSystemHives)) + { + /* Open only or create */ + CreateDisposition = FILE_OPEN_IF; + } + else + { + /* Open only */ + CreateDisposition = FILE_OPEN; + } + + /* Setup the flags */ + IoFlags = FILE_OPEN_FOR_BACKUP_INTENT | + FILE_NO_COMPRESSION | + FILE_RANDOM_ACCESS | + (NoBuffering) ? FILE_NO_INTERMEDIATE_BUFFERING : 0; + + /* Set share and access modes */ + if ((CmpMiniNTBoot) && (CmpShareSystemHives)) + { + /* We're on Live CD or otherwise sharing */ + DesiredAccess = FILE_READ_DATA; + ShareMode = FILE_SHARE_READ; + } + else + { + /* We want to write exclusively */ + ShareMode = 0; + DesiredAccess = FILE_READ_DATA | FILE_WRITE_DATA; + } + + /* Default attributes */ + AttributeFlags = FILE_ATTRIBUTE_NORMAL; + + /* Now create the file */ + Status = ZwCreateFile(Primary, + DesiredAccess, + &ObjectAttributes, + &IoStatusBlock, + NULL, + AttributeFlags, + ShareMode, + CreateDisposition, + FILE_SYNCHRONOUS_IO_NONALERT | IoFlags, + NULL, + 0); + if ((NT_SUCCESS(Status)) && (MarkAsSystemHive)) + { + /* We opened it, mark it as a system hive */ + Status = ZwFsControlFile(*Primary, + EventHandle, + NULL, + NULL, + &IoStatusBlock, + FSCTL_MARK_AS_SYSTEM_HIVE, + NULL, + 0, + NULL, + 0); + if (Status == STATUS_PENDING) + { + /* Wait for completion */ + KeWaitForSingleObject(Event, + Executive, + KernelMode, + FALSE, + NULL); + Status = IoStatusBlock.Status; + } + + /* If we don't support it, ignore the failure */ + if (Status == STATUS_INVALID_DEVICE_REQUEST) Status = STATUS_SUCCESS; + + /* If we failed, close the handle */ + if (!NT_SUCCESS(Status)) ZwClose(*Primary); + } + + /* Check if anything failed until now */ + if (!NT_SUCCESS(Status)) + { + /* Close handles and free buffers */ + if (NameBuffer) ExFreePool(NameBuffer); + ObDereferenceObject(Event); + ZwClose(EventHandle); + return Status; + } + + /* Disable compression */ + CompressionState = 0; + Status = ZwFsControlFile(*Primary, + EventHandle, + NULL, + NULL, + &IoStatusBlock, + FSCTL_SET_COMPRESSION, + &CompressionState, + sizeof(CompressionState), + NULL, + 0); + if (Status == STATUS_PENDING) + { + /* Wait for completion */ + KeWaitForSingleObject(Event, + Executive, + KernelMode, + FALSE, + NULL); + } + + /* Get the disposition */ + *PrimaryDisposition = IoStatusBlock.Information; + if (IoStatusBlock.Information != FILE_CREATED) + { + /* Check how large the file is */ + Status = ZwQueryInformationFile(*Primary, + &IoStatusBlock, + &FileInformation, + sizeof(FileInformation), + FileStandardInformation); + if (NT_SUCCESS(Status)) + { + /* Check if it's 0 bytes */ + if (!FileInformation.EndOfFile.QuadPart) + { + /* Assume it's a new file */ + *PrimaryDisposition = FILE_CREATED; + } + } + } + + /* Check if the caller wants cluster size returned */ + if (ClusterSize) + { + /* Query it */ + Status = ZwQueryVolumeInformationFile(*Primary, + &IoStatusBlock, + &FsSizeInformation, + sizeof(FsSizeInformation), + FileFsSizeInformation); + if (!NT_SUCCESS(Status)) + { + /* Close handles and free buffers */ + if (NameBuffer) ExFreePool(NameBuffer); + ObDereferenceObject(Event); + ZwClose(EventHandle); + return Status; + } + + /* Check if the sector size is invalid */ + if (FsSizeInformation.BytesPerSector > HBLOCK_SIZE) + { + /* Close handles and free buffers */ + if (NameBuffer) ExFreePool(NameBuffer); + ObDereferenceObject(Event); + ZwClose(EventHandle); + return STATUS_CANNOT_LOAD_REGISTRY_FILE; + } + + /* Return cluster size */ + *ClusterSize = max(1, FsSizeInformation.BytesPerSector / HSECTOR_SIZE); + } + + /* Check if we don't need to create a log file */ + if (!Extension) + { + /* We're done, close handles and free buffers */ + if (NameBuffer) ExFreePool(NameBuffer); + ObDereferenceObject(Event); + ZwClose(EventHandle); + return STATUS_SUCCESS; + } + + /* Check if we can create the hive */ + CreateDisposition = CmpShareSystemHives ? FILE_OPEN : FILE_OPEN_IF; + if (*PrimaryDisposition == FILE_CREATED) + { + /* Over-write the existing log file, since this is a new hive */ + CreateDisposition = FILE_SUPERSEDE; + } + + /* Setup the name */ + RtlInitUnicodeString(&ExtensionName, Extension); + RtlAppendUnicodeStringToString(&FullName, &ExtensionName); + + /* Initialize the attributes */ + InitializeObjectAttributes(&ObjectAttributes, + &FullName, + OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, + NULL, + NULL); + + /* Setup the flags */ + IoFlags = FILE_NO_COMPRESSION | FILE_NO_INTERMEDIATE_BUFFERING; + + /* Check if this is a log file */ + if (!_wcsnicmp(Extension, L".log", 4)) + { + /* Hide log files */ + AttributeFlags |= FILE_ATTRIBUTE_HIDDEN; + } + + /* Now create the file */ + Status = ZwCreateFile(Log, + DesiredAccess, + &ObjectAttributes, + &IoStatusBlock, + NULL, + AttributeFlags, + ShareMode, + CreateDisposition, + IoFlags, + NULL, + 0); + if ((NT_SUCCESS(Status)) && (MarkAsSystemHive)) + { + /* We opened it, mark it as a system hive */ + Status = ZwFsControlFile(*Log, + EventHandle, + NULL, + NULL, + &IoStatusBlock, + FSCTL_MARK_AS_SYSTEM_HIVE, + NULL, + 0, + NULL, + 0); + if (Status == STATUS_PENDING) + { + /* Wait for completion */ + KeWaitForSingleObject(Event, + Executive, + KernelMode, + FALSE, + NULL); + Status = IoStatusBlock.Status; + } + + /* If we don't support it, ignore the failure */ + if (Status == STATUS_INVALID_DEVICE_REQUEST) Status = STATUS_SUCCESS; + + /* If we failed, close the handle */ + if (!NT_SUCCESS(Status)) ZwClose(*Log); + } + + /* Check if anything failed until now */ + if (!NT_SUCCESS(Status)) + { + /* Clear the handle */ + *Log = NULL; + } + else + { + /* Disable compression */ + Status = ZwFsControlFile(*Log, + EventHandle, + NULL, + NULL, + &IoStatusBlock, + FSCTL_SET_COMPRESSION, + &CompressionState, + sizeof(CompressionState), + NULL, + 0); + if (Status == STATUS_PENDING) + { + /* Wait for completion */ + KeWaitForSingleObject(Event, + Executive, + KernelMode, + FALSE, + NULL); + } + + /* Return the disposition */ + *LogDisposition = IoStatusBlock.Information; + } + + /* We're done, close handles and free buffers */ + if (NameBuffer) ExFreePool(NameBuffer); + ObDereferenceObject(Event); + ZwClose(EventHandle); + return STATUS_SUCCESS; +} Modified: trunk/reactos/ntoskrnl/config/cmsysini.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmsysini.c…
============================================================================== --- trunk/reactos/ntoskrnl/config/cmsysini.c (original) +++ trunk/reactos/ntoskrnl/config/cmsysini.c Sat May 12 02:51:11 2007 @@ -12,25 +12,6 @@ #include "cm.h" #define NDEBUG #include "debug.h" - -/* GLOBALS *******************************************************************/ - -HIVE_LIST_ENTRY CmpMachineHiveList[5]; - -UNICODE_STRING CmSymbolicLinkValueName = - RTL_CONSTANT_STRING(L"SymbolicLinkValue"); - -UNICODE_STRING CmpSystemStartOptions; -UNICODE_STRING CmpLoadOptions; - -BOOLEAN CmpShareSystemHives; -BOOLEAN CmSelfHeal = TRUE; -BOOLEAN CmpSelfHeal = TRUE; -ULONG CmpBootType; - -HANDLE CmpRegistryRootHandle; - -extern BOOLEAN ExpInTextModeSetup; /* FUNCTIONS *****************************************************************/ Modified: trunk/reactos/ntoskrnl/config/cmwraprs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmwraprs.c…
============================================================================== --- trunk/reactos/ntoskrnl/config/cmwraprs.c (original) +++ trunk/reactos/ntoskrnl/config/cmwraprs.c Sat May 12 02:51:11 2007 @@ -14,6 +14,41 @@ #include "debug.h" /* FUNCTIONS *****************************************************************/ + +NTSTATUS +NTAPI +CmpCreateEvent(IN EVENT_TYPE EventType, + OUT PHANDLE EventHandle, + OUT PKEVENT *Event) +{ + NTSTATUS Status; + OBJECT_ATTRIBUTES ObjectAttributes; + + /* Create the event */ + InitializeObjectAttributes(&ObjectAttributes, + NULL, + OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, + NULL, + NULL); + Status = ZwCreateEvent(EventHandle, + EVENT_ALL_ACCESS, + &ObjectAttributes, + EventType, + FALSE); + if (!NT_SUCCESS(Status)) return Status; + + /* Get a pointer to the object itself */ + Status = ObReferenceObjectByHandle(*EventHandle, + EVENT_ALL_ACCESS, + NULL, + KernelMode, + (PVOID*)Event, + NULL); + if (!NT_SUCCESS(Status)) ZwClose(*EventHandle); + + /* Return status */ + return Status; +} PVOID NTAPI
17 years, 7 months
1
0
0
0
[ion] 26704: - Move Cmlib wrapper functions to cmwraprs.c and add the file -- no code change. - Move CmCheckRegistry stub to cmcheck.c and add the file. - Move CmpInitializeHive to cminit.c and add the file. Modify it to add Cm-rewrite compatible code (but #ifed out). - Change the HiveList lock to a pushlock instead of an ERESOURCE. Rename CmiHiveListHead to CmpHiveListHead. - Get rid of Cm security functions and stub the CmpSecurityMethod in cmse.c to always return success. Key security was nev
by ion@svn.reactos.org
Author: ion Date: Sat May 12 01:35:56 2007 New Revision: 26704 URL:
http://svn.reactos.org/svn/reactos?rev=26704&view=rev
Log: - Move Cmlib wrapper functions to cmwraprs.c and add the file -- no code change. - Move CmCheckRegistry stub to cmcheck.c and add the file. - Move CmpInitializeHive to cminit.c and add the file. Modify it to add Cm-rewrite compatible code (but #ifed out). - Change the HiveList lock to a pushlock instead of an ERESOURCE. Rename CmiHiveListHead to CmpHiveListHead. - Get rid of Cm security functions and stub the CmpSecurityMethod in cmse.c to always return success. Key security was never really working anyway, this just removes more code. Added: trunk/reactos/ntoskrnl/config/cmcheck.c trunk/reactos/ntoskrnl/config/cminit.c trunk/reactos/ntoskrnl/config/cmwraprs.c Modified: trunk/reactos/ntoskrnl/cm/cm.h trunk/reactos/ntoskrnl/cm/regfile.c trunk/reactos/ntoskrnl/cm/registry.c trunk/reactos/ntoskrnl/cm/regobj.c trunk/reactos/ntoskrnl/config/cm.h trunk/reactos/ntoskrnl/config/cmdata.c trunk/reactos/ntoskrnl/config/cmse.c trunk/reactos/ntoskrnl/ntoskrnl.rbuild Modified: trunk/reactos/ntoskrnl/cm/cm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/cm.h?rev=26704…
============================================================================== --- trunk/reactos/ntoskrnl/cm/cm.h (original) +++ trunk/reactos/ntoskrnl/cm/cm.h Sat May 12 01:35:56 2007 @@ -110,10 +110,10 @@ extern POBJECT_TYPE CmpKeyObjectType; extern KSPIN_LOCK CmiKeyListLock; -extern LIST_ENTRY CmiHiveListHead; +extern LIST_ENTRY CmpHiveListHead; extern ERESOURCE CmiRegistryLock; - +extern EX_PUSH_LOCK CmpHiveListHeadLock; /* Registry Callback Function */ typedef struct _REGISTRY_CALLBACK Modified: trunk/reactos/ntoskrnl/cm/regfile.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/regfile.c?rev=…
============================================================================== --- trunk/reactos/ntoskrnl/cm/regfile.c (original) +++ trunk/reactos/ntoskrnl/cm/regfile.c Sat May 12 01:35:56 2007 @@ -22,113 +22,6 @@ #define ABS_VALUE(V) (((V) < 0) ? -(V) : (V)) /* FUNCTIONS ****************************************************************/ - -PVOID CMAPI -CmpAllocate( - ULONG Size, - BOOLEAN Paged) -{ - return ExAllocatePoolWithTag(Paged ? PagedPool : NonPagedPool, - Size, TAG('R','E','G',' ')); -} - -VOID CMAPI -CmpFree( - PVOID Ptr) -{ - ExFreePool(Ptr); -} - - -BOOLEAN CMAPI -CmpFileRead( - PHHIVE RegistryHive, - ULONG FileType, - ULONGLONG FileOffset, - PVOID Buffer, - SIZE_T BufferLength) -{ - PEREGISTRY_HIVE CmHive = (PEREGISTRY_HIVE)RegistryHive; - HANDLE HiveHandle = FileType == HV_TYPE_PRIMARY ? CmHive->HiveHandle : CmHive->LogHandle; - LARGE_INTEGER _FileOffset; - IO_STATUS_BLOCK IoStatusBlock; - NTSTATUS Status; - - _FileOffset.QuadPart = FileOffset; - Status = ZwReadFile(HiveHandle, 0, 0, 0, &IoStatusBlock, - Buffer, BufferLength, &_FileOffset, 0); - return NT_SUCCESS(Status) ? TRUE : FALSE; -} - - -BOOLEAN CMAPI -CmpFileWrite( - PHHIVE RegistryHive, - ULONG FileType, - ULONGLONG FileOffset, - PVOID Buffer, - SIZE_T BufferLength) -{ - PEREGISTRY_HIVE CmHive = (PEREGISTRY_HIVE)RegistryHive; - HANDLE HiveHandle = FileType == HV_TYPE_PRIMARY ? CmHive->HiveHandle : CmHive->LogHandle; - LARGE_INTEGER _FileOffset; - IO_STATUS_BLOCK IoStatusBlock; - NTSTATUS Status; - - _FileOffset.QuadPart = FileOffset; - Status = ZwWriteFile(HiveHandle, 0, 0, 0, &IoStatusBlock, - Buffer, BufferLength, &_FileOffset, 0); - return NT_SUCCESS(Status) ? TRUE : FALSE; -} - - -BOOLEAN CMAPI -CmpFileSetSize( - PHHIVE RegistryHive, - ULONG FileType, - ULONGLONG FileSize) -{ - PEREGISTRY_HIVE CmHive = (PEREGISTRY_HIVE)RegistryHive; - HANDLE HiveHandle = FileType == HV_TYPE_PRIMARY ? CmHive->HiveHandle : CmHive->LogHandle; - FILE_END_OF_FILE_INFORMATION EndOfFileInfo; - FILE_ALLOCATION_INFORMATION FileAllocationInfo; - IO_STATUS_BLOCK IoStatusBlock; - NTSTATUS Status; - - EndOfFileInfo.EndOfFile.QuadPart = FileSize; - Status = ZwSetInformationFile(HiveHandle, &IoStatusBlock, - &EndOfFileInfo, - sizeof(FILE_END_OF_FILE_INFORMATION), - FileEndOfFileInformation); - if (!NT_SUCCESS(Status)) - return FALSE; - - FileAllocationInfo.AllocationSize.QuadPart = FileSize; - Status = ZwSetInformationFile(HiveHandle, &IoStatusBlock, - &FileAllocationInfo, - sizeof(FILE_ALLOCATION_INFORMATION), - FileAllocationInformation); - if (!NT_SUCCESS(Status)) - return FALSE; - - return TRUE; -} - - -BOOLEAN CMAPI -CmpFileFlush( - PHHIVE RegistryHive, - ULONG FileType) -{ - PEREGISTRY_HIVE CmHive = (PEREGISTRY_HIVE)RegistryHive; - HANDLE HiveHandle = FileType == HV_TYPE_PRIMARY ? CmHive->HiveHandle : CmHive->LogHandle; - IO_STATUS_BLOCK IoStatusBlock; - NTSTATUS Status; - - Status = ZwFlushBuffersFile(HiveHandle, &IoStatusBlock); - return NT_SUCCESS(Status) ? TRUE : FALSE; -} - static NTSTATUS CmiCreateNewRegFile(HANDLE FileHandle) @@ -319,144 +212,6 @@ return STATUS_SUCCESS; } -ULONG -NTAPI -CmCheckRegistry(IN PEREGISTRY_HIVE RegistryHive, - IN ULONG Flags) -{ - /* FIXME: HACK! */ - return 0; -} - -NTSTATUS -NTAPI -CmpInitializeHive(OUT PEREGISTRY_HIVE *RegistryHive, - IN ULONG OperationType, - IN ULONG HiveFlags, - IN ULONG FileType, - IN PVOID HiveData OPTIONAL, - IN HANDLE Primary, - IN HANDLE Log, - IN HANDLE External, - IN PUNICODE_STRING FileName OPTIONAL, - IN ULONG CheckFlags) -{ - PEREGISTRY_HIVE Hive; - IO_STATUS_BLOCK IoStatusBlock; - FILE_FS_SIZE_INFORMATION FileSizeInformation; - NTSTATUS Status; - ULONG Cluster; - - /* Assume failure */ - *RegistryHive = NULL; - - /* - * The following are invalid: - * An external hive that is also internal. - * A log hive that's not a primary hive too. - * A volatile hive that's linked to permanent storage. - * An in-memory initialization without hive data. - * A log hive that's not linked to a correct file type. - */ - if (((External) && ((Primary) || (Log))) || - ((Log) && !(Primary)) || - ((HiveFlags & HIVE_VOLATILE) && ((Primary) || (External) || (Log))) || - ((OperationType == HINIT_MEMORY) && (!HiveData)) || - ((Log) && (FileType != HFILE_TYPE_LOG))) - { - /* Fail the request */ - return STATUS_INVALID_PARAMETER; - } - - /* Check if this is a primary hive */ - if (Primary) - { - /* Get the cluster size */ - Status = ZwQueryVolumeInformationFile(Primary, - &IoStatusBlock, - &FileSizeInformation, - sizeof(FILE_FS_SIZE_INFORMATION), - FileFsSizeInformation); - if (!NT_SUCCESS(Status)) return Status; - - /* Make sure it's not larger then the block size */ - if (FileSizeInformation.BytesPerSector > HBLOCK_SIZE) - { - /* Fail */ - return STATUS_REGISTRY_IO_FAILED; - } - - /* Otherwise, calculate the cluster */ - Cluster = FileSizeInformation.BytesPerSector / HSECTOR_SIZE; - Cluster = max(1, Cluster); - } - else - { - /* Otherwise use cluster 1 */ - Cluster = 1; - } - - /* Allocate and clear the hive */ - Hive = ExAllocatePoolWithTag(NonPagedPool, sizeof(EREGISTRY_HIVE), TAG_CM); - if (!Hive) return STATUS_INSUFFICIENT_RESOURCES; - RtlZeroMemory(Hive, sizeof(EREGISTRY_HIVE)); - - /* Initialize it */ - Status = HvInitialize(&Hive->Hive, - OperationType, - HiveFlags, - FileType, - (ULONG_PTR)HiveData, - Cluster, - CmpAllocate, - CmpFree, - CmpFileRead, - CmpFileWrite, - CmpFileSetSize, - CmpFileFlush, - FileName); - if (!NT_SUCCESS(Status)) - { - /* Clear allocations and fail */ - ExFreePool(Hive); - return Status; - } - - /* Set flags */ - Hive->Flags = HiveFlags; - - /* Check if we should verify the registry */ - if ((OperationType == HINIT_FILE) || - (OperationType == HINIT_MEMORY) || - (OperationType == HINIT_MEMORY_INPLACE) || - (OperationType == HINIT_MAPFILE)) - { - /* Verify integrity */ - if (CmCheckRegistry(Hive, TRUE)) - { - /* Free all alocations */ - ExFreePool(Hive); - return STATUS_REGISTRY_CORRUPT; - } - } - - /* Acquire hive list lock exclusively */ - KeEnterCriticalRegion(); - ExAcquireResourceExclusiveLite(&CmiRegistryLock, TRUE); - - /* Add the new hive to the hive list */ - InsertTailList(&CmiHiveListHead, &Hive->HiveList); - - /* Release hive list lock */ - ExReleaseResourceLite(&CmiRegistryLock); - KeLeaveCriticalRegion(); - - /* Return the hive and success */ - VERIFY_REGISTRY_HIVE(Hive); - *RegistryHive = Hive; - return STATUS_SUCCESS; -} - NTSTATUS CmiLoadHive(IN POBJECT_ATTRIBUTES KeyObjectAttributes, IN PUNICODE_STRING FileName, @@ -493,7 +248,7 @@ } /* Add the new hive to the hive list */ - InsertTailList (&CmiHiveListHead, + InsertTailList (&CmpHiveListHead, &Hive->HiveList); VERIFY_REGISTRY_HIVE(Hive); Modified: trunk/reactos/ntoskrnl/cm/registry.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/registry.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/cm/registry.c (original) +++ trunk/reactos/ntoskrnl/cm/registry.c Sat May 12 01:35:56 2007 @@ -32,7 +32,7 @@ POBJECT_TYPE CmpKeyObjectType = NULL; PEREGISTRY_HIVE CmiVolatileHive = NULL; -LIST_ENTRY CmiHiveListHead; +LIST_ENTRY CmpHiveListHead; ERESOURCE CmiRegistryLock; @@ -210,8 +210,9 @@ PSECURITY_DESCRIPTOR SecurityDescriptor; PAGED_CODE(); - /* Initialize the hive list */ - InitializeListHead(&CmiHiveListHead); + /* Initialize the hive list and lock */ + InitializeListHead(&CmpHiveListHead); + ExInitializePushLock((PVOID)&CmpHiveListHeadLock); /* Initialize registry lock */ ExInitializeResourceLite(&CmiRegistryLock); @@ -854,12 +855,11 @@ CmiHiveSyncPending = FALSE; } - /* Acquire hive list lock exclusively */ - KeEnterCriticalRegion(); - ExAcquireResourceExclusiveLite(&CmiRegistryLock, TRUE); - - Entry = CmiHiveListHead.Flink; - while (Entry != &CmiHiveListHead) + /* Lock the hive list */ + ExAcquirePushLockExclusive(&CmpHiveListHeadLock); + + Entry = CmpHiveListHead.Flink; + while (Entry != &CmpHiveListHead) { Hive = CONTAINING_RECORD(Entry, EREGISTRY_HIVE, HiveList); @@ -872,9 +872,8 @@ Entry = Entry->Flink; } - /* Release hive list lock */ - ExReleaseResourceLite(&CmiRegistryLock); - KeLeaveCriticalRegion(); + /* Release the lock */ + ExReleasePushLock(&CmpHiveListHeadLock); DPRINT("CmShutdownRegistry() done\n"); } @@ -890,12 +889,11 @@ CmiHiveSyncPending = FALSE; - /* Acquire hive list lock exclusively */ - KeEnterCriticalRegion(); - ExAcquireResourceExclusiveLite(&CmiRegistryLock, TRUE); - - Entry = CmiHiveListHead.Flink; - while (Entry != &CmiHiveListHead) + /* Lock the hive list */ + ExAcquirePushLockExclusive(&CmpHiveListHeadLock); + + Entry = CmpHiveListHead.Flink; + while (Entry != &CmpHiveListHead) { Hive = CONTAINING_RECORD(Entry, EREGISTRY_HIVE, HiveList); @@ -908,9 +906,8 @@ Entry = Entry->Flink; } - /* Release hive list lock */ - ExReleaseResourceLite(&CmiRegistryLock); - KeLeaveCriticalRegion(); + /* Release the lock */ + ExReleasePushLock(&CmpHiveListHeadLock); DPRINT("DeferredContext 0x%p\n", DeferredContext); ExFreePool(DeferredContext); Modified: trunk/reactos/ntoskrnl/cm/regobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/regobj.c?rev=2…
============================================================================== --- trunk/reactos/ntoskrnl/cm/regobj.c (original) +++ trunk/reactos/ntoskrnl/cm/regobj.c Sat May 12 01:35:56 2007 @@ -675,158 +675,6 @@ CmiCallRegisteredCallbacks(RegNtPostKeyHandleClose, &PostOperationInfo); } - -static NTSTATUS -CmiQuerySecurityDescriptor(PKEY_OBJECT KeyObject, - SECURITY_INFORMATION SecurityInformation, - PISECURITY_DESCRIPTOR SecurityDescriptor, - PULONG BufferLength) -{ - ULONG_PTR Current; - ULONG SidSize; - ULONG SdSize; - NTSTATUS Status; - - DPRINT("CmiQuerySecurityDescriptor() called\n"); - - /* - * FIXME: - * This is a big hack!! - * We need to retrieve the security descriptor from the keys security cell! - */ - - if (SecurityInformation == 0) - { - return STATUS_ACCESS_DENIED; - } - - SidSize = RtlLengthSid(SeWorldSid); - SdSize = sizeof(SECURITY_DESCRIPTOR) + (2 * SidSize); - - if (*BufferLength < SdSize) - { - *BufferLength = SdSize; - return STATUS_BUFFER_TOO_SMALL; - } - - *BufferLength = SdSize; - - Status = RtlCreateSecurityDescriptor(SecurityDescriptor, - SECURITY_DESCRIPTOR_REVISION); - if (!NT_SUCCESS(Status)) - { - return Status; - } - - SecurityDescriptor->Control |= SE_SELF_RELATIVE; - Current = (ULONG_PTR)SecurityDescriptor + sizeof(SECURITY_DESCRIPTOR); - - if (SecurityInformation & OWNER_SECURITY_INFORMATION) - { - RtlCopyMemory((PVOID)Current, - SeWorldSid, - SidSize); - SecurityDescriptor->Owner = (PSID)((ULONG_PTR)Current - (ULONG_PTR)SecurityDescriptor); - Current += SidSize; - } - - if (SecurityInformation & GROUP_SECURITY_INFORMATION) - { - RtlCopyMemory((PVOID)Current, - SeWorldSid, - SidSize); - SecurityDescriptor->Group = (PSID)((ULONG_PTR)Current - (ULONG_PTR)SecurityDescriptor); - Current += SidSize; - } - - if (SecurityInformation & DACL_SECURITY_INFORMATION) - { - SecurityDescriptor->Control |= SE_DACL_PRESENT; - } - - if (SecurityInformation & SACL_SECURITY_INFORMATION) - { - SecurityDescriptor->Control |= SE_SACL_PRESENT; - } - - return STATUS_SUCCESS; -} - - -static NTSTATUS -CmiAssignSecurityDescriptor(PKEY_OBJECT KeyObject, - PSECURITY_DESCRIPTOR SecurityDescriptor) -{ -#if 0 - PEREGISTRY_HIVE Hive; - - DPRINT1("CmiAssignSecurityDescriptor() callled\n"); - - DPRINT1("KeyObject %p\n", KeyObject); - DPRINT1("KeyObject->RegistryHive %p\n", KeyObject->RegistryHive); - - Hive = KeyObject->RegistryHive; - if (Hive == NULL) - { - DPRINT1("Create new root security cell\n"); - return STATUS_SUCCESS; - } - - if (Hive->RootSecurityCell == NULL) - { - DPRINT1("Create new root security cell\n"); - - } - else - { - DPRINT1("Search for security cell\n"); - - } -#endif - - return STATUS_SUCCESS; -} - - -NTSTATUS STDCALL -CmpSecurityMethod(PVOID ObjectBody, - SECURITY_OPERATION_CODE OperationCode, - PSECURITY_INFORMATION SecurityInformation, - PSECURITY_DESCRIPTOR SecurityDescriptor, - PULONG BufferLength, - PSECURITY_DESCRIPTOR *OldSecurityDescriptor, - POOL_TYPE PoolType, - PGENERIC_MAPPING GenericMapping) -{ - DPRINT("CmpSecurityMethod() called\n"); - - switch (OperationCode) - { - case SetSecurityDescriptor: - DPRINT("Set security descriptor\n"); - return STATUS_SUCCESS; - - case QuerySecurityDescriptor: - DPRINT("Query security descriptor\n"); - return CmiQuerySecurityDescriptor((PKEY_OBJECT)ObjectBody, - *SecurityInformation, - SecurityDescriptor, - BufferLength); - - case DeleteSecurityDescriptor: - DPRINT("Delete security descriptor\n"); - return STATUS_SUCCESS; - - case AssignSecurityDescriptor: - DPRINT("Assign security descriptor\n"); - return CmiAssignSecurityDescriptor((PKEY_OBJECT)ObjectBody, - SecurityDescriptor); - } - - return STATUS_UNSUCCESSFUL; -} - - NTSTATUS STDCALL CmpQueryKeyName (PVOID ObjectBody, IN BOOLEAN HasName, Modified: trunk/reactos/ntoskrnl/config/cm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cm.h?rev=2…
============================================================================== --- trunk/reactos/ntoskrnl/config/cm.h (original) +++ trunk/reactos/ntoskrnl/config/cm.h Sat May 12 01:35:56 2007 @@ -696,11 +696,11 @@ // // Registry Validation Functions // -BOOLEAN +ULONG NTAPI CmCheckRegistry( IN PCMHIVE Hive, - IN BOOLEAN CleanFlag + IN ULONG Flags ); // @@ -1002,6 +1002,57 @@ IN INTERFACE_TYPE InterfaceType, IN ULONG BusNumber, IN PUSHORT DeviceIndexTable +); + +// +// Wrapper Routines +// +PVOID +NTAPI +CmpAllocate( + IN ULONG Size, + IN BOOLEAN Paged +); + +VOID +NTAPI +CmpFree( + IN PVOID Ptr +); + +BOOLEAN +NTAPI +CmpFileRead( + IN PHHIVE RegistryHive, + IN ULONG FileType, + IN ULONGLONG FileOffset, + OUT PVOID Buffer, + IN SIZE_T BufferLength +); + +BOOLEAN +NTAPI +CmpFileWrite( + IN PHHIVE RegistryHive, + IN ULONG FileType, + IN ULONGLONG FileOffset, + IN PVOID Buffer, + IN SIZE_T BufferLength +); + +BOOLEAN +NTAPI +CmpFileSetSize( + IN PHHIVE RegistryHive, + IN ULONG FileType, + IN ULONGLONG FileSize +); + +BOOLEAN +NTAPI +CmpFileFlush( + IN PHHIVE RegistryHive, + IN ULONG FileType ); // Added: trunk/reactos/ntoskrnl/config/cmcheck.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmcheck.c?…
============================================================================== --- trunk/reactos/ntoskrnl/config/cmcheck.c (added) +++ trunk/reactos/ntoskrnl/config/cmcheck.c Sat May 12 01:35:56 2007 @@ -1,0 +1,27 @@ +/* + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory + * FILE: ntoskrnl/config/cmcheck.c + * PURPOSE: Configuration Manager - Hive and Key Validation + * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include "ntoskrnl.h" +#include "cm.h" +#define NDEBUG +#include "debug.h" + +/* GLOBALS *******************************************************************/ + +/* FUNCTIONS *****************************************************************/ + +ULONG +NTAPI +CmCheckRegistry(IN PCMHIVE RegistryHive, + IN ULONG Flags) +{ + /* FIXME: HACK! */ + return 0; +} Modified: trunk/reactos/ntoskrnl/config/cmdata.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmdata.c?r…
============================================================================== --- trunk/reactos/ntoskrnl/config/cmdata.c (original) +++ trunk/reactos/ntoskrnl/config/cmdata.c Sat May 12 01:35:56 2007 @@ -35,6 +35,8 @@ ULONG CmpConfigurationAreaSize = PAGE_SIZE * 4; PCM_FULL_RESOURCE_DESCRIPTOR CmpConfigurationData; + +EX_PUSH_LOCK CmpHiveListHeadLock; UNICODE_STRING CmTypeName[MaximumType + 1] = { Added: trunk/reactos/ntoskrnl/config/cminit.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cminit.c?r…
============================================================================== --- trunk/reactos/ntoskrnl/config/cminit.c (added) +++ trunk/reactos/ntoskrnl/config/cminit.c Sat May 12 01:35:56 2007 @@ -1,0 +1,228 @@ +/* + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory + * FILE: ntoskrnl/config/cminit.c + * PURPOSE: Configuration Manager - Hive Initialization + * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include "ntoskrnl.h" +#include "cm.h" +#define NDEBUG +#include "debug.h" + +/* FUNCTIONS *****************************************************************/ + +NTSTATUS +NTAPI +CmpInitializeHive(OUT PCMHIVE *RegistryHive, + IN ULONG OperationType, + IN ULONG HiveFlags, + IN ULONG FileType, + IN PVOID HiveData OPTIONAL, + IN HANDLE Primary, + IN HANDLE Log, + IN HANDLE External, + IN PUNICODE_STRING FileName OPTIONAL, + IN ULONG CheckFlags) +{ +#if 0 + PCMHIVE Hive; +#else + PEREGISTRY_HIVE Hive; +#endif + IO_STATUS_BLOCK IoStatusBlock; + FILE_FS_SIZE_INFORMATION FileSizeInformation; + NTSTATUS Status; + ULONG Cluster; + + /* Assume failure */ + *RegistryHive = NULL; + + /* + * The following are invalid: + * An external hive that is also internal. + * A log hive that's not a primary hive too. + * A volatile hive that's linked to permanent storage. + * An in-memory initialization without hive data. + * A log hive that's not linked to a correct file type. + */ + if (((External) && ((Primary) || (Log))) || + ((Log) && !(Primary)) || + ((HiveFlags & HIVE_VOLATILE) && ((Primary) || (External) || (Log))) || + ((OperationType == HINIT_MEMORY) && (!HiveData)) || + ((Log) && (FileType != HFILE_TYPE_LOG))) + { + /* Fail the request */ + return STATUS_INVALID_PARAMETER; + } + + /* Check if this is a primary hive */ + if (Primary) + { + /* Get the cluster size */ + Status = ZwQueryVolumeInformationFile(Primary, + &IoStatusBlock, + &FileSizeInformation, + sizeof(FILE_FS_SIZE_INFORMATION), + FileFsSizeInformation); + if (!NT_SUCCESS(Status)) return Status; + + /* Make sure it's not larger then the block size */ + if (FileSizeInformation.BytesPerSector > HBLOCK_SIZE) + { + /* Fail */ + return STATUS_REGISTRY_IO_FAILED; + } + + /* Otherwise, calculate the cluster */ + Cluster = FileSizeInformation.BytesPerSector / HSECTOR_SIZE; + Cluster = max(1, Cluster); + } + else + { + /* Otherwise use cluster 1 */ + Cluster = 1; + } + + /* Allocate the hive */ + Hive = ExAllocatePoolWithTag(NonPagedPool, sizeof(EREGISTRY_HIVE), TAG_CM); + if (!Hive) return STATUS_INSUFFICIENT_RESOURCES; +#if 0 + /* Setup null fields */ + Hive->UnloadEvent = NULL; + Hive->RootKcb = NULL; + Hive->Frozen = FALSE; + Hive->UnloadWorkItem = NULL; + Hive->GrowOnlyMode = FALSE; + Hive->GrowOffset = 0; + Hive->CellRemapArray = NULL; + Hive->UseCountLog.Next = 0; + Hive->LockHiveLog.Next = 0; + Hive->FileObject = NULL; + Hive->NotifyList.Flink = NULL; + Hive->NotifyList.Blink = NULL; + + /* Set loading flag */ + Hive->HiveIsLoading = TRUE; + + /* Set the current thread as creator */ + Hive->CreatorOwner = KeGetCurrentThread(); + + /* Initialize lists */ + InitializeListHead(&Hive->KcbConvertListHead); + InitializeListHead(&Hive->KnodeConvertListHead); + InitializeListHead(&Hive->TrustClassEntry); + + /* Allocate the view log */ + Hive->ViewLock = ExAllocatePoolWithTag(NonPagedPool, + sizeof(KGUARDED_MUTEX), + TAG_CM); + if (!Hive->ViewLock) return STATUS_INSUFFICIENT_RESOURCES; + + /* Allocate the flush lock */ + Hive->FlusherLock = ExAllocatePoolWithTag(NonPagedPool, + sizeof(ERESOURCE), + TAG_CM); + if (!Hive->FlusherLock) return STATUS_INSUFFICIENT_RESOURCES; + + /* Setup the handles */ + Hive->FileHandles[HFILE_TYPE_PRIMARY] = Primary; + Hive->FileHandles[HFILE_TYPE_LOG] = Log; + Hive->FileHandles[HFILE_TYPE_EXTERNAL] = External; + + /* Initailize the guarded mutex */ + KeInitializeGuardedMutex(Hive->ViewLock); + Hive->ViewLockOwner = NULL; + + /* Initialize the flush lock */ + ExInitializeResourceLite(Hive->FlusherLock); + + /* Setup hive locks */ + ExInitializePushLock(&Hive->HiveLock); + Hive->HiveLockOwner = NULL; + ExInitializePushLock(&Hive->WriterLock); + Hive->WriterLockOwner = NULL; + ExInitializePushLock(&Hive->SecurityLock); + Hive->HiveSecurityLockOwner = NULL; + + /* Clear file names */ + RtlInitEmptyUnicodeString(&Hive->FileUserName, NULL, 0); + RtlInitEmptyUnicodeString(&Hive->FileFullPath, NULL, 0); + + /* Initialize the view list */ + CmpInitializeHiveViewList(Hive); + + /* Initailize the security cache */ + CmpInitializeSecurityCache(Hive); + + /* Setup flags */ + Hive->Flags = 0; + Hive->FlushCount = 0; +#else + /* Clear it */ + RtlZeroMemory(Hive, sizeof(EREGISTRY_HIVE)); + + /* Set flags */ + Hive->Flags = HiveFlags; +#endif + + /* Initialize it */ + Status = HvInitialize(&Hive->Hive, + OperationType, + HiveFlags, + FileType, + (ULONG_PTR)HiveData, + Cluster, + CmpAllocate, + CmpFree, + CmpFileRead, + CmpFileWrite, + CmpFileSetSize, + CmpFileFlush, + FileName); + if (!NT_SUCCESS(Status)) + { + /* Clear allocations and fail */ +#if 0 + ExFreePool(Hive->ViewLock); + ExFreePool(Hive->FlusherLock); +#endif + ExFreePool(Hive); + return Status; + } + + /* Check if we should verify the registry */ + if ((OperationType == HINIT_FILE) || + (OperationType == HINIT_MEMORY) || + (OperationType == HINIT_MEMORY_INPLACE) || + (OperationType == HINIT_MAPFILE)) + { + /* Verify integrity */ + if (CmCheckRegistry((PCMHIVE)Hive, TRUE)) + { + /* Free all alocations */ +#if 0 + ExFreePool(Hive->ViewLock); + ExFreePool(Hive->FlusherLock); +#endif + ExFreePool(Hive); + return STATUS_REGISTRY_CORRUPT; + } + } + + /* Lock the hive list */ + ExAcquirePushLockExclusive(&CmpHiveListHeadLock); + + /* Insert this hive */ + InsertHeadList(&CmpHiveListHead, &Hive->HiveList); + + /* Release the lock */ + ExReleasePushLock(&CmpHiveListHeadLock); + + /* Return the hive and success */ + *RegistryHive = (PCMHIVE)Hive; + return STATUS_SUCCESS; +} Modified: trunk/reactos/ntoskrnl/config/cmse.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmse.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/config/cmse.c (original) +++ trunk/reactos/ntoskrnl/config/cmse.c Sat May 12 01:35:56 2007 @@ -136,3 +136,18 @@ /* Return the security descriptor */ return SecurityDescriptor; } + +NTSTATUS +NTAPI +CmpSecurityMethod(IN PVOID ObjectBody, + IN SECURITY_OPERATION_CODE OperationCode, + IN PSECURITY_INFORMATION SecurityInformation, + IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor, + IN OUT PULONG BufferLength, + IN OUT PSECURITY_DESCRIPTOR *OldSecurityDescriptor, + IN POOL_TYPE PoolType, + IN PGENERIC_MAPPING GenericMapping) +{ + /* HACK */ + return STATUS_SUCCESS; +} Added: trunk/reactos/ntoskrnl/config/cmwraprs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmwraprs.c…
============================================================================== --- trunk/reactos/ntoskrnl/config/cmwraprs.c (added) +++ trunk/reactos/ntoskrnl/config/cmwraprs.c Sat May 12 01:35:56 2007 @@ -1,0 +1,119 @@ +/* + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory + * FILE: ntoskrnl/config/cmwraprs.c + * PURPOSE: Configuration Manager - Wrappers for Hive Operations + * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include "ntoskrnl.h" +#include "cm.h" +#define NDEBUG +#include "debug.h" + +/* FUNCTIONS *****************************************************************/ + +PVOID +NTAPI +CmpAllocate(IN ULONG Size, + IN BOOLEAN Paged) +{ + return ExAllocatePoolWithTag(Paged ? PagedPool : NonPagedPool, + Size, + TAG('R','E','G',' ')); +} + +VOID +NTAPI +CmpFree(IN PVOID Ptr) +{ + ExFreePool(Ptr); +} + +BOOLEAN +NTAPI +CmpFileRead(IN PHHIVE RegistryHive, + IN ULONG FileType, + IN ULONGLONG FileOffset, + OUT PVOID Buffer, + IN SIZE_T BufferLength) +{ + PEREGISTRY_HIVE CmHive = (PEREGISTRY_HIVE)RegistryHive; + HANDLE HiveHandle = FileType == HV_TYPE_PRIMARY ? CmHive->HiveHandle : CmHive->LogHandle; + LARGE_INTEGER _FileOffset; + IO_STATUS_BLOCK IoStatusBlock; + NTSTATUS Status; + + _FileOffset.QuadPart = FileOffset; + Status = ZwReadFile(HiveHandle, 0, 0, 0, &IoStatusBlock, + Buffer, BufferLength, &_FileOffset, 0); + return NT_SUCCESS(Status) ? TRUE : FALSE; +} + +BOOLEAN +NTAPI +CmpFileWrite(IN PHHIVE RegistryHive, + IN ULONG FileType, + IN ULONGLONG FileOffset, + IN PVOID Buffer, + IN SIZE_T BufferLength) +{ + PEREGISTRY_HIVE CmHive = (PEREGISTRY_HIVE)RegistryHive; + HANDLE HiveHandle = FileType == HV_TYPE_PRIMARY ? CmHive->HiveHandle : CmHive->LogHandle; + LARGE_INTEGER _FileOffset; + IO_STATUS_BLOCK IoStatusBlock; + NTSTATUS Status; + + _FileOffset.QuadPart = FileOffset; + Status = ZwWriteFile(HiveHandle, 0, 0, 0, &IoStatusBlock, + Buffer, BufferLength, &_FileOffset, 0); + return NT_SUCCESS(Status) ? TRUE : FALSE; +} + +BOOLEAN +NTAPI +CmpFileSetSize(IN PHHIVE RegistryHive, + IN ULONG FileType, + IN ULONGLONG FileSize) +{ + PEREGISTRY_HIVE CmHive = (PEREGISTRY_HIVE)RegistryHive; + HANDLE HiveHandle = FileType == HV_TYPE_PRIMARY ? CmHive->HiveHandle : CmHive->LogHandle; + FILE_END_OF_FILE_INFORMATION EndOfFileInfo; + FILE_ALLOCATION_INFORMATION FileAllocationInfo; + IO_STATUS_BLOCK IoStatusBlock; + NTSTATUS Status; + + EndOfFileInfo.EndOfFile.QuadPart = FileSize; + Status = ZwSetInformationFile(HiveHandle, + &IoStatusBlock, + &EndOfFileInfo, + sizeof(FILE_END_OF_FILE_INFORMATION), + FileEndOfFileInformation); + if (!NT_SUCCESS(Status)) return FALSE; + + FileAllocationInfo.AllocationSize.QuadPart = FileSize; + Status = ZwSetInformationFile(HiveHandle, + &IoStatusBlock, + &FileAllocationInfo, + sizeof(FILE_ALLOCATION_INFORMATION), + FileAllocationInformation); + if (!NT_SUCCESS(Status)) return FALSE; + + return TRUE; +} + +BOOLEAN +NTAPI +CmpFileFlush(IN PHHIVE RegistryHive, + IN ULONG FileType) +{ + PEREGISTRY_HIVE CmHive = (PEREGISTRY_HIVE)RegistryHive; + HANDLE HiveHandle = FileType == HV_TYPE_PRIMARY ? CmHive->HiveHandle : CmHive->LogHandle; + IO_STATUS_BLOCK IoStatusBlock; + NTSTATUS Status; + + Status = ZwFlushBuffersFile(HiveHandle, &IoStatusBlock); + return NT_SUCCESS(Status) ? TRUE : FALSE; +} Modified: trunk/reactos/ntoskrnl/ntoskrnl.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ntoskrnl.rbuild?r…
============================================================================== --- trunk/reactos/ntoskrnl/ntoskrnl.rbuild (original) +++ trunk/reactos/ntoskrnl/ntoskrnl.rbuild Sat May 12 01:35:56 2007 @@ -90,10 +90,12 @@ </directory> </if> <file>cmboot.c</file> + <file>cmcheck.c</file> <file>cmcontrl.c</file> <file>cmconfig.c</file> <file>cmdata.c</file> <file>cmindex.c</file> + <file>cminit.c</file> <file>cmhook.c</file> <file>cmkcbncb.c</file> <file>cmmapvw.c</file> @@ -103,6 +105,7 @@ <file>cmsecach.c</file> <file>cmsysini.c</file> <file>cmvalue.c</file> + <file>cmwraprs.c</file> </directory> <directory name="cm"> <file>ntfunc.c</file>
17 years, 7 months
1
0
0
0
[ion] 26703: - Move CmpCreateRootNode and CmpCreateRegistryRoot to cmsysini.c as well, and add some fixes to CmpCreateRegistryRoot to make it compatible with the Cm Rewrite when it's done. - Initialize some stuff that wasn't being initialized in CmpCreateRootNode. - Use CmpHiveRootSecurityDescriptor in CmpCreateRegistryRoot to protect the key. - Save the root handle globally so we can close it during shutdown. - Add cmkcbncb.c with an empty stub for CmpCreateKeyControlBlock. Will copy from Cm re
by ion@svn.reactos.org
Author: ion Date: Fri May 11 23:34:11 2007 New Revision: 26703 URL:
http://svn.reactos.org/svn/reactos?rev=26703&view=rev
Log: - Move CmpCreateRootNode and CmpCreateRegistryRoot to cmsysini.c as well, and add some fixes to CmpCreateRegistryRoot to make it compatible with the Cm Rewrite when it's done. - Initialize some stuff that wasn't being initialized in CmpCreateRootNode. - Use CmpHiveRootSecurityDescriptor in CmpCreateRegistryRoot to protect the key. - Save the root handle globally so we can close it during shutdown. - Add cmkcbncb.c with an empty stub for CmpCreateKeyControlBlock. Will copy from Cm rewrite branch later. - Properly name fields of CM_KEY_NODE in the headers of the /config tree. Added: trunk/reactos/ntoskrnl/config/cmkcbncb.c Modified: trunk/reactos/ntoskrnl/cm/cm.h trunk/reactos/ntoskrnl/cm/registry.c trunk/reactos/ntoskrnl/config/cm.h trunk/reactos/ntoskrnl/config/cmsysini.c trunk/reactos/ntoskrnl/ntoskrnl.rbuild Modified: trunk/reactos/ntoskrnl/cm/cm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/cm.h?rev=26703…
============================================================================== --- trunk/reactos/ntoskrnl/cm/cm.h (original) +++ trunk/reactos/ntoskrnl/cm/cm.h Fri May 11 23:34:11 2007 @@ -486,6 +486,16 @@ NTAPI CmpCreateObjectTypes(VOID); +BOOLEAN +NTAPI +CmpCreateRootNode(IN PHHIVE Hive, + IN PCWSTR Name, + OUT PHCELL_INDEX Index); + +BOOLEAN +NTAPI +CmpCreateRegistryRoot(VOID); + #if 0 static __inline PVOID xHvGetCell(char *file, int line, PHHIVE Hive, HCELL_INDEX Cell) { Modified: trunk/reactos/ntoskrnl/cm/registry.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/registry.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/cm/registry.c (original) +++ trunk/reactos/ntoskrnl/cm/registry.c Fri May 11 23:34:11 2007 @@ -159,6 +159,15 @@ return (PVOID)(MdBlock->BasePage << PAGE_SHIFT); } +VOID +NTAPI +EnlistKeyBodyWithKCB(IN PKEY_OBJECT KeyObject, + IN ULONG Flags) +{ + /* Insert it into the global list (we don't have KCBs here) */ + InsertTailList(&CmiKeyObjectListHead, &KeyObject->ListEntry); +} + NTSTATUS NTAPI CmpLinkHiveToMaster(IN PUNICODE_STRING LinkName, @@ -181,142 +190,6 @@ /* Connect the hive */ return CmiConnectHive(&ObjectAttributes, RegistryHive); -} - -BOOLEAN -NTAPI -CmpCreateRootNode(IN PHHIVE Hive, - IN PCWSTR Name, - OUT PHCELL_INDEX Index) -{ - UNICODE_STRING KeyName; - PCM_KEY_NODE KeyCell; - LARGE_INTEGER SystemTime; - PAGED_CODE(); - - /* Initialize the node name and allocate it */ - RtlInitUnicodeString(&KeyName, Name); - *Index = HvAllocateCell(Hive, - FIELD_OFFSET(CM_KEY_NODE, Name) + - CmpNameSize(Hive, &KeyName), - HvStable); // FIXME: , HCELL_NIL); - if (*Index == HCELL_NIL) return FALSE; - - /* Set the cell index and get the data */ - Hive->HiveHeader->RootCell = *Index; - KeyCell = (PCM_KEY_NODE)HvGetCell(Hive, *Index); - if (!KeyCell) return FALSE; - - /* Setup the cell */ - KeyCell->Id = (USHORT)CM_KEY_NODE_SIGNATURE;; - KeyCell->Flags = KEY_HIVE_ENTRY | KEY_NO_DELETE; - KeQuerySystemTime(&SystemTime); - KeyCell->LastWriteTime = SystemTime; - KeyCell->Parent = HCELL_NIL; - KeyCell->SubKeyCounts[HvStable] = 0; - KeyCell->SubKeyCounts[HvVolatile] = 0; - KeyCell->SubKeyLists[HvStable] = HCELL_NIL; - KeyCell->SubKeyLists[HvVolatile] = HCELL_NIL; - KeyCell->ValueList.Count = 0; - KeyCell->ValueList.List = HCELL_NIL; - KeyCell->SecurityKeyOffset = HCELL_NIL; - KeyCell->ClassNameOffset = HCELL_NIL; - KeyCell->ClassSize = 0; - - /* Copy the name (this will also set the length) */ - KeyCell->NameSize = CmpCopyName(Hive, (PWCHAR)KeyCell->Name, &KeyName); - - /* Check if the name was compressed */ - if (KeyCell->NameSize < KeyName.Length) - { - /* Set the flag */ - KeyCell->Flags |= KEY_COMP_NAME; - } - - /* Return success */ - HvReleaseCell(Hive, *Index); - return TRUE; -} - -BOOLEAN -NTAPI -CmpCreateRegistryRoot(VOID) -{ - UNICODE_STRING KeyName; - OBJECT_ATTRIBUTES ObjectAttributes; - PKEY_OBJECT RootKey; - HANDLE RootKeyHandle; - HCELL_INDEX RootIndex; - NTSTATUS Status; - PCM_KEY_NODE KeyCell; - PAGED_CODE(); - - /* Setup the root node */ - if (!CmpCreateRootNode(&CmiVolatileHive->Hive, L"REGISTRY", &RootIndex)) - { - /* We failed */ - return FALSE; - } - - /* Create '\Registry' key. */ - RtlInitUnicodeString(&KeyName, REG_ROOT_KEY_NAME); - InitializeObjectAttributes(&ObjectAttributes, - &KeyName, - OBJ_CASE_INSENSITIVE, - NULL, - NULL); - Status = ObCreateObject(KernelMode, - CmpKeyObjectType, - &ObjectAttributes, - KernelMode, - NULL, - sizeof(KEY_OBJECT), - 0, - 0, - (PVOID*)&RootKey); - if (!NT_SUCCESS(Status)) return FALSE; - - /* Sanity check, and get the key cell */ - ASSERT((&CmiVolatileHive->Hive)->ReleaseCellRoutine == NULL); - KeyCell = (PCM_KEY_NODE)HvGetCell(&CmiVolatileHive->Hive, RootIndex); - if (!KeyCell) return FALSE; - - /* Setup the root key */ - RootKey->RegistryHive = CmiVolatileHive; - RootKey->KeyCellOffset = RootIndex; - RootKey->KeyCell = KeyCell; - RootKey->ParentKey = RootKey; - RootKey->Flags = 0; - RootKey->SubKeyCounts = 0; - RootKey->SubKeys = NULL; - RootKey->SizeOfSubKeys = 0; - - /* Insert it into the object list head */ - InsertTailList(&CmiKeyObjectListHead, &RootKey->ListEntry); - - /* Setup the name */ - RtlpCreateUnicodeString(&RootKey->Name, L"Registry", NonPagedPool); - - /* Insert the key into the namespace */ - Status = ObInsertObject(RootKey, - NULL, - KEY_ALL_ACCESS, - 0, - NULL, - &RootKeyHandle); - if (!NT_SUCCESS(Status)) return FALSE; - - /* Reference the key again so that we never lose it */ - Status = ObReferenceObjectByHandle(RootKeyHandle, - KEY_READ, - NULL, - KernelMode, - (PVOID*)&RootKey, - NULL); - if (!NT_SUCCESS(Status)) return FALSE; - - /* Completely sucessful */ - return TRUE; } BOOLEAN Modified: trunk/reactos/ntoskrnl/config/cm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cm.h?rev=2…
============================================================================== --- trunk/reactos/ntoskrnl/config/cm.h (original) +++ trunk/reactos/ntoskrnl/config/cm.h Fri May 11 23:34:11 2007 @@ -145,7 +145,7 @@ #define CMP_HASH_PRIME 1000000007 // -// CmpCreateKcb Flags +// CmpCreateKeyControlBlock Flags // #define CMP_CREATE_FAKE_KCB 0x1 #define CMP_LOCK_HASHES_FOR_KCB 0x2 @@ -468,7 +468,7 @@ typedef struct _CM_KEY_NODE { - USHORT Id; + USHORT Signature; USHORT Flags; LARGE_INTEGER LastWriteTime; ULONG Spare; @@ -476,15 +476,15 @@ ULONG SubKeyCounts[HvMaxStorageType]; HCELL_INDEX SubKeyLists[HvMaxStorageType]; CHILD_LIST ValueList; - HCELL_INDEX SecurityKeyOffset; - HCELL_INDEX ClassNameOffset; + HCELL_INDEX Security; + HCELL_INDEX Class; ULONG MaxNameLen; ULONG MaxClassLen; ULONG MaxValueNameLen; ULONG MaxValueDataLen; ULONG WorkVar; USHORT NameLength; - USHORT ClassSize; + USHORT ClassLength; WCHAR Name[0]; } CM_KEY_NODE, *PCM_KEY_NODE; @@ -637,6 +637,44 @@ PULONG Type; } CM_SYSTEM_CONTROL_VECTOR, *PCM_SYSTEM_CONTROL_VECTOR; +/////////////////////////////////////////////////////////////////////////////// +// +// BUGBUG Old Hive Stuff for Temporary Support +// +#define SYSTEM_REG_FILE L"\\SystemRoot\\System32\\Config\\SYSTEM" +#define SYSTEM_LOG_FILE L"\\SystemRoot\\System32\\Config\\SYSTEM.log" +#define REG_SYSTEM_KEY_NAME L"\\Registry\\Machine\\SYSTEM" +typedef struct _EREGISTRY_HIVE +{ + HHIVE Hive; + LIST_ENTRY HiveList; + UNICODE_STRING HiveFileName; + UNICODE_STRING LogFileName; + PCM_KEY_SECURITY RootSecurityCell; + ULONG Flags; + HANDLE HiveHandle; + HANDLE LogHandle; +} EREGISTRY_HIVE, *PEREGISTRY_HIVE; +typedef struct _KEY_OBJECT +{ + CSHORT Type; + CSHORT Size; + ULONG Flags; + UNICODE_STRING Name; + PEREGISTRY_HIVE RegistryHive; + HCELL_INDEX KeyCellOffset; + PCM_KEY_NODE KeyCell; + struct _KEY_OBJECT *ParentKey; + LIST_ENTRY ListEntry; + ULONG SubKeyCounts; + ULONG SizeOfSubKeys; + struct _KEY_OBJECT **SubKeys; + ULONG TimeStamp; + LIST_ENTRY HiveList; +} KEY_OBJECT, *PKEY_OBJECT; +extern PEREGISTRY_HIVE CmiVolatileHive; +/////////////////////////////////////////////////////////////////////////////// + // // Mapped View Hive Functions // @@ -827,7 +865,7 @@ // PCM_KEY_CONTROL_BLOCK NTAPI -CmpCreateKcb( +CmpCreateKeyControlBlock( IN PHHIVE Hive, IN HCELL_INDEX Index, IN PCM_KEY_NODE Node, @@ -841,6 +879,17 @@ CmpDereferenceKcbWithLock( IN PCM_KEY_CONTROL_BLOCK Kcb, IN BOOLEAN LockHeldExclusively +); + +VOID +NTAPI +EnlistKeyBodyWithKCB( +#if 0 + IN PCM_KEY_BODY KeyObject, +#else + IN PKEY_OBJECT KeyObject, +#endif + IN ULONG Flags ); // @@ -983,24 +1032,6 @@ extern BOOLEAN ExpInTextModeSetup; // -// BUGBUG Old Hive Stuff for Temporary Support -// -#define SYSTEM_REG_FILE L"\\SystemRoot\\System32\\Config\\SYSTEM" -#define SYSTEM_LOG_FILE L"\\SystemRoot\\System32\\Config\\SYSTEM.log" -#define REG_SYSTEM_KEY_NAME L"\\Registry\\Machine\\SYSTEM" -typedef struct _EREGISTRY_HIVE -{ - HHIVE Hive; - LIST_ENTRY HiveList; - UNICODE_STRING HiveFileName; - UNICODE_STRING LogFileName; - PCM_KEY_SECURITY RootSecurityCell; - ULONG Flags; - HANDLE HiveHandle; - HANDLE LogHandle; -} EREGISTRY_HIVE, *PEREGISTRY_HIVE; - -// // Inlined functions // #include "cm_x.h" Added: trunk/reactos/ntoskrnl/config/cmkcbncb.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmkcbncb.c…
============================================================================== --- trunk/reactos/ntoskrnl/config/cmkcbncb.c (added) +++ trunk/reactos/ntoskrnl/config/cmkcbncb.c Fri May 11 23:34:11 2007 @@ -1,0 +1,31 @@ +/* + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory + * FILE: ntoskrnl/config/cmkcbncb.c + * PURPOSE: Configuration Manager - Key Control and Name Control Blocks + * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include "ntoskrnl.h" +#include "cm.h" +#define NDEBUG +#include "debug.h" + +/* GLOBALS *******************************************************************/ + +/* FUNCTIONS *****************************************************************/ + +PCM_KEY_CONTROL_BLOCK +NTAPI +CmpCreateKeyControlBlock(IN PHHIVE Hive, + IN HCELL_INDEX Index, + IN PCM_KEY_NODE Node, + IN PCM_KEY_CONTROL_BLOCK Parent, + IN ULONG Flags, + IN PUNICODE_STRING KeyName) +{ + /* Temporary hack */ + return (PVOID)1; +} Modified: trunk/reactos/ntoskrnl/config/cmsysini.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmsysini.c…
============================================================================== --- trunk/reactos/ntoskrnl/config/cmsysini.c (original) +++ trunk/reactos/ntoskrnl/config/cmsysini.c Fri May 11 23:34:11 2007 @@ -27,6 +27,8 @@ BOOLEAN CmSelfHeal = TRUE; BOOLEAN CmpSelfHeal = TRUE; ULONG CmpBootType; + +HANDLE CmpRegistryRootHandle; extern BOOLEAN ExpInTextModeSetup; @@ -480,3 +482,164 @@ return ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &CmpKeyObjectType); } +BOOLEAN +NTAPI +CmpCreateRootNode(IN PHHIVE Hive, + IN PCWSTR Name, + OUT PHCELL_INDEX Index) +{ + UNICODE_STRING KeyName; + PCM_KEY_NODE KeyCell; + LARGE_INTEGER SystemTime; + PAGED_CODE(); + + /* Initialize the node name and allocate it */ + RtlInitUnicodeString(&KeyName, Name); + *Index = HvAllocateCell(Hive, + FIELD_OFFSET(CM_KEY_NODE, Name) + + CmpNameSize(Hive, &KeyName), + HvStable); // FIXME: , HCELL_NIL); + if (*Index == HCELL_NIL) return FALSE; + + /* Set the cell index and get the data */ + Hive->HiveHeader->RootCell = *Index; + KeyCell = (PCM_KEY_NODE)HvGetCell(Hive, *Index); + if (!KeyCell) return FALSE; + + /* Setup the cell */ + KeyCell->Signature = (USHORT)CM_KEY_NODE_SIGNATURE;; + KeyCell->Flags = KEY_HIVE_ENTRY | KEY_NO_DELETE; + KeQuerySystemTime(&SystemTime); + KeyCell->LastWriteTime = SystemTime; + KeyCell->Parent = HCELL_NIL; + KeyCell->SubKeyCounts[HvStable] = 0; + KeyCell->SubKeyCounts[HvVolatile] = 0; + KeyCell->SubKeyLists[HvStable] = HCELL_NIL; + KeyCell->SubKeyLists[HvVolatile] = HCELL_NIL; + KeyCell->ValueList.Count = 0; + KeyCell->ValueList.List = HCELL_NIL; + KeyCell->Security = HCELL_NIL; + KeyCell->Class = HCELL_NIL; + KeyCell->ClassLength = 0; + KeyCell->MaxNameLen = 0; + KeyCell->MaxClassLen = 0; + KeyCell->MaxValueNameLen = 0; + KeyCell->MaxValueDataLen = 0; + + /* Copy the name (this will also set the length) */ + KeyCell->NameLength = CmpCopyName(Hive, (PWCHAR)KeyCell->Name, &KeyName); + + /* Check if the name was compressed */ + if (KeyCell->NameLength < KeyName.Length) + { + /* Set the flag */ + KeyCell->Flags |= KEY_COMP_NAME; + } + + /* Return success */ + HvReleaseCell(Hive, *Index); + return TRUE; +} + +BOOLEAN +NTAPI +CmpCreateRegistryRoot(VOID) +{ + UNICODE_STRING KeyName; + OBJECT_ATTRIBUTES ObjectAttributes; +#if 0 + PCM_KEY_BODY RootKey; +#else + PKEY_OBJECT RootKey; +#endif + HCELL_INDEX RootIndex; + NTSTATUS Status; + PCM_KEY_NODE KeyCell; + PSECURITY_DESCRIPTOR SecurityDescriptor; + PCM_KEY_CONTROL_BLOCK Kcb; + PAGED_CODE(); + + /* Setup the root node */ + if (!CmpCreateRootNode(&CmiVolatileHive->Hive, L"REGISTRY", &RootIndex)) + { + /* We failed */ + return FALSE; + } + + /* Create '\Registry' key. */ + RtlInitUnicodeString(&KeyName, L"\\Registry"); + SecurityDescriptor = CmpHiveRootSecurityDescriptor(); + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + Status = ObCreateObject(KernelMode, + CmpKeyObjectType, + &ObjectAttributes, + KernelMode, + NULL, + sizeof(KEY_OBJECT), + 0, + 0, + (PVOID*)&RootKey); + ExFreePool(SecurityDescriptor); + if (!NT_SUCCESS(Status)) return FALSE; + + /* Sanity check, and get the key cell */ + ASSERT((&CmiVolatileHive->Hive)->ReleaseCellRoutine == NULL); + KeyCell = (PCM_KEY_NODE)HvGetCell(&CmiVolatileHive->Hive, RootIndex); + if (!KeyCell) return FALSE; + + /* Create the KCB */ + RtlInitUnicodeString(&KeyName, L"Registry"); + Kcb = CmpCreateKeyControlBlock(&CmiVolatileHive->Hive, + RootIndex, + KeyCell, + NULL, + 0, + &KeyName); + if (!Kcb) return FALSE; + + /* Initialize the object */ +#if 0 + RootKey->Type = TAG('k', 'v', '0', '2'; + RootKey->KeyControlBlock = Kcb; + RootKey->NotifyBlock = NULL; + RootKey->ProcessID = PsGetCurrentProcessId(); +#else + RtlpCreateUnicodeString(&RootKey->Name, L"Registry", NonPagedPool); + RootKey->RegistryHive = CmiVolatileHive; + RootKey->KeyCellOffset = RootIndex; + RootKey->KeyCell = KeyCell; + RootKey->ParentKey = RootKey; + RootKey->Flags = 0; + RootKey->SubKeyCounts = 0; + RootKey->SubKeys = NULL; + RootKey->SizeOfSubKeys = 0; +#endif + + /* Insert it into the object list head */ + EnlistKeyBodyWithKCB(RootKey, 0); + + /* Insert the key into the namespace */ + Status = ObInsertObject(RootKey, + NULL, + KEY_ALL_ACCESS, + 0, + NULL, + &CmpRegistryRootHandle); + if (!NT_SUCCESS(Status)) return FALSE; + + /* Reference the key again so that we never lose it */ + Status = ObReferenceObjectByHandle(CmpRegistryRootHandle, + KEY_READ, + NULL, + KernelMode, + (PVOID*)&RootKey, + NULL); + if (!NT_SUCCESS(Status)) return FALSE; + + /* Completely sucessful */ + return TRUE; +} Modified: trunk/reactos/ntoskrnl/ntoskrnl.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ntoskrnl.rbuild?r…
============================================================================== --- trunk/reactos/ntoskrnl/ntoskrnl.rbuild (original) +++ trunk/reactos/ntoskrnl/ntoskrnl.rbuild Fri May 11 23:34:11 2007 @@ -95,6 +95,7 @@ <file>cmdata.c</file> <file>cmindex.c</file> <file>cmhook.c</file> + <file>cmkcbncb.c</file> <file>cmmapvw.c</file> <file>cmname.c</file> <file>cmparse.c</file>
17 years, 7 months
1
0
0
0
[ion] 26702: - Move CmpInitializeSystemHive and CmpCreateObjectTypes to cmsysini.c since they're almost identical to the Cm rewrite and compatible, so they're considered "new" code (although they still use EREGISTRY_HIVE). - Add code missing in CmpInitializeSystemHive from Cm Rewrite (mainly detecting boot type and self-healing settings). - Free a memory leak. - Enable security for key objects. - Rename CmiKeyType to CmpKeyObjectType.
by ion@svn.reactos.org
Author: ion Date: Fri May 11 22:58:34 2007 New Revision: 26702 URL:
http://svn.reactos.org/svn/reactos?rev=26702&view=rev
Log: - Move CmpInitializeSystemHive and CmpCreateObjectTypes to cmsysini.c since they're almost identical to the Cm rewrite and compatible, so they're considered "new" code (although they still use EREGISTRY_HIVE). - Add code missing in CmpInitializeSystemHive from Cm Rewrite (mainly detecting boot type and self-healing settings). - Free a memory leak. - Enable security for key objects. - Rename CmiKeyType to CmpKeyObjectType. Modified: trunk/reactos/ntoskrnl/cm/cm.h trunk/reactos/ntoskrnl/cm/ntfunc.c trunk/reactos/ntoskrnl/cm/registry.c trunk/reactos/ntoskrnl/cm/regobj.c trunk/reactos/ntoskrnl/config/cm.h trunk/reactos/ntoskrnl/config/cmse.c trunk/reactos/ntoskrnl/config/cmsysini.c Modified: trunk/reactos/ntoskrnl/cm/cm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/cm.h?rev=26702…
============================================================================== --- trunk/reactos/ntoskrnl/cm/cm.h (original) +++ trunk/reactos/ntoskrnl/cm/cm.h Fri May 11 22:58:34 2007 @@ -107,7 +107,7 @@ extern PEREGISTRY_HIVE CmiVolatileHive; -extern POBJECT_TYPE CmiKeyType; +extern POBJECT_TYPE CmpKeyObjectType; extern KSPIN_LOCK CmiKeyListLock; extern LIST_ENTRY CmiHiveListHead; @@ -148,7 +148,7 @@ CmUnRegisterCallback(IN LARGE_INTEGER Cookie); NTSTATUS STDCALL -CmiObjectParse(IN PVOID ParsedObject, +CmpParseKey(IN PVOID ParsedObject, IN PVOID ObjectType, IN OUT PACCESS_STATE AccessState, IN KPROCESSOR_MODE AccessMode, @@ -160,10 +160,10 @@ OUT PVOID *NextObject); VOID STDCALL -CmiObjectDelete(PVOID DeletedObject); +CmpDeleteKeyObject(PVOID DeletedObject); NTSTATUS STDCALL -CmiObjectSecurity(PVOID ObjectBody, +CmpSecurityMethod(PVOID ObjectBody, SECURITY_OPERATION_CODE OperationCode, PSECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR SecurityDescriptor, @@ -173,7 +173,7 @@ PGENERIC_MAPPING GenericMapping); NTSTATUS STDCALL -CmiObjectQueryName (PVOID ObjectBody, +CmpQueryKeyName (PVOID ObjectBody, IN BOOLEAN HasObjectName, POBJECT_NAME_INFORMATION ObjectNameInfo, ULONG Length, @@ -478,6 +478,14 @@ NTAPI CmpHiveRootSecurityDescriptor(VOID); +BOOLEAN +NTAPI +CmpInitializeSystemHive(IN PLOADER_PARAMETER_BLOCK LoaderBlock); + +NTSTATUS +NTAPI +CmpCreateObjectTypes(VOID); + #if 0 static __inline PVOID xHvGetCell(char *file, int line, PHHIVE Hive, HCELL_INDEX Cell) { Modified: trunk/reactos/ntoskrnl/cm/ntfunc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/ntfunc.c?rev=2…
============================================================================== --- trunk/reactos/ntoskrnl/cm/ntfunc.c (original) +++ trunk/reactos/ntoskrnl/cm/ntfunc.c Fri May 11 22:58:34 2007 @@ -24,7 +24,7 @@ /* GLOBALS ******************************************************************/ -extern POBJECT_TYPE CmiKeyType; +extern POBJECT_TYPE CmpKeyObjectType; extern LIST_ENTRY CmiKeyObjectListHead; static BOOLEAN CmiRegistryInitialized = FALSE; @@ -218,7 +218,7 @@ &ObjectName, (PVOID*)&Object, &RemainingPath, - CmiKeyType, + CmpKeyObjectType, NULL, NULL); if (!NT_SUCCESS(Status)) @@ -300,7 +300,7 @@ DPRINT("RemainingPath %S ParentObject 0x%p\n", RemainingPath.Buffer, Object); Status = ObCreateObject(PreviousMode, - CmiKeyType, + CmpKeyObjectType, NULL, PreviousMode, NULL, @@ -452,7 +452,7 @@ /* Verify that the handle is valid and is a registry key */ Status = ObReferenceObjectByHandle(KeyHandle, DELETE, - CmiKeyType, + CmpKeyObjectType, PreviousMode, (PVOID *)&KeyObject, NULL); @@ -516,7 +516,7 @@ /* * Note: * Hive-Synchronization will not be triggered here. This is done in - * CmiObjectDelete() (in regobj.c) after all key-related structures + * CmpDeleteKeyObject() (in regobj.c) after all key-related structures * have been released. */ @@ -563,7 +563,7 @@ /* Verify that the handle is valid and is a registry key */ Status = ObReferenceObjectByHandle(KeyHandle, KEY_ENUMERATE_SUB_KEYS, - CmiKeyType, + CmpKeyObjectType, PreviousMode, (PVOID *) &KeyObject, NULL); @@ -863,7 +863,7 @@ /* Verify that the handle is valid and is a registry key */ Status = ObReferenceObjectByHandle(KeyHandle, KEY_QUERY_VALUE, - CmiKeyType, + CmpKeyObjectType, ExGetPreviousMode(), (PVOID *) &KeyObject, NULL); @@ -1116,7 +1116,7 @@ /* Verify that the handle is valid and is a registry key */ Status = ObReferenceObjectByHandle(KeyHandle, 0, - CmiKeyType, + CmpKeyObjectType, PreviousMode, (PVOID *)&KeyObject, NULL); @@ -1244,7 +1244,7 @@ &ObjectName, (PVOID*)&Object, &RemainingPath, - CmiKeyType, + CmpKeyObjectType, NULL, NULL); if (!NT_SUCCESS(Status)) @@ -1340,7 +1340,7 @@ /* Verify that the handle is valid and is a registry key */ Status = ObReferenceObjectByHandle(KeyHandle, (KeyInformationClass != KeyNameInformation ? KEY_QUERY_VALUE : 0), - CmiKeyType, + CmpKeyObjectType, ExGetPreviousMode(), (PVOID *) &KeyObject, NULL); @@ -1566,7 +1566,7 @@ /* Verify that the handle is valid and is a registry key */ Status = ObReferenceObjectByHandle(KeyHandle, KEY_QUERY_VALUE, - CmiKeyType, + CmpKeyObjectType, ExGetPreviousMode(), (PVOID *)&KeyObject, NULL); @@ -1830,7 +1830,7 @@ /* Verify that the handle is valid and is a registry key */ Status = ObReferenceObjectByHandle(KeyHandle, DesiredAccess, - CmiKeyType, + CmpKeyObjectType, ExGetPreviousMode(), (PVOID *)&KeyObject, NULL); @@ -2005,7 +2005,7 @@ /* Verify that the handle is valid and is a registry key */ Status = ObReferenceObjectByHandle(KeyHandle, KEY_SET_VALUE, - CmiKeyType, + CmpKeyObjectType, PreviousMode, (PVOID *)&KeyObject, NULL); @@ -2218,7 +2218,7 @@ /* Verify that the handle is valid and is a registry key */ Status = ObReferenceObjectByHandle(KeyHandle, KEY_QUERY_VALUE, - CmiKeyType, + CmpKeyObjectType, ExGetPreviousMode(), (PVOID *) &KeyObject, NULL); Modified: trunk/reactos/ntoskrnl/cm/registry.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/registry.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/cm/registry.c (original) +++ trunk/reactos/ntoskrnl/cm/registry.c Fri May 11 22:58:34 2007 @@ -29,7 +29,7 @@ extern BOOLEAN ExpInTextModeSetup; -POBJECT_TYPE CmiKeyType = NULL; +POBJECT_TYPE CmpKeyObjectType = NULL; PEREGISTRY_HIVE CmiVolatileHive = NULL; LIST_ENTRY CmiHiveListHead; @@ -45,9 +45,6 @@ volatile BOOLEAN CmiHiveSyncPending = FALSE; KDPC CmiHiveSyncDpc; KTIMER CmiHiveSyncTimer; - -static GENERIC_MAPPING CmiKeyMapping = - {KEY_READ, KEY_WRITE, KEY_EXECUTE, KEY_ALL_ACCESS}; static VOID STDCALL CmiHiveSyncDpcRoutine(PKDPC Dpc, @@ -188,118 +185,6 @@ BOOLEAN NTAPI -CmpInitializeSystemHive(IN PLOADER_PARAMETER_BLOCK LoaderBlock) -{ - PVOID HiveBase; - ANSI_STRING LoadString; - PVOID Buffer; - ULONG Length; - NTSTATUS Status; - BOOLEAN Allocate; - UNICODE_STRING KeyName; - PEREGISTRY_HIVE SystemHive; - UNICODE_STRING HiveName = RTL_CONSTANT_STRING(L"SYSTEM"); - PSECURITY_DESCRIPTOR SecurityDescriptor; - PAGED_CODE(); - - /* Setup the ansi string */ - RtlInitAnsiString(&LoadString, LoaderBlock->LoadOptions); - - /* Allocate the unicode buffer */ - Length = LoadString.Length * sizeof(WCHAR) + sizeof(UNICODE_NULL); - Buffer = ExAllocatePoolWithTag(PagedPool, Length, 0); - if (!Buffer) - { - /* Fail */ - KEBUGCHECKEX(BAD_SYSTEM_CONFIG_INFO, 3, 1, (ULONG_PTR)LoaderBlock, 0); - } - - /* Setup the unicode string */ - RtlInitEmptyUnicodeString(&CmpLoadOptions, Buffer, Length); - - /* Add the load options and null-terminate */ - RtlAnsiStringToUnicodeString(&CmpLoadOptions, &LoadString, FALSE); - CmpLoadOptions.Buffer[LoadString.Length] = UNICODE_NULL; - CmpLoadOptions.Length += sizeof(WCHAR); - - /* Get the System Hive base address */ - HiveBase = LoaderBlock->RegistryBase; - if (HiveBase) - { - /* Import it */ - ((PHBASE_BLOCK)HiveBase)->Length = LoaderBlock->RegistryLength; - Status = CmpInitializeHive(&SystemHive, - HINIT_MEMORY, - 0, //HIVE_NOLAZYFLUSH, - HFILE_TYPE_LOG, - HiveBase, - NULL, - NULL, - NULL, - &HiveName, - 2); - if (!NT_SUCCESS(Status)) return FALSE; - CmPrepareHive(&SystemHive->Hive); - - /* Set the hive filename */ - RtlCreateUnicodeString(&SystemHive->HiveFileName, SYSTEM_REG_FILE); - - /* Set the log filename */ - RtlCreateUnicodeString(&SystemHive->LogFileName, SYSTEM_LOG_FILE); - - /* We imported, no need to create a new hive */ - Allocate = FALSE; - } - else - { - /* FIXME: Create an empty hive */ - Allocate = TRUE; - } - - /* Create the default security descriptor */ - SecurityDescriptor = CmpHiveRootSecurityDescriptor(); - - /* Attach it to the system key */ - RtlInitUnicodeString(&KeyName, REG_SYSTEM_KEY_NAME); - Status = CmpLinkHiveToMaster(&KeyName, - NULL, - SystemHive, - Allocate, - SecurityDescriptor); - if (!NT_SUCCESS(Status)) return FALSE; - - /* Success! */ - return TRUE; -} - -NTSTATUS -NTAPI -CmpCreateObjectTypes(VOID) -{ - OBJECT_TYPE_INITIALIZER ObjectTypeInitializer; - UNICODE_STRING Name; - PAGED_CODE(); - - /* Initialize the Key object type */ - RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer)); - RtlInitUnicodeString(&Name, L"Key"); - ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer); - ObjectTypeInitializer.DefaultPagedPoolCharge = sizeof(KEY_OBJECT); - ObjectTypeInitializer.GenericMapping = CmiKeyMapping; - ObjectTypeInitializer.PoolType = PagedPool; - ObjectTypeInitializer.ValidAccessMask = KEY_ALL_ACCESS; - ObjectTypeInitializer.UseDefaultObject = TRUE; - ObjectTypeInitializer.DeleteProcedure = CmiObjectDelete; - ObjectTypeInitializer.ParseProcedure = CmiObjectParse; - ObjectTypeInitializer.SecurityProcedure = CmiObjectSecurity; - ObjectTypeInitializer.QueryNameProcedure = CmiObjectQueryName; - - /* Create it */ - return ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &CmiKeyType); -} - -BOOLEAN -NTAPI CmpCreateRootNode(IN PHHIVE Hive, IN PCWSTR Name, OUT PHCELL_INDEX Index) @@ -381,7 +266,7 @@ NULL, NULL); Status = ObCreateObject(KernelMode, - CmiKeyType, + CmpKeyObjectType, &ObjectAttributes, KernelMode, NULL, @@ -675,7 +560,7 @@ &ObjectName, (PVOID*)&ParentKey, &RemainingPath, - CmiKeyType, + CmpKeyObjectType, NULL, NULL); /* Yields a new reference */ @@ -714,7 +599,7 @@ &RemainingPath, ParentKey); Status = ObCreateObject(KernelMode, - CmiKeyType, + CmpKeyObjectType, NULL, KernelMode, NULL, Modified: trunk/reactos/ntoskrnl/cm/regobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/regobj.c?rev=2…
============================================================================== --- trunk/reactos/ntoskrnl/cm/regobj.c (original) +++ trunk/reactos/ntoskrnl/cm/regobj.c Fri May 11 22:58:34 2007 @@ -174,7 +174,7 @@ { ObReferenceObjectByPointer(ObpRootDirectoryObject, DIRECTORY_TRAVERSE, - CmiKeyType, + CmpKeyObjectType, ObjectCreateInfo->ProbeMode); CurrentObject = ObpRootDirectoryObject; } @@ -267,7 +267,7 @@ ObReferenceObjectByPointer(FoundObject, STANDARD_RIGHTS_REQUIRED, - CmiKeyType, + CmpKeyObjectType, KernelMode); if (End != NULL) { @@ -317,7 +317,7 @@ ObReferenceObjectByPointer(NextObject, DIRECTORY_TRAVERSE, - CmiKeyType, + CmpKeyObjectType, ObjectCreateInfo->ProbeMode); } @@ -342,7 +342,7 @@ } NTSTATUS STDCALL -CmiObjectParse(IN PVOID ParsedObject, +CmpParseKey(IN PVOID ParsedObject, IN PVOID ObjectType, IN OUT PACCESS_STATE AccessState, IN KPROCESSOR_MODE AccessMode, @@ -481,9 +481,9 @@ } /* Create new key object and put into linked list */ - DPRINT("CmiObjectParse: %S\n", *Path); + DPRINT("CmpParseKey: %S\n", *Path); Status = ObCreateObject(KernelMode, - CmiKeyType, + CmpKeyObjectType, NULL, KernelMode, NULL, @@ -586,7 +586,7 @@ ExReleaseResourceLite(&CmiRegistryLock); KeLeaveCriticalRegion(); - DPRINT("CmiObjectParse: %wZ\n", &FoundObject->Name); + DPRINT("CmpParseKey: %wZ\n", &FoundObject->Name); *Path = EndPtr; @@ -600,7 +600,7 @@ } VOID STDCALL -CmiObjectDelete(PVOID DeletedObject) +CmpDeleteKeyObject(PVOID DeletedObject) { PKEY_OBJECT ParentKeyObject; PKEY_OBJECT KeyObject; @@ -789,7 +789,7 @@ NTSTATUS STDCALL -CmiObjectSecurity(PVOID ObjectBody, +CmpSecurityMethod(PVOID ObjectBody, SECURITY_OPERATION_CODE OperationCode, PSECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR SecurityDescriptor, @@ -798,7 +798,7 @@ POOL_TYPE PoolType, PGENERIC_MAPPING GenericMapping) { - DPRINT("CmiObjectSecurity() called\n"); + DPRINT("CmpSecurityMethod() called\n"); switch (OperationCode) { @@ -828,7 +828,7 @@ NTSTATUS STDCALL -CmiObjectQueryName (PVOID ObjectBody, +CmpQueryKeyName (PVOID ObjectBody, IN BOOLEAN HasName, POBJECT_NAME_INFORMATION ObjectNameInfo, ULONG Length, @@ -838,7 +838,7 @@ PKEY_OBJECT KeyObject; NTSTATUS Status; - DPRINT ("CmiObjectQueryName() called\n"); + DPRINT ("CmpQueryKeyName() called\n"); KeyObject = (PKEY_OBJECT)ObjectBody; @@ -931,7 +931,7 @@ ObReferenceObjectByPointer(ParentKey, STANDARD_RIGHTS_REQUIRED, - CmiKeyType, + CmpKeyObjectType, KernelMode); NewKey->ParentKey = ParentKey; } Modified: trunk/reactos/ntoskrnl/config/cm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cm.h?rev=2…
============================================================================== --- trunk/reactos/ntoskrnl/config/cm.h (original) +++ trunk/reactos/ntoskrnl/config/cm.h Fri May 11 22:58:34 2007 @@ -767,10 +767,10 @@ IN ULONG FileType, IN PVOID HiveData, IN HANDLE Primary, - IN HANDLE Alternate, IN HANDLE Log, IN HANDLE External, - IN PUNICODE_STRING FileName + IN PUNICODE_STRING FileName, + IN ULONG CheckFlags ); PSECURITY_DESCRIPTOR @@ -983,6 +983,24 @@ extern BOOLEAN ExpInTextModeSetup; // +// BUGBUG Old Hive Stuff for Temporary Support +// +#define SYSTEM_REG_FILE L"\\SystemRoot\\System32\\Config\\SYSTEM" +#define SYSTEM_LOG_FILE L"\\SystemRoot\\System32\\Config\\SYSTEM.log" +#define REG_SYSTEM_KEY_NAME L"\\Registry\\Machine\\SYSTEM" +typedef struct _EREGISTRY_HIVE +{ + HHIVE Hive; + LIST_ENTRY HiveList; + UNICODE_STRING HiveFileName; + UNICODE_STRING LogFileName; + PCM_KEY_SECURITY RootSecurityCell; + ULONG Flags; + HANDLE HiveHandle; + HANDLE LogHandle; +} EREGISTRY_HIVE, *PEREGISTRY_HIVE; + +// // Inlined functions // #include "cm_x.h" Modified: trunk/reactos/ntoskrnl/config/cmse.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmse.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/config/cmse.c (original) +++ trunk/reactos/ntoskrnl/config/cmse.c Fri May 11 22:58:34 2007 @@ -44,7 +44,7 @@ if (!(Sid[0]) || !(Sid[1]) || !(Sid[2]) || !(Sid[3])) { /* Bugcheck */ - KEBUGCHECKEX(REGISTRY_ERROR, 2, 1, 0, 0); + KEBUGCHECKEX(REGISTRY_ERROR, 11, 1, 0, 0); } /* Phase 2: Initialize all SIDs */ @@ -52,7 +52,7 @@ Status |= RtlInitializeSid(Sid[1], &NtAuthority, 1); Status |= RtlInitializeSid(Sid[2], &NtAuthority, 1); Status |= RtlInitializeSid(Sid[3], &NtAuthority, 2); - if (!NT_SUCCESS(Status)) KEBUGCHECKEX(REGISTRY_ERROR, 2, 2, 0, 0); + if (!NT_SUCCESS(Status)) KEBUGCHECKEX(REGISTRY_ERROR, 11, 2, 0, 0); /* Phase 2: Setup SID Sub Authorities */ *RtlSubAuthoritySid(Sid[0], 0) = SECURITY_WORLD_RID; @@ -79,18 +79,18 @@ /* Phase 3: Allocate the ACL */ Acl = ExAllocatePoolWithTag(PagedPool, AclLength, TAG_CM); - if (!Acl) KEBUGCHECKEX(REGISTRY_ERROR, 2, 3, 0, 0); + if (!Acl) KEBUGCHECKEX(REGISTRY_ERROR, 11, 3, 0, 0); /* Phase 4: Create the ACL */ Status = RtlCreateAcl(Acl, AclLength, ACL_REVISION); - if (!NT_SUCCESS(Status)) KEBUGCHECKEX(REGISTRY_ERROR, 2, 4, Status, 0); + if (!NT_SUCCESS(Status)) KEBUGCHECKEX(REGISTRY_ERROR, 11, 4, Status, 0); /* Phase 5: Build the ACL */ Status = RtlAddAccessAllowedAce(Acl, ACL_REVISION, KEY_ALL_ACCESS, Sid[0]); Status |= RtlAddAccessAllowedAce(Acl, ACL_REVISION, KEY_ALL_ACCESS, Sid[1]); Status |= RtlAddAccessAllowedAce(Acl, ACL_REVISION, KEY_READ, Sid[2]); Status |= RtlAddAccessAllowedAce(Acl, ACL_REVISION, KEY_READ, Sid[3]); - if (!NT_SUCCESS(Status)) KEBUGCHECKEX(REGISTRY_ERROR, 2, 5, Status, 0); + if (!NT_SUCCESS(Status)) KEBUGCHECKEX(REGISTRY_ERROR, 11, 5, Status, 0); /* Phase 5: Make the ACEs inheritable */ Status = RtlGetAce(Acl, 0,( PVOID*)&AceHeader); @@ -111,7 +111,7 @@ sizeof(SECURITY_DESCRIPTOR) + AclLength, TAG_CM); - if (!SecurityDescriptor) KEBUGCHECKEX(REGISTRY_ERROR, 2, 6, 0, 0); + if (!SecurityDescriptor) KEBUGCHECKEX(REGISTRY_ERROR, 11, 6, 0, 0); /* Phase 6: Make a copy of the ACL */ AclCopy = (PACL)((PISECURITY_DESCRIPTOR)SecurityDescriptor + 1); @@ -120,14 +120,14 @@ /* Phase 7: Create the security descriptor */ Status = RtlCreateSecurityDescriptor(SecurityDescriptor, SECURITY_DESCRIPTOR_REVISION); - if (!NT_SUCCESS(Status)) KEBUGCHECKEX(REGISTRY_ERROR, 2, 7, Status, 0); + if (!NT_SUCCESS(Status)) KEBUGCHECKEX(REGISTRY_ERROR, 11, 7, Status, 0); /* Phase 8: Set the ACL as a DACL */ Status = RtlSetDaclSecurityDescriptor(SecurityDescriptor, TRUE, AclCopy, FALSE); - if (!NT_SUCCESS(Status)) KEBUGCHECKEX(REGISTRY_ERROR, 2, 8, Status, 0); + if (!NT_SUCCESS(Status)) KEBUGCHECKEX(REGISTRY_ERROR, 11, 8, Status, 0); /* Free the SIDs and original ACL */ for (i = 0; i < 4; i++) ExFreePool(Sid[i]); Modified: trunk/reactos/ntoskrnl/config/cmsysini.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmsysini.c…
============================================================================== --- trunk/reactos/ntoskrnl/config/cmsysini.c (original) +++ trunk/reactos/ntoskrnl/config/cmsysini.c Fri May 11 22:58:34 2007 @@ -15,11 +15,19 @@ /* GLOBALS *******************************************************************/ +HIVE_LIST_ENTRY CmpMachineHiveList[5]; + UNICODE_STRING CmSymbolicLinkValueName = RTL_CONSTANT_STRING(L"SymbolicLinkValue"); UNICODE_STRING CmpSystemStartOptions; UNICODE_STRING CmpLoadOptions; + +BOOLEAN CmpShareSystemHives; +BOOLEAN CmSelfHeal = TRUE; +BOOLEAN CmpSelfHeal = TRUE; +ULONG CmpBootType; + extern BOOLEAN ExpInTextModeSetup; /* FUNCTIONS *****************************************************************/ @@ -310,3 +318,165 @@ /* Return success */ return STATUS_SUCCESS; } + +BOOLEAN +NTAPI +CmpInitializeSystemHive(IN PLOADER_PARAMETER_BLOCK LoaderBlock) +{ + PVOID HiveBase; + ANSI_STRING LoadString; + PVOID Buffer; + ULONG Length; + NTSTATUS Status; + BOOLEAN Allocate; + UNICODE_STRING KeyName; + PEREGISTRY_HIVE SystemHive = NULL; + UNICODE_STRING HiveName = RTL_CONSTANT_STRING(L"SYSTEM"); + PSECURITY_DESCRIPTOR SecurityDescriptor; + PAGED_CODE(); + + /* Setup the ansi string */ + RtlInitAnsiString(&LoadString, LoaderBlock->LoadOptions); + + /* Allocate the unicode buffer */ + Length = LoadString.Length * sizeof(WCHAR) + sizeof(UNICODE_NULL); + Buffer = ExAllocatePoolWithTag(PagedPool, Length, 0); + if (!Buffer) + { + /* Fail */ + KEBUGCHECKEX(BAD_SYSTEM_CONFIG_INFO, 3, 1, (ULONG_PTR)LoaderBlock, 0); + } + + /* Setup the unicode string */ + RtlInitEmptyUnicodeString(&CmpLoadOptions, Buffer, Length); + + /* Add the load options and null-terminate */ + RtlAnsiStringToUnicodeString(&CmpLoadOptions, &LoadString, FALSE); + CmpLoadOptions.Buffer[LoadString.Length] = UNICODE_NULL; + CmpLoadOptions.Length += sizeof(WCHAR); + + /* Get the System Hive base address */ + HiveBase = LoaderBlock->RegistryBase; + if (HiveBase) + { + /* Import it */ + ((PHBASE_BLOCK)HiveBase)->Length = LoaderBlock->RegistryLength; + Status = CmpInitializeHive((PCMHIVE*)&SystemHive, + HINIT_MEMORY, + 0, //HIVE_NOLAZYFLUSH, + HFILE_TYPE_LOG, + HiveBase, + NULL, + NULL, + NULL, + &HiveName, + 2); + if (!NT_SUCCESS(Status)) return FALSE; + CmPrepareHive(&SystemHive->Hive); + + /* Set the hive filename */ + RtlCreateUnicodeString(&SystemHive->HiveFileName, SYSTEM_REG_FILE); + + /* Set the log filename */ + RtlCreateUnicodeString(&SystemHive->LogFileName, SYSTEM_LOG_FILE); + + /* We imported, no need to create a new hive */ + Allocate = FALSE; + + /* Manually set the hive as volatile, if in Live CD mode */ + if (CmpShareSystemHives) SystemHive->Hive.HiveFlags = HIVE_VOLATILE; + } + else + { +#if 0 + /* Create it */ + Status = CmpInitializeHive((PCMHIVE*)&SystemHive, + HINIT_CREATE, + HIVE_NOLAZYFLUSH, + HFILE_TYPE_LOG, + NULL, + NULL, + NULL, + NULL, + &HiveName, + 0); + if (!NT_SUCCESS(Status)) return FALSE; +#endif + + /* Tell CmpLinkHiveToMaster to allocate a hive */ + Allocate = TRUE; + } + + /* Save the boot type */ + if (SystemHive) CmpBootType = SystemHive->Hive.HiveHeader->BootType; + + /* Are we in self-healing mode? */ + if (!CmSelfHeal) + { + /* Disable self-healing internally and check if boot type wanted it */ + CmpSelfHeal = FALSE; + if (CmpBootType & 4) + { + /* We're disabled, so bugcheck */ + KEBUGCHECKEX(BAD_SYSTEM_CONFIG_INFO, + 3, + 3, + (ULONG_PTR)SystemHive, + 0); + } + } + + /* Create the default security descriptor */ + SecurityDescriptor = CmpHiveRootSecurityDescriptor(); + + /* Attach it to the system key */ + RtlInitUnicodeString(&KeyName, REG_SYSTEM_KEY_NAME); + Status = CmpLinkHiveToMaster(&KeyName, + NULL, + (PCMHIVE)SystemHive, + Allocate, + SecurityDescriptor); + + /* Free the security descriptor */ + ExFreePool(SecurityDescriptor); + if (!NT_SUCCESS(Status)) return FALSE; + + /* Add the hive to the hive list */ + CmpMachineHiveList[3].CmHive = (PCMHIVE)SystemHive; + + /* Success! */ + return TRUE; +} + +NTSTATUS +NTAPI +CmpCreateObjectTypes(VOID) +{ + OBJECT_TYPE_INITIALIZER ObjectTypeInitializer; + UNICODE_STRING Name; + GENERIC_MAPPING CmpKeyMapping = {KEY_READ, + KEY_WRITE, + KEY_EXECUTE, + KEY_ALL_ACCESS}; + PAGED_CODE(); + + /* Initialize the Key object type */ + RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer)); + RtlInitUnicodeString(&Name, L"Key"); + ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer); + ObjectTypeInitializer.DefaultPagedPoolCharge = sizeof(CM_KEY_BODY); + ObjectTypeInitializer.GenericMapping = CmpKeyMapping; + ObjectTypeInitializer.PoolType = PagedPool; + ObjectTypeInitializer.ValidAccessMask = KEY_ALL_ACCESS; + ObjectTypeInitializer.UseDefaultObject = TRUE; + ObjectTypeInitializer.DeleteProcedure = CmpDeleteKeyObject; + ObjectTypeInitializer.ParseProcedure = CmpParseKey; + ObjectTypeInitializer.SecurityProcedure = CmpSecurityMethod; + ObjectTypeInitializer.QueryNameProcedure = CmpQueryKeyName; + //ObjectTypeInitializer.CloseProcedure = CmpCloseKeyObject; + ObjectTypeInitializer.SecurityRequired = TRUE; + + /* Create it */ + return ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &CmpKeyObjectType); +} +
17 years, 7 months
1
0
0
0
[ion] 26701: - Add missing ACE structures to ntifs.h. - Add missing SeLengthSid to ntifs.h. - Implement CmpHiveRootSecurityDescriptor and use it in CmpInitializeSystemHive and CmInitSystem1 to properly secure system-created hives. - Implement CmpInitializeHardwareConfiguration and call it. Its job is to populate the hardware hive, but FreeLDR already does this, so it doesn't do much at the moment.
by ion@svn.reactos.org
Author: ion Date: Fri May 11 22:15:13 2007 New Revision: 26701 URL:
http://svn.reactos.org/svn/reactos?rev=26701&view=rev
Log: - Add missing ACE structures to ntifs.h. - Add missing SeLengthSid to ntifs.h. - Implement CmpHiveRootSecurityDescriptor and use it in CmpInitializeSystemHive and CmInitSystem1 to properly secure system-created hives. - Implement CmpInitializeHardwareConfiguration and call it. Its job is to populate the hardware hive, but FreeLDR already does this, so it doesn't do much at the moment. Added: trunk/reactos/ntoskrnl/config/cmse.c Modified: trunk/reactos/include/ddk/ntifs.h trunk/reactos/ntoskrnl/cm/cm.h trunk/reactos/ntoskrnl/cm/registry.c trunk/reactos/ntoskrnl/config/cmconfig.c trunk/reactos/ntoskrnl/ntoskrnl.rbuild Modified: trunk/reactos/include/ddk/ntifs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/ntifs.h?rev=26…
============================================================================== --- trunk/reactos/include/ddk/ntifs.h (original) +++ trunk/reactos/include/ddk/ntifs.h Fri May 11 22:15:13 2007 @@ -1724,6 +1724,41 @@ USHORT AceSize; } ACE_HEADER, *PACE_HEADER; +typedef struct _ACCESS_ALLOWED_ACE +{ + ACE_HEADER Header; + ACCESS_MASK Mask; + ULONG SidStart; +} ACCESS_ALLOWED_ACE, *PACCESS_ALLOWED_ACE; + +typedef struct _ACCESS_DENIED_ACE +{ + ACE_HEADER Header; + ACCESS_MASK Mask; + ULONG SidStart; +} ACCESS_DENIED_ACE, *PACCESS_DENIED_ACE; + +typedef struct _SYSTEM_AUDIT_ACE +{ + ACE_HEADER Header; + ACCESS_MASK Mask; + ULONG SidStart; +} SYSTEM_AUDIT_ACE, *PSYSTEM_AUDIT_ACE; + +typedef struct _SYSTEM_ALARM_ACE +{ + ACE_HEADER Header; + ACCESS_MASK Mask; + ULONG SidStart; +} SYSTEM_ALARM_ACE, *PSYSTEM_ALARM_ACE; + +typedef struct _SYSTEM_MANDATORY_LABEL_ACE +{ + ACE_HEADER Header; + ACCESS_MASK Mask; + ULONG SidStart; +} SYSTEM_MANDATORY_LABEL_ACE, *PSYSTEM_MANDATORY_LABEL_ACE; + typedef struct _TUNNEL { FAST_MUTEX Mutex; PRTL_SPLAY_LINKS Cache; @@ -4305,6 +4340,10 @@ ); #endif /* (VER_PRODUCTBUILD >= 2195) */ + + +#define SeLengthSid( Sid ) \ + (8 + (4 * ((SID *)Sid)->SubAuthorityCount)) #define SeDeleteClientSecurity(C) { \ if (SeTokenType((C)->ClientToken) == TokenPrimary) { \ Modified: trunk/reactos/ntoskrnl/cm/cm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/cm.h?rev=26701…
============================================================================== --- trunk/reactos/ntoskrnl/cm/cm.h (original) +++ trunk/reactos/ntoskrnl/cm/cm.h Fri May 11 22:15:13 2007 @@ -418,6 +418,66 @@ PHHIVE RegistryHive, ULONG FileType); +VOID +CmiCheckKey(BOOLEAN Verbose, + HANDLE Key); + +BOOLEAN +INIT_FUNCTION +CmImportSystemHive(PCHAR ChunkBase, + ULONG ChunkSize, + OUT PEREGISTRY_HIVE *RegistryHive); + +BOOLEAN +INIT_FUNCTION +CmImportHardwareHive(PCHAR ChunkBase, + ULONG ChunkSize, + OUT PEREGISTRY_HIVE *RegistryHive); + +NTSTATUS +NTAPI +CmpSetSystemValues(IN PLOADER_PARAMETER_BLOCK LoaderBlock); + +NTSTATUS +NTAPI +CmpCreateControlSet(IN PLOADER_PARAMETER_BLOCK LoaderBlock); + +NTSTATUS +NTAPI +CmpInitializeMachineDependentConfiguration(IN PLOADER_PARAMETER_BLOCK LoaderBlock); + +NTSTATUS +NTAPI +CmpInitializeHive(PEREGISTRY_HIVE *RegistryHive, + ULONG OperationType, + ULONG HiveFlags, + ULONG FileType, + PVOID HiveData OPTIONAL, + HANDLE Primary, + HANDLE Log, + HANDLE External, + PUNICODE_STRING FileName OPTIONAL, + ULONG CheckFlags); + +USHORT +NTAPI +CmpCopyName(IN PHHIVE Hive, + IN PWCHAR Destination, + IN PUNICODE_STRING Source); + +USHORT +NTAPI +CmpNameSize(IN PHHIVE Hive, + IN PUNICODE_STRING Name); + +NTSTATUS +NTAPI +CmpInitializeHardwareConfiguration(IN PLOADER_PARAMETER_BLOCK LoaderBlock); + +PSECURITY_DESCRIPTOR +NTAPI +CmpHiveRootSecurityDescriptor(VOID); + #if 0 static __inline PVOID xHvGetCell(char *file, int line, PHHIVE Hive, HCELL_INDEX Cell) { Modified: trunk/reactos/ntoskrnl/cm/registry.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/registry.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/cm/registry.c (original) +++ trunk/reactos/ntoskrnl/cm/registry.c Fri May 11 22:15:13 2007 @@ -48,60 +48,6 @@ static GENERIC_MAPPING CmiKeyMapping = {KEY_READ, KEY_WRITE, KEY_EXECUTE, KEY_ALL_ACCESS}; - - - -VOID -CmiCheckKey(BOOLEAN Verbose, - HANDLE Key); - -BOOLEAN -INIT_FUNCTION -CmImportSystemHive(PCHAR ChunkBase, - ULONG ChunkSize, - OUT PEREGISTRY_HIVE *RegistryHive); - -BOOLEAN -INIT_FUNCTION -CmImportHardwareHive(PCHAR ChunkBase, - ULONG ChunkSize, - OUT PEREGISTRY_HIVE *RegistryHive); - -NTSTATUS -NTAPI -CmpSetSystemValues(IN PLOADER_PARAMETER_BLOCK LoaderBlock); - -NTSTATUS -NTAPI -CmpCreateControlSet(IN PLOADER_PARAMETER_BLOCK LoaderBlock); - -NTSTATUS -NTAPI -CmpInitializeMachineDependentConfiguration(IN PLOADER_PARAMETER_BLOCK LoaderBlock); - -NTSTATUS -NTAPI -CmpInitializeHive(PEREGISTRY_HIVE *RegistryHive, - ULONG OperationType, - ULONG HiveFlags, - ULONG FileType, - PVOID HiveData OPTIONAL, - HANDLE Primary, - HANDLE Log, - HANDLE External, - PUNICODE_STRING FileName OPTIONAL, - ULONG CheckFlags); - -USHORT -NTAPI -CmpCopyName(IN PHHIVE Hive, - IN PWCHAR Destination, - IN PUNICODE_STRING Source); - -USHORT -NTAPI -CmpNameSize(IN PHHIVE Hive, - IN PUNICODE_STRING Name); static VOID STDCALL CmiHiveSyncDpcRoutine(PKDPC Dpc, @@ -253,6 +199,7 @@ UNICODE_STRING KeyName; PEREGISTRY_HIVE SystemHive; UNICODE_STRING HiveName = RTL_CONSTANT_STRING(L"SYSTEM"); + PSECURITY_DESCRIPTOR SecurityDescriptor; PAGED_CODE(); /* Setup the ansi string */ @@ -309,9 +256,16 @@ Allocate = TRUE; } + /* Create the default security descriptor */ + SecurityDescriptor = CmpHiveRootSecurityDescriptor(); + /* Attach it to the system key */ RtlInitUnicodeString(&KeyName, REG_SYSTEM_KEY_NAME); - Status = CmpLinkHiveToMaster(&KeyName, NULL, SystemHive, Allocate, NULL); + Status = CmpLinkHiveToMaster(&KeyName, + NULL, + SystemHive, + Allocate, + SecurityDescriptor); if (!NT_SUCCESS(Status)) return FALSE; /* Success! */ @@ -495,6 +449,7 @@ PEREGISTRY_HIVE HardwareHive; PVOID BaseAddress; ULONG Length; + PSECURITY_DESCRIPTOR SecurityDescriptor; PAGED_CODE(); /* Initialize the hive list */ @@ -559,13 +514,16 @@ KEBUGCHECKEX(CONFIG_INITIALIZATION_FAILED, 1, 3, 0, 0); } + /* Create the default security descriptor */ + SecurityDescriptor = CmpHiveRootSecurityDescriptor(); + /* Create '\Registry\Machine' key. */ RtlInitUnicodeString(&KeyName, L"\\REGISTRY\\MACHINE"); InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE, NULL, - NULL); + SecurityDescriptor); Status = NtCreateKey(&KeyHandle, KEY_READ | KEY_WRITE, &ObjectAttributes, @@ -588,7 +546,7 @@ &KeyName, OBJ_CASE_INSENSITIVE, NULL, - NULL); + SecurityDescriptor); Status = NtCreateKey(&KeyHandle, KEY_READ | KEY_WRITE, &ObjectAttributes, @@ -642,11 +600,23 @@ /* Attach it to the machine key */ RtlInitUnicodeString(&KeyName, REG_HARDWARE_KEY_NAME); - Status = CmpLinkHiveToMaster(&KeyName, NULL, HardwareHive, FALSE, NULL); + Status = CmpLinkHiveToMaster(&KeyName, + NULL, + HardwareHive, + FALSE, + SecurityDescriptor); if (!NT_SUCCESS(Status)) { /* Bugcheck */ KEBUGCHECKEX(CONFIG_INITIALIZATION_FAILED, 1, 12, Status, 0); + } + + /* Fill out the Hardware key with the ARC Data from the Loader */ + Status = CmpInitializeHardwareConfiguration(KeLoaderBlock); + if (!NT_SUCCESS(Status)) + { + /* Bugcheck */ + KEBUGCHECKEX(CONFIG_INITIALIZATION_FAILED, 1, 13, Status, 0); } /* Initialize machine-dependent information into the registry */ Modified: trunk/reactos/ntoskrnl/config/cmconfig.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmconfig.c…
============================================================================== --- trunk/reactos/ntoskrnl/config/cmconfig.c (original) +++ trunk/reactos/ntoskrnl/config/cmconfig.c Fri May 11 22:15:13 2007 @@ -194,3 +194,81 @@ return Status; } +NTSTATUS +NTAPI +CmpInitializeHardwareConfiguration(IN PLOADER_PARAMETER_BLOCK LoaderBlock) +{ + NTSTATUS Status; + OBJECT_ATTRIBUTES ObjectAttributes; + HANDLE KeyHandle; + ULONG Disposition; + UNICODE_STRING KeyName; + + /* Setup the key name */ + RtlInitUnicodeString(&KeyName, + L"\\Registry\\Machine\\Hardware\\DeviceMap"); + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + + /* Create the device map key */ + Status = NtCreateKey(&KeyHandle, + KEY_READ | KEY_WRITE, + &ObjectAttributes, + 0, + NULL, + 0, + &Disposition); + if (!NT_SUCCESS(Status)) return Status; + NtClose(KeyHandle); + + /* Nobody should've created this key yet! */ + //ASSERT(Disposition == REG_CREATED_NEW_KEY); + + /* Setup the key name */ + RtlInitUnicodeString(&KeyName, + L"\\Registry\\Machine\\Hardware\\Description"); + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + + /* Create the description key */ + Status = NtCreateKey(&KeyHandle, + KEY_READ | KEY_WRITE, + &ObjectAttributes, + 0, + NULL, + 0, + &Disposition); + if (!NT_SUCCESS(Status)) return Status; + + /* Nobody should've created this key yet! */ + //ASSERT(Disposition == REG_CREATED_NEW_KEY); + + /* Allocate the configuration data buffer */ + CmpConfigurationData = ExAllocatePoolWithTag(PagedPool, + CmpConfigurationAreaSize, + TAG_CM); + if (!CmpConfigurationData) return STATUS_INSUFFICIENT_RESOURCES; + + /* Check if we got anything from NTLDR */ + if (LoaderBlock->ConfigurationRoot) + { + ASSERTMSG("NTLDR ARC Hardware Tree Not Supported!\n", FALSE); + } + else + { + /* Nothing else to do */ + Status = STATUS_SUCCESS; + } + + /* Close our handle, free the buffer and return status */ + ExFreePool(CmpConfigurationData); + NtClose(KeyHandle); + return Status; +} + Added: trunk/reactos/ntoskrnl/config/cmse.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmse.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/config/cmse.c (added) +++ trunk/reactos/ntoskrnl/config/cmse.c Fri May 11 22:15:13 2007 @@ -1,0 +1,138 @@ +/* + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory + * FILE: ntoskrnl/config/cmse.c + * PURPOSE: Configuration Manager - Security Subsystem Interface + * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include "ntoskrnl.h" +#include "cm.h" +#define NDEBUG +#include "debug.h" + +/* GLOBALS *******************************************************************/ + +/* FUNCTIONS *****************************************************************/ + +PSECURITY_DESCRIPTOR +NTAPI +CmpHiveRootSecurityDescriptor(VOID) +{ + NTSTATUS Status; + PSECURITY_DESCRIPTOR SecurityDescriptor; + PACL Acl, AclCopy; + PSID Sid[3]; + SID_IDENTIFIER_AUTHORITY WorldAuthority = {SECURITY_WORLD_SID_AUTHORITY}; + SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY}; + ULONG AceLength, AclLength, SidLength; + PACE_HEADER AceHeader; + ULONG i; + PAGED_CODE(); + + /* Phase 1: Allocate SIDs */ + SidLength = RtlLengthRequiredSid(1); + Sid[0] = ExAllocatePoolWithTag(PagedPool, SidLength, TAG_CM); + Sid[1] = ExAllocatePoolWithTag(PagedPool, SidLength, TAG_CM); + Sid[2] = ExAllocatePoolWithTag(PagedPool, SidLength, TAG_CM); + SidLength = RtlLengthRequiredSid(2); + Sid[3] = ExAllocatePoolWithTag(PagedPool, SidLength, TAG_CM); + + /* Make sure all SIDs were allocated */ + if (!(Sid[0]) || !(Sid[1]) || !(Sid[2]) || !(Sid[3])) + { + /* Bugcheck */ + KEBUGCHECKEX(REGISTRY_ERROR, 2, 1, 0, 0); + } + + /* Phase 2: Initialize all SIDs */ + Status = RtlInitializeSid(Sid[0], &WorldAuthority, 1); + Status |= RtlInitializeSid(Sid[1], &NtAuthority, 1); + Status |= RtlInitializeSid(Sid[2], &NtAuthority, 1); + Status |= RtlInitializeSid(Sid[3], &NtAuthority, 2); + if (!NT_SUCCESS(Status)) KEBUGCHECKEX(REGISTRY_ERROR, 2, 2, 0, 0); + + /* Phase 2: Setup SID Sub Authorities */ + *RtlSubAuthoritySid(Sid[0], 0) = SECURITY_WORLD_RID; + *RtlSubAuthoritySid(Sid[1], 0) = SECURITY_RESTRICTED_CODE_RID; + *RtlSubAuthoritySid(Sid[2], 0) = SECURITY_LOCAL_SYSTEM_RID; + *RtlSubAuthoritySid(Sid[3], 0) = SECURITY_BUILTIN_DOMAIN_RID; + *RtlSubAuthoritySid(Sid[3], 1) = DOMAIN_ALIAS_RID_ADMINS; + + /* Make sure all SIDs are valid */ + ASSERT(RtlValidSid(Sid[0])); + ASSERT(RtlValidSid(Sid[1])); + ASSERT(RtlValidSid(Sid[2])); + ASSERT(RtlValidSid(Sid[3])); + + /* Phase 3: Calculate ACL Length */ + AclLength = sizeof(ACL); + for (i = 0; i < 4; i++) + { + /* This is what MSDN says to do */ + AceLength = FIELD_OFFSET(ACCESS_ALLOWED_ACE, SidStart); + AceLength += SeLengthSid(Sid[i]); + AclLength += AceLength; + } + + /* Phase 3: Allocate the ACL */ + Acl = ExAllocatePoolWithTag(PagedPool, AclLength, TAG_CM); + if (!Acl) KEBUGCHECKEX(REGISTRY_ERROR, 2, 3, 0, 0); + + /* Phase 4: Create the ACL */ + Status = RtlCreateAcl(Acl, AclLength, ACL_REVISION); + if (!NT_SUCCESS(Status)) KEBUGCHECKEX(REGISTRY_ERROR, 2, 4, Status, 0); + + /* Phase 5: Build the ACL */ + Status = RtlAddAccessAllowedAce(Acl, ACL_REVISION, KEY_ALL_ACCESS, Sid[0]); + Status |= RtlAddAccessAllowedAce(Acl, ACL_REVISION, KEY_ALL_ACCESS, Sid[1]); + Status |= RtlAddAccessAllowedAce(Acl, ACL_REVISION, KEY_READ, Sid[2]); + Status |= RtlAddAccessAllowedAce(Acl, ACL_REVISION, KEY_READ, Sid[3]); + if (!NT_SUCCESS(Status)) KEBUGCHECKEX(REGISTRY_ERROR, 2, 5, Status, 0); + + /* Phase 5: Make the ACEs inheritable */ + Status = RtlGetAce(Acl, 0,( PVOID*)&AceHeader); + ASSERT(NT_SUCCESS(Status)); + AceHeader->AceFlags |= CONTAINER_INHERIT_ACE; + Status = RtlGetAce(Acl, 1, (PVOID*)&AceHeader); + ASSERT(NT_SUCCESS(Status)); + AceHeader->AceFlags |= CONTAINER_INHERIT_ACE; + Status = RtlGetAce(Acl, 2, (PVOID*)&AceHeader); + ASSERT(NT_SUCCESS(Status)); + AceHeader->AceFlags |= CONTAINER_INHERIT_ACE; + Status = RtlGetAce(Acl, 3, (PVOID*)&AceHeader); + ASSERT(NT_SUCCESS(Status)); + AceHeader->AceFlags |= CONTAINER_INHERIT_ACE; + + /* Phase 6: Allocate the security descriptor and make space for the ACL */ + SecurityDescriptor = ExAllocatePoolWithTag(PagedPool, + sizeof(SECURITY_DESCRIPTOR) + + AclLength, + TAG_CM); + if (!SecurityDescriptor) KEBUGCHECKEX(REGISTRY_ERROR, 2, 6, 0, 0); + + /* Phase 6: Make a copy of the ACL */ + AclCopy = (PACL)((PISECURITY_DESCRIPTOR)SecurityDescriptor + 1); + RtlCopyMemory(AclCopy, Acl, AclLength); + + /* Phase 7: Create the security descriptor */ + Status = RtlCreateSecurityDescriptor(SecurityDescriptor, + SECURITY_DESCRIPTOR_REVISION); + if (!NT_SUCCESS(Status)) KEBUGCHECKEX(REGISTRY_ERROR, 2, 7, Status, 0); + + /* Phase 8: Set the ACL as a DACL */ + Status = RtlSetDaclSecurityDescriptor(SecurityDescriptor, + TRUE, + AclCopy, + FALSE); + if (!NT_SUCCESS(Status)) KEBUGCHECKEX(REGISTRY_ERROR, 2, 8, Status, 0); + + /* Free the SIDs and original ACL */ + for (i = 0; i < 4; i++) ExFreePool(Sid[i]); + ExFreePool(Acl); + + /* Return the security descriptor */ + return SecurityDescriptor; +} Modified: trunk/reactos/ntoskrnl/ntoskrnl.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ntoskrnl.rbuild?r…
============================================================================== --- trunk/reactos/ntoskrnl/ntoskrnl.rbuild (original) +++ trunk/reactos/ntoskrnl/ntoskrnl.rbuild Fri May 11 22:15:13 2007 @@ -98,6 +98,7 @@ <file>cmmapvw.c</file> <file>cmname.c</file> <file>cmparse.c</file> + <file>cmse.c</file> <file>cmsecach.c</file> <file>cmsysini.c</file> <file>cmvalue.c</file>
17 years, 7 months
1
0
0
0
[dgorbachev] 26700: - Terminate the string. NtUserMenuItemInfo() sometimes returns no string. - Check if NtUserBuildMenuItemList() returns negative result.
by dgorbachev@svn.reactos.org
Author: dgorbachev Date: Fri May 11 18:12:57 2007 New Revision: 26700 URL:
http://svn.reactos.org/svn/reactos?rev=26700&view=rev
Log: - Terminate the string. NtUserMenuItemInfo() sometimes returns no string. - Check if NtUserBuildMenuItemList() returns negative result. Modified: trunk/reactos/dll/win32/user32/windows/menu.c Modified: trunk/reactos/dll/win32/user32/windows/menu.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/m…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/menu.c (original) +++ trunk/reactos/dll/win32/user32/windows/menu.c Fri May 11 18:12:57 2007 @@ -200,6 +200,7 @@ ItemInfo->fType = 0; return FALSE; } + ItemInfo->dwTypeData[ItemInfo->cch - 1] = UNICODE_NULL; } ItemInfo->fMask = Save_Mask; return TRUE; @@ -251,7 +252,7 @@ DWORD BufSize; BufSize = NtUserBuildMenuItemList(Menu, (VOID *) 1, 0, 0); - if (BufSize <= 0) + if (BufSize == (DWORD) -1 || BufSize == 0) { return -1; }
17 years, 7 months
1
0
0
0
[dgorbachev] 26699: Check result of DRIVER_FindFromHDrvr().
by dgorbachev@svn.reactos.org
Author: dgorbachev Date: Fri May 11 18:12:40 2007 New Revision: 26699 URL:
http://svn.reactos.org/svn/reactos?rev=26699&view=rev
Log: Check result of DRIVER_FindFromHDrvr(). Modified: trunk/reactos/dll/win32/winmm/lolvldrv.c Modified: trunk/reactos/dll/win32/winmm/lolvldrv.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/winmm/lolvldrv.c…
============================================================================== --- trunk/reactos/dll/win32/winmm/lolvldrv.c (original) +++ trunk/reactos/dll/win32/winmm/lolvldrv.c Fri May 11 18:12:40 2007 @@ -645,7 +645,11 @@ return FALSE; } - d = DRIVER_FindFromHDrvr(lpDrv->hDriver); + if (!(d = DRIVER_FindFromHDrvr(lpDrv->hDriver))) { + CloseDriver(lpDrv->hDriver, 0, 0); + WARN("Couldn't get the WINE internal structure for driver '%s'\n", drvFileName); + return FALSE; + } lpDrv->bIs32 = (d->dwFlags & WINE_GDF_16BIT) ? FALSE : TRUE; /* Then look for xxxMessage functions */
17 years, 7 months
1
0
0
0
[dgorbachev] 26698: Fix (partially) bug #2243.
by dgorbachev@svn.reactos.org
Author: dgorbachev Date: Fri May 11 18:12:21 2007 New Revision: 26698 URL:
http://svn.reactos.org/svn/reactos?rev=26698&view=rev
Log: Fix (partially) bug #2243. Modified: trunk/reactos/ntoskrnl/lpc/send.c Modified: trunk/reactos/ntoskrnl/lpc/send.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/lpc/send.c?rev=26…
============================================================================== --- trunk/reactos/ntoskrnl/lpc/send.c (original) +++ trunk/reactos/ntoskrnl/lpc/send.c Fri May 11 18:12:21 2007 @@ -285,11 +285,26 @@ else { /* No callback, just copy the message */ - LpcpMoveMessage(&Message->Request, - LpcRequest, - LpcRequest + 1, - MessageType, - &Thread->Cid); + _SEH_TRY + { + LpcpMoveMessage(&Message->Request, + LpcRequest, + LpcRequest + 1, + MessageType, + &Thread->Cid); + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + + if (!NT_SUCCESS(Status)) + { + LpcpFreeToPortZone(Message, 0); + ObDereferenceObject(Port); + return Status; + } /* Acquire the LPC lock */ KeAcquireGuardedMutex(&LpcpLock);
17 years, 7 months
1
0
0
0
[gedmurphy] 26697: don't try to boot with bad paths
by gedmurphy@svn.reactos.org
Author: gedmurphy Date: Fri May 11 17:41:40 2007 New Revision: 26697 URL:
http://svn.reactos.org/svn/reactos?rev=26697&view=rev
Log: don't try to boot with bad paths Modified: trunk/tools/Qemu GUI/AboutForm.Designer.cs trunk/tools/Qemu GUI/AboutForm.resx trunk/tools/Qemu GUI/MainForm.Designer.cs trunk/tools/Qemu GUI/MainForm.cs trunk/tools/Qemu GUI/Runner.cs Modified: trunk/tools/Qemu GUI/AboutForm.Designer.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Qemu%20GUI/AboutForm.Designe…
============================================================================== --- trunk/tools/Qemu GUI/AboutForm.Designer.cs (original) +++ trunk/tools/Qemu GUI/AboutForm.Designer.cs Fri May 11 17:41:40 2007 @@ -32,8 +32,8 @@ this.button1 = new System.Windows.Forms.Button(); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); + this.textBox1 = new System.Windows.Forms.TextBox(); this.tabPage2 = new System.Windows.Forms.TabPage(); - this.textBox1 = new System.Windows.Forms.TextBox(); this.textBox2 = new System.Windows.Forms.TextBox(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); @@ -71,6 +71,16 @@ this.tabPage1.Text = "License"; this.tabPage1.UseVisualStyleBackColor = true; // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(6, 6); + this.textBox1.Multiline = true; + this.textBox1.Name = "textBox1"; + this.textBox1.ReadOnly = true; + this.textBox1.Size = new System.Drawing.Size(267, 207); + this.textBox1.TabIndex = 0; + this.textBox1.Text = resources.GetString("textBox1.Text"); + // // tabPage2 // this.tabPage2.Controls.Add(this.textBox2); @@ -81,16 +91,6 @@ this.tabPage2.TabIndex = 1; this.tabPage2.Text = "Credits"; this.tabPage2.UseVisualStyleBackColor = true; - // - // textBox1 - // - this.textBox1.Location = new System.Drawing.Point(6, 6); - this.textBox1.Multiline = true; - this.textBox1.Name = "textBox1"; - this.textBox1.ReadOnly = true; - this.textBox1.Size = new System.Drawing.Size(267, 207); - this.textBox1.TabIndex = 0; - this.textBox1.Text = resources.GetString("textBox1.Text"); // // textBox2 // Modified: trunk/tools/Qemu GUI/AboutForm.resx URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Qemu%20GUI/AboutForm.resx?re…
============================================================================== --- trunk/tools/Qemu GUI/AboutForm.resx (original) +++ trunk/tools/Qemu GUI/AboutForm.resx Fri May 11 17:41:40 2007 @@ -117,14 +117,6 @@ <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> - <data name="textBox2.Text" xml:space="preserve"> - <value>ReactOS QEmu Manager was brought to you by: - -Magnus Olsen [greatlord(a)reactos.org] -Christoph Von Widitch [Christoph_vW(a)ReactOS.org] -Samuel Serapión [samcharly(a)hotmail.com] -Ged Murphy [gedmurphy(a)reactos.org]</value> - </data> <data name="textBox1.Text" xml:space="preserve"> <value>This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. @@ -132,4 +124,12 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.</value> </data> + <data name="textBox2.Text" xml:space="preserve"> + <value>ReactOS QEmu Manager was brought to you by: + +Magnus Olsen [greatlord(a)reactos.org] +Christoph von Wittich [Christoph_vW(a)ReactOS.org] +Samuel Serapión [samcharly(a)hotmail.com] +Ged Murphy [gedmurphy(a)reactos.org]</value> + </data> </root> Modified: trunk/tools/Qemu GUI/MainForm.Designer.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Qemu%20GUI/MainForm.Designer…
============================================================================== --- trunk/tools/Qemu GUI/MainForm.Designer.cs (original) +++ trunk/tools/Qemu GUI/MainForm.Designer.cs Fri May 11 17:41:40 2007 @@ -358,9 +358,9 @@ this.groupBox3.Controls.Add(this.btnBrowseBios); this.groupBox3.Controls.Add(this.txtABios); this.groupBox3.Enabled = false; - this.groupBox3.Location = new System.Drawing.Point(6, 65); + this.groupBox3.Location = new System.Drawing.Point(3, 65); this.groupBox3.Name = "groupBox3"; - this.groupBox3.Size = new System.Drawing.Size(351, 57); + this.groupBox3.Size = new System.Drawing.Size(354, 57); this.groupBox3.TabIndex = 11; this.groupBox3.TabStop = false; this.groupBox3.Text = "BIOS"; @@ -475,9 +475,9 @@ this.groupBox1.Controls.Add(this.btnBrowseLinuxK); this.groupBox1.Controls.Add(this.txtLinuxK); this.groupBox1.Enabled = false; - this.groupBox1.Location = new System.Drawing.Point(6, 6); + this.groupBox1.Location = new System.Drawing.Point(3, 6); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(351, 53); + this.groupBox1.Size = new System.Drawing.Size(354, 53); this.groupBox1.TabIndex = 0; this.groupBox1.TabStop = false; this.groupBox1.Text = "Linux"; @@ -532,9 +532,9 @@ this.grpVDK.Controls.Add(this.btnMount); this.grpVDK.Controls.Add(this.lblImage); this.grpVDK.Enabled = false; - this.grpVDK.Location = new System.Drawing.Point(4, 83); + this.grpVDK.Location = new System.Drawing.Point(3, 83); this.grpVDK.Name = "grpVDK"; - this.grpVDK.Size = new System.Drawing.Size(501, 118); + this.grpVDK.Size = new System.Drawing.Size(502, 118); this.grpVDK.TabIndex = 7; this.grpVDK.TabStop = false; this.grpVDK.Text = "VDK"; @@ -619,9 +619,9 @@ this.groupBox9.Controls.Add(this.lblImageSize); this.groupBox9.Controls.Add(this.btnCreateImage); this.groupBox9.Controls.Add(this.cboImageFormat); - this.groupBox9.Location = new System.Drawing.Point(4, 3); + this.groupBox9.Location = new System.Drawing.Point(3, 3); this.groupBox9.Name = "groupBox9"; - this.groupBox9.Size = new System.Drawing.Size(501, 74); + this.groupBox9.Size = new System.Drawing.Size(502, 74); this.groupBox9.TabIndex = 6; this.groupBox9.TabStop = false; this.groupBox9.Text = "Harddisk Tools"; @@ -1315,9 +1315,9 @@ this.grpHarddisk.Controls.Add(this.btnBrowseHDA); this.grpHarddisk.Controls.Add(this.chkUseHDB); this.grpHarddisk.Controls.Add(this.chkUseHDA); - this.grpHarddisk.Location = new System.Drawing.Point(5, 3); + this.grpHarddisk.Location = new System.Drawing.Point(3, 3); this.grpHarddisk.Name = "grpHarddisk"; - this.grpHarddisk.Size = new System.Drawing.Size(500, 195); + this.grpHarddisk.Size = new System.Drawing.Size(502, 195); this.grpHarddisk.TabIndex = 5; this.grpHarddisk.TabStop = false; this.grpHarddisk.Text = " Harddisks"; Modified: trunk/tools/Qemu GUI/MainForm.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Qemu%20GUI/MainForm.cs?rev=2…
============================================================================== --- trunk/tools/Qemu GUI/MainForm.cs (original) +++ trunk/tools/Qemu GUI/MainForm.cs Fri May 11 17:41:40 2007 @@ -697,18 +697,56 @@ bool HasHDisk = false; bool HasFDisk = false; + /* check the QEmu path */ + if (!Directory.Exists(data.Paths.Qemu)) + { + MessageBox.Show("\"" + data.Paths.Qemu + "\"" + " does not exist", "Error - QEmu path"); + return; + } + /* There must be atleast one source of OS */ for (int i = 0; i < data.Harddisks.HDD.Length; i++) { if (data.Harddisks.HDD[i].Enabled == true) - HasHDisk = true; + { + if (File.Exists(data.Harddisks.HDD[i].Path)) + { + HasHDisk = true; + } + else + { + MessageBox.Show("\"" + data.Harddisks.HDD[i].Path + "\"" + " does not exist", "Error - Harddisk file"); + return; + } + } } for (int i = 0; i < data.Floppies.FDD.Length; i++) { if (data.Floppies.FDD[i].Enabled == true) - HasFDisk = true; - } + { + if (File.Exists(data.Floppies.FDD[i].Path)) + { + HasFDisk = true; + } + else + { + MessageBox.Show("\"" + data.Floppies.FDD[i].Path + "\"" + " does not exist", "Error - Floppy File"); + return; + } + } + } + + /* ensure we have a correct CD image if we need to boot from it */ + if (optCDImage.Enabled && txtCDROM.Text.Length > 0) + { + if (!File.Exists(txtCDROM.Text)) + { + MessageBox.Show("\"" + txtCDROM.Text + "\"" + " does not exist", "Error - CD-ROM image"); + return; + } + } + if (HasHDisk == false && data.CDROM.Enabled == false && HasFDisk == false) MessageBox.Show("Must enable atleast 1 Hard disk, CD-Rom or Floppy disk!", "Error");//or specify linux kernel image??? else Modified: trunk/tools/Qemu GUI/Runner.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Qemu%20GUI/Runner.cs?rev=266…
============================================================================== --- trunk/tools/Qemu GUI/Runner.cs (original) +++ trunk/tools/Qemu GUI/Runner.cs Fri May 11 17:41:40 2007 @@ -79,7 +79,6 @@ } catch { } } - } p.StartInfo.Arguments = data.GetArgv(); }
17 years, 7 months
1
0
0
0
← Newer
1
...
20
21
22
23
24
25
26
...
33
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Results per page:
10
25
50
100
200