Commit in reactos/ntoskrnl/io on MAIN
arcname.c+25-51.16 -> 1.17
- Don't assign arc names to removable media drives like zip drives.

reactos/ntoskrnl/io
arcname.c 1.16 -> 1.17
diff -u -r1.16 -r1.17
--- arcname.c	17 Nov 2003 02:12:51 -0000	1.16
+++ arcname.c	2 May 2004 22:49:24 -0000	1.17
@@ -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.16 2003/11/17 02:12:51 hyperion Exp $
+/* $Id: arcname.c,v 1.17 2004/05/02 22:49:24 hbirr Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -52,8 +52,11 @@
   WCHAR ArcNameBuffer[80];
   UNICODE_STRING DeviceName;
   UNICODE_STRING ArcName;
-  ULONG i, j;
+  ULONG i, j, k;
   NTSTATUS Status;
+  PFILE_OBJECT FileObject;
+  PDEVICE_OBJECT DeviceObject;
+  BOOL IsRemovableMedia;
 
   DPRINT("IoCreateArcNames() called\n");
 
@@ -86,7 +89,7 @@
 
   /* create ARC names for hard disk drives */
   DPRINT("Disk drives: %lu\n", ConfigInfo->DiskCount);
-  for (i = 0; i < ConfigInfo->DiskCount; i++)
+  for (i = 0, k = 0; i < ConfigInfo->DiskCount; i++)
     {
       swprintf(DeviceNameBuffer,
 	       L"\\Device\\Harddisk%lu\\Partition0",
@@ -94,9 +97,25 @@
       RtlInitUnicodeString(&DeviceName,
 			   DeviceNameBuffer);
 
+
+      Status = IoGetDeviceObjectPointer(&DeviceName,
+				        FILE_READ_DATA,
+				        &FileObject,
+				        &DeviceObject);
+      if (!NT_SUCCESS(Status))
+        {
+	  continue;
+	}
+      IsRemovableMedia = DeviceObject->Characteristics & FILE_REMOVABLE_MEDIA ? TRUE : FALSE;
+      ObDereferenceObject(FileObject);
+      if (IsRemovableMedia)
+        {
+          continue;
+	}
+
       swprintf(ArcNameBuffer,
 	       L"\\ArcName\\multi(0)disk(0)rdisk(%lu)partition(0)",
-	       i);
+	       k);
       RtlInitUnicodeString(&ArcName,
 			   ArcNameBuffer);
       DPRINT("%wZ ==> %wZ\n",
@@ -126,7 +145,7 @@
 
 	  swprintf(ArcNameBuffer,
 		   L"\\ArcName\\multi(0)disk(0)rdisk(%lu)partition(%lu)",
-		   i,
+		   k,
 		   j + 1);
 	  RtlInitUnicodeString(&ArcName,
 			       ArcNameBuffer);
@@ -142,6 +161,7 @@
 
       ExFreePool(LayoutInfo);
       LayoutInfo = NULL;
+      k++;
     }
 
   /* create ARC names for cdrom drives */
CVSspam 0.2.8