Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account



Photo

7z SFX Modified Module and Tools

- - - - -

  • Please log in to reply
463 replies to this topic

#451
ThePackager

ThePackager
  • Member
  • 6 posts
  • Joined 05-December 11
  • OS:Windows 7 x64
  • Country: Country Flag

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


  • nova-s likes this


How to remove advertisement from MSFN

#452
nova-s

nova-s
  • Member
  • 7 posts
  • Joined 06-August 14
  • OS:Windows 7 x64
  • Country: Country Flag

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, 06 August 2014 - 08:49 PM.


#453
ThePackager

ThePackager
  • Member
  • 6 posts
  • Joined 05-December 11
  • OS:Windows 7 x64
  • Country: Country Flag

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, 07 August 2014 - 07:14 AM.

  • nova-s likes this

#454
nova-s

nova-s
  • Member
  • 7 posts
  • Joined 06-August 14
  • OS:Windows 7 x64
  • Country: Country Flag

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

Attached Files


Edited by nova-s, 17 August 2014 - 06:16 PM.


#455
ThePackager

ThePackager
  • Member
  • 6 posts
  • Joined 05-December 11
  • OS:Windows 7 x64
  • Country: Country Flag

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")


#456
gora

gora

    Member

  • Member
  • PipPip
  • 152 posts
  • Joined 09-August 07
  • OS:Windows 7 x64
  • Country: Country Flag

Hi, ThePackager 

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



#457
nova-s

nova-s
  • Member
  • 7 posts
  • Joined 06-August 14
  • OS:Windows 7 x64
  • Country: Country Flag

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:\ProgramData
APPDATA=C:\Users\User\AppData\Roaming
CommonDesktop=C:\Users\Public\Desktop
CommonDocuments=C:\Users\Public\Documents
CommonProgramFiles=C:\Program Files (x86)\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMPUTERNAME=USER-PC
ComSpec=C:\Windows\system32\cmd.exe
FP_NO_HOST_CHECK=NO
HOMEDRIVE=C:
HOMEPATH=\Users\User
LOCALAPPDATA=C:\Users\User\AppData\Local
LOGONSERVER=\\USER-PC
MyDocs=C:\Users\User\Documents
MyDocuments=C:\Users\User\Documents
NUMBER_OF_PROCESSORS=1
OS=Windows_NT
Path=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;.MSC
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_ARCHITEW6432=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 42 Stepping 7, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=2a07
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files (x86)
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
PROMPT=$P$G
PSModulePath=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
PUBLIC=C:\Users\Public
SystemDrive=C:
SystemRoot=C:\Windows
TEMP=C:\Users\User\AppData\Local\Temp
TMP=C:\Users\User\AppData\Local\Temp
UserDesktop=C:\Users\User\Desktop
USERDOMAIN=User-PC
USERNAME=User
USERPROFILE=C:\Users\User
windir=C:\Windows
windows_tracing_flags=3
windows_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, 11 August 2014 - 03:35 PM.


#458
gora

gora

    Member

  • Member
  • PipPip
  • 152 posts
  • Joined 09-August 07
  • OS:Windows 7 x64
  • Country: Country Flag
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!

 



#459
nova-s

nova-s
  • Member
  • 7 posts
  • Joined 06-August 14
  • OS:Windows 7 x64
  • Country: Country Flag

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, 17 August 2014 - 06:26 PM.


#460
hessam

hessam

    Member

  • Member
  • PipPip
  • 135 posts
  • Joined 15-December 07

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



#461
nova-s

nova-s
  • Member
  • 7 posts
  • Joined 06-August 14
  • OS:Windows 7 x64
  • Country: Country Flag

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, 28 September 2014 - 07:19 AM.


#462
hessam

hessam

    Member

  • Member
  • PipPip
  • 135 posts
  • Joined 15-December 07
thanks you nova-s

#463
gora

gora

    Member

  • Member
  • PipPip
  • 152 posts
  • Joined 09-August 07
  • OS:Windows 7 x64
  • Country: Country Flag

@ nova-s

 

Here are some interesting solutions and answers to many questions.



#464
nova-s

nova-s
  • Member
  • 7 posts
  • Joined 06-August 14
  • OS:Windows 7 x64
  • Country: Country Flag

@ 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...




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users