Do not hardcode cdrom directory
authorHervé Poussineau <hpoussin@reactos.org>
Tue, 2 Oct 2007 12:16:45 +0000 (12:16 +0000)
committerHervé Poussineau <hpoussin@reactos.org>
Tue, 2 Oct 2007 12:16:45 +0000 (12:16 +0000)
svn path=/trunk/; revision=29352

reactos/base/setup/usetup/drivesup.c
reactos/base/setup/usetup/drivesup.h
reactos/base/setup/usetup/interface/usetup.c
reactos/base/setup/usetup/usetup.h

index 6926b3f..ad5d205 100644 (file)
@@ -35,7 +35,8 @@
 
 NTSTATUS
 GetSourcePaths(PUNICODE_STRING SourcePath,
-              PUNICODE_STRING SourceRootPath)
+              PUNICODE_STRING SourceRootPath,
+              PUNICODE_STRING SourceRootDir)
 {
   OBJECT_ATTRIBUTES ObjectAttributes;
   UNICODE_STRING LinkName;
@@ -73,17 +74,19 @@ GetSourcePaths(PUNICODE_STRING SourcePath,
   if (NT_SUCCESS(Status))
     {
       RtlCreateUnicodeString(SourcePath,
-                            SourceName.Buffer);
+                             SourceName.Buffer);
 
       /* strip trailing directory */
       Ptr = wcsrchr(SourceName.Buffer, L'\\');
-//      if ((Ptr != NULL) &&
-//       (wcsicmp(Ptr, L"\\reactos") == 0))
-      if (Ptr != NULL)
-       *Ptr = 0;
+      if (Ptr)
+          RtlCreateUnicodeString(SourceRootDir, Ptr);
+      else
+          RtlCreateUnicodeString(SourceRootDir, L"");
 
+      if (Ptr != NULL)
+          *Ptr = 0;
       RtlCreateUnicodeString(SourceRootPath,
-                            SourceName.Buffer);
+                             SourceName.Buffer);
     }
 
   NtClose(Handle);
index 86ebc55..aebeb35 100644 (file)
@@ -29,7 +29,8 @@
 
 NTSTATUS
 GetSourcePaths(PUNICODE_STRING SourcePath,
-              PUNICODE_STRING SourceRootPath);
+              PUNICODE_STRING SourceRootPath,
+              PUNICODE_STRING SourceRootDir);
 
 #endif /* __DRIVESUP_H__ */
 
index 1d8d6e6..ed0974b 100644 (file)
@@ -74,6 +74,7 @@ typedef enum _PAGE_NUMBER
 
 HANDLE ProcessHeap;
 UNICODE_STRING SourceRootPath;
+UNICODE_STRING SourceRootDir;
 UNICODE_STRING SourcePath;
 BOOLEAN IsUnattendedSetup = FALSE;
 LONG UnattendDestinationDiskNumber;
@@ -635,7 +636,8 @@ SetupStartPage(PINPUT_RECORD Ir)
 
   /* Get the source path and source root path */
   Status = GetSourcePaths(&SourcePath,
-                         &SourceRootPath);
+                         &SourceRootPath,
+                         &SourceRootDir);
   if (!NT_SUCCESS(Status))
     {
       CONSOLE_PrintTextXY(6, 15, "GetSourcePaths() failed (Status 0x%08lx)", Status);
@@ -649,6 +651,7 @@ SetupStartPage(PINPUT_RECORD Ir)
     {
       CONSOLE_PrintTextXY(6, 15, "SourcePath: '%wZ'", &SourcePath);
       CONSOLE_PrintTextXY(6, 16, "SourceRootPath: '%wZ'", &SourceRootPath);
+      CONSOLE_PrintTextXY(6, 17, "SourceRootDir: '%wZ'", &SourceRootDir);
     }
 #endif
 
@@ -2692,7 +2695,7 @@ AddSectionToCopyQueue(HINF InfFile,
       if (!SetupQueueCopy(SetupFileQueue,
                          SourceCabinet,
                          SourceRootPath.Buffer,
-                         L"\\reactos",
+                         SourceRootDir.Buffer,
                          FileKeyName,
                          DirKeyValue,
                          TargetFileName))
@@ -3562,6 +3565,7 @@ RunUSetup(VOID)
   /* Initialize global unicode strings */
   RtlInitUnicodeString(&SourcePath, NULL);
   RtlInitUnicodeString(&SourceRootPath, NULL);
+  RtlInitUnicodeString(&SourceRootDir, NULL);
   RtlInitUnicodeString(&InstallPath, NULL);
   RtlInitUnicodeString(&DestinationPath, NULL);
   RtlInitUnicodeString(&DestinationArcPath, NULL);
index aed00da..c2119e6 100644 (file)
@@ -74,6 +74,7 @@
 
 extern HANDLE ProcessHeap;
 extern UNICODE_STRING SourceRootPath;
+extern UNICODE_STRING SourceRootDir;
 extern UNICODE_STRING SourcePath;
 extern BOOLEAN IsUnattendedSetup;