Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

how? transparent zip with ahk. dllcall?


  • Please log in to reply
31 replies to this topic
BETLOG
  • Members
  • 222 posts
  • Last active: Apr 07 2010 01:58 PM
  • Joined: 27 Nov 2006
I am now partly blind from looking through the registry for quite a while... and this is trying to tell me something... something simple... but I don't know how to test it.

Could it be that all I have to do is call zipfldr.dll and just pass it a filename?

Compressed (zipped) Folder DropHandler
InProcServer32
default = %SystemRoot%\system32\zipfldr.dll
ThreadingModel = Apartment

...this is the exported key:
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\CLSID\{ed9d80b9-d157-457b-9192-0e7280313bf0}]
@="Compressed (zipped) Folder DropHandler"

[HKEY_CLASSES_ROOT\CLSID\{ed9d80b9-d157-457b-9192-0e7280313bf0}\InProcServer32]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,7a,00,69,00,\
70,00,66,00,6c,00,64,00,72,00,2e,00,64,00,6c,00,6c,00,00,00
"ThreadingModel"="Apartment"

BETLOG
  • Members
  • 222 posts
  • Last active: Apr 07 2010 01:58 PM
  • Joined: 27 Nov 2006
Partial solution:
Script-generate a zero byte file called SendTo.ZFSentToTarget in the directory of the files to be zipped, and drop the files to be zipped onto this new shortcut.
...I wonder how I can do this with no mousing?

Dippy46
  • Members
  • 171 posts
  • Last active: Aug 17 2007 06:53 AM
  • Joined: 06 Jul 2004
@BETLOG

Word on the vine seems to suggest that Microsoft removed those DLL's due to possible copyright infringement + I found this.

This broadcast message was sent to all bidders on Tuesday Jun 21, 2005 11:04:49 AM:

Hello RAC Coders,

I did some enquiries on this project and found out, that is is NOT possible to script zipfldr.zip. I asked a microsoft employee who is trainer for scripting classes.

The dll is not usable outside NT Explorer, so there is no chance using it with scripting or 3rd Party programs.

I am sorry, but this project will be closed now. Thanks for your bids.


Regards
Dave
Simple ideas lie within reach, only of complex minds

BETLOG
  • Members
  • 222 posts
  • Last active: Apr 07 2010 01:58 PM
  • Joined: 27 Nov 2006
After looking through more than 20 pages of google search results I was thinking the same thing. It *should* be a simple matter to find out how they zip files, but XP seems to go to so much trouble to hide the mechanism that there must be some reason for this.
It's difficult to believe that it would be impossible to figure out what they are doing... maybe it's just a matter of the right person/tool looking at the process.

The core issue here is that XP CAN create zip files, it just makes it very difficult to see how it does so.

Can you quote a link so i can read into it in more detail?
Thanks for the link, but as usual, you really should quote/link your sources.
Mainly because people will always ask that question, but also because plagiarism, copyright and intellectual copyright laws might be disturbed.

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005
I did a similar search, probably not as extensive as your, though, and came up empty hands... That's why I use 3rd party compressors now...
Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")

Dippy46
  • Members
  • 171 posts
  • Last active: Aug 17 2007 06:53 AM
  • Joined: 06 Jul 2004
@BETLOG,

Firstly, the suggestion given by PhiLho of going in thru the shell would seem to be a good bet.

Secondly, I feel the need at this point to clear up some technical issues.

The use of third party CLI's and DLL's can provide you with functionality you could only dream of. In most cases these will have been written in a language like C or assembler, meaning that their functionality might run anything from 10 to 100 times faster then what you could hope to achieve in AHK, + they've done all the work for you.
Throughout the forum, the terms [TRANSPARENT] , [EXCESS BAGGAGE] are frequently used, presumably meaning the prime objective of a single EXE. Well this I find confusing. What then is the definition of transparent. Well the System32 directory contains over 200 CLI's and about 1200 DLL's, all of which are required to run windows, your transparent app included!
When AHK runs it loads at least half a dozen of these DLL's. Ah! so that must be the definition of [TRANSPARENT] it resides in system32. OK. got it. So in that case all we have to do to make our progam [BAGGAGE-LESS] and [TRANSPARENT] is to use one line of code.!

