Bhx 3.1

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: [utility] Bhx 2.1

#16 Post by foxidrive » 05 Jan 2014 22:20

berserker wrote:its still "downloading" from somewhere


A benefit is that you can provide the 'correct' tool with your batch file (licensing rules have to be adhered to)
instead of the user trying to download one of the many variants (of sed for the case we mentioned) and the batch
fails because a version is downloaded that has different switches or syntax.

The drawback is that the size of the batch file will grow very large, when large binaries are encoded.

berserker
Posts: 95
Joined: 18 Dec 2013 00:51

Re: [utility] Bhx 2.1

#17 Post by berserker » 05 Jan 2014 22:47

what is 'correct'? for eexample, if carlos wants to package sed.exe, where should he download from that would statisfy "licensing issues" and "universal syntax" that doesn't break?

foxidrive wrote:The drawback is that the size of the batch file will grow very large, when large binaries are encoded.

actually the size should not matter, after all, the main purpose is to use the tool, in which case, i don't find any difference downloading straight from the main web site vs "packaging" it as hex encoded binary to installation. I mean if you want to distribute sed.exe for example, its just a small binary. what's the difference if you encode in bh21 and distribute it?
Last edited by berserker on 06 Jan 2014 00:43, edited 1 time in total.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: [utility] Bhx 2.1

#18 Post by foxidrive » 05 Jan 2014 23:07

berserker wrote:what is 'correct'?


Read my comment again, the answer is there.

berserker
Posts: 95
Joined: 18 Dec 2013 00:51

Re: [utility] Bhx 2.1

#19 Post by berserker » 06 Jan 2014 00:44

foxidrive wrote:Read my comment again, the answer is there.

no its not.

carlos
Expert
Posts: 503
Joined: 20 Aug 2010 13:57
Location: Chile
Contact:

Re: [utility] Bhx 2.2

#20 Post by carlos » 06 Jan 2014 03:00

I posted the version 2.2.
This version have some fixes and improves the /nt option.

Respectly about this utility. E-mail attachments are stored in a text plain and browser convert it to binary form. The same concept can be done in batch using the script that generate bhx.
In batch sometimes is needed build a binary file, generally small, it can be a dat file or a small executable, etc.
In the past the task of convert binary from a text plain way to binary was do it with 16 bit utilities (.com files) or using debug.
All it have the limitations that only can rebuild upto 65535 bytes and not works on 64 bit windows os.
Because it I write this utility.

I used bhx for create the installation of small utilities like:
fs:

Code: Select all

http://www.dostips.com/forum/viewtopic.php?p=30674#p30674
Last edited by carlos on 14 Jan 2014 20:52, edited 2 times in total.

ShadowThief
Expert
Posts: 1166
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: [utility] Bhx 2.1

#21 Post by ShadowThief » 06 Jan 2014 08:01

berserker wrote:
foxidrive wrote:Read my comment again, the answer is there.

no its not.


foxidrive wrote:
berserker wrote:its still "downloading" from somewhere


A benefit is that you can provide the 'correct' tool with your batch file (licensing rules have to be adhered to)

Yes, it is.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: [utility] Bhx 2.1

#22 Post by foxidrive » 06 Jan 2014 08:19

ShadowThief wrote:
foxidrive wrote:A benefit is that you can provide the 'correct' tool with your batch file (licensing rules have to be adhered to)

Yes, it is.


My sentence rambled - the 'correct' tool is the one you are using, that supports the switches and syntax you are using in the batch code.
Some 'sed' implementations have different syntax - so you can bundle the 'correct' one with BHX in your batch file.

Licensing being followed of course.

carlos
Expert
Posts: 503
Joined: 20 Aug 2010 13:57
Location: Chile
Contact:

Re: Bhx 3.0 [final version]

#23 Post by carlos » 14 Jan 2014 20:51

I did the latest changes to bhx and I posted the version 3.0.
I removed all the Windows nt 4 support (/nt option), because incompatibility with features of cabinets with expand command on Windows nt, xp, and seven.
Also, I removed the old style support (/os option), because is slow.
I really improved the usage with cabinet files.

