Jump to content

.inf Run taskkill before CopyFiles


Recommended Posts


Here is the best i could come up with (Trimmed down). The "wuauclt.exe" process needs to be terminated so that the "DataStor.edb" file can be overwritten.

But this does not works because the CopyFiles is executed before the UnregisterDlls so i'm trying to find a way around this problem.

[Version]    signature="$Windows NT$"    ClassGUID={00000000-0000-0000-0000-000000000000}    SetupClass=Base    LayoutFile=layout.inf    DriverVer=07/01/2001,5.1.2600.5512[Optional Components]    MicrosoftUpdate[MicrosoftUpdate]    UnregisterDlls = Stop.MicrosoftUpdate    CopyFiles      = DataStore.Files[Stop.MicrosoftUpdate]    11,,taskkill.exe,,,"/IM ""wuauclt.exe"" /F"[DestinationDirs]    DataStore.Files = 10, "SoftwareDistribution\DataStore" DataStore.Files]    DataStore.edb, DataStor.edb, ,4
Edited by Outbreaker
Link to comment
Share on other sites

Try stopping the Windows Update service.

 

Commands like

net stop wuauserv

and to start

net start wuauserv

Or you could use sc.exe. Use sc /? at a cmd prompt for more information of use.

 

This page below shows some commands used in a cmd script. Perhaps more then you need. You can convert to inf format.

http://wuauclt.info/scripts.asp

Link to comment
Share on other sites

I have little knowledge with inf files though something like

[Stop.MicrosoftUpdate]11,,sc.exe,,,"stop wuauserv"[Start.MicrosoftUpdate]11,,sc.exe,,,"start wuauserv"
may do?
Link to comment
Share on other sites

The thing is that the "DataStore.edb" file is used by the "wuauserv" service so it needs to be stoped before i can overwrite the "DataStore.edb" file.

But no matter what i try the .inf file is always executing the CopyFiles ("DataStore.edb") before the UnregisterDlls (SC stop "wuauserv"). :crazy:

So i try to find a workaround for the .inf file to first execute a command before a copy process. :(

Edited by Outbreaker
Link to comment
Share on other sites

How are you calling your INF, Outbreaker?

I found an interesting, if hard to follow, reference years ago. Look into RunPreSetupCommands. In order to use it, you must call your INF using AdvPack.

For a usage example, tear apart an installer I built five years ago. Pull out the INF with 7-zip, or another file decompression tool.

Link to comment
Share on other sites

I'm using "ocgen.dll" not sure if i could use "advpack.dll" for an UpdatePack without messing things up. :unsure:

This .inf part is being run from the "Add/Remove Windows Components".

Edited by Outbreaker
Link to comment
Share on other sites

I'm not familiar with making things work through the components wizard. A hybrid method may still work, but I don't know how. OnePiece should know.

Edited by 5eraph
Link to comment
Share on other sites

After looking into this a little more i think this will not work because the "Add/Remove Windows Components" is using "ocgen.dll" to execute the .inf files.

Windows Registry Editor Version 5.00[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\OptionalComponents\MU]"INF"="WINXPUP.inf""Section"="MicrosoftUpdate""Installed"="1"
Edited by Outbreaker
Link to comment
Share on other sites

  • 4 weeks later...

Hi all, all UpdatePack\AddOn use the SetupApi, because in Window setup ocgen.dll use (depends on) SetupApi, but also import the RunSetupCommand from AdvPack, so to give support to diretives as RunPreSetupCommands & RunPostSetupCommands and some other special directives, which only the AdvcPack supports (named as advanced INF options, SmartReboot for example), as already said import only some Not All, for example the directive of advpack such as Un\RegisterOCXs is not supported

 

so SetupApi mod

[Version]    signature="$Windows NT$"[DefaultInstall]    UnregisterDlls = Kill.Process    CopyFiles      = Copy.Files[Kill.Process]    11,,taskkill.exe,,,"/IM ""Name.exe"" /F";; Copy.Files etc etc[Copy.Files]

advpack mod (rundll32.exe advpack.dll,LaunchINFSection %Path%\FileName.inf)

[Version]    signature="$Windows NT$"[DefaultInstall]    RunPreSetupCommands = Kill_Process:1    CopyFiles      = Copy.Files[Kill_Process]    %11%\taskkill.exe /IM """Name.exe""" /F;; Copy.Files etc etc[Copy.Files]

as already mentioned above ocgen supports both Un\RegisterDlls && Run(Pre\Post)SetupCommands

 

Ciao.

Edited by DXRW4E
Link to comment
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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...