News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Number and type of arguments required for call to C library

Started by jj2007, May 21, 2014, 10:21:19 PM

Previous topic - Next topic

Gunther

Hi vertograd,

Quote from: vertograd on May 25, 2014, 07:00:29 PM
Your condolences are accepted but my poor hard drive isn't dead yet . It's in coma  :biggrin:
Copying of 150MB of MASM folder with all the stuff  took about 3 hours . That's what I call slow 

oh yes, that's indeed a bit slow.

Gunther
You have to know the facts before you can distort them.

dedndave

well - part of the problem was that i did not have the proper file and folder structure
i created the folders
\masm32\projects
\masm32\projects\TST
\masm32\projects\TST\NEW
\masm32\projects\TST\ZIPIT

i then created an empty zip file (NEW.ZIP) in the \masm32\projects\TST\NEW folder
and, i put the assembler source file in the \masm32\projects\TST\ZIPIT folder (something to zip)

now, when i run the program, it says SUCCESS on all steps
at the end, we get the "Press Any Key To Continue..." prompt
THEN, Olly pops up   :redface:
a weird state i have never seen before
the NEW.ZIP file is still empty

dedndave

things are not properly released, but that shouldn't cause an empty zip file   :(

GoneFishing

Dave, thanks again
Exactly the same behavior  here  - SUCCESS on every step ,  final crash and still empty ZIP .
It looks like ZIP folder is not registered as DROP TARGET on XP   -  drag'n'drop operation doesn't add files to ZIP
Maybe it  os version specific feature
I ran ASSOC command and it showed that ZIP folder exists as SendToTarget :
QuoteASSOC | FIND "ZF"
I created an empty file with .ZFSendToTarget extension on the Desktop and tried to drop files on it. OS asked me if I want to chose ZIP FOLDER as a default program for zip archives and only then it worked ... once  :biggrin: Next time I drop file onto it - next message box with the same question.

I'll check that final crash and try to fix it .
The lack of wanted functionality requires additional reading and testing .
For now thank you all for your feedback

dedndave

welllll.....

after doing some reading, i am not sure that this is a very good method to zip files, anyways
it seems that, under XP, there is no way to get rid of the progress dialog box
i remember someone using zlib a while back, and creating an INC for it
worse comes to worse, PK zip is not that difficult of an algorithm to code   :P

that having been said, we should still be able to get it to work - lol
i found some very interesting reading in the Community Additions section of CopyHere

http://msdn.microsoft.com/en-us/library/windows/desktop/bb787866%28v=vs.85%29.aspx

MSDN seems to have gotten away from Community Additions - it's a shame - i have learned a lot from them

also, i seem to recall we did something similar a while ago
i wrote an interface using qWord's METHOD macro and all that
Japheth came in and made a few changes or something....

http://masm32.com/board/index.php?topic=2834.0

dedndave

one more note....

when working with API functions like CreateFile, UNICODE paths must be prepended with '\\?\'
that rule may not apply to COM, however   :P

GoneFishing

Dave,
Does DRAG'N'DROP work on ZIP folder for you?
As to whether this built-in method to zip files is good or not  - It's BUILT-IN , the DEFAULT , ready for use OUT OF THE BOX and in this role it must not be perfect.
Somewhere I read that option 4 ( hide the progress dialog ) doesn't work in scripts etc.
 

dedndave

yes, i can drag-n-drop to zips
according to what i've read, the 4 value works on vista/win7, just not XP

dedndave

the windows shell method probably has a couple advantages
the obvious being, it's built-in
and - it will handle special locations like "My Documents" for you
also - it will do the recursion for you

on the other hand, disadvantages...
you get the dialog under xp
you may have UAC issues under vista or win7/8
it probably uses the windows shell copy algo, which doesn't always copy everything
(files like desktop.ini files that are marked do not copy or zero-length files, etc)

GoneFishing

The final crash is fixed now!
Simply comment out "inkey" macro call . That's all.
Still have no idea why it doesn't zip files ...

adeyblue

Quote from: dedndave on May 25, 2014, 10:34:26 PM
on the other hand, disadvantages...
you get the dialog under xp
you may have UAC issues under vista or win7/8
it probably uses the windows shell copy algo, which doesn't always copy everything
(files like desktop.ini files that are marked do not copy or zero-length files, etc)

It also runs on a separate, unwaitable and unstoppable thread, which is a plus or minus depending on your perception of things. At least in the Win7 version (which is the only one I've really looked at), there is no way to disable the progress dialog. You only see it sometimes because it's an IProgressDialog, which runs the actual dialog on another thread. If the zipping finishes before the dialog's done it's initializing, you'll never see it.

The separate zipping thread is probably the reason for the 0 length zips. You'd have to wait for it to finish before calling ExitProcess, but as zipfldr uses SHCreateThread which doesn't give you a thread handle or the thread id, it can't even wait for the zipping to finish, never mind us mortals on the outside.

Let's just say that it's not the most robust piece of multi-threaded programming ever seen.

Oh and hi :) I wrote the necessarily hacky monstrosity that peter_asm linked to in post 16.

EDIT:
Totally forgot, the preceeding applies to dragging and dropping, whether from explorer or simulated. The IStorage/IStream interfaces don't use a separate thread, but I can't ever get them to work. I'll have a look at what underlying method the scripting interface uses.

jj2007

Quote from: adeyblue on May 26, 2014, 12:49:36 AM
Oh and hi :) I wrote the necessarily hacky monstrosity that peter_asm linked to in post 16.

You mean IShellFolder to create ZIP files in post #15? Looks pretty advanced, you know your COM, also at (dis)assembly level ;-)

Welcome to the Forum :icon14:

Gunther

Hi adeyblue,

Quote from: adeyblue on May 26, 2014, 12:49:36 AM
Oh and hi :) I wrote the necessarily hacky monstrosity that peter_asm linked to in post 16.

Hats off.  :t And welcome to the forum.

Gunther
You have to know the facts before you can distort them.

adeyblue

Quote
You mean IShellFolder to create ZIP files in post #15?

Yep, that's the one. Shame I can't count. It is a monstrostity though, going through the IContextMenu and simulating pasting the files on the zip is a lot easier and smaller than setting up custom dataobjects and droptargets (at least when using certain c++ features anyway - http://pastebin.com/pNjfLjWn).

Anyway, the IShellDispatch method of zipping simulates a drag and drop, so it follows what I said above. I checked the XP SP0 version of zipfldr.dll and that uses CreateThread instead of SHCreateThread. Any hope of it waiting for zipping to complete dies there though, as it promptly ignores the thread handle and leaks it.

GoneFishing

Hello and welcome , adeyblue
Your article was an answer to my question in this thread
Thanks for your explanations  :icon14: