MultiArc - archiver plugin - troubles creating the configuration

English support forum

Moderators: white, Hacker, petermad, Stefan2

akhon
Junior Member
Junior Member
Posts: 12
Joined: 2023-01-14, 13:15 UTC

MultiArc - archiver plugin - troubles creating the configuration

Post by *akhon »

Hi,

I'm using the MultiArc 1.4.1.7+ MVV Build v.1.4.3.162 and I've troubles creating the configuration for VBK files (VeeamZIP). The tool to extract files is "Extract.exe" provided by the Veeam team and it generates this output:

Code: Select all

        0%======================50%======================100%
        *****************************************************
VM Name ------------------ Size/State ------ Date ---- Host Name ------------ 
my-virtual-machine-00001    16 GiB        03/22/2022    192.168.1.50 
The problems are:
1. For some unkown reason the output is generated as UNICODE. If I enable the debug then the output "%TEMP%\$mltwcx\zha****.tmp" contains the output with 2 BYTES for each character. Therefore as the second byte is 0x0, the output stops at each char and I can't read anything. With a fake generator (a simple echo of the text) the output is readed right. So the question is: how to disable Unicode text output? Or I can enforce to read text as Unicode?
2. How to read "16 GiB" as the size of the file?

So, please could you help me?
Thank you.

Note: My current configuration

Code: Select all

[VBK]
Archiver="%$MULTIARC%\extract.exe"
Description="VeeamZIP Extractor v1.0"
Extension=vbk
Start="^VM Name ------"
Format0="n+ zz tt dd yyyy"
List="%P -dir %AQ"
Debug=1
Note 2: I discovered another DEBUG file at "%TCMDHOME%\Plugins\wcx\MultiArc\MultiArc.VBK" but I don't know how to generate it. And the contents shows different executions like:

Code: Select all

>>>> BEGIN:14/1/2023 13:56:37

>Command executed:C:\totalcmd\Plugins\wcx\MultiArc\\Extract.exe -dir C:\my-virtual-machine-00001.vbk

Current directory : c:\

> === Archiver output begin ===



> === Archiver output end ===

> Errorlevel returned: 0 

<<<< END:14/1/2023 13:56:37
So it's clear that the output is not correctly captured. Any help?
akhon
Junior Member
Junior Member
Posts: 12
Joined: 2023-01-14, 13:15 UTC

Re: MultiArc - archiver plugin - troubles creating the configuration

Post by *akhon »

Hi,

Please I need help with the MutiArc MVV Build !!! Can you help me?






Post split from main "MultiArc - archiver plugin --- https://ghisler.ch/board/viewtopic.php?p=384101#p384101 "
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: MultiArc - archiver plugin - troubles creating the configuration

Post by *Dalai »

The only way I know to convert Unicode output to ANSI (directly in CMD) is to redirect the output to a file and then use CMD's type command to read that file:

Code: Select all

@echo off
setlocal
set "f=%TEMP%\%RANDOM%%RANDOM%.txt"
SomeCommandWithUnicodeOutput.exe >"%f%" 2>&1
type "%f%"
del "%f%"
endlocal
You can put above code into a batch file, adapt it to your needs and call that instead of directly calling extract.exe.