FileInstall, %WorkingDir%\mydll.dll,C:\windows\system32\MyDll.dll,0
Along with the other 1200 it'll be fairly transparent.

In a previous discussion we spoke about transparent CLI's so again the same applies
FileInstall, %WorkingDir%\MyCli.exe,C:\windows\system32\MyCli.exe,0
and
RunWait, %comspec% /c "c:\windows\system32\MyCli.exe MyParms , ,hide

And if you want to be really sneaky
rename MyCli.exe -> MyCli.dll

FileInstall, %WorkingDir%\MyCli.dll,C:\windows\system32\MyCli.dll,0
and
RunWait, %comspec% /c "c:\windows\system32\MyCli.dll MyParms , ,hide

The only difference between loading a DLL and a CLI is that the DLL is loaded into your process space + a better communication structure. The CLI loads into it's own address space leaving only STDOUT/STDIN as the way to communicate.

To illustrate by example (as they say), the link below will get you 2 demo programs, both do graphical work. The first a clock would be considered [TRANSPARENT] because it's a single exe and all the drawing is done using dllcalls to GDI32. The second demo is a skinned animation, but it only has one exe, so by the above definitions it must user transparent ???

QED.

https://ahknet.autoh...k/DwnLdDemo.zip

Regards
Dave.

Trying to keep AHK a Caveat free zone.
Simple ideas lie within reach, only of complex minds

BETLOG
  • Members
  • 222 posts
  • Last active: Apr 07 2010 01:58 PM
  • Joined: 27 Nov 2006
By transparent I simply meant not using things not standard in the OS (XP), and not popping up windows. But you already knew that.

