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
2025
January
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
September 2005
----- 2025 -----
January 2025
----- 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
22 participants
582 discussions
Start a n
N
ew thread
[gvg] 17871: Fix some of the damage r17811 did to the GDB stub
by gvg@svn.reactos.com
Fix some of the damage r17811 did to the GDB stub Modified: trunk/reactos/ntoskrnl/kd/wrappers/gdbstub.c Modified: trunk/reactos/ntoskrnl/ke/i386/exp.c _____ Modified: trunk/reactos/ntoskrnl/kd/wrappers/gdbstub.c --- trunk/reactos/ntoskrnl/kd/wrappers/gdbstub.c 2005-09-15 20:24:30 UTC (rev 17870) +++ trunk/reactos/ntoskrnl/kd/wrappers/gdbstub.c 2005-09-15 22:07:35 UTC (rev 17871) @@ -1068,7 +1068,7 @@ } -static BOOL gdb_attached_yet = TRUE; +static BOOL gdb_attached_yet = FALSE; /* * This function does all command procesing for interfacing to gdb. */ @@ -1102,7 +1102,7 @@ { GspAccessLocation = NULL; GspMemoryError = TRUE; - TrapFrame->Eip += 3; + Context->Eip += 3; } else { @@ -1321,8 +1321,7 @@ #error Unknown compiler for inline assembler #endif - KeContextToTrapFrame(Context, NULL, TrapFrame, KernelMode); - return ((SigVal == 5) ? (kdContinue) : (kdHandleException)); + return kdContinue; break; } @@ -1399,7 +1398,7 @@ ASSERT(0); } - return kdDoNotHandleException; + return kdContinue; } _____ Modified: trunk/reactos/ntoskrnl/ke/i386/exp.c --- trunk/reactos/ntoskrnl/ke/i386/exp.c 2005-09-15 20:24:30 UTC (rev 17870) +++ trunk/reactos/ntoskrnl/ke/i386/exp.c 2005-09-15 22:07:35 UTC (rev 17871) @@ -1242,7 +1242,7 @@ &Context, TrapFrame, TRUE, - FALSE); + TRUE); /* Exit if we're continuing */ if (Action == kdContinue) goto Handled;
19 years, 3 months
1
0
0
0
[fireball] 17870: Fix the tree at last, by reverting previous changes to RtlpCheckForActiveDebugger.
by fireball@svn.reactos.com
Fix the tree at last, by reverting previous changes to RtlpCheckForActiveDebugger. Modified: trunk/reactos/lib/rtl/exception.c Modified: trunk/reactos/lib/rtl/rtlp.h _____ Modified: trunk/reactos/lib/rtl/exception.c --- trunk/reactos/lib/rtl/exception.c 2005-09-15 19:30:27 UTC (rev 17869) +++ trunk/reactos/lib/rtl/exception.c 2005-09-15 20:24:30 UTC (rev 17870) @@ -39,7 +39,7 @@ Context.ContextFlags = CONTEXT_FULL; /* Check if we're being debugged (user-mode only) */ - if (!RtlpCheckForActiveDebugger(TRUE)) + if (!RtlpCheckForActiveDebugger()) { /* Raise an exception immediately */ Status = ZwRaiseException(ExceptionRecord, &Context, TRUE); @@ -91,7 +91,7 @@ Context.ContextFlags = CONTEXT_FULL; /* Check if we're being debugged (user-mode only) */ - if (!RtlpCheckForActiveDebugger(TRUE)) + if (!RtlpCheckForActiveDebugger()) { /* Raise an exception immediately */ ZwRaiseException(&ExceptionRecord, &Context, TRUE); _____ Modified: trunk/reactos/lib/rtl/rtlp.h --- trunk/reactos/lib/rtl/rtlp.h 2005-09-15 19:30:27 UTC (rev 17869) +++ trunk/reactos/lib/rtl/rtlp.h 2005-09-15 20:24:30 UTC (rev 17870) @@ -51,7 +51,7 @@ BOOLEAN NTAPI -RtlpCheckForActiveDebugger(BOOLEAN Type); +RtlpCheckForActiveDebugger(VOID); BOOLEAN NTAPI
19 years, 3 months
1
0
0
0
[fireball] 17869: Revert 17867:17866 change, introduced to temporarily fix tree-compiling. Made obsolete by rev. 17868.
by fireball@svn.reactos.com
Revert 17867:17866 change, introduced to temporarily fix tree-compiling. Made obsolete by rev. 17868. Modified: trunk/reactos/lib/rtl/exception.c _____ Modified: trunk/reactos/lib/rtl/exception.c --- trunk/reactos/lib/rtl/exception.c 2005-09-15 19:18:59 UTC (rev 17868) +++ trunk/reactos/lib/rtl/exception.c 2005-09-15 19:30:27 UTC (rev 17869) @@ -39,7 +39,7 @@ Context.ContextFlags = CONTEXT_FULL; /* Check if we're being debugged (user-mode only) */ - if (!RtlpCheckForActiveDebugger()) + if (!RtlpCheckForActiveDebugger(TRUE)) { /* Raise an exception immediately */ Status = ZwRaiseException(ExceptionRecord, &Context, TRUE); @@ -91,7 +91,7 @@ Context.ContextFlags = CONTEXT_FULL; /* Check if we're being debugged (user-mode only) */ - if (!RtlpCheckForActiveDebugger()) + if (!RtlpCheckForActiveDebugger(TRUE)) { /* Raise an exception immediately */ ZwRaiseException(&ExceptionRecord, &Context, TRUE);
19 years, 3 months
1
0
0
0
[ion] 17868: - Fix build, sorry.
by ion@svn.reactos.com
- Fix build, sorry. Modified: trunk/reactos/lib/rtl/rtlp.h _____ Modified: trunk/reactos/lib/rtl/rtlp.h --- trunk/reactos/lib/rtl/rtlp.h 2005-09-15 19:14:42 UTC (rev 17867) +++ trunk/reactos/lib/rtl/rtlp.h 2005-09-15 19:18:59 UTC (rev 17868) @@ -51,7 +51,7 @@ BOOLEAN NTAPI -RtlpCheckForActiveDebugger(VOID); +RtlpCheckForActiveDebugger(BOOLEAN Type); BOOLEAN NTAPI @@ -63,6 +63,10 @@ #define RtlpAllocateStringMemory RtlpAllocateMemory #define RtlpFreeStringMemory RtlpFreeMemory +BOOLEAN +NTAPI +RtlpSetInDbgPrint(IN BOOLEAN NewValue); + /* i386/except.S */ EXCEPTION_DISPOSITION @@ -96,6 +100,15 @@ NTAPI RtlpCaptureContext(OUT PCONTEXT ContextRecord); +/* i386/debug.S */ +NTSTATUS +NTAPI +DebugService(IN ULONG Service, + IN PVOID Buffer, + IN ULONG Length, + IN PVOID Argument1, + IN PVOID Argument2); + /* Tags for the String Allocators */ #define TAG_USTR TAG('U', 'S', 'T', 'R') #define TAG_ASTR TAG('A', 'S', 'T', 'R')
19 years, 3 months
1
0
0
0
[fireball] 17867: Fix compiling error, feel free to revert this when commiting missing changes (if it's not a typo).
by fireball@svn.reactos.com
Fix compiling error, feel free to revert this when commiting missing changes (if it's not a typo). Modified: trunk/reactos/lib/rtl/exception.c _____ Modified: trunk/reactos/lib/rtl/exception.c --- trunk/reactos/lib/rtl/exception.c 2005-09-15 17:26:56 UTC (rev 17866) +++ trunk/reactos/lib/rtl/exception.c 2005-09-15 19:14:42 UTC (rev 17867) @@ -39,7 +39,7 @@ Context.ContextFlags = CONTEXT_FULL; /* Check if we're being debugged (user-mode only) */ - if (!RtlpCheckForActiveDebugger(TRUE)) + if (!RtlpCheckForActiveDebugger()) { /* Raise an exception immediately */ Status = ZwRaiseException(ExceptionRecord, &Context, TRUE); @@ -91,7 +91,7 @@ Context.ContextFlags = CONTEXT_FULL; /* Check if we're being debugged (user-mode only) */ - if (!RtlpCheckForActiveDebugger(TRUE)) + if (!RtlpCheckForActiveDebugger()) { /* Raise an exception immediately */ ZwRaiseException(&ExceptionRecord, &Context, TRUE);
19 years, 3 months
1
0
0
0
[hbirr] 17866: - Assign first the partitions to drive letters, which have a registry entry in MountedDevices.
by hbirr@svn.reactos.com
- Assign first the partitions to drive letters, which have a registry entry in MountedDevices. - Create for all partitions a registry entry in MountedDevices if none exists. - Assign all partitions with arc names first and the others as second. Modified: trunk/reactos/ntoskrnl/io/disk.c _____ Modified: trunk/reactos/ntoskrnl/io/disk.c --- trunk/reactos/ntoskrnl/io/disk.c 2005-09-15 17:23:41 UTC (rev 17865) +++ trunk/reactos/ntoskrnl/io/disk.c 2005-09-15 17:26:56 UTC (rev 17866) @@ -48,6 +48,12 @@ USHORT Magic; /* 0x1FE */ } PARTITION_SECTOR, *PPARTITION_SECTOR; +typedef struct _REG_DISK_MOUNT_INFO +{ + ULONG Signature; + LARGE_INTEGER StartingOffset; +} REG_DISK_MOUNT_INFO, *PREG_DISK_MOUNT_INFO; + #include <poppack.h> @@ -89,6 +95,8 @@ HAL_PRIVATE_DISPATCH_VERSION }; +const WCHAR DiskMountString[] = L"\\DosDevices\\%C:"; + /* FUNCTIONS *****************************************************************/ NTSTATUS @@ -372,15 +380,20 @@ static VOID HalpAssignDrive(IN PUNICODE_STRING PartitionName, IN ULONG DriveNumber, - IN UCHAR DriveType) + IN UCHAR DriveType, + IN ULONG Signature, + IN LARGE_INTEGER StartingOffset, + IN HANDLE hKey) { - WCHAR DriveNameBuffer[8]; + WCHAR DriveNameBuffer[16]; UNICODE_STRING DriveName; ULONG i; + NTSTATUS Status; + REG_DISK_MOUNT_INFO DiskMountInfo; DPRINT("HalpAssignDrive()\n"); - if ((DriveNumber != AUTO_DRIVE) && (DriveNumber < 24)) + if ((DriveNumber != AUTO_DRIVE) && (DriveNumber < 26)) { /* Force assignment */ if ((ObSystemDeviceMap->DriveMap & (1 << DriveNumber)) != 0) @@ -394,7 +407,7 @@ /* Automatic assignment */ DriveNumber = AUTO_DRIVE; - for (i = 2; i < 24; i++) + for (i = 2; i < 26; i++) { if ((ObSystemDeviceMap->DriveMap & (1 << i)) == 0) { @@ -428,11 +441,185 @@ PartitionName); /* Create symbolic link */ - IoCreateSymbolicLink(&DriveName, - PartitionName); + Status = IoCreateSymbolicLink(&DriveName, + PartitionName); + + if (DriveType == DOSDEVICE_DRIVE_FIXED && hKey) + { + DiskMountInfo.Signature = Signature; + DiskMountInfo.StartingOffset = StartingOffset; + swprintf(DriveNameBuffer, DiskMountString, L'A' + DriveNumber); + RtlInitUnicodeString(&DriveName, DriveNameBuffer); + + Status = ZwSetValueKey(hKey, + &DriveName, + 0, + REG_BINARY, + &DiskMountInfo, + sizeof(DiskMountInfo)); + if (!NT_SUCCESS(Status)) + { + DPRINT1("ZwCreateValueKey failed for %wZ, status=%x\n", &DriveName, Status); + } + } } +ULONG +xHalpGetRDiskCount(VOID) +{ + NTSTATUS Status; + UNICODE_STRING ArcName; + PWCHAR ArcNameBuffer; + OBJECT_ATTRIBUTES ObjectAttributes; + HANDLE DirectoryHandle; + POBJECT_DIRECTORY_INFORMATION DirectoryInfo; + ULONG Skip; + ULONG ResultLength; + ULONG CurrentRDisk; + ULONG RDiskCount; + BOOLEAN First = TRUE; + ULONG Count; + + DirectoryInfo = ExAllocatePool(PagedPool, 2 * PAGE_SIZE); + if (DirectoryInfo == NULL) + { + return 0; + } + RtlInitUnicodeString(&ArcName, L"\\ArcName"); + InitializeObjectAttributes(&ObjectAttributes, + &ArcName, + 0, + NULL, + NULL); + + Status = ZwOpenDirectoryObject (&DirectoryHandle, + SYMBOLIC_LINK_ALL_ACCESS, + &ObjectAttributes); + if (!NT_SUCCESS(Status)) + { + DPRINT1("ZwOpenDirectoryObject for %wZ failed, status=%lx\n", &ArcName, Status); + ExFreePool(DirectoryInfo); + return 0; + } + + RDiskCount = 0; + Skip = 0; + while (NT_SUCCESS(Status)) + { + Status = NtQueryDirectoryObject (DirectoryHandle, + DirectoryInfo, + 2 * PAGE_SIZE, + FALSE, + First, + &Skip, + &ResultLength); + First = FALSE; + if (NT_SUCCESS(Status)) + { + Count = 0; + while (DirectoryInfo[Count].ObjectName.Buffer) + { + DPRINT("Count %x\n", Count); + DirectoryInfo[Count].ObjectName.Buffer[DirectoryInfo[Count].ObjectName.L ength / sizeof(WCHAR)] = 0; + ArcNameBuffer = DirectoryInfo[Count].ObjectName.Buffer; + if (DirectoryInfo[Count].ObjectName.Length >= sizeof(L"multi(0)disk(0)rdisk(0)") - sizeof(WCHAR) && + !_wcsnicmp(ArcNameBuffer, L"multi(0)disk(0)rdisk(", (sizeof(L"multi(0)disk(0)rdisk(") - sizeof(WCHAR)) / sizeof(WCHAR))) + { + DPRINT("%S\n", ArcNameBuffer); + ArcNameBuffer += (sizeof(L"multi(0)disk(0)rdisk(") - sizeof(WCHAR)) / sizeof(WCHAR); + CurrentRDisk = 0; + while (iswdigit(*ArcNameBuffer)) + { + CurrentRDisk = CurrentRDisk * 10 + *ArcNameBuffer - L'0'; + ArcNameBuffer++; + } + if (!_wcsicmp(ArcNameBuffer, L")") && + CurrentRDisk >= RDiskCount) + { + RDiskCount = CurrentRDisk + 1; + } + } + Count++; + } + } + } + ExFreePool(DirectoryInfo); + return RDiskCount; +} + +NTSTATUS +xHalpGetDiskNumberFromRDisk(ULONG RDisk, PULONG DiskNumber) +{ + WCHAR NameBuffer[80]; + UNICODE_STRING ArcName; + UNICODE_STRING LinkName; + OBJECT_ATTRIBUTES ObjectAttributes; + HANDLE LinkHandle; + NTSTATUS Status; + + swprintf(NameBuffer, + L"\\ArcName\\multi(0)disk(0)rdisk(%lu)", + RDisk); + + RtlInitUnicodeString(&ArcName, NameBuffer); + InitializeObjectAttributes(&ObjectAttributes, + &ArcName, + 0, + NULL, + NULL); + Status = ZwOpenSymbolicLinkObject(&LinkHandle, + SYMBOLIC_LINK_ALL_ACCESS, + &ObjectAttributes); + if (!NT_SUCCESS(Status)) + { + DPRINT1("ZwOpenSymbolicLinkObject failed for %wZ, status=%lx\n", &ArcName, Status); + return Status; + } + + LinkName.Buffer = NameBuffer; + LinkName.Length = 0; + LinkName.MaximumLength = sizeof(NameBuffer); + Status = ZwQuerySymbolicLinkObject(LinkHandle, + &LinkName, + NULL); + ZwClose(LinkHandle); + if (!NT_SUCCESS(Status)) + { + DPRINT1("ZwQuerySymbolicLinkObject failed, status=%lx\n", Status); + return Status; + } + if (LinkName.Length < sizeof(L"\\Device\\Harddisk0\\Partition0") - sizeof(WCHAR) || + LinkName.Length >= sizeof(NameBuffer)) + { + return STATUS_UNSUCCESSFUL; + } + + NameBuffer[LinkName.Length / sizeof(WCHAR)] = 0; + if (_wcsnicmp(NameBuffer, L"\\Device\\Harddisk", (sizeof(L"\\Device\\Harddisk") - sizeof(WCHAR)) / sizeof(WCHAR))) + { + return STATUS_UNSUCCESSFUL; + } + LinkName.Buffer += (sizeof(L"\\Device\\Harddisk") - sizeof(WCHAR)) / sizeof(WCHAR); + + if (!iswdigit(*LinkName.Buffer)) + { + return STATUS_UNSUCCESSFUL; + } + *DiskNumber = 0; + while (iswdigit(*LinkName.Buffer)) + { + *DiskNumber = *DiskNumber * 10 + *LinkName.Buffer - L'0'; + LinkName.Buffer++; + } + if (_wcsicmp(LinkName.Buffer, L"\\Partition0")) + { + return STATUS_UNSUCCESSFUL; + } + return STATUS_SUCCESS; +} + + VOID FASTCALL xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock, IN PSTRING NtDeviceName, @@ -448,19 +635,60 @@ HANDLE FileHandle; PWSTR Buffer1; PWSTR Buffer2; - ULONG i; + ULONG i, j, k; + ULONG DiskNumber; + ULONG RDisk; NTSTATUS Status; - ULONG j; + HANDLE hKey; + ULONG Length; + PKEY_VALUE_PARTIAL_INFORMATION PartialInformation; + PREG_DISK_MOUNT_INFO DiskMountInfo; + ULONG RDiskCount; DPRINT("xHalIoAssignDriveLetters()\n"); ConfigInfo = IoGetConfigurationInformation(); + RDiskCount = xHalpGetRDiskCount(); + + DPRINT1("RDiskCount %d\n", RDiskCount); + Buffer1 = (PWSTR)ExAllocatePool(PagedPool, 64 * sizeof(WCHAR)); Buffer2 = (PWSTR)ExAllocatePool(PagedPool, 32 * sizeof(WCHAR)); + + PartialInformation = (PKEY_VALUE_PARTIAL_INFORMATION)ExAllocatePool(PagedPool, + sizeof(KEY_VALUE_PARTIAL_INFORMATION) + sizeof(REG_DISK_MOUNT_INFO)); + DiskMountInfo = (PREG_DISK_MOUNT_INFO) PartialInformation->Data; + + /* Open or Create the 'MountedDevices' key */ + RtlInitUnicodeString(&UnicodeString1, L"\\Registry\\Machine\\SYSTEM\\MountedDevices"); + InitializeObjectAttributes(&ObjectAttributes, + &UnicodeString1, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + Status = ZwOpenKey(&hKey, + KEY_ALL_ACCESS, + &ObjectAttributes); + if (!NT_SUCCESS(Status)) + { + Status = ZwCreateKey(&hKey, + KEY_ALL_ACCESS, + &ObjectAttributes, + 0, + NULL, + REG_OPTION_NON_VOLATILE, + NULL); + } + if (!NT_SUCCESS(Status)) + { + hKey = NULL; + DPRINT1("ZwCreateKey failed for %wZ, status=%x\n", &UnicodeString1, Status); + } + /* Create PhysicalDrive links */ DPRINT("Physical disk drives: %d\n", ConfigInfo->DiskCount); for (i = 0; i < ConfigInfo->DiskCount; i++) @@ -524,6 +752,13 @@ LayoutArray[i] = NULL; continue; } + /* We don't use the RewritePartition value while mounting the disks. + * We use this value for marking pre-assigned (registry) partitions. + */ + for (j = 0; j < LayoutArray[i]->PartitionCount; j++) + { + LayoutArray[i]->PartitionEntry[j].RewritePartition = FALSE; + } } #ifndef NDEBUG @@ -553,84 +788,234 @@ #endif /* Assign pre-assigned (registry) partitions */ + if (hKey) + { + for (k = 2; k < 26; k++) + { + swprintf(Buffer1, DiskMountString, L'A' + k); + RtlInitUnicodeString(&UnicodeString1, Buffer1); + Status = ZwQueryValueKey(hKey, + &UnicodeString1, + KeyValuePartialInformation, + PartialInformation, + sizeof(KEY_VALUE_PARTIAL_INFORMATION) + sizeof(REG_DISK_MOUNT_INFO), + &Length); + if (NT_SUCCESS(Status) && + PartialInformation->Type == REG_BINARY && + PartialInformation->DataLength == sizeof(REG_DISK_MOUNT_INFO)) + { + DPRINT("%wZ => %08x:%08x%08x\n", &UnicodeString1, DiskMountInfo->Signature, + DiskMountInfo->StartingOffset.u.HighPart, DiskMountInfo->StartingOffset.u.LowPart); + for (i = 0; i < ConfigInfo->DiskCount; i++) + { + DPRINT("%x\n", LayoutArray[i]->Signature); + if (LayoutArray[i] && + LayoutArray[i]->Signature == DiskMountInfo->Signature) + { + for (j = 0; j < LayoutArray[i]->PartitionCount; j++) + { + if (LayoutArray[i]->PartitionEntry[j].StartingOffset.QuadPart == DiskMountInfo->StartingOffset.QuadPart) + { + if (IsRecognizedPartition(LayoutArray[i]->PartitionEntry[j].PartitionType)) + { + swprintf(Buffer2, + L"\\Device\\Harddisk%d\\Partition%d", + i, + LayoutArray[i]->PartitionEntry[j].PartitionNumber); + RtlInitUnicodeString(&UnicodeString2, + Buffer2); + /* Assign drive */ + DPRINT(" %wZ\n", &UnicodeString2); + HalpAssignDrive(&UnicodeString2, + k, + DOSDEVICE_DRIVE_FIXED, + DiskMountInfo->Signature, + DiskMountInfo->StartingOffset, + NULL); + /* Mark the partition as assigned */ + LayoutArray[i]->PartitionEntry[j].RewritePartition = TRUE; + } + break; + } + } + break; + } + } + } + } + } /* Assign bootable partition on first harddisk */ DPRINT("Assigning bootable primary partition on first harddisk:\n"); - if (ConfigInfo->DiskCount > 0) + if (RDiskCount > 0) { - if (LayoutArray[0]) + Status = xHalpGetDiskNumberFromRDisk(0, &DiskNumber); + if (NT_SUCCESS(Status) && + DiskNumber < ConfigInfo->DiskCount && + LayoutArray[DiskNumber]) { /* Search for bootable partition */ - for (j = 0; j < LayoutArray[0]->PartitionCount; j++) + for (j = 0; j < PARTITION_TBL_SIZE && j < LayoutArray[DiskNumber]->PartitionCount; j++) { - if ((LayoutArray[0]->PartitionEntry[j].BootIndicator == TRUE) && - IsRecognizedPartition(LayoutArray[0]->PartitionEntry[j].PartitionType)) + if ((LayoutArray[DiskNumber]->PartitionEntry[j].BootIndicator == TRUE) && + IsRecognizedPartition(LayoutArray[DiskNumber]->PartitionEntry[j].Partiti onType)) + { + if (LayoutArray[DiskNumber]->PartitionEntry[j].RewritePartition == FALSE) + { + swprintf(Buffer2, + L"\\Device\\Harddisk%lu\\Partition%d", + DiskNumber, + LayoutArray[DiskNumber]->PartitionEntry[j].PartitionNumber); + RtlInitUnicodeString(&UnicodeString2, + Buffer2); + + /* Assign drive */ + DPRINT1(" %wZ\n", &UnicodeString2); + HalpAssignDrive(&UnicodeString2, + AUTO_DRIVE, + DOSDEVICE_DRIVE_FIXED, + LayoutArray[DiskNumber]->Signature, + LayoutArray[DiskNumber]->PartitionEntry[j].StartingOffset, + hKey); + /* Mark the partition as assigned */ + LayoutArray[DiskNumber]->PartitionEntry[j].RewritePartition = TRUE; + } + break; + } + } + } + } + + /* Assign remaining primary partitions */ + DPRINT("Assigning remaining primary partitions:\n"); + for (RDisk = 0; RDisk < RDiskCount; RDisk++) + { + Status = xHalpGetDiskNumberFromRDisk(RDisk, &DiskNumber); + if (NT_SUCCESS(Status) && + DiskNumber < ConfigInfo->DiskCount && + LayoutArray[DiskNumber]) + { + /* Search for primary partitions */ + for (j = 0; (j < PARTITION_TBL_SIZE) && (j < LayoutArray[DiskNumber]->PartitionCount); j++) + { + if (LayoutArray[DiskNumber]->PartitionEntry[j].RewritePartition == FALSE && + IsRecognizedPartition(LayoutArray[DiskNumber]->PartitionEntry[j].Partiti onType)) { - swprintf(Buffer2, - L"\\Device\\Harddisk0\\Partition%d", - LayoutArray[0]->PartitionEntry[j].PartitionNumber); + swprintf(Buffer2, + L"\\Device\\Harddisk%d\\Partition%d", + DiskNumber, + LayoutArray[DiskNumber]->PartitionEntry[j].PartitionNumber); RtlInitUnicodeString(&UnicodeString2, Buffer2); /* Assign drive */ - DPRINT(" %wZ\n", &UnicodeString2); + DPRINT(" %wZ\n", + &UnicodeString2); HalpAssignDrive(&UnicodeString2, AUTO_DRIVE, - DOSDEVICE_DRIVE_FIXED); + DOSDEVICE_DRIVE_FIXED, + LayoutArray[DiskNumber]->Signature, + LayoutArray[DiskNumber]->PartitionEntry[j].StartingOffset, + hKey); + /* Mark the partition as assigned */ + LayoutArray[DiskNumber]->PartitionEntry[j].RewritePartition = TRUE; } } } } - /* Assign remaining primary partitions */ + /* Assign extended (logical) partitions */ + DPRINT("Assigning extended (logical) partitions:\n"); + for (RDisk = 0; RDisk < RDiskCount; RDisk++) + { + Status = xHalpGetDiskNumberFromRDisk(RDisk, &DiskNumber); + if (NT_SUCCESS(Status) && + DiskNumber < ConfigInfo->DiskCount && + LayoutArray[DiskNumber]) + { + /* Search for extended partitions */ + for (j = PARTITION_TBL_SIZE; j < LayoutArray[DiskNumber]->PartitionCount; j++) + { + if (IsRecognizedPartition(LayoutArray[DiskNumber]->PartitionEntry[j].Partit ionType) && + LayoutArray[DiskNumber]->PartitionEntry[j].RewritePartition == FALSE && + LayoutArray[DiskNumber]->PartitionEntry[j].PartitionNumber != 0) + { + swprintf(Buffer2, + L"\\Device\\Harddisk%d\\Partition%d", + DiskNumber, + LayoutArray[DiskNumber]->PartitionEntry[j].PartitionNumber); + RtlInitUnicodeString(&UnicodeString2, + Buffer2); + + /* Assign drive */ + DPRINT(" %wZ\n", + &UnicodeString2); + HalpAssignDrive(&UnicodeString2, + AUTO_DRIVE, + DOSDEVICE_DRIVE_FIXED, + LayoutArray[DiskNumber]->Signature, + LayoutArray[DiskNumber]->PartitionEntry[j].StartingOffset, + hKey); + /* Mark the partition as assigned */ + LayoutArray[DiskNumber]->PartitionEntry[j].RewritePartition = TRUE; + } + } + } + } + + /* Assign remaining primary partitions without an arc-name */ DPRINT("Assigning remaining primary partitions:\n"); - for (i = 0; i < ConfigInfo->DiskCount; i++) + for (DiskNumber = 0; DiskNumber < ConfigInfo->DiskCount; DiskNumber++) { - if (LayoutArray[i]) + if (LayoutArray[DiskNumber]) { /* Search for primary partitions */ - for (j = 0; (j < PARTITION_TBL_SIZE) && (j < LayoutArray[i]->PartitionCount); j++) + for (j = 0; (j < PARTITION_TBL_SIZE) && (j < LayoutArray[DiskNumber]->PartitionCount); j++) { - if ((i == 0) && (LayoutArray[i]->PartitionEntry[j].BootIndicator == TRUE)) - continue; - - if (IsRecognizedPartition(LayoutArray[i]->PartitionEntry[j].PartitionType)) + if (LayoutArray[DiskNumber]->PartitionEntry[j].RewritePartition == FALSE && + IsRecognizedPartition(LayoutArray[DiskNumber]->PartitionEntry[j].Partiti onType)) { - swprintf(Buffer2, + swprintf(Buffer2, L"\\Device\\Harddisk%d\\Partition%d", - i, - LayoutArray[i]->PartitionEntry[j].PartitionNumber); + DiskNumber, + LayoutArray[DiskNumber]->PartitionEntry[j].PartitionNumber); RtlInitUnicodeString(&UnicodeString2, Buffer2); /* Assign drive */ DPRINT(" %wZ\n", &UnicodeString2); - HalpAssignDrive(&UnicodeString2, - AUTO_DRIVE, - DOSDEVICE_DRIVE_FIXED); + HalpAssignDrive(&UnicodeString2, + AUTO_DRIVE, + DOSDEVICE_DRIVE_FIXED, + LayoutArray[DiskNumber]->Signature, + LayoutArray[DiskNumber]->PartitionEntry[j].StartingOffset, + hKey); + /* Mark the partition as assigned */ + LayoutArray[DiskNumber]->PartitionEntry[j].RewritePartition = TRUE; } } } } - /* Assign extended (logical) partitions */ + /* Assign extended (logical) partitions without an arc-name */ DPRINT("Assigning extended (logical) partitions:\n"); - for (i = 0; i < ConfigInfo->DiskCount; i++) + for (DiskNumber = 0; DiskNumber < ConfigInfo->DiskCount; DiskNumber++) { - if (LayoutArray[i]) + if (LayoutArray[DiskNumber]) { /* Search for extended partitions */ - for (j = PARTITION_TBL_SIZE; j < LayoutArray[i]->PartitionCount; j++) + for (j = PARTITION_TBL_SIZE; j < LayoutArray[DiskNumber]->PartitionCount; j++) { - if (IsRecognizedPartition(LayoutArray[i]->PartitionEntry[j].PartitionType) && - (LayoutArray[i]->PartitionEntry[j].PartitionNumber != 0)) + if (IsRecognizedPartition(LayoutArray[DiskNumber]->PartitionEntry[j].Partit ionType) && + LayoutArray[DiskNumber]->PartitionEntry[j].RewritePartition == FALSE && + LayoutArray[DiskNumber]->PartitionEntry[j].PartitionNumber != 0) { - swprintf(Buffer2, + swprintf(Buffer2, L"\\Device\\Harddisk%d\\Partition%d", - i, - LayoutArray[i]->PartitionEntry[j].PartitionNumber); + DiskNumber, + LayoutArray[DiskNumber]->PartitionEntry[j].PartitionNumber); RtlInitUnicodeString(&UnicodeString2, Buffer2); @@ -639,7 +1024,12 @@ &UnicodeString2); HalpAssignDrive(&UnicodeString2, AUTO_DRIVE, - DOSDEVICE_DRIVE_FIXED); + DOSDEVICE_DRIVE_FIXED, + LayoutArray[DiskNumber]->Signature, + LayoutArray[DiskNumber]->PartitionEntry[j].StartingOffset, + hKey); + /* Mark the partition as assigned */ + LayoutArray[DiskNumber]->PartitionEntry[j].RewritePartition = TRUE; } } } @@ -666,7 +1056,10 @@ &UnicodeString2); HalpAssignDrive(&UnicodeString2, AUTO_DRIVE, - DOSDEVICE_DRIVE_REMOVABLE); + DOSDEVICE_DRIVE_REMOVABLE, + 0, + (LARGE_INTEGER)0LL, + hKey); } } } @@ -694,7 +1087,10 @@ &UnicodeString1); HalpAssignDrive(&UnicodeString1, (i < 2) ? i : AUTO_DRIVE, - DOSDEVICE_DRIVE_REMOVABLE); + DOSDEVICE_DRIVE_REMOVABLE, + 0, + (LARGE_INTEGER)0LL, + hKey); } /* Assign cdrom drives */ @@ -711,13 +1107,21 @@ DPRINT(" %wZ\n", &UnicodeString1); HalpAssignDrive(&UnicodeString1, AUTO_DRIVE, - DOSDEVICE_DRIVE_CDROM); + DOSDEVICE_DRIVE_CDROM, + 0, + (LARGE_INTEGER)0LL, + hKey); } /* Anything else to do? */ + ExFreePool(PartialInformation); ExFreePool(Buffer2); ExFreePool(Buffer1); + if (hKey) + { + ZwClose(hKey); + } } @@ -1317,6 +1721,7 @@ PartitionSector->Magic = PARTITION_MAGIC; } + PartitionSector->Signature = PartitionBuffer->Signature; /* Update partition sector entries */ for (j = 0; j < 4; j++) {
19 years, 3 months
1
0
0
0
[hbirr] 17865: - Fixed the creation of arc names. Only valid partitions should be linked to an arc names.
by hbirr@svn.reactos.com
- Fixed the creation of arc names. Only valid partitions should be linked to an arc names. - Create arc names only for partitions on disks, which are visible by the bios. Modified: trunk/reactos/ntoskrnl/io/arcname.c _____ Modified: trunk/reactos/ntoskrnl/io/arcname.c --- trunk/reactos/ntoskrnl/io/arcname.c 2005-09-15 17:19:31 UTC (rev 17864) +++ trunk/reactos/ntoskrnl/io/arcname.c 2005-09-15 17:23:41 UTC (rev 17865) @@ -19,56 +19,197 @@ #define FS_VOLUME_BUFFER_SIZE (MAX_PATH + sizeof(FILE_FS_VOLUME_INFORMATION)) -/* FUNCTIONS ****************************************************************/ +/* STRUCTURES ***************************************************************/ -NTSTATUS INIT_FUNCTION -IoCreateArcNames(VOID) +typedef struct _DISKENTRY { - PCONFIGURATION_INFORMATION ConfigInfo; - PDRIVE_LAYOUT_INFORMATION LayoutInfo = NULL; - WCHAR DeviceNameBuffer[80]; - WCHAR ArcNameBuffer[80]; - UNICODE_STRING DeviceName; - UNICODE_STRING ArcName; - ULONG i, j, k; - NTSTATUS Status; - PFILE_OBJECT FileObject; + LIST_ENTRY ListEntry; + ULONG DiskNumber; + ULONG Signature; + ULONG Checksum; PDEVICE_OBJECT DeviceObject; - BOOL IsRemovableMedia; +} DISKENTRY, *PDISKENTRY; - DPRINT("IoCreateArcNames() called\n"); +#define PARTITION_TBL_SIZE 4 - ConfigInfo = IoGetConfigurationInformation(); +#include <pshpack1.h> - /* create ARC names for floppy drives */ - DPRINT("Floppy drives: %lu\n", ConfigInfo->FloppyCount); - for (i = 0; i < ConfigInfo->FloppyCount; i++) +typedef struct _PARTITION +{ + unsigned char BootFlags; /* bootable? 0=no, 128=yes */ + unsigned char StartingHead; /* beginning head number */ + unsigned char StartingSector; /* beginning sector number */ + unsigned char StartingCylinder; /* 10 bit nmbr, with high 2 bits put in begsect */ + unsigned char PartitionType; /* Operating System type indicator code */ + unsigned char EndingHead; /* ending head number */ + unsigned char EndingSector; /* ending sector number */ + unsigned char EndingCylinder; /* also a 10 bit nmbr, with same high 2 bit trick */ + unsigned int StartingBlock; /* first sector relative to start of disk */ + unsigned int SectorCount; /* number of sectors in partition */ +} PARTITION, *PPARTITION; + +typedef struct _PARTITION_SECTOR +{ + UCHAR BootCode[440]; /* 0x000 */ + ULONG Signature; /* 0x1B8 */ + UCHAR Reserved[2]; /* 0x1BC */ + PARTITION Partition[PARTITION_TBL_SIZE]; /* 0x1BE */ + USHORT Magic; /* 0x1FE */ +} PARTITION_SECTOR, *PPARTITION_SECTOR; + +#include <poppack.h> + +/* FUNCTIONS ****************************************************************/ + +STATIC +NTSTATUS +STDCALL +INIT_FUNCTION +DiskQueryRoutine(PWSTR ValueName, + ULONG ValueType, + PVOID ValueData, + ULONG ValueLength, + PVOID Context, + PVOID EntryContext) +{ + PLIST_ENTRY ListHead = (PLIST_ENTRY)Context; + PULONG GlobalDiskCount = (PULONG)EntryContext; + PDISKENTRY DiskEntry; + UNICODE_STRING NameU; + + if (ValueType == REG_SZ && + ValueLength == 20 * sizeof(WCHAR)) { - swprintf(DeviceNameBuffer, - L"\\Device\\Floppy%lu", - i); - RtlInitUnicodeString(&DeviceName, - DeviceNameBuffer); + DiskEntry = ExAllocatePool(PagedPool, sizeof(DISKENTRY)); + if (DiskEntry == NULL) + { + return STATUS_NO_MEMORY; + } + DiskEntry->DiskNumber = (*GlobalDiskCount)++; - swprintf(ArcNameBuffer, - L"\\ArcName\\multi(0)disk(0)fdisk(%lu)", - i); - RtlInitUnicodeString(&ArcName, - ArcNameBuffer); - DPRINT("%wZ ==> %wZ\n", - &ArcName, - &DeviceName); + NameU.Buffer = (PWCHAR)ValueData; + NameU.Length = NameU.MaximumLength = 8 * sizeof(WCHAR); + RtlUnicodeStringToInteger(&NameU, 16, &DiskEntry->Checksum); - Status = IoAssignArcName(&ArcName, - &DeviceName); + NameU.Buffer = (PWCHAR)ValueData + 9; + RtlUnicodeStringToInteger(&NameU, 16, &DiskEntry->Signature); + + InsertTailList(ListHead, &DiskEntry->ListEntry); + } + + return STATUS_SUCCESS; +} + +#define ROOT_NAME L"\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System\\MultifunctionAdapt er" + +STATIC VOID INIT_FUNCTION +IopEnumerateBiosDisks(PLIST_ENTRY ListHead) +{ + RTL_QUERY_REGISTRY_TABLE QueryTable[2]; + WCHAR Name[100]; + ULONG AdapterCount; + ULONG ControllerCount; + ULONG DiskCount; + NTSTATUS Status; + ULONG GlobalDiskCount=0; + + + memset(QueryTable, 0, sizeof(QueryTable)); + QueryTable[0].Name = L"Identifier"; + QueryTable[0].QueryRoutine = DiskQueryRoutine; + QueryTable[0].EntryContext = (PVOID)&GlobalDiskCount; + + AdapterCount = 0; + while (1) + { + swprintf(Name, L"%s\\%lu", ROOT_NAME, AdapterCount); + Status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE, + Name, + &QueryTable[1], + NULL, + NULL); if (!NT_SUCCESS(Status)) - return(Status); + { + break; + } + + swprintf(Name, L"%s\\%lu\\DiskController", ROOT_NAME, AdapterCount); + Status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE, + Name, + &QueryTable[1], + NULL, + NULL); + if (NT_SUCCESS(Status)) + { + ControllerCount = 0; + while (1) + { + swprintf(Name, L"%s\\%lu\\DiskController\\%lu", ROOT_NAME, AdapterCount, ControllerCount); + Status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE, + Name, + &QueryTable[1], + NULL, + NULL); + if (!NT_SUCCESS(Status)) + { + break; + } + + swprintf(Name, L"%s\\%lu\\DiskController\\%lu\\DiskPeripheral", ROOT_NAME, AdapterCount, ControllerCount); + Status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE, + Name, + &QueryTable[1], + NULL, + NULL); + if (NT_SUCCESS(Status)) + { + DiskCount = 0; + while (1) + { + swprintf(Name, L"%s\\%lu\\DiskController\\%lu\\DiskPeripheral\\%lu", ROOT_NAME, AdapterCount, ControllerCount, DiskCount); + Status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE, + Name, + QueryTable, + (PVOID)ListHead, + NULL); + if (!NT_SUCCESS(Status)) + { + break; + } + DiskCount++; + } + } + ControllerCount++; + } + } + AdapterCount++; } +} - /* create ARC names for hard disk drives */ - DPRINT("Disk drives: %lu\n", ConfigInfo->DiskCount); - for (i = 0, k = 0; i < ConfigInfo->DiskCount; i++) +STATIC VOID INIT_FUNCTION +IopEnumerateDisks(PLIST_ENTRY ListHead) +{ + ULONG i, k; + PDISKENTRY DiskEntry; + DISK_GEOMETRY DiskGeometry; + KEVENT Event; + PIRP Irp; + IO_STATUS_BLOCK StatusBlock; + LARGE_INTEGER PartitionOffset; + PULONG Buffer; + WCHAR DeviceNameBuffer[80]; + UNICODE_STRING DeviceName; + NTSTATUS Status; + PDEVICE_OBJECT DeviceObject; + PFILE_OBJECT FileObject; + BOOLEAN IsRemovableMedia; + PPARTITION_SECTOR PartitionBuffer = NULL; + ULONG PartitionBufferSize = 0; + + + for (i = 0; i < IoGetConfigurationInformation()->DiskCount; i++) { + swprintf(DeviceNameBuffer, L"\\Device\\Harddisk%lu\\Partition0", i); @@ -88,12 +229,249 @@ ObDereferenceObject(FileObject); if (IsRemovableMedia) { + ObDereferenceObject(DeviceObject); continue; } + DiskEntry = ExAllocatePool(PagedPool, sizeof(DISKENTRY)); + if (DiskEntry == NULL) + { + KEBUGCHECK(0); + } + DiskEntry->DiskNumber = i; + DiskEntry->DeviceObject = DeviceObject; + /* determine the sector size */ + KeInitializeEvent(&Event, NotificationEvent, FALSE); + Irp = IoBuildDeviceIoControlRequest(IOCTL_DISK_GET_DRIVE_GEOMETRY, + DeviceObject, + NULL, + 0, + &DiskGeometry, + sizeof(DISK_GEOMETRY), + FALSE, + &Event, + &StatusBlock); + if (Irp == NULL) + { + KEBUGCHECK(0); + } + + Status = IoCallDriver(DeviceObject, Irp); + if (Status == STATUS_PENDING) + { + KeWaitForSingleObject(&Event, + Executive, + KernelMode, + FALSE, + NULL); + Status = StatusBlock.Status; + } + if (!NT_SUCCESS(Status)) + { + KEBUGCHECK(0); + } + if (PartitionBuffer != NULL && PartitionBufferSize < DiskGeometry.BytesPerSector) + { + ExFreePool(PartitionBuffer); + PartitionBuffer = NULL; + } + if (PartitionBuffer == NULL) + { + PartitionBufferSize = max(DiskGeometry.BytesPerSector, PAGE_SIZE); + PartitionBuffer = ExAllocatePool(PagedPool, PartitionBufferSize); + if (PartitionBuffer == NULL) + { + KEBUGCHECK(0); + } + } + + /* read the partition sector */ + KeInitializeEvent(&Event, NotificationEvent, FALSE); + PartitionOffset.QuadPart = 0; + Irp = IoBuildSynchronousFsdRequest(IRP_MJ_READ, + DeviceObject, + PartitionBuffer, + DiskGeometry.BytesPerSector, + &PartitionOffset, + &Event, + &StatusBlock); + Status = IoCallDriver(DeviceObject, Irp); + if (Status == STATUS_PENDING) + { + KeWaitForSingleObject(&Event, + Executive, + KernelMode, + FALSE, + NULL); + Status = StatusBlock.Status; + } + + if (!NT_SUCCESS(Status)) + { + KEBUGCHECK(0); + } + + /* Calculate the MBR checksum */ + DiskEntry->Checksum = 0; + Buffer = (PULONG)PartitionBuffer; + for (k = 0; k < 128; k++) + { + DiskEntry->Checksum += Buffer[k]; + } + DiskEntry->Checksum = ~DiskEntry->Checksum + 1; + DiskEntry->Signature = PartitionBuffer->Signature; + + InsertTailList(ListHead, &DiskEntry->ListEntry); + } + if (PartitionBuffer) + { + ExFreePool(PartitionBuffer); + } +} + +STATIC NTSTATUS INIT_FUNCTION +IopAssignArcNamesToDisk(PDEVICE_OBJECT DeviceObject, ULONG RDisk, ULONG DiskNumber) +{ + WCHAR DeviceNameBuffer[80]; + WCHAR ArcNameBuffer[80]; + UNICODE_STRING DeviceName; + UNICODE_STRING ArcName; + PDRIVE_LAYOUT_INFORMATION LayoutInfo = NULL; + NTSTATUS Status; + ULONG i; + KEVENT Event; + PIRP Irp; + IO_STATUS_BLOCK StatusBlock; + ULONG PartitionNumber; + + swprintf(DeviceNameBuffer, + L"\\Device\\Harddisk%lu\\Partition0", + DiskNumber); + RtlInitUnicodeString(&DeviceName, + DeviceNameBuffer); + + swprintf(ArcNameBuffer, + L"\\ArcName\\multi(0)disk(0)rdisk(%lu)", + RDisk); + RtlInitUnicodeString(&ArcName, + ArcNameBuffer); + + DPRINT("%wZ ==> %wZ\n", &ArcName, &DeviceName); + + Status = IoAssignArcName(&ArcName, &DeviceName); + if (!NT_SUCCESS(Status)) + { + DPRINT1("IoAssignArcName failed, status=%lx\n", Status); + return(Status); + } + + LayoutInfo = ExAllocatePool(PagedPool, 2 * PAGE_SIZE); + if (LayoutInfo == NULL) + { + return STATUS_NO_MEMORY; + } + KeInitializeEvent(&Event, NotificationEvent, FALSE); + Irp = IoBuildDeviceIoControlRequest(IOCTL_DISK_GET_DRIVE_LAYOUT, + DeviceObject, + NULL, + 0, + LayoutInfo, + 2 * PAGE_SIZE, + FALSE, + &Event, + &StatusBlock); + if (Irp == NULL) + { + ExFreePool(LayoutInfo); + return STATUS_INSUFFICIENT_RESOURCES; + } + + Status = IoCallDriver(DeviceObject, Irp); + if (Status == STATUS_PENDING) + { + KeWaitForSingleObject(&Event, + Executive, + KernelMode, + FALSE, + NULL); + Status = StatusBlock.Status; + } + if (!NT_SUCCESS(Status)) + { + ExFreePool(LayoutInfo); + return Status; + } + + DPRINT("Number of partitions: %u\n", LayoutInfo->PartitionCount); + + PartitionNumber = 1; + for (i = 0; i < LayoutInfo->PartitionCount; i++) + { + if (!IsContainerPartition(LayoutInfo->PartitionEntry[i].PartitionType) && + LayoutInfo->PartitionEntry[i].PartitionType != PARTITION_ENTRY_UNUSED) + { + + swprintf(DeviceNameBuffer, + L"\\Device\\Harddisk%lu\\Partition%lu", + DiskNumber, + PartitionNumber); + RtlInitUnicodeString(&DeviceName, DeviceNameBuffer); + + swprintf(ArcNameBuffer, + L"\\ArcName\\multi(0)disk(0)rdisk(%lu)partition(%lu)", + RDisk, + PartitionNumber); + RtlInitUnicodeString(&ArcName, ArcNameBuffer); + + DPRINT("%wZ ==> %wZ\n", &ArcName, &DeviceName); + + Status = IoAssignArcName(&ArcName, &DeviceName); + if (!NT_SUCCESS(Status)) + { + DPRINT1("IoAssignArcName failed, status=%lx\n", Status); + ExFreePool(LayoutInfo); + return(Status); + } + PartitionNumber++; + } + } + ExFreePool(LayoutInfo); + return STATUS_SUCCESS; +} + +NTSTATUS INIT_FUNCTION +IoCreateArcNames(VOID) +{ + PCONFIGURATION_INFORMATION ConfigInfo; + WCHAR DeviceNameBuffer[80]; + WCHAR ArcNameBuffer[80]; + UNICODE_STRING DeviceName; + UNICODE_STRING ArcName; + ULONG i, RDiskNumber; + NTSTATUS Status; + LIST_ENTRY BiosDiskListHead; + LIST_ENTRY DiskListHead; + PLIST_ENTRY Entry; + PDISKENTRY BiosDiskEntry; + PDISKENTRY DiskEntry; + + DPRINT("IoCreateArcNames() called\n"); + + ConfigInfo = IoGetConfigurationInformation(); + + /* create ARC names for floppy drives */ + DPRINT("Floppy drives: %lu\n", ConfigInfo->FloppyCount); + for (i = 0; i < ConfigInfo->FloppyCount; i++) + { + swprintf(DeviceNameBuffer, + L"\\Device\\Floppy%lu", + i); + RtlInitUnicodeString(&DeviceName, + DeviceNameBuffer); + swprintf(ArcNameBuffer, - L"\\ArcName\\multi(0)disk(0)rdisk(%lu)partition(0)", - k); + L"\\ArcName\\multi(0)disk(0)fdisk(%lu)", + i); RtlInitUnicodeString(&ArcName, ArcNameBuffer); DPRINT("%wZ ==> %wZ\n", @@ -104,42 +482,44 @@ &DeviceName); if (!NT_SUCCESS(Status)) return(Status); + } - Status = xHalQueryDriveLayout(&DeviceName, - &LayoutInfo); - if (!NT_SUCCESS(Status)) - return(Status); + /* create ARC names for hard disk drives */ + InitializeListHead(&BiosDiskListHead); + InitializeListHead(&DiskListHead); + IopEnumerateBiosDisks(&BiosDiskListHead); + IopEnumerateDisks(&DiskListHead); - DPRINT("Number of partitions: %u\n", LayoutInfo->PartitionCount); + RDiskNumber = 0; + while (!IsListEmpty(&BiosDiskListHead)) + { + Entry = RemoveHeadList(&BiosDiskListHead); + BiosDiskEntry = CONTAINING_RECORD(Entry, DISKENTRY, ListEntry); + Entry = DiskListHead.Flink; + while (Entry != &DiskListHead) + { + DiskEntry = CONTAINING_RECORD(Entry, DISKENTRY, ListEntry); + if (DiskEntry->Checksum == BiosDiskEntry->Checksum && + DiskEntry->Signature == BiosDiskEntry->Signature) + { - for (j = 0;j < LayoutInfo->PartitionCount; j++) - { - swprintf(DeviceNameBuffer, - L"\\Device\\Harddisk%lu\\Partition%lu", - i, - j + 1); - RtlInitUnicodeString(&DeviceName, - DeviceNameBuffer); + Status = IopAssignArcNamesToDisk(DiskEntry->DeviceObject, RDiskNumber, DiskEntry->DiskNumber); - swprintf(ArcNameBuffer, - L"\\ArcName\\multi(0)disk(0)rdisk(%lu)partition(%lu)", - k, - j + 1); - RtlInitUnicodeString(&ArcName, - ArcNameBuffer); - DPRINT("%wZ ==> %wZ\n", - &ArcName, - &DeviceName); + RemoveEntryList(&DiskEntry->ListEntry); + ExFreePool(DiskEntry); + break; + } + Entry = Entry->Flink; + } + RDiskNumber++; + ExFreePool(BiosDiskEntry); + } - Status = IoAssignArcName(&ArcName, - &DeviceName); - if (!NT_SUCCESS(Status)) - return(Status); - } - - ExFreePool(LayoutInfo); - LayoutInfo = NULL; - k++; + while (!IsListEmpty(&DiskListHead)) + { + Entry = RemoveHeadList(&DiskListHead); + DiskEntry = CONTAINING_RECORD(Entry, DISKENTRY, ListEntry); + ExFreePool(DiskEntry); } /* create ARC names for cdrom drives */ @@ -173,7 +553,7 @@ } -static NTSTATUS +static NTSTATUS INIT_FUNCTION IopCheckCdromDevices(PULONG DeviceNumber) { PCONFIGURATION_INFORMATION ConfigInfo;
19 years, 3 months
1
0
0
0
[hbirr] 17864: - Do only allow to install reactos on disks which are visible by the bios.
by hbirr@svn.reactos.com
- Do only allow to install reactos on disks which are visible by the bios. - Arrange the disks in the same sequence how they was detected by the bios. - Create a registry entry in MountedDevices for each recognized partition. Modified: trunk/reactos/subsys/system/usetup/partlist.c Modified: trunk/reactos/subsys/system/usetup/partlist.h Modified: trunk/reactos/subsys/system/usetup/registry.c Modified: trunk/reactos/subsys/system/usetup/usetup.c _____ Modified: trunk/reactos/subsys/system/usetup/partlist.c --- trunk/reactos/subsys/system/usetup/partlist.c 2005-09-15 16:52:23 UTC (rev 17863) +++ trunk/reactos/subsys/system/usetup/partlist.c 2005-09-15 17:19:31 UTC (rev 17864) @@ -1,6 +1,6 @@ /* * ReactOS kernel - * Copyright (C) 2002, 2003 ReactOS Team + * Copyright (C) 2002, 2003, 2004, 2005 ReactOS Team * * 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 @@ -23,6 +23,7 @@ * PURPOSE: Partition list functions * PROGRAMMER: Eric Kohl * Casper S. Hornstrup (chorns(a)users.sourceforge.net) + * Hartmut Birr */ #include <usetup.h> @@ -421,7 +422,129 @@ } } +NTSTATUS +STDCALL +DiskQueryRoutine(PWSTR ValueName, + ULONG ValueType, + PVOID ValueData, + ULONG ValueLength, + PVOID Context, + PVOID EntryContext) +{ + PLIST_ENTRY ListHead = (PLIST_ENTRY)Context; + PULONG GlobalDiskCount = (PULONG)EntryContext; + PBIOSDISKENTRY BiosDiskEntry; + UNICODE_STRING NameU; + if (ValueType == REG_SZ && + ValueLength == 20 * sizeof(WCHAR)) + { + BiosDiskEntry = RtlAllocateHeap(ProcessHeap, 0, sizeof(BIOSDISKENTRY)); + if (BiosDiskEntry == NULL) + { + return STATUS_NO_MEMORY; + } + BiosDiskEntry->DiskNumber = (*GlobalDiskCount)++; + + NameU.Buffer = (PWCHAR)ValueData; + NameU.Length = NameU.MaximumLength = 8 * sizeof(WCHAR); + RtlUnicodeStringToInteger(&NameU, 16, &BiosDiskEntry->Checksum); + + NameU.Buffer = (PWCHAR)ValueData + 9; + RtlUnicodeStringToInteger(&NameU, 16, &BiosDiskEntry->Signature); + + InsertTailList(ListHead, &BiosDiskEntry->ListEntry); + } + + return STATUS_SUCCESS; +} + +#define ROOT_NAME L"\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System\\MultifunctionAdapt er" + +STATIC VOID +EnumerateBiosDiskEntries(PPARTLIST PartList) +{ + RTL_QUERY_REGISTRY_TABLE QueryTable[2]; + WCHAR Name[100]; + ULONG AdapterCount; + ULONG ControllerCount; + ULONG DiskCount; + NTSTATUS Status; + ULONG GlobalDiskCount=0; + + + memset(QueryTable, 0, sizeof(QueryTable)); + QueryTable[0].Name = L"Identifier"; + QueryTable[0].QueryRoutine = DiskQueryRoutine; + QueryTable[0].EntryContext = (PVOID)&GlobalDiskCount; + + AdapterCount = 0; + while (1) + { + swprintf(Name, L"%s\\%lu", ROOT_NAME, AdapterCount); + Status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE, + Name, + &QueryTable[1], + NULL, + NULL); + if (!NT_SUCCESS(Status)) + { + break; + } + + swprintf(Name, L"%s\\%lu\\DiskController", ROOT_NAME, AdapterCount); + Status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE, + Name, + &QueryTable[1], + NULL, + NULL); + if (NT_SUCCESS(Status)) + { + ControllerCount = 0; + while (1) + { + swprintf(Name, L"%s\\%lu\\DiskController\\%lu", ROOT_NAME, AdapterCount, ControllerCount); + Status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE, + Name, + &QueryTable[1], + NULL, + NULL); + if (!NT_SUCCESS(Status)) + { + break; + } + + swprintf(Name, L"%s\\%lu\\DiskController\\%lu\\DiskPeripheral", ROOT_NAME, AdapterCount, ControllerCount); + Status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE, + Name, + &QueryTable[1], + NULL, + NULL); + if (NT_SUCCESS(Status)) + { + DiskCount = 0; + while (1) + { + swprintf(Name, L"%s\\%lu\\DiskController\\%lu\\DiskPeripheral\\%lu", ROOT_NAME, AdapterCount, ControllerCount, DiskCount); + Status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE, + Name, + QueryTable, + (PVOID)&PartList->BiosDiskListHead, + NULL); + if (!NT_SUCCESS(Status)) + { + break; + } + DiskCount++; + } + } + ControllerCount++; + } + } + AdapterCount++; + } +} + static VOID AddDiskToList (HANDLE FileHandle, ULONG DiskNumber, @@ -433,6 +556,15 @@ PDISKENTRY DiskEntry; IO_STATUS_BLOCK Iosb; NTSTATUS Status; + PPARTITION_SECTOR Mbr; + PULONG Buffer; + LARGE_INTEGER FileOffset; + WCHAR Identifier[20]; + ULONG Checksum; + ULONG Signature; + ULONG i; + PLIST_ENTRY ListEntry; + PBIOSDISKENTRY BiosDiskEntry; Status = NtDeviceIoControlFile (FileHandle, NULL, @@ -469,6 +601,51 @@ return; } + Mbr = RtlAllocateHeap(ProcessHeap, + 0, + DiskGeometry.BytesPerSector); + + if (Mbr == NULL) + { + return; + } + + FileOffset.QuadPart = 0; + Status = NtReadFile(FileHandle, + NULL, + NULL, + NULL, + &Iosb, + (PVOID)Mbr, + DiskGeometry.BytesPerSector, + &FileOffset, + NULL); + if (!NT_SUCCESS(Status)) + { + RtlFreeHeap(ProcessHeap, + 0, + Mbr); + DPRINT1("NtReadFile failed, status=%x\n", Status); + return; + } + Signature = Mbr->Signature; + + /* Calculate the MBR checksum */ + Checksum = 0; + Buffer = (PULONG)Mbr; + for (i = 0; i < 128; i++) + { + Checksum += Buffer[i]; + } + Checksum = ~Checksum + 1; + + RtlFreeHeap (ProcessHeap, + 0, + Mbr); + + swprintf(Identifier, L"%08x-%08x-A", Checksum, Signature); + DPRINT("Identifier: %S\n", Identifier); + DiskEntry = (PDISKENTRY)RtlAllocateHeap (ProcessHeap, 0, sizeof(DISKENTRY)); @@ -477,6 +654,35 @@ return; } + DiskEntry->Checksum = Checksum; + DiskEntry->Signature = Signature; + DiskEntry->BiosFound = FALSE; + + ListEntry = List->BiosDiskListHead.Flink; + while(ListEntry != &List->BiosDiskListHead) + { + BiosDiskEntry = CONTAINING_RECORD(ListEntry, BIOSDISKENTRY, ListEntry); + if (BiosDiskEntry->Signature == Signature && + BiosDiskEntry->Checksum == Checksum) + { + if (!DiskEntry->BiosFound) + { + DiskEntry->BiosDiskNumber = BiosDiskEntry->DiskNumber; + DiskEntry->BiosFound = TRUE; + } + else + { + } + } + ListEntry = ListEntry->Flink; + } + + if (!DiskEntry->BiosFound) + { + RtlFreeHeap(ProcessHeap, 0, DiskEntry); + return; + } + InitializeListHead (&DiskEntry->PartListHead); DiskEntry->Cylinders = DiskGeometry.Cylinders.QuadPart; @@ -509,8 +715,7 @@ GetDriverName (DiskEntry); - InsertTailList (&List->DiskListHead, - &DiskEntry->ListEntry); + InsertAscendingList(&List->DiskListHead, DISKENTRY, ListEntry, DiskEntry, BiosDiskNumber); LayoutBuffer = (DRIVE_LAYOUT_INFORMATION*)RtlAllocateHeap (ProcessHeap, 0, @@ -587,7 +792,10 @@ List->CurrentPartition = NULL; InitializeListHead (&List->DiskListHead); + InitializeListHead (&List->BiosDiskListHead); + EnumerateBiosDiskEntries(List); + Status = NtQuerySystemInformation (SystemDeviceInformation, &Sdi, sizeof(SYSTEM_DEVICE_INFORMATION), @@ -667,6 +875,7 @@ DestroyPartitionList (PPARTLIST List) { PDISKENTRY DiskEntry; + PBIOSDISKENTRY BiosDiskEntry; PPARTENTRY PartEntry; PLIST_ENTRY Entry; @@ -694,6 +903,15 @@ RtlFreeHeap (ProcessHeap, 0, DiskEntry); } + /* release the bios disk info */ + while(!IsListEmpty(&List->BiosDiskListHead)) + { + Entry = RemoveHeadList(&List->BiosDiskListHead); + BiosDiskEntry = CONTAINING_RECORD(Entry, BIOSDISKENTRY, ListEntry); + + RtlFreeHeap(ProcessHeap, 0, BiosDiskEntry); + } + /* Release list head */ RtlFreeHeap (ProcessHeap, 0, List); } @@ -2000,7 +2218,29 @@ DriveLayoutSize); DriveLayout->PartitionCount = PartitionCount; + if (DiskEntry->Signature == 0) + { + LARGE_INTEGER SystemTime; + TIME_FIELDS TimeFields; + PUCHAR Buffer; + NtQuerySystemTime (&SystemTime); + RtlTimeToTimeFields (&SystemTime, &TimeFields); + + Buffer = (PUCHAR)&DiskEntry->Signature; + Buffer[0] = (UCHAR)(TimeFields.Year & 0xFF) + (UCHAR)(TimeFields.Hour & 0xFF); + Buffer[1] = (UCHAR)(TimeFields.Year >> 8) + (UCHAR)(TimeFields.Minute & 0xFF); + Buffer[2] = (UCHAR)(TimeFields.Month & 0xFF) + (UCHAR)(TimeFields.Second & 0xFF); + Buffer[3] = (UCHAR)(TimeFields.Day & 0xFF) + (UCHAR)(TimeFields.Milliseconds & 0xFF); + + /* FIXME: + * check for an existing signature + */ + + } + + DriveLayout->Signature = DiskEntry->Signature; + Index = 0; Entry2 = DiskEntry->PartListHead.Flink; while (Entry2 != &DiskEntry->PartListHead) @@ -2095,4 +2335,42 @@ return TRUE; } +BOOL SetMountedDeviceValues(PPARTLIST List) +{ + PLIST_ENTRY Entry1, Entry2; + PDISKENTRY DiskEntry; + PPARTENTRY PartEntry; + + if (List == NULL) + { + return FALSE; + } + + Entry1 = List->DiskListHead.Flink; + while (Entry1 != &List->DiskListHead) + { + DiskEntry = CONTAINING_RECORD (Entry1, + DISKENTRY, + ListEntry); + + Entry2 = DiskEntry->PartListHead.Flink; + while (Entry2 != &DiskEntry->PartListHead) + { + PartEntry = CONTAINING_RECORD(Entry2, PARTENTRY, ListEntry); + if (!PartEntry->Unpartitioned && PartEntry->DriveLetter) + { + if (!SetMountedDeviceValue(PartEntry->DriveLetter, DiskEntry->Signature, PartEntry->PartInfo[0].StartingOffset)) + { + return FALSE; + } + } + Entry2 = Entry2->Flink; + } + Entry1 = Entry1->Flink; + } + return TRUE; +} + + + /* EOF */ _____ Modified: trunk/reactos/subsys/system/usetup/partlist.h --- trunk/reactos/subsys/system/usetup/partlist.h 2005-09-15 16:52:23 UTC (rev 17863) +++ trunk/reactos/subsys/system/usetup/partlist.h 2005-09-15 17:19:31 UTC (rev 17864) @@ -68,6 +68,15 @@ } PARTENTRY, *PPARTENTRY; +typedef struct _BIOSDISKENTRY +{ + LIST_ENTRY ListEntry; + ULONG DiskNumber; + ULONG Signature; + ULONG Checksum; +} BIOSDISKENTRY, *PBIOSDISKENTRY; + + typedef struct _DISKENTRY { LIST_ENTRY ListEntry; @@ -81,6 +90,11 @@ ULONGLONG CylinderSize; ULONGLONG TrackSize; + BOOLEAN BiosFound; + ULONG BiosDiskNumber; + ULONG Signature; + ULONG Checksum; + ULONG DiskNumber; USHORT Port; USHORT Bus; @@ -118,11 +132,47 @@ PPARTENTRY ActiveBootPartition; LIST_ENTRY DiskListHead; + LIST_ENTRY BiosDiskListHead; } PARTLIST, *PPARTLIST; +#define PARTITION_TBL_SIZE 4 +#include <pshpack1.h> +typedef struct _PARTITION +{ + unsigned char BootFlags; /* bootable? 0=no, 128=yes */ + unsigned char StartingHead; /* beginning head number */ + unsigned char StartingSector; /* beginning sector number */ + unsigned char StartingCylinder; /* 10 bit nmbr, with high 2 bits put in begsect */ + unsigned char PartitionType; /* Operating System type indicator code */ + unsigned char EndingHead; /* ending head number */ + unsigned char EndingSector; /* ending sector number */ + unsigned char EndingCylinder; /* also a 10 bit nmbr, with same high 2 bit trick */ + unsigned int StartingBlock; /* first sector relative to start of disk */ + unsigned int SectorCount; /* number of sectors in partition */ +} PARTITION, *PPARTITION; + +typedef struct _PARTITION_SECTOR +{ + UCHAR BootCode[440]; /* 0x000 */ + ULONG Signature; /* 0x1B8 */ + UCHAR Reserved[2]; /* 0x1BC */ + PARTITION Partition[PARTITION_TBL_SIZE]; /* 0x1BE */ + USHORT Magic; /* 0x1FE */ +} PARTITION_SECTOR, *PPARTITION_SECTOR; + +#include <poppack.h> + +typedef struct +{ + LIST_ENTRY ListEntry; + ULONG DiskNumber; + ULONG Idendifier; + ULONG Signature; +} BIOS_DISK, *PBIOS_DISK; + PPARTLIST CreatePartitionList (SHORT Left, SHORT Top, _____ Modified: trunk/reactos/subsys/system/usetup/registry.c --- trunk/reactos/subsys/system/usetup/registry.c 2005-09-15 16:52:23 UTC (rev 17863) +++ trunk/reactos/subsys/system/usetup/registry.c 2005-09-15 17:19:31 UTC (rev 17864) @@ -45,7 +45,16 @@ #define FLG_ADDREG_TYPE_NONE (0x00020000 | FLG_ADDREG_BINVALUETYPE) #define FLG_ADDREG_TYPE_MASK (0xFFFF0000 | FLG_ADDREG_BINVALUETYPE) +#include <pshpack1.h> +typedef struct _REG_DISK_MOUNT_INFO +{ + ULONG Signature; + LARGE_INTEGER StartingOffset; +} REG_DISK_MOUNT_INFO, *PREG_DISK_MOUNT_INFO; + +#include <poppack.h> + /* FUNCTIONS ****************************************************************/ static BOOLEAN @@ -640,4 +649,61 @@ return TRUE; } +BOOLEAN +SetMountedDeviceValue(CHAR Letter, ULONG Signature, LARGE_INTEGER StartingOffset) +{ + OBJECT_ATTRIBUTES ObjectAttributes; + WCHAR ValueNameBuffer[16]; + UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\SYSTEM\\MountedDevices"); + UNICODE_STRING ValueName; + REG_DISK_MOUNT_INFO MountInfo; + NTSTATUS Status; + HANDLE KeyHandle; + + swprintf(ValueNameBuffer, L"\\DosDevices\\%C:", Letter); + RtlInitUnicodeString(&ValueName, ValueNameBuffer); + + InitializeObjectAttributes (&ObjectAttributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + Status = NtOpenKey (&KeyHandle, + KEY_ALL_ACCESS, + &ObjectAttributes); + if (!NT_SUCCESS(Status)) + { + Status = NtCreateKey(&KeyHandle, + KEY_ALL_ACCESS, + &ObjectAttributes, + 0, + NULL, + REG_OPTION_NON_VOLATILE, + NULL); + } + + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtCreateKey() failed (Status %lx)\n", Status); + return FALSE; + } + + MountInfo.Signature = Signature; + MountInfo.StartingOffset = StartingOffset; + Status = NtSetValueKey (KeyHandle, + &ValueName, + 0, + REG_BINARY, + (PVOID)&MountInfo, + sizeof(MountInfo)); + NtClose(KeyHandle); + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status); + return FALSE; + } + + return TRUE; +} + /* EOF */ _____ Modified: trunk/reactos/subsys/system/usetup/usetup.c --- trunk/reactos/subsys/system/usetup/usetup.c 2005-09-15 16:52:23 UTC (rev 17863) +++ trunk/reactos/subsys/system/usetup/usetup.c 2005-09-15 17:19:31 UTC (rev 17864) @@ -2545,7 +2545,7 @@ RtlFreeUnicodeString(&DestinationArcPath); swprintf(PathBuffer, L"multi(0)disk(0)rdisk(%lu)partition(%lu)", - DiskEntry->DiskNumber, + DiskEntry->BiosDiskNumber, PartEntry->PartInfo[0].PartitionNumber); if (InstallDir[0] != L'\\') wcscat(PathBuffer, @@ -3241,6 +3241,9 @@ } } + /* Update the mounted devices list */ + SetMountedDeviceValues(PartitionList); + SetStatusText(" Done..."); return BOOT_LOADER_PAGE;
19 years, 3 months
1
0
0
0
[hbirr] 17863: Fixed the MP build.
by hbirr@svn.reactos.com
Fixed the MP build. Modified: trunk/reactos/ntoskrnl/ex/power.c Modified: trunk/reactos/ntoskrnl/ke/apc.c Modified: trunk/reactos/ntoskrnl/ke/bug.c Modified: trunk/reactos/ntoskrnl/ke/dpc.c _____ Modified: trunk/reactos/ntoskrnl/ex/power.c --- trunk/reactos/ntoskrnl/ex/power.c 2005-09-15 16:46:17 UTC (rev 17862) +++ trunk/reactos/ntoskrnl/ex/power.c 2005-09-15 16:52:23 UTC (rev 17863) @@ -80,7 +80,7 @@ KeInitializeDpc(Dpc, KiHaltProcessorDpcRoutine, (PVOID)Dpc); KeSetTargetProcessorDpc(Dpc, i); KeInsertQueueDpc(Dpc, NULL, NULL); - KiIpiSendRequest(1 << i, IPI_REQUEST_DPC); + KiIpiSendRequest(1 << i, IPI_DPC); } } KeLowerIrql(OldIrql); _____ Modified: trunk/reactos/ntoskrnl/ke/apc.c --- trunk/reactos/ntoskrnl/ke/apc.c 2005-09-15 16:46:17 UTC (rev 17862) +++ trunk/reactos/ntoskrnl/ke/apc.c 2005-09-15 16:52:23 UTC (rev 17863) @@ -341,7 +341,7 @@ if (Prcb->CurrentThread == Thread) { ASSERT (CurrentPrcb != Prcb); - KiIpiSendRequest(Prcb->SetMember, IPI_REQUEST_APC); + KiIpiSendRequest(Prcb->SetMember, IPI_APC); break; } } _____ Modified: trunk/reactos/ntoskrnl/ke/bug.c --- trunk/reactos/ntoskrnl/ke/bug.c 2005-09-15 16:46:17 UTC (rev 17862) +++ trunk/reactos/ntoskrnl/ke/bug.c 2005-09-15 16:52:23 UTC (rev 17863) @@ -428,7 +428,7 @@ if (i != (LONG)KeGetCurrentProcessorNumber()) { /* Send the IPI and give them one second to catch up */ - KiIpiSendRequest(1 << i, IPI_REQUEST_FREEZE); + KiIpiSendRequest(1 << i, IPI_FREEZE); KeStallExecutionProcessor(1000000); } } _____ Modified: trunk/reactos/ntoskrnl/ke/dpc.c --- trunk/reactos/ntoskrnl/ke/dpc.c 2005-09-15 16:46:17 UTC (rev 17862) +++ trunk/reactos/ntoskrnl/ke/dpc.c 2005-09-15 16:52:23 UTC (rev 17863) @@ -246,10 +246,10 @@ if (Dpc->Number >= MAXIMUM_PROCESSORS) { - KiIpiSendRequest(1 << (Dpc->Number - MAXIMUM_PROCESSORS), IPI_REQUEST_DPC); + KiIpiSendRequest(1 << (Dpc->Number - MAXIMUM_PROCESSORS), IPI_DPC); } else { - KiIpiSendRequest(1 << Dpc->Number, IPI_REQUEST_DPC); + KiIpiSendRequest(1 << Dpc->Number, IPI_DPC); } }
19 years, 3 months
1
0
0
0
[hbirr] 17862: Used the given registry path from DriverEntry to query the registry.
by hbirr@svn.reactos.com
Used the given registry path from DriverEntry to query the registry. This will also fix the bug in I8042ReadRegistry, which has append the string to an unicode string with an uninitialized length value. Modified: trunk/reactos/drivers/input/i8042prt/i8042prt.c Modified: trunk/reactos/drivers/input/i8042prt/i8042prt.h Modified: trunk/reactos/drivers/input/i8042prt/registry.c _____ Modified: trunk/reactos/drivers/input/i8042prt/i8042prt.c --- trunk/reactos/drivers/input/i8042prt/i8042prt.c 2005-09-15 15:57:28 UTC (rev 17861) +++ trunk/reactos/drivers/input/i8042prt/i8042prt.c 2005-09-15 16:46:17 UTC (rev 17862) @@ -27,6 +27,8 @@ #define I8042_MAX_COMMAND_LENGTH 16 #define I8042_MAX_UPWARDS_STACK 5 +UNICODE_STRING I8042RegistryPath; + /* FUNCTIONS *****************************************************************/ /* @@ -794,6 +796,21 @@ { DPRINT("I8042 Driver 0.0.1\n"); + I8042RegistryPath.MaximumLength = RegistryPath->Length + sizeof(L"\\Parameters"); + I8042RegistryPath.Buffer = ExAllocatePoolWithTag(PagedPool, + I8042RegistryPath.MaximumLength, + TAG_I8042); + if (I8042RegistryPath.Buffer == NULL) { + + return STATUS_INSUFFICIENT_RESOURCES; + } + + RtlCopyUnicodeString(&I8042RegistryPath, RegistryPath); + RtlAppendUnicodeToString(&I8042RegistryPath, L"\\Parameters"); + I8042RegistryPath.Buffer[I8042RegistryPath.Length / sizeof(WCHAR)] = 0; + + + DriverObject->MajorFunction[IRP_MJ_CREATE] = I8042CreateDispatch; DriverObject->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = I8042InternalDeviceControl; _____ Modified: trunk/reactos/drivers/input/i8042prt/i8042prt.h --- trunk/reactos/drivers/input/i8042prt/i8042prt.h 2005-09-15 15:57:28 UTC (rev 17861) +++ trunk/reactos/drivers/input/i8042prt/i8042prt.h 2005-09-15 16:46:17 UTC (rev 17862) @@ -263,6 +263,8 @@ #define MOUSE_NACK 0xFE /* i8042prt.c */ +extern UNICODE_STRING I8042RegistryPath; + NTSTATUS I8042ReadData(UCHAR *Data); NTSTATUS I8042ReadStatus(UCHAR *Status); _____ Modified: trunk/reactos/drivers/input/i8042prt/registry.c --- trunk/reactos/drivers/input/i8042prt/registry.c 2005-09-15 15:57:28 UTC (rev 17861) +++ trunk/reactos/drivers/input/i8042prt/registry.c 2005-09-15 16:46:17 UTC (rev 17862) @@ -30,10 +30,7 @@ { RTL_QUERY_REGISTRY_TABLE Parameters[19]; - UNICODE_STRING ParametersPath; - PWSTR RegistryPath = L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\i8042Prt\\Pa rameters"; - NTSTATUS Status; ULONG DefaultHeadless = 0; @@ -55,23 +52,6 @@ ULONG DefaultNumberOfButtons = 2; ULONG DefaultEnableWheelDetection = 1; - RtlInitUnicodeString(&ParametersPath, NULL); - ParametersPath.MaximumLength = (wcslen(RegistryPath) * - sizeof(WCHAR)) + - sizeof(UNICODE_NULL); - - ParametersPath.Buffer = ExAllocatePoolWithTag(PagedPool, - ParametersPath.MaximumLength, - TAG_I8042); - - if (!ParametersPath.Buffer) { - DPRINT1("No buffer space for reading registry\n"); - return; - } - - RtlZeroMemory(ParametersPath.Buffer, ParametersPath.MaximumLength); - RtlAppendUnicodeToString(&ParametersPath, RegistryPath); - RtlZeroMemory(Parameters, sizeof(Parameters)); Parameters[0].Flags = RTL_QUERY_REGISTRY_DIRECT; @@ -202,9 +182,8 @@ Parameters[17].DefaultData = &DefaultEnableWheelDetection; Parameters[17].DefaultLength = sizeof(ULONG); - Status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE | - RTL_REGISTRY_OPTIONAL, - ParametersPath.Buffer, + Status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE | RTL_REGISTRY_OPTIONAL, + I8042RegistryPath.Buffer, Parameters, NULL, NULL); @@ -224,7 +203,6 @@ DPRINT1 ("Manually set defaults\n"); } - ExFreePoolWithTag(ParametersPath.Buffer, TAG_I8042); if (DevExt->Settings.MouseResolution > 3) DevExt->Settings.MouseResolution = 3;
19 years, 3 months
1
0
0
0
← Newer
1
...
29
30
31
32
33
34
35
...
59
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Results per page:
10
25
50
100
200