carlos
Expert
Posts: 503
Joined: 20 Aug 2010 13:57
Location: Chile
Contact:

Re: Bhx 3.1 [latest version]

#24 Post by carlos » 15 Jan 2014 12:31

Posted the version 3.1 that fix a 3.0 mistake were a file that is not a cabinet is considered as a corrupted cabinet. This version fix this doing the difference.

npocmaka_
Posts: 516
Joined: 24 Jun 2013 17:10
Location: Bulgaria
Contact:

Re: Bhx 3.1 [latest version]

#25 Post by npocmaka_ » 22 Jan 2014 05:49

.
Last edited by npocmaka_ on 23 Jan 2014 15:16, edited 1 time in total.

carlos
Expert
Posts: 503
Joined: 20 Aug 2010 13:57
Location: Chile
Contact:

Re: Bhx 3.1 [latest version]

#26 Post by carlos » 22 Jan 2014 12:11

npocmaka_ wrote:both mshta calls give me an error on windows 7;


@npocmaka: what Windows 7 you use. Please give me details about language and service packs installed, for try replicate the problem. On my tests, all mshta works but I want solve the problem that you mentions . Also, please you can upload your mshta.exe and share the executable for do a test with it ? Maybe scripting host version, but is strange on Windows 8 the Windows Script Host version is 5.8 and Windows 7 use the same.

npocmaka_
Posts: 516
Joined: 24 Jun 2013 17:10
Location: Bulgaria
Contact:

Re: Bhx 3.1 [latest version]

#27 Post by npocmaka_ » 23 Jan 2014 09:40

9.00.8112 - version of the mshta.

