Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 

Sign in to follow this  
big_gie

New tool! Run multiple programs from winnt.sif

Recommended Posts

I know people using XPlode wanted conditional statement. Maybe I'll try to add this.

I'm trying to imagine how the xml could look like . Here's what I've came with:

<item>
 <program>%windir%\system32\cmd.exe</program>
 <arguments>SourceDrive = %SourceDrive%
            $mt39_PathToXml = %$mt39_PathToXml%
            $mt39_PathToExe %$mt39_PathToExe%
            $mt39_PathToLog %$mt39_PathToLog%
            $mt39_NameOfXml %$mt39_NameOfXml%
            $mt39_NameOfXmlNoExt %$mt39_NameOfXmlNoExt%
            $mt39_NameOfLog %$mt39_NameOfLog%
            $mt39_NameOfLogNoExt %$mt39_NameOfLogNoExt%
            $mt39_OriginalArguments %$mt39_OriginalArguments%</arguments>
 <hide>1</hide>
 <wait>300</wait>
</item>
   <conditional>
       <if condition="Execute">
           <command>command to execute</command>
           <then>
               <do what="Execute">
                   <program>cmd.exe</program>
                   <arguments>%SourceDrive%\<arguments>
                   <hide>1</hide>
                   <wait>300</wait>
               </do>
           </then>
           <else>
               <do what="Execute">
                   <program>%windir%\explorer.exe</program>
                   <arguments>%systemdrive%</arguments>
                   <hide>1</hide>
                   <wait>300</wait>
               </do>
           </else>
       </if>
       <if condition="StringCompare">
           <string1>This is string 1</string1>
           <string2>and this is string 2</string2>
           <then>
               <do what="Move">
                   <source>cmd.exe</source>
                   <destination>%SourceDrive%\</destination>
               </do>
           </then>
           <else>
               <do what="Execute">
                   <program>%windir%\explorer.exe</program>
                   <arguments>%systemdrive%</arguments>
                   <hide>1</hide>
                   <wait>300</wait>
               </do>
               <do what="Copy">
                   <source>%SourceDrive%\$OEM$\cmdlines.txt</source>
                   <destination>%Systemdrive%\</destination>
               </do>
           </else>
       </if>
   </conditional>

What do you think about?

I also added some new variables that will be parsed inside the xml like %$mt39_PathToExe% and others...

Share this post


Link to post
Share on other sites

v0.8.1 is up.

New variables supported and exe inside the path variable can be called without complete path. Example:

   <item>
       <program>7z</program>
       <arguments>x -y -o%systemdrive%\setup\drivers\scanner %systemdrive%\setup\drivers\scanner.7z</arguments>
       <hide>1</hide>
       <wait>300</wait>
   </item>
   <item>
       <program>notepad</program>
       <arguments>%systemdrive%\boot.ini</arguments>
       <hide>0</hide>
       <wait>300</wait>
   </item>

Share this post


Link to post
Share on other sites
Do you think it could be interesting to pass a value as a variable to mt39.exe

winnt.sif

[GuiUnattended]
   ...
   DetachedProgram="%systemdrive%\setup\mt39.exe"
   Arguments="%systemdrive%\setup\default.xml /DevicePath="PnPDrvrs"
   ...

in order to use a value that isn't an existing environnement variable for substitution in the xml file.

<?xml version="1.0" encoding="ISO-8859-2" standalone="no"?>
<mt39 version="0.5" testingmode="0" logging="1">
   <item>
       <program>%systemdrive%\setup\7z.exe</program>
       <arguments>x -y -o%systemdrive%\%DevicePath% %systemdrive%\setup\CfgSets\Fennel\drivers.7z</arguments>
       <hide>1</hide>
       <wait>300</wait>
   </item>
   <item>
       <program>%systemdrive%\setup\7z.exe</program>
       <arguments>x -y -o%systemdrive%\%DevicePath% %systemdrive%\setup\CfgSets\Other\other.7z</arguments>
       <hide>1</hide>
       <wait>300</wait>
   </item>
   <item>
       <program>%systemdrive%\Setup\devpath.exe</program>
       <arguments>%systemdrive%\%DevicePath%</arguments>
       <hide>1</hide>
       <wait>300</wait>
   </item>
