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
458 replies to this topic

#251
myselfidem

myselfidem

    Member

  • Member
  • PipPipPipPipPipPipPipPip
  • 2,559 posts
  • Joined 06-January 10
  • OS:Windows 7 x64
  • Country: Country Flag
You need to create a config.bat to have your .exe file for silent installation!

Rename your run.cmd as config.bat and launch this batch file!

You will have your .exe file!

*Edit: just add the switch /h inside config.txt for the hiden files!
like this:

;!@Install@!UTF-8!
GUIMode="2"
RunProgram="hidcon:cmd /c xcopy %%T\\*.* %SYSTEMDRIVE%\\ /s /e /i /y /h"
;!@InstallEnd@!

Tested and works fine!
Of course you need to choose Show hiden files and folders to see your files on C:\ drive!

Edited by myselfidem, 20 June 2011 - 05:09 AM.

For Windows 7 OS: SetProductKey.rar (fr-FR/en-US. Integrate keys).


How to remove advertisement from MSFN

#252
eltunisie

eltunisie

    Newbie

  • Member
  • 16 posts
  • Joined 17-February 11
  • OS:XP Pro x86
  • Country: Country Flag

You need to create a config.bat to have your .exe file for silent installation!

Rename your run.cmd as config.bat and launch this batch file!

You will have your .exe file!

*Edit: just add the switch /h inside config.txt for the hiden files!
like this:

;!@Install@!UTF-8!
GUIMode="2"
RunProgram="hidcon:cmd /c xcopy %%T\\*.* %SYSTEMDRIVE%\\ /s /e /i /y /h"
;!@InstallEnd@!

Tested and works fine!
Of course you need to choose Show hiden files and folders to see your files on C:\ drive!


thanks
but not work :(
:blushing: pls can you make this files to exe ?????????????? :)

#253
myselfidem

myselfidem

    Member

  • Member
  • PipPipPipPipPipPipPipPip
  • 2,559 posts
  • Joined 06-January 10
  • OS:Windows 7 x64
  • Country: Country Flag
Ok!
You can try this one I've tested like you want!

Just double-click on the .exe file to launch the program and see immediately the result on your C:\ drive

Edited by myselfidem, 15 June 2012 - 02:20 PM.

For Windows 7 OS: SetProductKey.rar (fr-FR/en-US. Integrate keys).

#254
gora

gora

    Member

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

RunProgram="hidcon:cmd /c xcopy %%T\\*.* %SYSTEMDRIVE%\\ /s /e /i /y /h"

This is an incorrect line

Variable %%T can contain spaces
Correctly written as:
RunProgram="hidcon:cmd /c xcopy *.* %SYSTEMDRIVE%\\ /s /e /i /y /h"
or so:
RunProgram="hidcon:cmd /c xcopy \"%%T\\*.*\" %SYSTEMDRIVE%\\ /s /e /i /y /h"
2 eltunisie
Write a line:
RunProgram="cmd /k xcopy \"%%T\\*.*\" %SYSTEMDRIVE%\\ /s /e /i /y /h"
and see the output into the console window

PS
Update module, you have very old

#255
myselfidem

myselfidem

    Member

  • Member
  • PipPipPipPipPipPipPipPip
  • 2,559 posts
  • Joined 06-January 10
  • OS:Windows 7 x64
  • Country: Country Flag

RunProgram="hidcon:cmd /c xcopy %%T\\*.* %SYSTEMDRIVE%\\ /s /e /i /y /h"

This is an incorrect line

Variable %%T can contain spaces
Correctly written as:
RunProgram="hidcon:cmd /c xcopy *.* %SYSTEMDRIVE%\\ /s /e /i /y /h"
or so:
RunProgram="hidcon:cmd /c xcopy \"%%T\\*.*\" %SYSTEMDRIVE%\\ /s /e /i /y /h"

Thanks :)

The two methods works fine for me, but I think it's better to write like your example above: \"%%T\\*.*\"

@eltunisie

download link updated with the new config.txt:

http://www.mediafire.com/?3s43j1jw65ycd

*Edit: file updated and moved

Edited by myselfidem, 21 June 2011 - 01:26 AM.

For Windows 7 OS: SetProductKey.rar (fr-FR/en-US. Integrate keys).

#256
eltunisie

eltunisie

    Newbie

  • Member
  • 16 posts
  • Joined 17-February 11
  • OS:XP Pro x86
  • Country: Country Flag
