• Announcements

    • xper

      MSFN Sponsorship and AdBlockers!   07/10/2016

      Dear members, MSFN is made available via subscriptions, donations and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, become a site sponsor and ads will be disabled automatically and by subscribing you get other sponsor benefits.
Oleg_Sch

7z SFX Modified Module and Tools

511 posts in this topic

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
0

Share this post


Link to post
Share on other sites

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 ?????????????? :)

0

Share this post


Link to post
Share on other sites

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
0

Share this post


Link to post
Share on other sites
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

0

Share this post


Link to post
Share on other sites
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
0

Share this post


Link to post
Share on other sites

: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

0

Share this post


Link to post
Share on other sites

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

0

Share this post


Link to post
Share on other sites
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"

0

Share this post


Link to post
Share on other sites

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

0

Share this post


Link to post
Share on other sites

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.

0

Share this post


Link to post
Share on other sites

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
0

Share this post


Link to post
Share on other sites

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.

0

Share this post


Link to post
Share on other sites
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

0

Share this post


Link to post
Share on other sites

Thanks again, gora!

Where exactly is that history file so I don't have to ask again in the future?

0

Share this post


Link to post
Share on other sites

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
0

Share this post


Link to post
Share on other sites

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
0

Share this post


Link to post
Share on other sites

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;
}

0

Share this post


Link to post
Share on other sites

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

0

Share this post


Link to post
Share on other sites

YumeYao, thanks

This not "danger", because strSignature* are initialized to "empty strings", but this is a "bug".

I'll fix it in next update.

0

Share this post


Link to post
Share on other sites

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:

  1. 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.
  2. 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.
  3. 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
0

Share this post


Link to post
Share on other sites
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.

0

Share this post


Link to post
Share on other sites

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
0

Share this post


Link to post
Share on other sites
;!@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@!

0

Share this post


Link to post
Share on other sites

;!@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
0

Share this post


Link to post
Share on other sites

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
0

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.