I ended up just biting the bullet and coding in a bunch of application specific stuff for IZarc, the zip util I use, an approach i'm not very satisfied with, but because it's only for my use (that was not the plan though) thats ok, at least i can use it to test for usefulness and bugs while i spend some more time looking into how to do it the 'right way' (XP's internal zip routines).

It's kind of funny in a way. I'm not a coder, but I have been hacking code up for a long time, and I'm not too bad at it now... yet every time i try writing something that looks fairly straight forward, and uncomplicated, I eventually find something that *should* be simple, and yet it completely kills the grand plan for the project... google searches reveal hundreds of people all trying to do what should be simple and coming up with nothing, and everybody I ask just shrugs and tells me how they couldn't figure it out either.
I must be cursed.

....Oooooh! thats right!... I *AM* cursed....
Damn, I knew I forgot something important.

I'm just going over into the corner here to practice my Darth Vader death grip, and my fist shaking....
\:|

Dippy46
  • Members
  • 171 posts
  • Last active: Aug 17 2007 06:53 AM
  • Joined: 06 Jul 2004
@BETLOG,

I know the feeling :lol:

I'm totally insane, and I've got CODE to prove it! :roll:

Regards

Dave.
Simple ideas lie within reach, only of complex minds

Seabiscuit
  • Members
  • 109 posts
  • Last active: May 08 2008 06:31 PM
  • Joined: 07 Jan 2007
Good Year @All !

Take a look at that ..http://www.autoitscr...e=post&id=12491 , interesting idea :idea: , but without compression. I know it will work in AHK also :wink:

Good day to all

Seabiscuit
  • Members
  • 109 posts
  • Last active: May 08 2008 06:31 PM
  • Joined: 07 Jan 2007
That was the source..this is the page http://www.autoitscr...showtopic=38019

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005
I must be missing something, I don't see why they are so excited by creating a Zip file with uncompressed data...
Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")

BETLOG
  • Members
  • 222 posts
  • Last active: Apr 07 2010 01:58 PM
  • Joined: 27 Nov 2006
According to spyrorocks: "The compression is not needed."
So I guess they just needed a form of PAK file (no compression).

However i do need compression. i still haven't come up with anythig useful that uses XP's inbuilt zip capabilities. The closest I came was to manually generate a SendTo.ZFSentToTarget shortcut and then mousedrag the files/folder onto it.
But that as so ugly that I ended up using 7zip, and it's single-file command line executable, which if necessary i can redistribute with the script under the GPL agreement.
However at this point the script is so badly written, has changed direction so many times it's an outright mess, and has had very little error checking done or written... so it's still a personal use script right now.

However, I didn't actually read through the AutoIt code to see what they have done... but from what they are saying in their forum I doubt that adding compression would be trivial.
Thanks for referencing it though.... i think when we do find a solution to this it will appeal to quite a few people.

Seabicuit
  • Members
  • 2 posts
  • Last active: Oct 02 2007 02:50 PM
  • Joined: 07 Jan 2007
Hi friends!

I just find out :p another approach :wink: ; here is another briliant :idea: :shock: ideea using batch scripts for Windows (with compression :!: this time) or, if u prefer, down below :arrow: :

' ZIP.VBS manipulates ZIP file in command line.
' Usage: CScript.exe ZIP.VBS [-d|-e|-v] ZIPfile [files...]
'    CScript.exe ZIP.VBS -a archive.zip 1.txt

Option Explicit
Dim arg
Dim optind

If WScript.Arguments.Count<1 Then
 WScript.Echo "Usage: CScript.exe ZIP.VBS [-d|-e|-v] ZIPfile [files...]"
 WScript.Quit
End If
arg=WScript.Arguments(optind)
Select Case LCase(arg)
Case "-a","-c"
 optind=optind+1
 Call MakeZIP()
Case "-d"
 optind=optind+1
 Call DeleteZIP()
Case "-e"
 optind=optind+1
 Call ExtractZIP()
Case "-v","-l"
 optind=optind+1
 Call ListZIP()
Case Else
 If optind=WScript.Arguments.Count-1 Then
  Call ListZIP()
 Else
  Call MakeZIP()
 End If
End Select
WScript.Quit

Sub MakeZIP()
Dim fso
Dim wShell
Dim Shell
Dim n
Dim ie
Dim ZIPfile
Dim ZIPdata:ZIPdata="PK" & Chr(5) & Chr(6) & String(18,0)
Dim file
Dim Folder
Dim FolderItem
Dim dFolder

If WScript.Arguments.Count<optind+2 Then
 WScript.Echo "Arguments Missing."
 WScript.Quit
End If

Set fso=CreateObject("Scripting.FileSystemObject")
Set wShell=CreateObject("WScript.Shell")

Set Shell=CreateObject("Shell.Application")
For n=0 To 9 
 For Each ie In Shell.Windows 
  If Not ie.Busy Then
   If ie.ReadyState=4 Then
    If InStr(TypeName(ie.Document),"IShellFolderViewDual")=1 Then
     Exit For 
    End If
   End If
  End If
 Next 
 If Not IsEmpty(ie) Then Exit For 
 If n=0 Then CreateObject("WScript.Shell").Run "explorer.exe",0,True 
 WScript.Sleep 100 
Next 
If IsEmpty(ie) Then
 WScript.Echo "Failed"
 WScript.Quit
End If
Set Shell=ie.Document.Application 

ZIPfile=fso.GetAbsolutePathName(WScript.Arguments(optind))
If UCase(fso.GetExtensionName(ZIPfile))<>"ZIP" Then
 WScript.Echo "Invalid Extension Name -",fso.GetExtensionName(ZIPfile)
 WScript.Quit
End If
If Not fso.FileExists(ZIPfile) Then
 fso.CreateTextFile(ZIPfile,False).Write ZIPdata
End If
Set dFolder=Shell.NameSpace(ZIPfile)
For optind=optind+1 To WScript.Arguments.Count-1
 file=fso.GetAbsolutePathName(WScript.Arguments(optind))
 Set Folder=Shell.NameSpace(fso.GetParentFolderName(file))
 Set FolderItem=Folder.ParseName(fso.GetFileName(file))
 If FolderItem Is Nothing Then
  WScript.Echo WScript.Arguments(optind),"- Not Found."
  WScript.Quit
 End If
 dFolder.CopyHere FolderItem
Next
End Sub

Sub ListZIP()
Dim fso
Dim Shell
Dim ZIPfile
Dim Folder
Dim FolderItem
Dim k
Dim COL:COL=8
Dim cols
ReDim cols(COL)
Dim rows
Dim j

If WScript.Arguments.Count<optind+1 Then
 WScript.Echo "Arguments Missing."
 WScript.Quit
End If

Set fso=CreateObject("Scripting.FileSystemObject")
Set Shell=CreateObject("Shell.Application")
ZIPfile=fso.GetAbsolutePathName(WScript.Arguments(optind))
If UCase(fso.GetExtensionName(ZIPfile))<>"ZIP" Then
 WScript.Echo "Invalid Extension Name -",fso.GetExtensionName(ZIPfile)
 WScript.Quit
End If
Set Folder=Shell.NameSpace(ZIPfile)
ReDim rows(Folder.Items.Count)
For k=0 To COL
 cols(k)=Folder.GetDetailsOf(,k)
Next
j=0
rows(j)=Join(cols,vbTab)
For Each FolderItem In Folder.Items
 For k=0 To COL
  Cols(k)=Folder.GetDetailsOf(FolderItem,k)
 Next
 j=j+1
 rows(j)=Join(cols,vbTab)
Next
WScript.Echo Join(rows,vbCRLF)
End Sub

Sub DeleteZIP()
Dim fso
Dim Shell
Dim ZIPfile
Dim Folder
Dim FolderItem

If WScript.Arguments.Count<optind+2 Then
 WScript.Echo "Arguments Missing."
 WScript.Quit
End If

Set fso=CreateObject("Scripting.FileSystemObject")
Set Shell=CreateObject("Shell.Application")
ZIPfile=fso.GetAbsolutePathName(WScript.Arguments(optind))
If UCase(fso.GetExtensionName(ZIPfile))<>"ZIP" Then
 WScript.Echo "Invalid Extension Name -",fso.GetExtensionName(ZIPfile)
 WScript.Quit
End If
Set Folder=Shell.NameSpace(ZIPfile)
For optind=optind+1 To WScript.Arguments.Count-1
 Set FolderItem=Folder.ParseName(WScript.Arguments(optind))
 If FolderItem Is Nothing Then
  WScript.Echo WScript.Arguments(optind),"- Not Found."
  WScript.Quit
 End If
' FolderItem.InvokeVerb("delete")
 FolderItem.InvokeVerb("??(&D)")
Next
End Sub

Sub ExtractZIP()
Dim fso
Dim Shell
Dim ZIPfile
Dim Folder
Dim FolderItem
Dim dFolder

If WScript.Arguments.Count<optind+1 Then
 WScript.Echo "Arguments Missing."
 WScript.Quit
End If

Set fso=CreateObject("Scripting.FileSystemObject")
Set Shell=CreateObject("Shell.Application")
ZIPfile=fso.GetAbsolutePathName(WScript.Arguments(optind))
If UCase(fso.GetExtensionName(ZIPfile))<>"ZIP" Then
 WScript.Echo "Invalid Extension Name -",fso.GetExtensionName(ZIPfile)
 WScript.Quit
End If
Set Folder=Shell.NameSpace(ZIPfile)
Set dFolder=Shell.NameSpace(fso.GetAbsolutePathName(""))
If WScript.Arguments.Count<optind+2 Then
 dFolder.CopyHere Folder.Items
Else
 For optind=optind+1 To WScript.Arguments.Count-1
  Set FolderItem=Folder.ParseName(WScript.Arguments(optind))
  If FolderItem Is Nothing Then
   WScript.Echo WScript.Arguments(optind),"- Not Found."
   WScript.Quit
  End If
  dFolder.CopyHere FolderItem
 Next
End If
End Sub


Seabiscuit
  • Members
  • 109 posts
  • Last active: May 08 2008 06:31 PM
  • Joined: 07 Jan 2007
gosh!! I screwed up my IDs. Now I have two..lol :lol:

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005

another briliant :idea: :shock: ideea using batch scripts for Windows

Usually, batch scripts are .bat files (or .cmd in XP). You are showing a VBS script, indeed able to leverage the needed Com interfaces to access this facility.
Thanks for sharing.
Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")