:D thanks thanks :thumbup :thumbup :thumbup :thumbup :thumbup :thumbup
and i used this code
----------------------------------------------------------------
;!@Install@!UTF-8!
GUIMode="2"
RunProgram="hidcon:cmd /c xcopy \"%%T\\*.*\" %SYSTEMDRIVE%\\ /s /e /i /y /h /r /k"
;!@InstallEnd@!
------------------------------------------------------------------------------------
this is good code

#257
vonmillhausen

vonmillhausen
  • Member
  • 3 posts
  • Joined 22-June 11
  • OS:none specified
  • Country: Country Flag
Hi guys,

Is it possible to get 7zSfx to exit with the same return code as an executable it runs?

For example, say I have a 7zSfx archive, with a file called setup.exe inside it, and the archive is configured to run setup.exe using RunProgram. If setup.exe exited with return code 1, is there a way to get the 7zSfx executable to also exit with return code 1?

I am pushing out a 7zSfx compressed installer to some machines using Altiris, and Altiris uses the return code to detect if the installer completed successfully. Right now it's always receiving return code 0 from the 7zSfx executable, even if the bundled setup.exe file exits with a non-zero return code, making it impossible for me to generate reports on the success rate of the installation.

Cheers,

John

#258
gora

gora

    Member

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

For example, say I have a 7zSfx archive, with a file called setup.exe inside it, and the archive is configured to run setup.exe using RunProgram. If setup.exe exited with return code 1, is there a way to get the 7zSfx executable to also exit with return code 1?

The module always returns its own return code.
Return code from internal exe files can be stored in an external file only.
For example:
RunProgram="hidcon:cmd /c setup.exe & %ErrorLevel% > %SYSTEMDRIVE%\\errorcode.txt"


#259
vonmillhausen

vonmillhausen
  • Member
  • 3 posts
  • Joined 22-June 11
  • OS:none specified
  • Country: Country Flag

The module always returns its own return code.
Return code from internal exe files can be stored in an external file only.
For example:

RunProgram="hidcon:cmd /c setup.exe & %ErrorLevel% > %SYSTEMDRIVE%\\errorcode.txt"


Thanks Gora! Unfortunately Altiris just uses the return code, I can't get it to check the contents of a file. I might download the source from SVN and modify it for my own purposes to capture and report the internal executable's return code.

Cheers,

John

#260
visegrip

visegrip

    Newbie

  • Member
  • 36 posts
  • Joined 19-October 08
To Oleg or gora, mostly,
Can you post a list of function and feature differences between versions 1.4.1.2100 and 1.5.0.2100 of the modified module?
I have tried google search and translate for the OSZone forum but haven't quite got the differences yet.

I would like to know what the 1.5 version line can do that the 1.4 line cannot do.
Appreciate any help you can post on this.

#261
gora

gora

    Member

  • Member
  • PipPip
  • 151 posts
  • Joined 09-August 07
  • OS:Windows 7 x64
  • Country: Country Flag
When you see the version 1.5, version 1.4 is frozen (1.4-RC1 (build 1898) 10/08/10). Version 1.4 is fixing bugs and recompileon the basis of the source new stable versions of the archiver 7-zip only.
After this date may appear new in version 1.5. See for details the history of version (1.5 since version 1.5 develop (build 1794) 26/06/10)

PS
I always use the latest beta version. The latest beta version always has a full set of features described in the Help file and its reliability does not yield a stable version.

Edited by gora, 30 June 2011 - 08:13 AM.


#262
visegrip

visegrip

    Newbie

  • Member
  • 36 posts
  • Joined 19-October 08
Thanks gora,
I just looked through the log for 1.5.0.2100 from revision 1 - 80 and make out four feature additions:

1."waitall" prefix ('wait all childs' of the executed process)
2. MiscFlag '4' - run as administrator
3. BeginPrompt timeout
4. New module variable %%P - OS platform

Also, one initial addition has been removed:
Deletion of redefined config parameters "Parameter=-"

As far as differences from version 1.4.1.2100, is this list correct and complete?
Thanks again.

#263
gora

gora

    Member

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

As far as differences from version 1.4.1.2100, is this list correct and complete?

1.5 beta (build 2088) 16/04/11
# Dialogue '-sfxversion'

1.5 alpha (build 1978) 12/27/10
# Changed the logic in the switch '-!', removed forced the leading space

1.5 alpha (build 1951) 30/11/10
+ Displaying the support volume (switch '-sfxversion')

1.5 alpha (build 1948) 27/11/10
+ Support volume
+ Option 'VolumeNameStyle' in the configuration file

