Author: hbelusca
Date: Sat Aug 26 14:33:48 2017
New Revision: 75676

URL: http://svn.reactos.org/svn/reactos?rev=75676&view=rev
Log:
[SETUPLIB]: Initialization fixes:
- Use correct inf style flags in SetupOpenInfFileEx() calls when opening 
txtsetup.sif and unattend.inf. Technically txtsetup.sif would be INF_STYLE_WIN4
  but since we use "$ReactOS$" as its version signature, it would not work when 
opening it with setupapi.dll functions. Hence I combine the flag with 
INF_STYLE_OLDNT too.
- Don't fail if opening the \SystemRoot symbolic link doesn't work (usually due 
to incorrect access rights); in that case, just use the installer image file 
path as the installation source path.

Modified:
    branches/setup_improvements/base/setup/lib/setuplib.c

Modified: branches/setup_improvements/base/setup/lib/setuplib.c
URL: 
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/lib/setuplib.c?rev=75676&r1=75675&r2=75676&view=diff
==============================================================================
--- branches/setup_improvements/base/setup/lib/setuplib.c       [iso-8859-1] 
(original)
+++ branches/setup_improvements/base/setup/lib/setuplib.c       [iso-8859-1] 
Sat Aug 26 14:33:48 2017
@@ -49,7 +49,7 @@
     /* Load 'unattend.inf' from installation media */
     UnattendInf = SetupOpenInfFileExW(UnattendInfPath,
                                       NULL,
-                                      INF_STYLE_WIN4,
+                                      INF_STYLE_OLDNT,
                                       pSetupData->LanguageId,
                                       &ErrorLine);
 
@@ -262,7 +262,8 @@
 #if 0
 
     /* TODO: Append the standard unattend.inf file */
-    CombinePaths(UnattendInfPath, ARRAYSIZE(UnattendInfPath), 2, 
pSetupData->SourcePath.Buffer, L"unattend.inf");
+    CombinePaths(UnattendInfPath, ARRAYSIZE(UnattendInfPath), 2,
+                 pSetupData->SourcePath.Buffer, L"unattend.inf");
     if (DoesFileExist(NULL, UnattendInfPath) == FALSE)
     {
         DPRINT("Does not exist: %S\n", UnattendInfPath);
@@ -437,7 +438,16 @@
                                       SYMBOLIC_LINK_QUERY,
                                       &ObjectAttributes);
     if (!NT_SUCCESS(Status))
-        return Status;
+    {
+        /*
+         * We failed at opening the \SystemRoot link (usually due to wrong
+         * access rights). Do not consider this as a fatal error, but use
+         * instead the image file path as the installation source path.
+         */
+        DPRINT1("NtOpenSymbolicLinkObject(%wZ) failed with Status 0x%08lx\n",
+                &SystemRootPath, Status);
+        goto InitPaths;
+    }
 
     RtlInitEmptyUnicodeString(&SystemRootPath,
                               SystemRootBuffer,
@@ -449,7 +459,7 @@
     NtClose(Handle);
 
     if (!NT_SUCCESS(Status))
-        return Status;
+        return Status; // Unexpected error
 
     /* Check whether the resolved \SystemRoot is a prefix of the image file 
path */
     if (RtlPrefixUnicodeString(&SystemRootPath, InstallSourcePath, TRUE))
@@ -459,6 +469,7 @@
     }
 
 
+InitPaths:
     /*
      * Retrieve the different source path components
      */
@@ -499,7 +510,7 @@
 
     *SetupInf = SetupOpenInfFileExW(FileNameBuffer,
                                    NULL,
-                                   INF_STYLE_WIN4,
+                                   INF_STYLE_WIN4 | INF_STYLE_OLDNT,
                                    pSetupData->LanguageId,
                                    &ErrorLine);
 


Reply via email to