PS: You can run into this problem even with tools shipped with Windows (WMIC.exe's output is also UTF-16).

Regards
Dalai
Last edited by Dalai on 2023-01-23, 14:51 UTC, edited 1 time in total.
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
ZoSTeR
Power Member
Power Member
Posts: 1008
Joined: 2004-07-29, 11:00 UTC

Re: MultiArc - archiver plugin - troubles creating the configuration

Post by *ZoSTeR »

 
Here's a simple AutoIt script.

Compile as "RunExtract.exe" or whatever and put it next to the Extract.exe. It will pass any parameter to Extract.exe and return the output as ANSI.

Use it in the line "Archiver=\path\RunExtract.exe"

Content works here with

Code: Select all

Format0="n+ +z+ +* +tt dd yyyy"
Didn't try extraction yet.

Script: "RunExtract.au3"

Code: Select all

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Change2CUI=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <AutoItConstants.au3>
#include <StringConstants.au3>

$allCmd = $CmdLineRaw
$iPID = Run("extract.exe " & $allCmd, @ScriptDir, @SW_HIDE, $STDERR_MERGED)
ProcessWaitClose($iPID)
$bOutput = StdoutRead($iPID, "", True)
$sOutput = BinaryToString($bOutput, $SB_UTF16LE)
ConsoleWrite($sOutput)
akhon
Junior Member
Junior Member
Posts: 12
Joined: 2023-01-14, 13:15 UTC

Re: MultiArc - archiver plugin - troubles creating the configuration

Post by *akhon »

Thank you. I'll try the different options.
akhon
Junior Member
Junior Member
Posts: 12
Joined: 2023-01-14, 13:15 UTC

Re: MultiArc - archiver plugin - troubles creating the configuration

Post by *akhon »

Hi *ZoSTeR,

This works for format:

Code: Select all

Format0="n+ +z+ +* +tt dd yyyy"
And this for detection of starting list:

Code: Select all

Start="^VM Name -"
However, any idea convert "16 GiB" to the correct size and not 16 bytes?

I'm still fixing the UNICODE->ANSI conversion.
akhon
Junior Member
Junior Member
Posts: 12
Joined: 2023-01-14, 13:15 UTC

Re: MultiArc - archiver plugin - troubles creating the configuration

Post by *akhon »

Hi Dalai,

You scripts works... but the output continues to be UNICODE. Do you know for some "cat.exe" or similar tool that can handle unicode and enforce ANSI output?
akhon
Junior Member
Junior Member
Posts: 12
Joined: 2023-01-14, 13:15 UTC

Re: MultiArc - archiver plugin - troubles creating the configuration

Post by *akhon »

Hi,

Using the "iconv.exe" tool I can convert from UNICODE to ANSI. So this works for LISTING:

Code: Select all

[VBK]
Archiver="%$MULTIARC%bin\extract-ansi.bat"
Description="VeeamZIP Extractor v1.0.XXX"
Extension=vbk
Start="^VM Name -"
Format0="n+ +z+ +* +tt dd yyyy"
List="%P %PP -dir %AQ"
Debug=0
AskMode=0
SkipLIST=1
And the script file "extract-ansi.bat" contains:

Code: Select all

@echo off
setlocal
set "f=%TEMP%\%RANDOM%%RANDOM%.txt"
set "extract=%1%\extract.exe"
set "tool=%1%\iconv.exe"
%extract% %2 %3 %4 %5 %6 %7 %8 %9 >"%f%" 2>&1
%tool% -f UNICODELITTLE -t 437 "%f%"
del "%f%"
endlocal
But now I need to help to execute the extraction. My first test is this:

Code: Select all

Extract="%$MULTIARC%bin\extract-ansi.bat %PP -restore -vm %F %AQ %R"
But Total Commander closes and I don't see anything inside the output. Any idea?
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: MultiArc - archiver plugin - troubles creating the configuration

Post by *Dalai »

2akhon
Why

Code: Select all

set "extract=%1%\extract.exe"
set "tool=%1%\iconv.exe"
Aren't these paths static? Besides that, %1% is wrong. Positional parameters only have a single percent sign in front of the number, like you did with the call to extract.exe in the next line. And the call to both tools should be quoted to account for spaces and other separaters and special characters.

Suggestion:

Code: Select all

@echo off
setlocal
set "f=%TEMP%\%RANDOM%%RANDOM%.txt"
set "extract=%~dp0extract.exe"
set "tool=%~dp0iconv.exe"
"%extract%" %* >"%f%" 2>&1
"%tool%" -f UNICODELITTLE -t 437 "%f%"
del "%f%"
endlocal

Code: Select all

List="%P -dir %AQ"
(Haven't checked the other MultiArc parameters.)

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
ZoSTeR
Power Member
Power Member
Posts: 1008
Joined: 2004-07-29, 11:00 UTC

Re: MultiArc - archiver plugin - troubles creating the configuration

Post by *ZoSTeR »

akhon wrote: 2023-01-23, 15:08 UTC However, any idea convert "16 GiB" to the correct size and not 16 bytes?
You could use Sed or PowerShell for that.

Some tips: is-there-any-sed-like-utility-for-cmd-exe

You could replace " GiB" with "000000000" to get a close enough value without extractig the real number and calculating it correctly.
User avatar
ZoSTeR
Power Member
Power Member
Posts: 1008
Joined: 2004-07-29, 11:00 UTC

Re: MultiArc - archiver plugin - troubles creating the configuration

Post by *ZoSTeR »

 
Here's a new version of the AutoIt script with "GiB" conversion to bytes.

Save as "RunExtract.au3" and compile.

Use this modified Format string since the "GiB" is gone.

Code: Select all

Format0="n+ +z+ +tt dd yyyy"
Script "RunExtract.au3"

Code: Select all

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Change2CUI=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <AutoItConstants.au3>
#include <StringConstants.au3>

$allCmd = $CmdLineRaw

$iPID = Run("extract.exe " & $allCmd, @ScriptDir, @SW_HIDE, $STDERR_MERGED)
ProcessWaitClose($iPID)
$bOutput = StdoutRead($iPID, "", True)
$sOutput = BinaryToString($bOutput, $SB_UTF16LE)

$aResult = StringRegExp($sOutput, '(\d+)\s+GiB', $STR_REGEXPARRAYFULLMATCH)
If Not @error Then
    $iSize = $aResult[1] * 1024 * 1024 *1024
	$sOutput = StringReplace($sOutput, $aResult[0], $iSize)
EndIf
ConsoleWrite($sOutput)
akhon
Junior Member
Junior Member
Posts: 12
Joined: 2023-01-14, 13:15 UTC

Re: MultiArc - archiver plugin - troubles creating the configuration

Post by *akhon »

Hi,

Using the 32bit sed.exe version from here: https://github.com/mbuilov/sed-windows :

extract-ansi.bat

Code: Select all

@echo off
setlocal
set "f=%TEMP%\%RANDOM%%RANDOM%.txt"
set "extract=%~dp0extract.exe"
set "tool=%~dp0iconv.exe"
set "sed=%~dp0sed.exe"
"%extract%" %* >"%f%" 2>&1
"%tool%" -f UNICODELITTLE -t 437 "%f%" | "%sed%" "s/ GiB/000000000/g"
del "%f%"
endlocal
MultiArc.ini

Code: Select all

[VBK]
Archiver="%$MULTIARC%bin\extract-ansi.bat"
Description="VeeamZIP Extractor v1.0.XXX"
Extension=vbk
Start="^VM Name -"
Format0="n+ +z+ +tt dd yyyy"
List="%P -dir %AQ"
Debug=0
AskMode=0
SkipLIST=1
So, now I need help to comple the extraction... Any idea? With every call using something like

Code: Select all

Extract="%P -restore -vm %F %AQ %R"
the Total Commander instance will close. Why?
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: MultiArc - archiver plugin - troubles creating the configuration

Post by *Dalai »

2akhon
You should take a step back and test the command to extract files from the archive on a CMD first and look at the results. Then use the batch file you created and look at the results again (maybe even comment out the del command).

I didn't think about extracting files when I made my batch file suggestion, but my guess is that it extracts the file from the archive to the temporary file and tries to convert the extracted file's contents with iconv afterwards. This obviously can't work properly.

You'll probably need to come up with some switch to differentiate listing archive contents and extraction in that batch file, e.g.

Code: Select all

List="%P LIST -dir %AQ"

Code: Select all

Extract="%P EXTRACT -restore -vm %F %AQ %R"

Code: Select all

@echo off
setlocal
set "f=%TEMP%\%RANDOM%%RANDOM%.txt"
set "extract=%~dp0extract.exe"
set "tool=%~dp0iconv.exe"
set "sed=%~dp0sed.exe"

set _CMD=%~1
shift /1

if "%_CMD%"=="LIST" (
    "%extract%" %1 %2 %3 >"%f%" 2>&1
    "%tool%" -f UNICODELITTLE -t 437 "%f%" | "%sed%" "s/ GiB/000000000/g"
    del "%f%"
)
if "%_CMD%"=="EXTRACT" (
    "%extract%" %1 %2 %3 %4 %5 %6
)

endlocal
The extraction part is completely guessed on my part, no idea if that's going to work at all.

[EDIT]
Just saw that there's a Debug setting in the section. Maybe enable that and take a look at the generated log file to see what the plugin does.
[/EDIT]

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
akhon
Junior Member
Junior Member
Posts: 12
Joined: 2023-01-14, 13:15 UTC

Re: MultiArc - archiver plugin - troubles creating the configuration

Post by *akhon »

Hi,

After initial tests with this:

Code: Select all

Extract="%P -restore -vm %F %AQ %R"
The tool for extraction is called. The "hack" to work (and not closing TC) is to NEVER open the console window. This seems incompatible with Windows 10 (or almost in my PC). So I need to use "[MultiArc] ConMode=0".

So now the Virtual Machine is unpacked. However, not in the right way. The "extract.exe" tool seems that generates a more large folder name when extracting. For example, if the listing shows "My-Windows-7" as the filename (VM in fact); then the extraction is generating the folder "My-Windows-7(25)" in the temporal subdirectory (aka "%TEMP%\$mltwcx"). Therefore, after finish it the plugin (or TC) shows an error about disk.

Any idea to fix this?
akhon
Junior Member
Junior Member
Posts: 12
Joined: 2023-01-14, 13:15 UTC

Re: MultiArc - archiver plugin - troubles creating the configuration

Post by *akhon »

Hi dalai,

Thank you for your response. I'm catching the different modes inside the script... in this way:

Code: Select all

@echo off
setlocal
set "f=%TEMP%\%RANDOM%%RANDOM%.txt"
set "extract=%~dp0extract.exe"
set "tool=%~dp0iconv.exe"
set "sed=%~dp0sed.exe"

if "%1"=="-dir" goto LIST
if "%1"=="-restore" goto EXTRACT
goto END

:LIST
"%extract%" %* >"%f%" 2>&1
"%tool%" -f UNICODELITTLE -t 437 "%f%" | "%sed%" "s/ GiB/000000000/g"
del "%f%"
goto END

:EXTRACT
"%extract%" %* >"%f%" 2>&1
"%tool%" -f UNICODELITTLE -t 437 "%f%"
del "%f%"

:END
endlocal
So the problem is not the script. Now I need to handle what is expected by the MultiArc plugin AFTER the extraction is done. For example, in the LISTING is only the NAME of the Virtual Machine. So from the point of view of the plugin it is a FILE. But in fact is a FOLDER. So my problem is how to handle this. You have any idea?
Post Reply