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. 


Oleg_Sch

7z SFX Modified Module and Tools

Recommended Posts

Hello nova-s,

The issue looks to be that you are using 32 bit 7z sfx. This results in a 32 bit environment/cmd prompt being used and in turn the calls to (System32, Program Files, PowerShell modules, registry, etc...) get redirected to the 32 environment equivalents (SysWOW64, Program Files (x86), etc...). There are 2 options I can recommend.

  1. Switch to the 64 bit sfx module.
    1. This is the most thorough but the sfx will not work on 32 bit systems.
  2. for the" System32" issue, you can use a reference called "%sysNative%". This is a backdoor to the System32 dir for Windows 2008 x64 and newer.
    1. The sfx command will not run on 32 bit systems since "%sysNative%" does not exist there (though the sfx will be runable).
    2. If creative enough, you may be able to call the 64 bit cmd.exe and execute a separate bat. Though tracking and or interacting with activities may be hard.
    3. The "Program Files" issue can be addressed by using "%SYSTEMDRIVE%\Program Files".

I hope this helps,

ThePackager

  • Upvote 2

Share this post


Link to post
Share on other sites

thx for the quick reply!

 

i already had tried

attrib -s -h -r %SYSTEMROOT%\sysnative\drivers\etc\hosts

 

same result with %sysnative% - too bad

 

the only way i see now to have a 32/64bit version in one file would be to make a 32bit sfx containing two more sfx-files and depending on %PROCESSOR_ARCHITECTURE% start the next one - what a pain

 

the sfx itself should be constructed like that...

Edited by nova-s

Share this post


Link to post
Share on other sites

Hello nova-s,

Sorry it did not work. I tested on my side and it worked (Windows 8.1 and Windows 2008 R2 x64.). What OS are you using?

attrib -s -h -r %SYSTEMROOT%\sysnative\drivers\etc\hosts

I would recommend simulating the environment. For simulating, in the cmd prompt switch to 32 bit mode. "C:\Windows\SysWOW64\cmd.exe", then run your commands. From what I see, %PROCESSOR_ARCHITECTURE% will report back x86 and not AMD64. to check, run this.

FOR /F "TOKENS=3 DELIMS=: " %%A IN ('SYSTEMINFO ^| FINDSTR /B /C:"System Type"') DO (IF /I "%%A" EQU "x64-based" (echo "64bit") ELSE (echo "32bit"))

Let me know how it turns out,

ThePackager

Edited by ThePackager
  • Upvote 1

Share this post


Link to post
Share on other sites

well, i tried it on any version vista and above including 8.1 (but no server versions)

 

i think i found a smart solution:

since it is only that 1 command which doesn't work in my scripts on 64bit, i will make a 64bit-sfx with only that command inside and call it at the needed point.

 

but i'm going to sleep now, i will edit this post with results

 

EDIT: it finally works like that :yes:

 

what is the smartest way to find out if a 32bit-sfx is running on a 64bit system since all the variables have 32bit values?

[solved] - see "example.bat" in attachement below, working inside 32bit-sfx and also outside on 32/64bit systems

 

EDIT2: i attach my "64bit version" of attrib.exe - it receives parameters as usual

you can easy edit (with 7zip) the inside .cmd to your desired 64bit command

several commands will compress perfect as expected with 7zip :D

 

this post is outdated!

better and easier solution HERE

attrib64.7z

Edited by nova-s

Share this post


Link to post
Share on other sites

There are 2 ways I can think of. Note these commands will only run in a bat. To run outside of a bat replace %% with % and replace "%~DP0" withe the path to the sfx.

  1. Most thorough though takes some time.
    FOR /F "TOKENS=3 DELIMS=: " %%A IN ('SYSTEMINFO ^| FINDSTR /B /C:"System Type"') DO (IF /I "%%A" EQU "x64-based" (echo Running "64bit" & "%~DP064.exe") ELSE (echo Running "32bit" & "%~DP032.exe"))
  2. Less thorough but quicker and cleaner.

    IF EXIST "%SYSTEMDRIVE%\Program Files (x86)" (echo Running "64bit" & "%~DP064.exe") ELSE (echo Running "32bit" & "%~DP032.exe")

Share this post


Link to post
Share on other sites

Hi, ThePackager 

See variable module %SfxVarSystemPlatform% - operating system platform; takes values ​​x86 and x64 depending on the bit OS

Share this post


Link to post
Share on other sites

thanks again ThePackager and also thanks to gora - you both have pointed me to the right direction :thumbup

 

i don't have the variable %SfxVarSystemPlatform% within 32bit-sfx, but if i use the command "set" i get on 64bit:

C:\Users\User\AppData\Local\Temp\7ZipSfx.000>set(many 7zSfxStrings)ALLUSERSPROFILE=C:\ProgramDataAPPDATA=C:\Users\User\AppData\RoamingCommonDesktop=C:\Users\Public\DesktopCommonDocuments=C:\Users\Public\DocumentsCommonProgramFiles=C:\Program Files (x86)\Common FilesCommonProgramFiles(x86)=C:\Program Files (x86)\Common FilesCommonProgramW6432=C:\Program Files\Common FilesCOMPUTERNAME=USER-PCComSpec=C:\Windows\system32\cmd.exeFP_NO_HOST_CHECK=NOHOMEDRIVE=C:HOMEPATH=\Users\UserLOCALAPPDATA=C:\Users\User\AppData\LocalLOGONSERVER=\\USER-PCMyDocs=C:\Users\User\DocumentsMyDocuments=C:\Users\User\DocumentsNUMBER_OF_PROCESSORS=1OS=Windows_NTPath=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSCPROCESSOR_ARCHITECTURE=x86PROCESSOR_ARCHITEW6432=AMD64PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 42 Stepping 7, GenuineIntelPROCESSOR_LEVEL=6PROCESSOR_REVISION=2a07ProgramData=C:\ProgramDataProgramFiles=C:\Program Files (x86)ProgramFiles(x86)=C:\Program Files (x86)ProgramW6432=C:\Program FilesPROMPT=$P$GPSModulePath=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PUBLIC=C:\Users\PublicSystemDrive=C:SystemRoot=C:\WindowsTEMP=C:\Users\User\AppData\Local\TempTMP=C:\Users\User\AppData\Local\TempUserDesktop=C:\Users\User\DesktopUSERDOMAIN=User-PCUSERNAME=UserUSERPROFILE=C:\Users\Userwindir=C:\Windowswindows_tracing_flags=3windows_tracing_logfile=C:\BVTBin\Tests\installpackage\csilogfile.log

%PROCESSOR_ARCHITEW6432% only exists within 32bit-sfx on 64bit.

%ProgramW6432% only exists on 64bit and points to the correct program folder,

also %CommonProgramW6432%

 

i would say: all my problems are solved, thanks one more time! :thumbup

Edited by nova-s

Share this post


Link to post
Share on other sites
nova-s, on 07 Aug 2014 - 8:51 PM, said:

i don't have the variable %SfxVarSystemPlatform% within 32bit-sfx, but if i use command "set" i get on 64bit:

You have old modules, update

Quote

 

 

1.6 develop (сборка 2496) 28.05.12 * На запароленных SFX окно ввода пароля выводилось дважды (Valerkan:forum.oszone.net) * Некорректная работа ключа '-p' (gora:forum.oszone.net) + Переменные среды при работе модуля '7zSfxVarModulePlatform', '7zSfxVarSystemPlatform', '7zSfxVarSystemLanguage' – Переменная среды при работе модуля '7zSfxVarPlatform'

 

 

 for ver 1.6 develop (build 2712)

;!@Install@!UTF-8!Title="Variables %SfxVarModulePlatform% module in %%P OS"BeginPrompt="	Check of variables %SfxVarModulePlatform% module in %%P OS• Click 'OK', variables will are shown in a console window• Click 'OK', retaining [Shift], variables will be are saved  to the file %SystemDrive%\\vars_%SfxVarModulePlatform%_module_on_%%P_OS.txt"FinishMessage="The module %SfxVarModulePlatform% finished operation"SetEnvironment="cmnd=@Echo Off& Title Module - %SfxVarModulePlatform%, OS - %%P& Echo 	Module - %SfxVarModulePlatform%,	OS - %%P& Echo.& Echo Folders:&Set SfxFolder& Echo.& Echo Vars:&Set SfxVar& Echo %%^M=%%M& Echo %%^P=%%P& Echo %%^S=%%S& Echo %%^T=%%T& Set CommonD& Set MyDoc& Echo UserDesktop=%UserDesktop%& Echo."RunProgram="hidcon:cmd /c Echo"RunProgram="%%P:fm0:cmd /k %cmnd%"AutoInstall="hidcon:cmd /c Echo"AutoInstall="%%P:fm20:hidcon:cmd /c (%cmnd%)>%SystemDrive%\\vars_%SfxVarModulePlatform%_module_on_%%P_OS.txt"GUIMode="2"GUIFlags="2+4+8+16+32+2048+4096"MiscFlags="4";!@InstallEnd@!;!@Install@!UTF-8:Language:1049!Title="Переменные %SfxVarModulePlatform% модуля в %%P ОС"BeginPrompt="	Проверка переменных %SfxVarModulePlatform% модуля в %%P ОС• Нажмите 'OK', переменные будут показаны в окне консоли• Нажмите 'OK', удерживая [Shift], переменные будет  сохранены в файл %SystemDrive%\\vars_%SfxVarModulePlatform%_module_on_%%P_OS.txt"FinishMessage="Модуль %SfxVarModulePlatform% завершил работу";!@InstallEnd@:Language:1049!

 

Share this post


Link to post
Share on other sites

You have old modules, update

 

i'm using the latest stable one (1.5 build 2712) - anyway, i got it

 

EDIT: i have attached my summarized experience  :D   in that post

Edited by nova-s

Share this post


Link to post
Share on other sites

hi

i need help on config,i know how make an installer , but just for installing in one location example programfiles.

i have some other file in my 7z archive, i want copy some of them to windows folder and some in system32 folder and some of them programfiles dyring installing.is this possible?if so, please help on this config

 

thanks

Share this post


Link to post
Share on other sites

i need help on config,i know how make an installer , but just for installing in one location example programfiles.

i have some other file in my 7z archive, i want copy some of them to windows folder and some in system32 folder and some of them programfiles dyring installing.is this possible?if so, please help on this config

@ hessam

just use a .bat/.cmd file to do your desired copies, use additional lines like in config below...

 

 

@ ThePackager & gora

now i solved my 32/64bit problem much easier:

;!@Install@!UTF-8!RunProgram="x86:start.cmd"RunProgram="x64:start.cmd";!@InstallEnd@!

the very same .cmd has the desired environment, gets all systemvariables correct for the running version and also attrib command works like expected... :yes:

Edited by nova-s

Share this post


Link to post
Share on other sites

@ nova-s

 

Here are some interesting solutions and answers to many questions.

Share this post


Link to post
Share on other sites

@ nova-s

 

Here are some interesting solutions and answers to many questions.

thanks - but it is a pain to read this in google translate...

 

i just wonder why nobody told me before about this easy solution if it's so well-known...

Share this post


Link to post
Share on other sites

hello,

 

what is wrong please:

;!@Install@!UTF-8!Title="Oracle VM VirtualBox 4.3.18-r96516 x86/x64"BeginPrompt="Voulez-vous installer Oracle VM VirtualBox 4.3.18-r96516."ExtractTitle="Oracle VM VirtualBox 4.3.18-r96516"ExtractDialogText="Veuillez patienter pendant l'extraction..."FinishMessage="Oracle VM VirtualBox 4.3.18-r96516 a ete installe."MiscFlags	= "4"GUIMode="1"GUIFlags="1+8+2048"SetEnvironment="Var1=%ProgramFiles%\\Oracle\\VirtualBox\\VBoxManage.exe"SetEnvironment="Var2=%ProgramFiles%\\Oracle\\VirtualBox"SetEnvironment="Var3=VirtualBox_Extension_Pack.vbox-extpack"RunProgram="hidcon:cmd /c xcopy \"%Var3%\" \"%ProgramFiles%\\Oracle\\VirtualBox\" /i /e /y & sleep 5"RunProgram="x86:VirtualBox-4.3.18-r96516-MultiArch_x86.msi"RunProgram="x64:VirtualBox-4.3.18-r96516-MultiArch_amd64.msi"RunProgram="hidcon:cmd /c \"%Var1%\" extpack install \"%Var3%\" & sleep 5";Silent + Extpack [-ai]RunProgram="hidcon:cmd /c xcopy \"%Var3%\" \"%ProgramFiles%\\Oracle\\VirtualBox\" /i /e /y & sleep 5"AutoInstall="x86:VirtualBox-4.3.18-r96516-MultiArch_x86.msi /qn REBOOT=ReallySuppress"AutoInstall="x64:VirtualBox-4.3.18-r96516-MultiArch_amd64.msi /qn REBOOT=ReallySuppress"RunProgram="hidcon:cmd /c \"%Var1%\" extpack install \"%Var3%\" & sleep 5";Passive + Extpack [-ai1]RunProgram="hidcon:cmd /c xcopy \"%Var3%\" \"%ProgramFiles%\\Oracle\\VirtualBox\" /i /e /y & sleep 5"AutoInstall1="x86:fm20:VirtualBox-4.3.18-r96516-MultiArch_x86.msi /qb REBOOT=ReallySuppress"AutoInstall1="x64:fm20:VirtualBox-4.3.18-r96516-MultiArch_amd64.msi /qb REBOOT=ReallySuppress"RunProgram="hidcon:cmd /c \"%Var1%\" extpack install \"%Var3%\" & sleep 5";!@InstallEnd@!

xcopy doens't work, so extpack is not installed....

 

Thanks

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

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...