1.5 alpha (build 1937) 11/16/10
+ Support for encryption of archives
+ Options 'PasswordTitle' and 'PasswordText' in the configuration file
+ Switch '-pX'
+ Flag 8 'MiscFlags' - the password prompt dialog after 'BeginPrompt' and 'ExtractPath' or 'BeginPrompt' + 'ExtractPath'

1.5 alpha (build 1928) 07/11/10
+ Module variable %%P - the operating system platform

1.5 alpha (build 1922) 01/11/10
# Changes related to batch build

1.5 develop (build 1912) 10/22/10
+ Flag 16384 'GUIFlags' to display the '&' in the texts of the dialogues

1.5 develop (build 1899) 10/09/10
# Changed processing logic of language sections

1.5 develop (build 1898) 08/10/10
+ Option 'BeginPromptTimeout' in the configuration file
+ Switch '-bptX'

1.5 develop (build 1799) 01/07/10
+ Support Windows7 PCA in the manifest

1.5 develop (build 1795) 27/06/10
+ Flag 4 'MiscFlags' to run with elevated privileges

1.5 develop (build 1794) 26/06/10
+ The prefix 'waitall' expectations for the completion of all child processes



#264
visegrip

visegrip

    Newbie

  • Member
  • 36 posts
  • Joined 19-October 08
Thanks again, gora!
Where exactly is that history file so I don't have to ask again in the future?

#265
gora

gora

    Member

  • Member
  • PipPip
  • 151 posts
  • Joined 09-August 07
  • OS:Windows 7 x64
  • Country: Country Flag
Help File -> History changes -> Beta versions

