Jump to content

Calling 7z.dll


Starg
 Share

Recommended Posts

Yea, i know it's been a while but I finally took a moment to knock this one out for good...

I rewrote the script into a single include that can extract files to disk in a folder of choice or into an array for diskless extraction. I also implemented trancexx's Subrogation so that this can be run from memory entirely.

Examples provided as well, it's a bit too big for forums so, here is a MEGA link...

https://mega.nz/#!MBQhDaQS!VzKgH9P6QhhAv2tQykIRWmUDyi0GVxZZA9pSIGu130c

Edit: the only catch is that I cant get LZMA, Base64, and SHA1 to work on x64, however if you remove the MemDll and subrogation bits, it will function fine on x64.

Edited by Biatu

What is what? What is what.

Link to comment
Share on other sites

When running this against DriverPacks, searching for .inf files,I keep getting inconsistent behaviour on some archives.

  • Global variables being used without being declared
  • AutoIt hard crash -1073741819
  • seems to happen with archives with a large amount of files.

Edit: DP_Monitor_17112.7z has 6372 inf files yet does not crash. however other archives containing less seem to be crashing the script. will post back with a list of these archives

Edit 2: Affected Archives:
DP_CardReader_17113.7z
DP_Chipset_17112.7z
DP_MassStorage_17111.7z
DP_Misc_17112.7
DP_Sound_CMedia_17104.7z
DP_Sound_Conexant_17113.7z
DP_Sound_Others_17112.7z
DP_Sounds_Realtek_17113.7z
DP_Telephone_17073.7z
DP_Vendor_17112.7z
DP_Video_nVIDIA-NT_17113.7z
DP_Videos_Others_17105.7z
DP_WebCam_17113.7z

Dp Source: http://download.drp.su/driverpacks/

Edited by Biatu

What is what? What is what.

Link to comment
Share on other sites

This should not happen:

"T:\Temp\Autoit\DrvMgr\Data\Source\Includes\7z.au3" (222) : ==> Variable used without being declared.:
If $_7z_Debug Then ConsoleWrite("Here0,"&VarGetType($outStream)&","&BinaryLen($outStream)&@CRLF)
If $_7z_Debug Then ConsoleWrite("Here0,"&VarGetType(^ ERROR

With this func:

Func IArchiveExtractCallback_GetStream($pSelf, $index, $outStream, $askExtractMode)
    Static $tIndices, $iCount, $iIdx, $bSubfolders
    If $pSelf = 0 Then
        $tIndices = $index
        $iCount = DllStructGetSize( $tIndices ) / 4
        $iIdx = 1
        $bSubfolders = $outStream
        Return
    EndIf
    If $iIdx <= $iCount And $index = DllStructGetData( $tIndices, 1, $iIdx ) Then
        If $_7z_Debug Then ConsoleWrite( "IArchiveExtractCallback_GetStream $index = " & $index & @CRLF)
        Local $sName,$iSize,$isDir
        $_7z_oIInArchive.GetProperty($index, $_7z_kpidPath, $sName)
        $_7z_oIInArchive.GetProperty($index, $_7z_kpidSize, $iSize)
        $_7z_oIInArchive.GetProperty($index, $_7z_kpidIsDir, $isDir)
        If $_7z_Debug Then ConsoleWrite("IArchiveExtractCallback_GetStream $sName = "  & $sName & @CRLF)
        If $_7z_ExtractMem=0 And $bSubfolders Then
            Local $sSubFolder = StringLeft( $sName, StringInStr( $sName, "\", 0, -1 ) - 1 )
            If Not FileExists( $_7z_sExtractDir & "\" & $sSubFolder ) Then _
                DirCreate( $_7z_sExtractDir & "\" & $sSubFolder )
        EndIf
        $_7z_oIOutStream = 0
        DeleteObjectFromTag($_7z_tIOutStream)
        If $_7z_Debug Then ConsoleWrite("DeleteObjectFromTag"&@CRLF)
        $_7z_oIOutStream = ObjectFromTag("IOutStream_", $tagIOutStream, $_7z_tIOutStream, Default, $_7z_sIID_IOutStream)
        If $_7z_Debug Then ConsoleWrite("ObjectFromTag:"&@Error&","&@extended&@CRLF)
        $_7z_oIOutStream.AddRef()
        If $_7z_Debug Then ConsoleWrite("oIOutStream.AddRef()"&@CRLF)
        If $_7z_ExtractMem Then
            $_7z_oIStreamOut = CreateStreamOnHGlobal()
            If $_7z_Debug Then ConsoleWrite("CreateStreamOnHGlobal: "&@Error&","&@extended&","&_WinAPI_GetLastErrorMessage()&@CRLF)
        Else
            $_7z_oIStreamOut = SHCreateStreamOnFile($_7z_sExtractDir&"\"&$sName, 0x00001000 + 2)
            If $_7z_Debug Then ConsoleWrite("SHCreateStreamOnFile: "&@Error&","&@extended&","&_WinAPI_GetLastErrorMessage()&@CRLF)
        EndIf
        If $_7z_Debug Then ConsoleWrite("Here0,"&VarGetType($outStream)&","&BinaryLen($outStream)&@CRLF)
        Local $tStruct = DllStructCreate("ptr", $outStream)
        If $_7z_Debug Then ConsoleWrite("Here0,"&@Error&@CRLF)
        If $_7z_Debug Then ConsoleWrite("Here1"&@CRLF)
        Local $Stream = $_7z_oIOutStream()
        If $_7z_Debug Then ConsoleWrite("Here2"&@CRLF)
        $_7z_oIOutStream.AddRef()
        If $_7z_Debug Then ConsoleWrite("oIOutStream.AddRef()"&@CRLF)
        DllStructSetData($tStruct, 1, $Stream)
        $iIdx += 1
        If $_7z_ExtractMem Then
            $__a7zData[0][0]+=1
            $__a7zData[$__a7zData[0][0]][0]=$sName
            $__a7zData[$__a7zData[0][0]][1]=$isDir
            If Not $isDir Then $__a7zData[$__a7zData[0][0]][2]=$iSize
            $__a7zData[0][1]=1
        EndIf
    EndIf
    If $_7z_Debug Then ConsoleWrite("Here9"&@CRLF)
    Return $S_OK
EndFunc


 

 

Edited by Biatu

What is what? What is what.

Link to comment
Share on other sites

why not? is the

$outStream

declared?

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

9 hours ago, careca said:

why not? is the


$outStream

declared?

Func IArchiveExtractCallback_GetStream($pSelf, $index, $outStream, $askExtractMode)

$outstream is in the func parameters so yes by default it is

What is what? What is what.

Link to comment
Share on other sites

  • 4 weeks later...
On 1/7/2018 at 2:02 AM, Biatu said:

$outstream is in the func parameters so yes by default it is

Are you calling this function by a hotkey, or a GUICtrlSetOnEvent?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • 3 weeks later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...