From 3bc1216b7f5baf90905ce203eafab77e5762f0bb Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Fri, 26 Sep 2003 19:45:04 +0000 Subject: [PATCH] Check for presence of \reactos\ntoskrnl.exe instead of REACTOS disk label to identify the boot cdrom device. svn path=/trunk/; revision=6149 --- reactos/ntoskrnl/io/arcname.c | 39 ++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/reactos/ntoskrnl/io/arcname.c b/reactos/ntoskrnl/io/arcname.c index c8af781282a..0aa01e6e758 100644 --- a/reactos/ntoskrnl/io/arcname.c +++ b/reactos/ntoskrnl/io/arcname.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: arcname.c,v 1.12 2003/07/17 16:57:38 silverblade Exp $ +/* $Id: arcname.c,v 1.13 2003/09/26 19:45:04 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -177,22 +177,25 @@ IoCreateArcNames(VOID) static NTSTATUS IopCheckCdromDevices(PULONG DeviceNumber) { - PFILE_FS_VOLUME_INFORMATION FileFsVolume; PCONFIGURATION_INFORMATION ConfigInfo; OBJECT_ATTRIBUTES ObjectAttributes; UNICODE_STRING DeviceName; - WCHAR DeviceNameBuffer[32]; + WCHAR DeviceNameBuffer[MAX_PATH]; HANDLE Handle; ULONG i; NTSTATUS Status; +#if 0 + PFILE_FS_VOLUME_INFORMATION FileFsVolume; IO_STATUS_BLOCK IoStatusBlock; USHORT Buffer[FS_VOLUME_BUFFER_SIZE]; FileFsVolume = (PFILE_FS_VOLUME_INFORMATION)Buffer; +#endif ConfigInfo = IoGetConfigurationInformation(); for (i = 0; i < ConfigInfo->CdRomCount; i++) { +#if 0 swprintf(DeviceNameBuffer, L"\\Device\\CdRom%lu\\", i); @@ -232,8 +235,38 @@ IopCheckCdromDevices(PULONG DeviceNumber) } NtClose(Handle); } +#endif + + swprintf(DeviceNameBuffer, + L"\\Device\\CdRom%lu\\reactos\\ntoskrnl.exe", + i); + RtlInitUnicodeString(&DeviceName, + DeviceNameBuffer); + + InitializeObjectAttributes(&ObjectAttributes, + &DeviceName, + 0, + NULL, + NULL); + + Status = NtOpenFile(&Handle, + FILE_ALL_ACCESS, + &ObjectAttributes, + NULL, + 0, + 0); + DPRINT("NtOpenFile() DeviceNumber %lu Status %lx\n", i, Status); + if (NT_SUCCESS(Status)) + { + DPRINT("Found ntoskrnl.exe on Cdrom%lu\n", i); + NtClose(Handle); + *DeviceNumber = i; + return(STATUS_SUCCESS); + } + } + DPRINT("Could not find ntoskrnl.exe\n"); *DeviceNumber = (ULONG)-1; return(STATUS_UNSUCCESSFUL);