 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Laszlo
Joined: 14 Feb 2005 Posts: 4516 Location: Boulder, CO
|
Posted: Thu Jun 18, 2009 5:25 pm Post subject: |
|
|
Nice! I guess the right size is VarSetCapacity(MD5_CTX,104), though. Anything larger works, too. The string version at the second dll call needs VarSetCapacity(V) at the end of the line, not VarSetCapacity(L).
Also, the right offset to read the digest from is 87+A_Index. 7+A_Index works, too, but it is not the intended place.
It is not a fair rosettacode solution, because the work is done in the Windows advapi32.dll, not in AHK. I am not even sure if machine code functions qualify, because they are processor dependent, not in the control of AHK.
Last edited by Laszlo on Thu Jun 18, 2009 5:42 pm; edited 1 time in total |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 7185
|
Posted: Thu Jun 18, 2009 5:40 pm Post subject: |
|
|
| infogulch wrote: | | Cool MD5 functions! |
Thanks!
| Laszlo wrote: | | I guess the right size is VarSetCapacity(MD5_CTX,104) |
I do not understand that struct at all!.. I vaguely picked that number from here
| Quote: | | It is not a fair rosettacode solution, because the work is done in the Windows advapi32.dll, not in AHK. |
I agree Sir. Maybe you can consider posting your native implementation of MD5()
 |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4516 Location: Boulder, CO
|
Posted: Thu Jun 18, 2009 5:46 pm Post subject: |
|
|
MSDN says: | Code: | typedef struct {
ULONG i[2];
ULONG buf[4];
unsigned char in[64];
unsigned char digest[16];
} MD5_CTX; | It is 2*4+4*4+64+16 = 104 bytes. The offset for the result (digest) is 88. |
|
| Back to top |
|
 |
infogulch
Joined: 27 Mar 2008 Posts: 378
|
Posted: Thu Jun 18, 2009 5:47 pm Post subject: |
|
|
oops. I didn't know you had already done that, Laszlo. I agree with SKAN, you should post yours on rosetta code. _________________
Scripts - License |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 7185
|
Posted: Thu Jun 18, 2009 6:23 pm Post subject: |
|
|
| Laszlo wrote: | | It is 2*4+4*4+64+16 = 104 bytes. |
Thank you Sir.
| Laszlo wrote: | | The offset for the result (digest) is 88. |
I did not view that far with my Binspector. Seeing that the digest is also available at offset 8, I happily contended with 24 until I noticed I am not getting proper results for small strings.
Thanks again for the clarification..
Edit: I have updated the code with right VarSetCapacity and corrected the Message offset to read from. |
|
| Back to top |
|
 |
fragman
Joined: 13 Oct 2009 Posts: 95
|
Posted: Fri Jan 08, 2010 2:32 pm Post subject: |
|
|
ShellFileOperation doesn't work with FTP servers. Calling it like this:
ShellFileOperation(0x2,"C:\Program Files\AutoHotkey\main.exe","ftp://user@autohotkey.net/",0,0)
Shows a dialog asking if a path "C:\Program Files\AutoHotkey\ftp:\" should be created, and then it either fails with a Cancelled error system code or with a 123 code indicating a path with wrong format.
For now I'm going to avoid that by using a different transfer function for ftp, but it would be nice to see the windows dialogs for it, and I believe it should be possible since explorer can do it. |
|
| Back to top |
|
 |
OceanMachine
Joined: 15 Oct 2007 Posts: 277
|
Posted: Thu Mar 11, 2010 9:07 pm Post subject: |
|
|
| fragman wrote: | | ShellFileOperation doesn't work with FTP servers... I believe it should be possible since explorer can do it. |
I think that when you put the ftp protocol in the address bar of explorer (i.e. typing ftp://whatever), windows actually swiches to using Internet Explorer to do that for you, and not Explorer (the file explorer). So Explorer can't do it... (as far as I am aware). It's not a standard Shell File Operation.
Try something like this WININET wrapper for an FTP solution.
Another alternative is to use this libcURL wrapper. |
|
| Back to top |
|
 |
fragman
Joined: 13 Oct 2009 Posts: 95
|
Posted: Thu Mar 11, 2010 9:09 pm Post subject: |
|
|
I'm currently transferring files using the wrapper, but I want to show native transfer dialogs, so the user can also get replacement questions, progress etc.
(internet?) Explorer can do the transfer, even with files from clipboard, maybe I can find a way to remote control a hidden explorer window or so. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|