Jump to content

7z SFX Modified Module and Tools


Oleg_Sch

Recommended Posts

: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

Link to comment
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

Link to comment
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"

Link to comment
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

Link to comment
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.

Link to comment
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
Link to comment
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.

Link to comment
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

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

  • 2 weeks later...

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

Link to comment
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).

Link to comment
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
Link to comment
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...