See Russian Help only!
No English help, since, none of the English-speaking users do not want to translate it into English! :(

Edited by gora, 30 June 2011 - 11:22 PM.


#266
vonmillhausen

vonmillhausen
  • Member
  • 3 posts
  • Joined 22-June 11
  • OS:none specified
  • Country: Country Flag
Hi Gora,

I had posted a question on the previous page (13) about getting the return code of an executable run by 7zSfx. I've downloaded, modified and compiled the source, but I've run into a problem linking to msvcrt.dll.

Your official released version of 7zSfx links to msvcrt.dll and not to any of the VC++ version specific MSVCrt DLL files (eg, msvcr100.dll). This is good, as it means that machines don't need to have a specific version of the VC++ Redistributable installed for 7zSfx to work on them. I want to replicate this behavior, which does not appear to be the standard for VC++ setups.

From reading about this issue, it appears to be solved by linking to a specific version of the msvcrt.lib file, one that links to msvcrt.dll and not any of the other DLL files. I've tried the version that comes with the Windows Driver Developer Kit, and although the stub compiles fine, it only executes on Windows 7 machines (appears to require the Windows 7 version of msvcrt.dll).

I see in config.cpp that you have pragma links to msvcrt.lib in "C:/Mobile/Develop/Lib/VC8/<platform>/msvcrt.lib" - could you tell me exactly what versions of msvcrt.lib those are? Are they the versions provided with VC++ 2005? My development box has VC++ 2008 (on Windows 7) so maybe that's the problem... would you by any chance be able to temporarily provide me with a download link to those two .lib files?

Failing that, if I provided you with the two extra lines of code to capture and report the return-code of the last run executable, could I persuade you to build me a custom version of the current stable LZMA 32bit stub?

Cheers!


John

Edited by vonmillhausen, 04 July 2011 - 05:24 PM.


#267
YumeYao

YumeYao

    a RyanVM.net member

  • Member
  • Pip
  • 73 posts
  • Joined 10-December 05
BUG on macro _SFX_USE_LANG. (Version 141_2100)

main.cpp
AString strSignatureBegin;
	AString strSignatureEnd;

#ifdef _SFX_USE_LANG
	CreateLanguageSignature( idSfxLang, strSignatureBegin, strSignatureEnd );
#endif // _SFX_USE_LANG
	if( ReadConfig( inStream, strSignatureBegin, strSignatureEnd, config ) == false ) /* DANGER!!!! arg2 and arg3 not inited!!!! */
	{     /* BUG!!!!! NEVER REACH HERE!!! Because ReadConfig Easily Find the Signature of NULL and consider it have found the signature. */
		if( ReadConfig( inStream, kSignatureConfigStart, kSignatureConfigEnd, config ) == false )
		{
			SfxErrorDialog( FALSE, ERR_READ_CONFIG );
			return ERRC_READ_CONFIG;
		}
	}
This code will leave strSignatureBegin and strSignatureEnd not initialized and therefore the sfx doesn't work.



The fix I'm using:
#ifdef _SFX_USE_LANG
	AString strSignatureBegin;
	AString strSignatureEnd;

	CreateLanguageSignature( idSfxLang, strSignatureBegin, strSignatureEnd );
	if( ReadConfig( inStream, strSignatureBegin, strSignatureEnd, config ) == false )
	// if fall through
#endif // _SFX_USE_LANG
	if( ReadConfig( inStream, kSignatureConfigStart, kSignatureConfigEnd, config ) == false )
	{
		SfxErrorDialog( FALSE, ERR_READ_CONFIG );
		return ERRC_READ_CONFIG;
	}


#268
YumeYao

YumeYao

    a RyanVM.net member

  • Member
  • Pip
  • 73 posts
  • Joined 10-December 05

Hi Gora,

I had posted a question on the previous page (13) about getting the return code of an executable run by 7zSfx. I've downloaded, modified and compiled the source, but I've run into a problem linking to msvcrt.dll.

Your official released version of 7zSfx links to msvcrt.dll and not to any of the VC++ version specific MSVCrt DLL files (eg, msvcr100.dll). This is good, as it means that machines don't need to have a specific version of the VC++ Redistributable installed for 7zSfx to work on them. I want to replicate this behavior, which does not appear to be the standard for VC++ setups.

From reading about this issue, it appears to be solved by linking to a specific version of the msvcrt.lib file, one that links to msvcrt.dll and not any of the other DLL files. I've tried the version that comes with the Windows Driver Developer Kit, and although the stub compiles fine, it only executes on Windows 7 machines (appears to require the Windows 7 version of msvcrt.dll).

I see in config.cpp that you have pragma links to msvcrt.lib in "C:/Mobile/Develop/Lib/VC8/<platform>/msvcrt.lib" - could you tell me exactly what versions of msvcrt.lib those are? Are they the versions provided with VC++ 2005? My development box has VC++ 2008 (on Windows 7) so maybe that's the problem... would you by any chance be able to temporarily provide me with a download link to those two .lib files?

Failing that, if I provided you with the two extra lines of code to capture and report the return-code of the last run executable, could I persuade you to build me a custom version of the current stable LZMA 32bit stub?

Cheers!


John

Get WinDDK 2003 SP1 and use the CRT headers from it and lib (msvcrt.lib) from it.

Additionally, if you have VC6, you can use the lib from it. (But the CRT header should be from DDK 2003 SP1 or Win7 DDK for bug-free).

#269
Oleg_Sch

Oleg_Sch

    Newbie

  • Member
  • 34 posts
  • Joined 09-July 07
YumeYao, thanks
This not "danger", because strSignature* are initialized to "empty strings", but this is a "bug".
I'll fix it in next update.

#270
YumeYao

YumeYao

    a RyanVM.net member

  • Member
  • Pip
  • 73 posts
  • Joined 10-December 05
I just built a self-made version for my need yesterday and I encountered this bug so I just fixed it. It's really dangerous because people who want to turn it off will and doesn't test it will have the wrong sfx then wrong exe.

BTW, I have several suggestions( some already done by me locally) to you:
  • Dialog Version
    I see you're actually telling dialog version apart from non-dialog version by looking for the dialog resources, in other words, the code is same.
    I think you may want to let user manually add dialogs to versions other than LZMA, but this is not documented.

    Anyway, in my self-made version, I modified the code to fully disable dialogs, reducing the sfx by 1.5KB.
  • Russian
    Not to be offensive, but I don't think it's good to add them in the code, or we may need a macro to turn it off. The strings takes too much spaces.

    Also, you may think save langstrs.cpp as UTF-8, so that users using other languages can compile it without modifications.
  • RTF support on non-dialog versions
    Well, I tried adding it but failed. But I have some solutions that may work:

    Getting the Width:
    1. Set RTF Control to max width(as the window allows)
    2. Get line count. (EM_GETLINECOUNT)
    3. Set RTF Control to (it's previous width)/2
    4. Get line count, if equals to previous, goto 3, otherwise goto 5
    5. Set RTF Control to (it's previous width)-10
    6. Get line count, if equals to previous, goto 5, otherwise goto 7
    7. Set RTF Control to (it's previous width)-1
    8. Get line count, if equals to previous, goto 7, otherwise goto 9
    9. Done. Previous width(=current width + 1) is what we need.

    Getting the height:
    1. Get the text
    2. Add "\par " to the end. (There must be 2 spaces, first space is omitted because it follows a \par.)
    3. Set the text.
    4. Get line count. (EM_GETLINECOUNT)
    5. Get line index of last line(last return value -1). (EM_LINEINDEX) This index is the white space we just added.
    6. Get the position of the white space (EM_POSFROMCHAR), the y-offset is the height.
    7. Restore the text to before to not make user confusing(using arrow keys can move the cursor to the invisible white space).

Edited by YumeYao, 15 July 2011 - 12:00 AM.


#271
Oleg_Sch

Oleg_Sch

    Newbie

  • Member
  • 34 posts
  • Joined 09-July 07

Dialog Version
I see you're actually telling dialog version apart from non-dialog version by looking for the dialog resources, in other words, the code is same.
I think you may want to let user manually add dialogs to versions other than LZMA, but this is not documented.

Yes, you are right and user can manually add custom dialogs to any modules. I do not have enough time to develop, especially for documentation.

Russian
Not to be offensive, but I don't think it's good to add them in the code, or we may need a macro to turn it off. The strings takes too much spaces.

This is historical issue (if you don't know, I'm from Russia), may be later I will change this.

RTF support on non-dialog versions

More complex. I'll write PM to you in near week.

#272
skEwb

skEwb
  • Member
  • 6 posts
  • Joined 19-July 11
  • OS:Windows 7 x64
  • Country: Country Flag
Can someone please help me point out what I'm doing wrong here? These commands work fine if executed in a regular shell, however it gives this error when executed from within the SFX

Error in line 5 of configuration data:

;!@Install@!UTF-8!
OverwriteMode="1"
RunProgram="hidcon:cmd /c %APPDATA%\WhileIdle\WhileIdle.exe"
RunProgram="hidcon:cmd /c REG ADD HKLM\Software\Microsoft\Windows\CurrentVersion\Run\ /f /v Whileidle /d "\"%APPDATA%\WhileIdle\WhileIdle.exe\"""
InstallPath="%APPDATA%\WhileIdle"
GUIMode="2"
;!@InstallEnd@!

It specifically complains about this part "\"%APPDATA%\WhileIdle\WhileIdle.exe\"""

Screenshot

Edited by skEwb, 19 July 2011 - 10:42 AM.


#273
gora

gora

    Member

  • Member
  • PipPip
  • 151 posts
  • Joined 09-August 07
  • OS:Windows 7 x64
  • Country: Country Flag
;!@Install@!UTF-8!

OverwriteMode="1"

RunProgram="hidcon:cmd /c \"%APPDATA%\\WhileIdle\\WhileIdle.exe\""

RunProgram="hidcon:REG ADD HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run /f /v Whileidle /d \"\\\"%APPDATA%\\WhileIdle\\WhileIdle.exe\\\"\""

InstallPath="%APPDATA%\\WhileIdle"

GUIMode="2"

;!@InstallEnd@!



#274
skEwb

skEwb
  • Member
  • 6 posts
  • Joined 19-July 11
  • OS:Windows 7 x64
  • Country: Country Flag

;!@Install@!UTF-8!
OverwriteMode="1"
RunProgram="hidcon:cmd /c \"%APPDATA%\\WhileIdle\\WhileIdle.exe\""
RunProgram="hidcon:REG ADD HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run /f /v Whileidle /d \"\\\"%APPDATA%\\WhileIdle\\WhileIdle.exe\\\"\""
InstallPath="%APPDATA%\\WhileIdle"
GUIMode="2"
;!@InstallEnd@!


Thank you :)

The error is now fixed, however the registry entry doesn't get added, if the line is used in a shell it gives this output:

WindowsXP

C:\Documents and Settings\Administrator>REG ADD HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run /f /v Whileidle /d \"\\\"%APPDATA%\\WhileIdle\\WhileIdle.exe\\\"\

Error:  Too many command-line parameters

Windows 7:

C:\Users\Administrator>REG ADD HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run /f /v Whileidle /d \"\\\"%APPDATA%\\WhileIdle\\WhileIdle.exe\\\"\"

ERROR: Invalid key name.

Type "REG ADD /?" for usage.

My guess is that it's not supposed to work being interpreted by a standard Windows shell and only 7-Zip SFX interprets it correctly?

The program installs and triggers to execute, however, the registry entry isn't added.

Edited by skEwb, 19 July 2011 - 11:53 AM.


#275
gora

gora

    Member

  • Member
  • PipPip
  • 151 posts
  • Joined 09-August 07
  • OS:Windows 7 x64
  • Country: Country Flag
I did not check your line for availability. I gave her the syntax of the module only. Write a string to add the registry entry for a batch file which you work and adds information to the registry correctly.

PS
Syntax strings in a module and a batch file are not equal

Edited by gora, 19 July 2011 - 12:00 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users



How to remove advertisement from MSFN