Jump to content

copying multiple versions with same file name to multiple target folders


BusyElf
 Share

Recommended Posts

I would like to add nircmd via true addon CAB (a great little utility by Nir Sofer) to my Win7 x64 offline image (ie for making ISO out of it later).

 

It has both x86 and x64 versions.

 

SInce i intend to use it on x64 Windows, it means that calling application (usually cmd.exe) will call the corresponding version of nircmd (x86 cmd calls x86 nircmd and respectively x64 cmd.exe calls x64 version of nircmd).

 

Now a problem : i can make a CAB file that holds both versions under different names in same folder inside CAB, but since in future i intend to add other dual-bitness applications, this will be a problem for me.

 

I have my CAB referenced in Entries.ini like so

[txtsetup_files]AddUtils.cab = 1,,,,,,_x,,3,3

Note that i have left out other relevant information to make this post short and to the point.

 

I would like to package both versions of nircmd in CAB file under different subdirectories, like so :

MYCABFILE.CAB   < CAB file itself\X86VER\nircmd.exe  < first version in subdirectory\X64VER\nircmd.exe < second version in other subdirectory

I was reading INF reference documentation on MS site and it mentions multiple directories, but it is unclear to me if the above is possible.   There are two descriptions that don't explain this well enough :

[SourceDisksNames]diskid = disk-description[,[tag-or-cab-file],[unused],[path],[flags][,tag-file]]

I don't know if "path" part refers to my above case of subdirectories in CAB file or some other location.

 

Second one is

[SourceDisksFiles]filename=diskid[,[ subdir][,size]]

Also, i'm not sure to what "subdir" points to.

 

 

I was trying to find other true addons as examples (so far, they have been useful), and closest one is for Notepad2, similar to what i need, but it either copies x86 or x64 version (as defined in section names), and i need BOTH versions of nircmd.exe to be copied in their respective directories (%SystemRoot%\System32 and %SystemRoot%\SysWOW64).

 

I hope i haven't overcomplicated my post, i just wanted to be as specific as possible.

Link to comment
Share on other sites