</mt39>

devpath.exe is a 8.3 naming convention renamed exe of the SetDevicePath.exe tool written by Pyron :

SOLVED: drivers from CD , possible even without winnt.sif!

Command Line Syntax:

     DevPath path

Description:

     DevPath.exe searchs installer INF file in specified path subdirectories
  and add path for all subdirectories containing an INF file
  to the "DevicePath" value at registry key:
  HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion
                     
Arguments:

     path  specifies a path to process

Example:

     DevPath c:\PNPDrvrs
  adds the path of PnP devices INFs files found in all the
  subdirectories in specified path C:\PNPDrvrs

It may be possible to have a winnt.sif with variable not set and dynamically build the path in the registry AND to set the name of the main folder only with this variable.

[Unattended]
       UnattendMode=FullUnattended
       DriverSigningPolicy=Ignore
      OemPnPDriversPath=   ******blank******

Another alternative would be the ability to set this value with a supplemental XML line rather than supplemental switch but don't know how the syntax could be.

The purpose is to make the whole process needing less customization in XML code and winnt.sif

I wasn't able to remove the winnt.sif's OemPnPDriversPath with devpath.exe... Maybe because there is no registry @ t-39...

I'm still looking for a way to make it possible...

Share this post


Link to post
Share on other sites

@big_gie

DevPath.exe is not written to remove values in registry.

The purpose is to scan the path given, search for .inf files and add each folder found which contains and .inf file to the key in registry.

Nethertheless, at the end of windows Installation, The value for the key in registry is correct according to my PnPDrvrs folder, 7z drivers archives are well unpacked in the subfolders but my OEM drivers are not installed in windows.

I believe that Windows installation as already started PnP detection at the time mt39.exe run the command.

winnt.sif

[Unattended]
       UnattendMode=FullUnattended
       DriverSigningPolicy=Ignore
NtUpgrade=No
;     OemFilesPath=
;       OemPnPDriversPath=
OemPreinstall=Yes
OemSkipEula=Yes
OverwriteOemFilesOnUpgrade=No
TargetPath=\WINNT
Win9xUpgrade=No

[GuiUnattended]
   AdminPassword=*
   AutoLogon=Yes
   AutoLogonCount=1
   OEMSkipRegional=1
   TimeZone=105
   OemSkipWelcome=1
DetachedProgram="%systemdrive%\PnPDrvrs\mt39.exe"
  Arguments="%systemdrive%\PnPDrvrs\default.xml"

default.xml

<?xml version="1.0" encoding="ISO-8859-2" standalone="no"?>
<!--
   Note that the new encoding is ISO-8859-2
   This will let SOME special characters like accent in french. I think
   it should work with spanish, german, and other european languages. Please
   tell me if something doesn't work.
-->
<mt39 version="0.8.1" testingmode="0" logging="1">
<!--
   [MANDATORY]
   "version" = Your .xml version.
       It NEEDS to match the program's version

   [Optionnals]
   "testingmode" = 1 (default if not present) or 1
       mt39 will not execute files but pop you a MessageBox with informations
   "logging" = 1 (default if not present) or 1
       Will launch the logging feature if enabled
       NOT YET IMPLEMENTED