Here's how I've changed the bhx.bat to check the mshta calls (may be I've missed something?):


Code: Select all

Set ";=!.:#="!"
Echo !;!>"%bin%.da"


echo -------- mshta call
Mshta.exe Vbscript:Execute^("%.:#=""%:Close"^) >Nul 2>&1
echo -------- the other mshta call

Echo Close>>"%bin%.da"

 (  Echo ^<html^>^<head^>
   Echo   ^<hta:application windowstate="minimize"^>
   Echo   ^<script type="text/vbscript" src="%bin%.da"^/>
   Echo ^</head^>^</html^>
 )>>"%bin%.pa"

Mshta.exe "%bin%.pa" >Nul 2>&1
If Exist "%bin%" Expand.exe -r "%bin%" -F:* . >Nul 2>&1
rem Del /A /F "%bin%" "%bin%.hs" "%bin%.da" "%bin%.pa" >Nul 2>&1
Goto :Eof

carlos
Expert
Posts: 503
Joined: 20 Aug 2010 13:57
Location: Chile
Contact:

Re: Bhx 3.1 [latest version]

#28 Post by carlos » 23 Jan 2014 14:02

npocmaka_ wrote:9.00.8112 - version of the mshta.

Here's how I've changed the bhx.bat to check the mshta calls (may be I've missed something?):


Code: Select all

Set ";=!.:#="!"
Echo !;!>"%bin%.da"


echo -------- mshta call
Mshta.exe Vbscript:Execute^("%.:#=""%:Close"^) >Nul 2>&1
echo -------- the other mshta call

Echo Close>>"%bin%.da"

 (  Echo ^<html^>^<head^>
   Echo   ^<hta:application windowstate="minimize"^>
   Echo   ^<script type="text/vbscript" src="%bin%.da"^/>
   Echo ^</head^>^</html^>
 )>>"%bin%.pa"

Mshta.exe "%bin%.pa" >Nul 2>&1
If Exist "%bin%" Expand.exe -r "%bin%" -F:* . >Nul 2>&1
rem Del /A /F "%bin%" "%bin%.hs" "%bin%.da" "%bin%.pa" >Nul 2>&1
Goto :Eof


@npocmaka: I think that the bug not exist in bhx 3.1 and the bug that your mentions is caused from a modification of you.
This code that you rewrite:

Code: Select all

 (  Echo ^<html^>^<head^>
   Echo   ^<hta:application windowstate="minimize"^>
   Echo   ^<script type="text/vbscript" src="%bin%.da"^/>
   Echo ^</head^>^</html^>
 )>>"%bin%.pa"


Fails and:
"%bin%.da"^/>

for Works should be:
"%bin%.da"/^>


Also, you not write the
</script>
before
</head>


Because it, the script fails.
Please, you can remove the screenshot for avoid the impression that bhx 3.1 have a bug, because it not have bug.

npocmaka_
Posts: 516
Joined: 24 Jun 2013 17:10
Location: Bulgaria
Contact:

Re: Bhx 3.1 [latest version]

#29 Post by npocmaka_ » 23 Jan 2014 15:24

carlos wrote:
npocmaka_ wrote:9.00.8112 - version of the mshta.

Here's how I've changed the bhx.bat to check the mshta calls (may be I've missed something?):


Code: Select all

Set ";=!.:#="!"
Echo !;!>"%bin%.da"


echo -------- mshta call
Mshta.exe Vbscript:Execute^("%.:#=""%:Close"^) >Nul 2>&1
echo -------- the other mshta call

Echo Close>>"%bin%.da"

 (  Echo ^<html^>^<head^>
   Echo   ^<hta:application windowstate="minimize"^>
   Echo   ^<script type="text/vbscript" src="%bin%.da"^/>
   Echo ^</head^>^</html^>
 )>>"%bin%.pa"

Mshta.exe "%bin%.pa" >Nul 2>&1
If Exist "%bin%" Expand.exe -r "%bin%" -F:* . >Nul 2>&1
rem Del /A /F "%bin%" "%bin%.hs" "%bin%.da" "%bin%.pa" >Nul 2>&1
Goto :Eof


@npocmaka: I think that the bug not exist in bhx 3.1 and the bug that your mentions is caused from a modification of you.
This code that you rewrite:

Code: Select all

 (  Echo ^<html^>^<head^>
   Echo   ^<hta:application windowstate="minimize"^>
   Echo   ^<script type="text/vbscript" src="%bin%.da"^/>
   Echo ^</head^>^</html^>
 )>>"%bin%.pa"


Fails and:
"%bin%.da"^/>

for Works should be:
"%bin%.da"/^>


Also, you not write the
</script>
before
</head>


Because it, the script fails.
Please, you can remove the screenshot for avoid the impression that bhx 3.1 have a bug, because it not have bug.


Yep.The place of the caret here is wrong.But you can use only :

Code: Select all

 <script type="text/vbscript" src="C:\test\bhx.cab.unique.da"/>

the script tag is closed on the same line and everything is ok.It works on Win8.1 but fails on Win7x64. The both calls of Mshta.exe - even the one that not use the temp html file...(certutil build is ok, may be the problem is in the mshta itself)

carlos
Expert
Posts: 503
Joined: 20 Aug 2010 13:57
Location: Chile
Contact:

Re: Bhx 3.1 [latest version]

#30 Post by carlos » 23 Jan 2014 16:21

npocmaka wrote:But you can use only :

Code: Select all

 <script type="text/vbscript" src="C:\test\bhx.cab.unique.da"/>

the script tag is closed on the same line and everything is ok.It works on Win8.1 but fails on Win7x64. The both calls of Mshta.exe - even the one that not use the temp html file...(certutil build is ok, may be the problem is in the mshta itself)


the code for mshta generated from bhx fails or the code that you have rewrited fails?. The other part of the code for mshta is for a mshta windows be show minimized.

I remember test the code time ago on Windows 2000, then for change the code stuff it will be compatible from Windows 2000 to Windows 8.1.
In fact: this piece of code of bhx:

Code: Select all

Set ";=!.:#="!"
Echo !;!>"%bin%.da"

On modern cmd.exe can be writed:

Code: Select all

Echo !.:#="!>"%bin%.da"

But it not works on Windows 2000. I not know the reason. Then all the code stuff of bhx was writed for compatibility with windows 2000. Then for write a change to the stuff code, it will be tested on Windows 2000, xp and above. if you look are two call methods to mshta because one is not supported on Windows 2000.

Post Reply