Sign in to follow this  
Followers 0
big_gie

New tool! Run multiple programs from winnt.sif

64 posts in this topic

Updated: August 15th 2004

v0.8.2

As you may know, the winnt.sif's DetachedProgram section only allows you to run ONE program... And you can't execute a batch file to!

So I wrote a small program that will look in a file and execute what it contains. It even support environment variables! Even %CD% witch resolves to the drive you installed Windows from! (taken from %Windir%\system32\$winnt$.inf's "dospath=")

Usage:

mt39.exe /xml:file.xml:/xml /log:file.log:/log /var:<Variable name>=<Variable value>:/var /testingmode=[0|1] /logging=[0|1]

  • /xml:Full\path\to\file.xml:/xml OR /xml:file.xml:/xml
    The second one will make mt39 looks for "file.xml":
    • in the same directory as the exe
    • in the "current directory" if the later is not found. This "current directory" can depend on many thing, so I can't tell what it will be! Yours to see :)
      Default value for the path is the same as the exe's. Default file name is "default.xml"

    [*]/log:Full\path\to\file.log:/log OR /log:file.log:/log

    The second one will try to create the "file.log":

    • in the same directory as the xml
    • if it can't (write protected for example), in the same directory as the exe
    • if it can't, in the "currect directory"
    • if it can't, in the %TEMP% folder
    • if it can't, then you're really not lucky :rolleyes: Logging will be disable
      Default value for the path is the same as the xml's. Default file name is "mt39_<XML file name (no ext)>.log" (like "mt39_default.log")

    [*]/var:<Variable name>=<Variable value>:/var

    You can set as many variables like this as you want. You will be able to use those variables inside your xml file. For example, if you want to force the %CD% variable to be something else, you would use: /var:CD=F::/var and now in the xml, when you will use the %CD% variable, it will be parsed to "F:"

    [*]/testingmode=[0|1]

    Specify if testing mode should be use (usefull to debug) (default to "0" if not specified in the xml)

    [*]/logging=[0|1]

    Specify if you want to logging (default to "0" if not specified in the xml)

The configuration file is a xml file with programs to run.

Look in the xml from the package to see its usage.

If you don't specify a configuration files, mt39.exe uses the default one called "default.xml" in the same directory as the exe.

<?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" = 0 (default if not present) or 1

        mt39 will not execute files but pop you a MessageBox with informations

    "logging" = 0 (default if not present) or 1

        Will launch the logging feature if enabled

        NOT YET IMPLEMENTED

-->

    <item>

        <!-- 7z.exe should be: near the .exe, near the .xml, near the log or in the path -->

        <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>7z</program>

        <arguments>x -y -o%systemdrive%\setup\drivers\di8500\lan %systemdrive%\setup\drivers\di8500\lan.7z</arguments>

        <hide>1</hide>

        <wait>300</wait>

    </item>

    <item>

        <program>7z</program>

        <arguments>x -y -o%systemdrive%\setup\drivers\di8500\TM1300 %systemdrive%\setup\drivers\di8500\TM1300.7z</arguments>

        <hide>1</hide>

        <wait>300</wait>

    </item>

    <item>

        <program>%SourceDrive%\Programmes\7zip\7z.exe</program>

        <arguments>x -y -o%systemdrive%\setup\drivers\di8500\sigmatel %systemdrive%\setup\drivers\di8500\sigmatel.7z</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?showto...drivers+devpath -->

  <program>%SourceDrive%\Programmes\drivers\devpath.exe</program>

  <arguments>%systemdrive%\setup\drivers</arguments>

  <hide>1</hide>

  <wait>300</wait>

</item>

</mt39>

Call it like this:

[GuiUnattended]

    ...

    DetachedProgram="%systemdrive%\setup\mt39.exe"

    Arguments="/xml:%systemdrive%\setup\dd4550.xml:/xml /log:your\log\file.log:/log /var:var1=value1:/var /var:var2=value2:/var /testingmode:1 /logging:1"

    ...

or like this to use the default config (default.xml must be in the same directory or in the current directory (I don't know what is it though @t-39...)):

[GuiUnattended]

    ...

    DetachedProgram="%systemdrive%\setup\mt39.exe"

    ...

NOTES:

  • The XML should be encoded in ISO-8859-2 as is seems to work better... I'm hping to be moving to full UTF-8 enconding, but for now, ISO 8859-2 should do it.
  • Check the xml's "version" attribute. It should match the program's version (this is because the xml implementation is quite simple and crashes if it try to access a tag which is not present. To be able to add more features and to "force" users to check their xml file syntaxt to follow the program's evolution, I added this tag). To verify the program's version, run it with "/?" switch (or -h, or -?, or --h, or /h, or... ) or "-v" for the version.

Actual limitations:

  • None known :D

TODO:

  • [ADDED]Giving a variable by command line that will be parsed in the xml.
  • [ADDED]Better command line arguments handling.
  • [ADDED] Add a "test" tag whitch will tell mt39 to check the XML syntaxt, verify if files exists, etc. and reports (MessageBox and/or log file)
  • [ADDED]Add a tag checking routine to prevent program crash. (IMPORTANT)
  • Full support for Unicode (to support special characters like &ecute; and others)

Please post your questions, bugs, comments and suggestion so I can make mt39 better :D

Changelog:

  • 15 08 2004 (v0.8.2)
    Bug corrected that returned the wrong path for a program.
  • 13 08 2004 (v0.8.1)
    It is now possible to enter only a filename instead of a full pathname:
    mt39 will look near the exe, near the xml, near the log and in the path environment variable, in that order.
    New variables supported:
    $mt39_PathToXml for the full path to the xml file (without file name.ext)
    $mt39_PathToExe for the full path to the exe file (without file name.ext)
    $mt39_PathToLog for the full path to the log file (without file name.ext)
    $mt39_NameOfXml for the name of the xml (ex.: file.xml)
    $mt39_NameOfXmlNoExt for the name of the xml without extension (ex.: file)
    $mt39_NameOfLog for the name of the log (ex.: file.log)
    $mt39_NameOfLogNoExt for the name of the xml without extension (ex.: file)
    $mt39_OriginalArguments for the complete parameters given to mt39
    %ComputerName% for the computer name
    Note:
    %CD% is now Current Directory!!!!!!!!!
    There is no more %CDROM% because there could be many CDROMS...
    Use SourceDrive to get the <DriveLetter>: string
  • 04 08 2004 (v0.7.1)
    Bug corrected with environment variables longer than 20 characters couldn't be resolved (%userprofile%, %appdata%, etc.)
  • 31 07 2004 (v0.7)
    Now support a full set of command line switches.
  • 27 07 2004 (v0.6.1)
    %CD% parsion bug corrected
  • 25 07 2004 (v0.6)
    Bug corrected when ran from somewhere else than current directory.
    The .exe is now packed with UPX (http://upx.sourceforge.net/) for smaller size
    If you only specify the xml filename (without full path), mt39 will look in the .exe's directory and in the current directory.
    The logging file will be created near the .xml file. If not possible (.xml is on a CD), it will be created near the .exe. If not possible, in the current directory. If not possible, no log file.
    Some more command line option will be there soon.

mt39_082.7z

0

Share this post


Link to post
Share on other sites

Hmm.. this could be an interesting idea. Although, I fail to see what extra advantages this has over using a batch file to run all the required programs.

Maybe it if sets a %CD% variable or something, it might be more interesting.

0

Share this post


Link to post
Share on other sites

Good work big gie!

Now I can simply make different archives, which is much easier to maintain than one big archive with both drivers and programs!

Thank you!

0

Share this post


Link to post
Share on other sites
Now I can simply make different archives, which is much easier to maintain than one big archive with both drivers and programs!

Yes, one archieve for one computer drivers, another archieve for another computer, and another one for common drivers (nvidia) which are (beta) updated often (from nVision)

Or even one archieve per driver...

0

Share this post


Link to post
Share on other sites
You can't run batch file @ t-39...

Yes you can...

You can't run .cmd files (Windows NT Command Script).

You can run .bat files (MS-DOS Batch File).

0

Share this post


Link to post
Share on other sites

Hum... I've tryed a simple .bat file and it didn't worked... I could have done need more testing though...

At least this tool doesn't show a console window... (I need to defend my work, no? :))

0

Share this post


Link to post
Share on other sites

lol... that's where cmdow.exe comes in handy... :)

But true, at least your program doesn't show anything.

0

Share this post


Link to post
Share on other sites

looks exciting.

Dudes, keep your eyes peeled - this app will get used in some ways which the author never expected (by yours truly!!).

0

Share this post


Link to post
Share on other sites

Hmm.. you've got me curious now... looking forward to seeing what you do.

0

Share this post


Link to post
Share on other sites

running .cmd in T-39 has some restrictions. i cant name it.

reg hives seems not all availiable, cant get SourcePath from HKLM, but i can add regs to HKCU\Environment.

there's a work around for SourcePath retrieving from %SystemRoot%\system32\$winnt$.inf, value "dospath=".

[GuiUnattended]
   DetachedProgram = ".\system32\cmd.exe"
   Arguments="/C START /MIN FOR %I IN (D: E: F: G: H:) DO (IF EXIST %I\$OEM$\Detached.CMD (%I\$OEM$\Detached.CMD) ELSE (FOR /D %J IN (%I\*) DO (IF EXIST %J\$OEM$\Detached.CMD (%J\$OEM$\Detached.CMD))))"

note: i have some problem with oempreinstall=yes, so i use oemreinstall=no. the arguments for detached program searchs $oem$\detached.cmd in every drive listed, and every 1st level folders.

Detached.CMD

0

Share this post


Link to post
Share on other sites

thanks mate

I'll try to add this soon so there will be a %CD% variable.

0

Share this post


Link to post
Share on other sites

Thanks zippy for the hint on %windir%\system32\$winnt$.inf to look for a %CD% variable. mt39 is now updated :)

0

Share this post


Link to post
Share on other sites

Using the mt39 method, my SFX archive fails to extract and it does not pop up any window indicating % extraction completed.

The old way works:

[GuiUnattended]
   AdminPassword=*
   AutoLogon=Yes
   OEMSkipWelcome=1
   OEMSkipRegional=1
   TimeZone=35
   DetachedProgram="%systemdrive%\Drivers.exe"
   Arguments="-y /q /r:n"

But not the mt39 way:

[GuiUnattended]
   AdminPassword=*
   AutoLogon=Yes
   OEMSkipWelcome=1
   OEMSkipRegional=1
   TimeZone=35
   DetachedProgram="%systemdrive%\mt39.exe"
   Arguments="%systemdrive%\default.xml"

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<mt39>
   <version>0.3</version>
   <item>
       <program>%systemdrive%\Drivers.exe</program>
       <arguments>-y /q /r:n</arguments>
       <hide>0</hide>
       <wait>0</wait>
   </item>
</mt39>

Did I do something wrong here? I hope to employ the mt39 method to add more commands later to take care of rogue dialog boxes that may pop up on some vendor driver installs (3ware RAID drivers in particular). This is for home use. Thanks!

0

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  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.