-->
   <item>
       <program>%systemdrive%\PnPDrvrs\cmeu0wdm.exe</program>
       <arguments>-y /q /r:n</arguments>
       <hide>1</hide>
       <wait>300</wait>
   </item>
   <item>
       <program>%systemdrive%\PnPDrvrs\E100B.exe</program>
       <arguments>-y /q /r:n</arguments>
       <hide>1</hide>
       <wait>300</wait>
   </item>
   <item>
       <program>%systemdrive%\PnPDrvrs\iata.exe</program>
       <arguments>-y /q /r:n</arguments>
       <hide>1</hide>
       <wait>300</wait>
   </item>
   <item>
       <program>%systemdrive%\PnPDrvrs\IntelINF.exe</program>
       <arguments>-y /q /r:n</arguments>
       <hide>1</hide>
       <wait>300</wait>
   </item>
   <item>
       <program>%systemdrive%\PnPDrvrs\nvfs.exe</program>
       <arguments>-y /q /r:n</arguments>
       <hide>1</hide>
       <wait>300</wait>
   </item>
   <item>
       <program>%systemdrive%\PnPDrvrs\PSeries.exe</program>
       <arguments>-y /q /r:n</arguments>
       <hide>1</hide>
       <wait>300</wait>
   </item>
   <item>
       <program>%systemdrive%\PnPDrvrs\smwdm.exe</program>
       <arguments>-y /q /r:n</arguments>
       <hide>1</hide>
       <wait>300</wait>
   </item>
   <item>
       <!-- Add OEM drivers' location to registry -->
       <!-- Please see this post: http://www.msfn.org/board/index.php?showtopic=12566&hl=drivers+devpath -->
       <program>%systemdrive%\PnPDrvrs\devpath.exe</program>
       <arguments>%systemdrive%\PnPDrvrs</arguments>
       <hide>1</hide>
       <wait>300</wait>
   </item>
</mt39>

mt39_default.log

Sun Aug 15 17:12:16 2004
mt39 version: 0.8.1
XML version: 0.8.1
XML file: C:\PnPDrvrs\default.xml
Log file: C:\PnPDrvrs\mt39_default.log



Sun Aug 15 17:12:16 2004
INFO: File "C:\PnPDrvrs\cmeu0wdm.exe" does exist, trying to execute...

Sun Aug 15 17:12:17 2004
INFO: Program "C:\PnPDrvrs\cmeu0wdm.exe" was executed with arguments "cmeu0wdm.exe -y /q /r:n" and returned the code "0"

Sun Aug 15 17:12:17 2004
INFO: File "C:\PnPDrvrs\E100B.exe" does exist, trying to execute...

Sun Aug 15 17:12:18 2004
INFO: Program "C:\PnPDrvrs\E100B.exe" was executed with arguments "E100B.exe -y /q /r:n" and returned the code "0"

Sun Aug 15 17:12:18 2004
INFO: File "C:\PnPDrvrs\iata.exe" does exist, trying to execute...

Sun Aug 15 17:12:19 2004
INFO: Program "C:\PnPDrvrs\iata.exe" was executed with arguments "iata.exe -y /q /r:n" and returned the code "0"

Sun Aug 15 17:12:19 2004
INFO: File "C:\PnPDrvrs\IntelINF.exe" does exist, trying to execute...

Sun Aug 15 17:12:20 2004
INFO: Program "C:\PnPDrvrs\IntelINF.exe" was executed with arguments "IntelINF.exe -y /q /r:n" and returned the code "0"

Sun Aug 15 17:12:20 2004
INFO: File "C:\PnPDrvrs\nvfs.exe" does exist, trying to execute...

Sun Aug 15 17:12:25 2004
INFO: Program "C:\PnPDrvrs\nvfs.exe" was executed with arguments "nvfs.exe -y /q /r:n" and returned the code "0"

Sun Aug 15 17:12:25 2004
INFO: File "C:\PnPDrvrs\PSeries.exe" does exist, trying to execute...

Sun Aug 15 17:12:27 2004
INFO: Program "C:\PnPDrvrs\PSeries.exe" was executed with arguments "PSeries.exe -y /q /r:n" and returned the code "0"

Sun Aug 15 17:12:27 2004
INFO: File "C:\PnPDrvrs\smwdm.exe" does exist, trying to execute...

Sun Aug 15 17:12:29 2004
INFO: Program "C:\PnPDrvrs\smwdm.exe" was executed with arguments "smwdm.exe -y /q /r:n" and returned the code "0"

Sun Aug 15 17:12:29 2004
INFO: File "C:\PnPDrvrs\devpath.exe" does exist, trying to execute...

Sun Aug 15 17:12:30 2004
INFO: Program "C:\PnPDrvrs\devpath.exe" was executed with arguments "devpath.exe C:\PnPDrvrs" and returned the code "0"