I posted in this sub-forum to ask for help on integrating files directly in windows image, no post-install workarounds. All files in my CAB need to be present in their target locations as early as possible, at least during setup phase (i'm also using unattended setup).

 

I was using XP/nLite before this so i have expirience with making addons and i'm biased toward using this method.

 

I could experiment with before mentioned path definitions in .INF files and test by doing DXTi integration, and leaving image mounted, then have a look inside mount directory, but i would really like to avoid as it can take time (each add,remove and re-commit).

Edited by BusyElf
Link to comment
Share on other sites

Hi BusyElf, the inf setup and all other microsoft setup (like Windows Installer) do not support subdirectory inside cab archive, but it supports anything else so you do not need to do so that is not the most efficient and useful mod, so for this reason Microsoft does not use it, the alternatives are many (I do not know if nLite\RVMi support them I think not, but the DX WinNT6.x True Integrator supports all), so in INF SourceDisksNames Section

 

path

This optional value specifies the directory path on the distribution disk that contains source files. The path is relative to the installation root and is expressed as \dirname1\dirname2... and so forth. If this value is omitted from an entry, files are assumed to be in the installation root of the distribution disk.

You can use an INF SourceDisksFiles section to specify subdirectories, relative to a given path directory, that contain source files. However, tag files and cabinet file must reside either in the given path directory or in the installation root.

and in INF SourceDisksFiles Section

Examples

The following example shows a SourceDisksNames section and a corresponding SourceDisksFiles section.

 

[SourceDisksNames];; diskid = description[, [tagfile] [, <unused>, subdir]];1 = %Floppy_Description%,,,\WinNT[SourceDisksFiles.x86]aha154x.sys = 1,\x86 ; on distribution disk 1, in subdir \WinNT\x86; ...

so Mod 1 (nLite\RVMi support it)

2v8232t.jpg

Mod 2

zipnol.jpg

Mod 3

oa0owp.jpg

in poor words with Inf Setup you can do every everything, and even perfectly and safe, in the end is a Microsoft thing ehhhh

anyway see also how WinRAR True AddOn install the theme from Entries.ini, that an easy way, but not as useful as INF SourceDisksFiles because INF SourceDisksFiles check recent\version file ect ect

ahhh in x64 Setup for x32 files use DirId 16425 (16425 = %SystemRoot%\system32 ;OR %SystemRoot%\SysWOW64 in X64), as i said before inside all True AddOns find all possible examples

Ciao.

Link to comment
Share on other sites

Sooo. i've look at the examples, and the moment i looked at third one for CCleaner i will quote great minds of our time : "A-HA!"

 

OnePiece, you rule !

 

[EDIT: i replied the moment i saw your post and missed the "Mod 3" note, art can't be rushed :)]

Edited by BusyElf
Link to comment
Share on other sites

Umm OnePiece i need more help !

 

I have defined multiple diskid's in [sourceDisksNames] with above mentioned subdirectories, so same file names do not collide and have referenced them in [sourceDisksFiles] with filename=diskid pairs.

 

Now i have one final problem :

 

I have CopyFiles directive in my custom install section [utilities] and i do not know how to reference a specific version among files with same name but different subdirectory in CAB install root.

 

Config for clarification (with problem at end)

;custom named section, this could be DefaultInstall as well[Utilities]CopyFiles = files_x86, files_x64;directory targets for CopyFiles[DestinationDirs]files_x86 = 16425files_x64 = 16421;subdirectories inside files CAB addon[SourceDisksNames]1="MyFiles","MYFILES.cab",,"X86VER\nircmdc.exe"2="MyFiles","MYFILES.cab",,"X64VER\nircmdc.exe";references to files and their sources in CAB[SourceDisksFiles]NIRCMDC.EXE=1NIRCMDC.EXE=2;OOOPS ! Now what to do ? CopyFiles section referenced above has defined everything but here i hit a wall.;How does windows optional components installer know WHICH file i reference ???;At best, it will mix up 86 and x64 versions, at worst it will completely mess up OS setup[files_x86]nircmdc.exe,NIRCMDC.EXE[files_x64]nircmdc.exe,NIRCMDC.EXE 

Ok i hope i explained this well. I know that .x86 and .amd64 suffixes in section names can remove this ambiguity but i would need both x86 and x64 versions of files to be copied.

 

Example:

[files_to_copy_from_CAB_source.x86]nircmdc.exe,NIRCMDC.EXE[files_to_copy_from_CAB_source.amd64]nircmdc.exe,NIRCMDC.EXE

But this will copy only one of them, depending on OS architecture used in setup. I need both.

Link to comment
Share on other sites

[Version]    signature="$Windows NT$"[NirSoft.ntx86]    CopyFiles     = NirSoft.x86.System.Files    AddReg        = Uninstall.AddReg[NirSoft.ntamd64]    CopyFiles      = NirSoft.x86.System.Files, NirSoft.amd64.System.Files    AddReg         = Uninstall.AddReg[NirSoft.x86.System.Files]    NirCmd.chm, , ,32    nircmd.exe, , ,32    nircmdc.exe, , ,32[NirSoft.amd64.System.Files]    NirCmd.chm, , ,32    nircmd.exe, , ,32    nircmdc.exe, , ,32[DestinationDirs]    NirSoft.x86.System.Files   = 16425    NirSoft.amd64.System.Files = 11    DefaultDestDir             = 17[SourceDisksNames.x86]    1="NirSoft Files","WINNT6",,"\x86"[SourceDisksNames.amd64]    2="NirSoft x64 Files","WINNT6",,"\amd64"[SourceDisksFiles.x86]    NirCmd.chm=1,,45977    nircmd.exe=1,,44032    nircmdc.exe=1,,43520[SourceDisksFiles.amd64]    NirCmd.chm=2,,45977    nircmd.exe=2,,115712    nircmdc.exe=2,,113664[Uninstall.AddReg]    ;   Used during remove    HKLM,"%KEY_WIN_CURVER%\Uninstall\NirSoft"    ;   Used during install    HKLM,"%KEY_WIN_CURVER%\Uninstall\NirSoft","DisplayIcon", ,"%11%\NirSoft.exe"    HKLM,"%KEY_WIN_CURVER%\Uninstall\NirSoft","DisplayName", ,"NirSoft %NirSoft_ProductVersion%"    HKLM,"%KEY_WIN_CURVER%\Uninstall\NirSoft","DisplayVersion", ,"%NirSoft_ProductVersion%"    ;HKLM,"%KEY_WIN_CURVER%\Uninstall\NirSoft","Language", ,"%LanguageId%"    HKLM,"%KEY_WIN_CURVER%\Uninstall\NirSoft","OnlineVersion", ,"%NirSoft_ProductVersion%"    HKLM,"%KEY_WIN_CURVER%\Uninstall\NirSoft","Publisher", ,"Nir Sofer."    ;HKLM,"%KEY_WIN_CURVER%\Uninstall\NirSoft","UninstallString", ,"%11%\uninst.exe"    HKLM,"%KEY_WIN_CURVER%\Uninstall\NirSoft","UninstallString", ,"rundll32.exe advpack.dll,LaunchINFSection %17%\NirSoft.inf,DefaultUninstall"    HKLM,"%KEY_WIN_CURVER%\Uninstall\NirSoft","URLInfoAbout", ,"http://www.nirsoft.net/"    ;HKLM,"%KEY_WIN_CURVER%\Uninstall\NirSoft","SystemComponent",%REG_DWORD%,"1"    HKLM,"%KEY_WIN_CURVER%\Uninstall\NirSoft","ParentKeyName", ,"OperatingSystem"    HKLM,"%KEY_WIN_CURVER%\Uninstall\NirSoft","ParentDisplayName", ,"%PARENT_DISPLAY_NAME%"[DefaultUninstall]    BeginPrompt         = BeginUnInsPrompt    RunPreSetupCommands = Stop_NirSoft:1    DelFiles            = NirSoft.x86.System.Files, NirSoft.amd64.System.Files    DelReg              = Uninstall.AddReg    EndPrompt           = EndUnInsPrompt[Stop_NirSoft]    TASKKILL /F /IM nircmd.exe    TASKKILL /F /IM nircmdc.exe[BeginUnInsPrompt]    Title      = %PROG_NAME% Uninstaller    Prompt     = %UnInsPrompt%    ButtonType = YESNO ;<- YESNO or OKCANC[EndUnInsPrompt]    Prompt        = %EndUnInsPrompt%[DefaultInstall.ntx86]    CopyFiles    = @NirSoft.inf, NirSoft.x86.System.Files    AddReg      = Uninstall.AddReg[DefaultInstall.ntamd64]    CopyFiles    = @NirSoft.inf, NirSoft.x86.System.Files, NirSoft.amd64.System.Files    AddReg      = Uninstall.AddReg[Strings]    KEY_WIN_CURVER             = "Software\Microsoft\Windows\CurrentVersion"    NirSoft_ProductVersion     = "1.0.0"    PROG_NAME                  = "NirSoft"    REG_EXPAND_SZ=0x00020000    REG_SZ=0x00000000    REG_DWORD=0x00010001    REG_BINARY=0x00000001    REG_MULTI_SZ = 0x00010000    REG_DWORD_NOCLOBBER = 0x00010003    Reg_SZ_NOCLOBBER = 0x00000002    REG_BINARY_NOCLOBBER = 0x00000003    REG_MULTI_SZ_APPEND = 0x0001000A    REG_MULTI_SZ_NOCLOBBER = 0x00010002    REG_MULTI_SZ_DELVAL = 0x00010006    REG_ADDREG_APPEND = 0x00010008    REG_EXPAND_SZ_NOCLOBBER = 0x00020002    REG_NONE = 0x00020001    VALUE_NOT_SET = 0x00000010    VALUE_NOT_SET_NOCLOBBER = 0x00000012    ;Localizable    LANGNAME            = "English"    LanguageId          = "1033"    NirSoftTip          = "Freeware Utilities for Windows "    PARENT_DISPLAY_NAME = "Optional Components"            ;"Windows XP - Software Updates"    UnInsPrompt         = "Are you sure you want to remove NirSoft from your computer?"    EndUnInsPrompt      = "NirSoft was successfully removed from your computer."

See example (Remember NirSoft_True_AddOn.cab (Also like structure) is more Ok)

NirSoft_True_AddOn_WinNT6.x_Only.cab (for WinNT6.x Vista/Seven/8/10/NEXT with WinNT6.x True Integrator)

NirSoft_True_AddOn.cab (for WInNT5.x XP\2003 with nLite\RVMI and WinNT6.x Vista/Seven/8/10/NEXT with WinNT6.x True Integrator)

 

Ciao.

NirSoft_True_AddOn_WinNT6.x_Only.cab

NirSoft_True_AddOn.cab

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...