Sun Aug 15 17:12:30 2004
End of execution, exiting...

registry export

DevicePath=%SystemRoot%\Inf;C:\PnPDrvrs\cmeu0wdm;C:\PnPDrvrs\E100B;C:\PnPDrvrs\iata;C:\PnPDrvrs\IntelINF;C:\PnPDrvrs\nvfs;C:\PnPDrvrs\PSeries;C:\PnPDrvrs\smwdm

all my subfolders with .inf files are added to the default value %SystemRoot%\Inf

Share this post


Link to post
Share on other sites

Hi Bilou_Gateux,

The hardware detection is after t-39, so it is possible to extract drivers via mt39 so Windows will detect them and install the appropriate drivers.

I was using this, with the help of the winnt.sif's OemDriverPath section, to tell Windows to install the correct drivers.

I then tryed to remove the winnt.sif's OemDriverPath section nd instead call devpath.exe at the end of mt39, after driver extraction. As you know, devpath writes to the registry where the drivers are located.

But at t-39, there is no registry (at least it doesn't looks like and this is logic since setup just began) so devpath cannot write to it, so Windows doesn't know where to look for drivers. Though it doesn't install them.

I don't know where Windows setup is looking to find the path to the drivers. If it is looking directly into the winnt.sif, then we are screwed... But if it is looking in C:\windows\system32\$winnt$.inf, then there is hope. I could try to write a program, a kind of devpath, that will not write to the registry, but write to C:\windows\system32\$winnt$.inf and change the OemPnPDriversPath section to point to the correct path.

I'll need more testing on where setup finds the info for the OemPnPDriversPath. $winnt$.inf or winnt.sif? If anyone could help, I would be glad! :)

Share this post


Link to post
Share on other sites
DevicePath=%SystemRoot%\Inf;C:\PnPDrvrs\cmeu0wdm;C:\PnPDrvrs\E100B;C:\PnPDrvrs\iata;C:\PnPDrvrs\IntelINF;C:\PnPDrvrs\nvfs;C:\PnPDrvrs\PSeries;C:\PnPDrvrs\smwdm

all my subfolders with .inf files are added to the default value %SystemRoot%\Inf

Yes, when windows is started, but I'm more and more sceptical about registry @t-39. That could be the problem.

Share this post


Link to post
Share on other sites

Sorry, but SetServicePath.exe was created under the assumption that there is a registry available at that early time.

Look here, if in doubt. My whole "drivers from CD" method relies on that.

--

Pyron

Share this post


Link to post
Share on other sites

Hum,

Ok thanx for the clarification.

Unfortunatly there is something I did wrong :( But at least that mean that what I wa trying to do is indeed possible! :)

Share this post


Link to post
Share on other sites

v0.8.2 is up

It corrects a bug that prevented the usage of a file without its full path (<program>cmd</program> for example). The bug make mt39 return the wrong path to the file...

Share this post


Link to post
Share on other sites

Modify $winnt$.inf @T-39 will not work for drivers. I've wrote myself a .cmd script to generate OemPnPDriversPath & DevicePath @T-39, the $winnt$.inf looks okay, and DevicePath looks good(REG_EXPAND_SZ %SystemRoot%\inf;%SystemDrive%\DRV;%SystemDrive%\DRV\IntelINF;%SystemDrive%\DRV\Raid), but setup still won't work with them.

On my test, when I occasionally corrupted the $winnt$.inf @T-39, setup will popup a error message for it, I think that means setup rereads $winnt$.inf after T-39, but it still won't install the oem drivers with regTweak or $winnt$.inf modification. Got to find another way.

My testing script:

i386\WINNT.SIF:

[GuiUnattended]
  DetachedProgram = ".\system32\cmd.exe"
  Arguments="/Q /C FOR /F %I IN (%SystemRoot%\system32\$winnt$.inf) DO (FOR %J IN (%I$OEM$\Detached.cmd) DO (IF EXIST %J (START /MIN %J)))"

$OEM$\Detached.cmd:

@ECHO OFF
::change CurrentDirectory to where script is
CD /D "%~dp0"
::extracting $$ into SystemRoot
.\$$.exe -y -o"%SystemRoot%"
.\$1.exe -y -o"%SystemDrive%"
::extracting Intel INF
.\DRV\IntelINF.exe -y -o"%SystemRoot%\INF"
::extracting RyanVM SATA/Raid drivers repacked
.\DRV\RaidDRV.exe -y -o"%SystemDrive%\DRV"
::extracting drivers sfx
.\DRV\DRV_SFX.exe -y -o"%SystemDrive%\DRV"

SETLOCAL ENABLEDELAYEDEXPANSION
SET STDLOG=%SystemDrive%\Detached.log
SET PERCENT=%%
SET DevPath=%PERCENT%SystemRoot%PERCENT%\inf
SET OemPnPDriversPath=$
::traverse drivers path
CALL :TRAVERSAL %SystemDrive%\DRV
::update registry
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion" /v "DevicePath" /t REG_EXPAND_SZ /d "%DevPath%" /f >NUL 2>>%STDLOG%

::backup original $winnt$.inf
MOVE /Y %SystemRoot%\system32\$winnt$.inf %SystemDrive%\$winnt$.inf >NUL 2>>%STDLOG%
::recreate $winnt$.inf
ECHO.>%SystemRoot%\system32\$winnt$.inf 2>>%STDLOG%
CALL :RECREATE %SystemDrive%\$winnt$.inf %SystemRoot%\system32\$winnt$.inf

::make a dump
REG QUERY "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion" /v "DevicePath" >>%STDLOG%
TYPE %SystemRoot%\system32\$winnt$.inf >>%STDLOG%
EXIT
GOTO EOF

:TRAVERSAL
PUSHD %1
::FOR %%I IN ("%CD%") DO IF EXIST *.INF ECHO %%~pnI>>%STDLOG%
FOR %%I IN ("%CD%") DO IF EXIST *.INF SET DevPath=!DevPath!;%PERCENT%SystemDrive%PERCENT%%%~pnI
IF EXIST *.INF SET OemPnPDriversPath=!OemPnPDriversPath!;%CD:~3%
FOR /F %%I IN ('DIR /AD /OGN /B') DO (
 CALL :TRAVERSAL %CD%\%%I
)
POPD
GOTO EOF

:RECREATE
::%1=Source %2=Destination
SET FOUND=NO
SET UPDATE=NO
FOR /F "tokens=1,2*" %%I IN (%1) DO (
 IF "%%J"=="=" (
   IF /I "%%I"=="OemPnPDriversPath" (
     ECHO OemPnPDriversPath = "%OemPnPDriversPath:~2%">>%2
     SET UPDATE=YES
   ) ELSE (
     ECHO %%I %%J %%K>>%2
   )
 ) ELSE (
   IF /I "%%I"=="[Unattended]" (
     SET FOUND=YES
   ) ELSE (
     IF NOT "%FOUND%"=="NO" (
       IF "%UPDATE%"=="NO" (
         ECHO OemPnPDriversPath = "%OemPnPDriversPath:~2%">>%2
         SET UPDATE=YES
       )
       SET FOUND=NO
     )
   )
   ECHO %%I>>%2
 )
)
GOTO EOF

:EOF

It generates %SystemDrive%\Detached.log, and %SystemDrive%\$winnt$.inf is the original $winnt$.inf inside system32 @T-39.

Testing in VMWare with modified vmx_svga.inf, @800x600x32 with corresponding [Display] in winnt.sif, if OemPnPDriversPath/DevicePath works VM @800x600x32, or it will fall down to 640x480x32.

Share this post


Link to post
Share on other sites

That convince me: I hate batch scripts! :D

@Bilou_Gateux:

Have you succeeded using devpath.exe and omitting winnt.sif's OemPnPDriversPath?? If so, is there something special to be done to make it work?

I'm still looking for a solution on this...

Share this post


Link to post
Share on other sites

I hate that too, but it's straightforward, edit with Notepad, that's all.

If SetDevicePath.exe only manipulates registry, it should not work. Scripts above manipulates both registry & $winnt$.inf.

Can't find anything related yet.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×