 |
AutoHotkey Community Let's help each other out
|
AutoHotkey_L: Arrays, Debugger, x64, COM, #If expression ...
Goto page Previous 1, 2, 3 ... 52, 53, 54 ... 68, 69, 70 Next
|
| View previous topic :: View next topic |
| Author |
Message |
fincs
Joined: 05 May 2007 Posts: 1163 Location: Seville, Spain
|
Posted: Sun Aug 29, 2010 10:04 pm Post subject: |
|
|
I've written a small test script and everything seems to work (even the reported size is correct)... except the StrGet() call.
| Code: | lib := DllCall("LoadLibrary", "str", "CompiledScript.exe", "ptr")
msgbox %lib% %A_LastError%
res := DllCall("FindResource", "ptr", lib, "str", ">AUTOHOTKEY SCRIPT<", "ptr", 10, "ptr")
msgbox %res% %A_LastError%
ressize := DllCall("SizeofResource", "ptr", lib, "ptr", res, "uint")
msgbox %ressize% %A_LastError%
hresdata := DllCall("LoadResource", "ptr", lib, "ptr", res, "ptr")
msgbox %hresdata% %A_LastError%
presdata := DllCall("LockResource", "ptr", hresdata, "ptr")
msgbox %presdata% %A_LastError%
msgbox % StrGet(presdata, ressize, "UTF-8")
|
Passing the -r flag to MPRESS ("don't compress resources") makes StrGet() work.
Allright, more protection for compiled AHK scripts  _________________ fincs
Get SciTE4AutoHotkey v3.0.00 (Release Candidate)
[My project list] |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 7299 Location: Australia
|
Posted: Mon Aug 30, 2010 2:49 am Post subject: |
|
|
I hadn't gone to that much effort, just inspected the exe using PEBrowsePro. It is able to list the resources, but they appear empty when viewed. Once or twice I got an error message instead.
I think what actually happens is that the resource section of the exe is loaded by the PE loader, so Find/Load/LockResource don't really do anything other than give you the address that the resource should be at. In other words, everything seems to work, but really doesn't. StrGet fails because there's nothing meaningful at that address. |
|
| Back to top |
|
 |
fincs
Joined: 05 May 2007 Posts: 1163 Location: Seville, Spain
|
Posted: Mon Aug 30, 2010 3:06 pm Post subject: |
|
|
I found a bug: "str*" return types don't work in the x64 build:
| Code: | case DLL_ARG_INT64:
case DLL_ARG_DOUBLE:
#ifdef _WIN64 // fincs-edit: pointers are 64-bit on x64.
case DLL_ARG_STR:
#endif
// Same as next section but for eight bytes:
return_value.Int64 = *(__int64 *)return_value.Pointer;
break;
default: // Namely
//case DLL_ARG_STR: // fincs-edit: else, this is a 32-bit build, no harm on doing this:
//case DLL_ARG_INT:
//case DLL_ARG_SHORT:
//case DLL_ARG_CHAR:
//case DLL_ARG_FLOAT:
// All the above are stored in four bytes, so a straight dereference will copy the value
// over unchanged, even if it's a float.
return_value.Int = *(int *)return_value.Pointer; |
_________________ fincs
Get SciTE4AutoHotkey v3.0.00 (Release Candidate)
[My project list] |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 7299 Location: Australia
|
Posted: Mon Aug 30, 2010 9:51 pm Post subject: |
|
|
| Thanks; I've added WSTR and ASTR instead of STR. (No update yet.) |
|
| Back to top |
|
 |
AGu
Joined: 13 Aug 2010 Posts: 11
|
Posted: Tue Aug 31, 2010 10:28 am Post subject: Updating AutoHotkey_L |
|
|
I've got AutoHotkey L55 installed and now I see that L56 is out.
What should I do to update *.exe, *.chm. etc.?
Should I download and run AutoHotkey_L_Install.exe?
Or should I download AutoHotkey_Lw.zip + AutoHotkey.chm
and replace the files by hand? |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 7299 Location: Australia
|
Posted: Tue Aug 31, 2010 11:57 am Post subject: |
|
|
Using the installer is easiest, but if you're concerned about download size, the (Lw) zip and chm are currently about 1.3 MB less than the installer. Since L56 was mainly bug fixes, you can save yourself another 1.1 MB by skipping AutoHotkey.chm for now. There is no separate download for Ahk2Exe_L, so if you want that, you'll need the L56 installer. I don't expect you do, though.
If you're like me, you've customized "Edit Script" to open something other than Notepad. After having to re-customize a few times, I realized that copying the registry key HKEY_LOCAL_MACHINE\Software\Classes\AutoHotkeyScript\shell\Edit\command to HKEY_CURRENT_USER conveniently keeps the editor association intact after reinstalls. |
|
| Back to top |
|
 |
rousni
Joined: 23 Mar 2006 Posts: 126
|
Posted: Thu Sep 02, 2010 6:55 pm Post subject: virus detection |
|
|
| From the last version, (installed - 32-bit), any compiled script is treated as a "virus" by AntiVir (TR/Dropper.GEN), including when the script is the template. At the same time, AutoHotkeySC.bin is clean, again according to AntiVir. Curious and annoying AntiVir... |
|
| Back to top |
|
 |
guest3456 Guest
|
Posted: Fri Sep 03, 2010 2:31 pm Post subject: Re: virus detection |
|
|
| rousni wrote: | | From the last version, (installed - 32-bit), any compiled script is treated as a "virus" by AntiVir (TR/Dropper.GEN), including when the script is the template. At the same time, AutoHotkeySC.bin is clean, again according to AntiVir. Curious and annoying AntiVir... |
this happens often with Vanilla AHK as well.. |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 7299 Location: Australia
|
Posted: Sat Sep 04, 2010 2:09 am Post subject: |
|
|
| Quote: | Revision 57 - September 4, 2010
- Fixed Str*, WStr* and AStr* DllCall return types on x64.
- Added functionality to InStr to bring it in line with StringGetPos:
- If StartingPos is negative, the search is conducted right-to-left beginning at that offset from the end.
- An additional parameter is available to specify which occurrence of the string to find.
- Added #include <LibName> for explicitly including a script from a function library folder.
- Added functionality to IniRead and IniWrite allowing an entire section to be read or written.
- Added functionality to IniRead allowing a list of section names to be retrieved.
- Added support for custom verbs to Run/RunWait: Run *verb file.
- Made improvements to the way Run/RunWait extracts the action and its parameters from the Target parameter.
- Changed NumGet/NumPut to allow Offset to be omitted entirely since Type is always non-numeric.
- Removed the restriction that a label can't point to the end of a block.
|
|
|
| Back to top |
|
 |
rousni
Joined: 23 Mar 2006 Posts: 126
|
Posted: Sat Sep 04, 2010 9:41 am Post subject: |
|
|
Thank you for the new functionalities !
Is there a way to avoid the max section content size restriction for IniWrite and IniRead (32-bit, Windows-7)? |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 7299 Location: Australia
|
Posted: Sat Sep 04, 2010 11:05 pm Post subject: |
|
|
Probably not, other than to parse the INI file manually.
|
|
| Back to top |
|
 |
rousni
Joined: 23 Mar 2006 Posts: 126
|
Posted: Sun Sep 05, 2010 8:55 am Post subject: another question |
|
|
| Quote: | The maximum profile section size is 32,767 characters.
Source: GetPrivateProfileSection Function |
I see, thank you.
When I was using AutoHotkey, I was able to distinguish between copied text and copied file by the mean of "Transform, OutputVar, Unicode" (OutputVar is empty if a file was copied.
Can you tell me please how can I do that with AutoHotkey_L. |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 7299 Location: Australia
|
Posted: Sun Sep 05, 2010 10:02 am Post subject: |
|
|
That's obscure.
Here's a much more conventional method:
| Code: | if DllCall("IsClipboardFormatAvailable", "uint", CF_HDROP:=15)
MsgBox File: %Clipboard%
else
MsgBox Text: %Clipboard% |
AutoHotkey_L not required. |
|
| Back to top |
|
 |
rousni
Joined: 23 Mar 2006 Posts: 126
|
Posted: Sun Sep 05, 2010 10:49 am Post subject: |
|
|
| Great ! the perfect, since direct method |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 7299 Location: Australia
|
Posted: Sun Sep 05, 2010 12:21 pm Post subject: |
|
|
| Quote: | Revision 58 - September 5, 2010
Static var := expression is supported. All such expressions are evaluated immediately before the script's auto-execute section in the order they are encountered in the script. |
First example - old method vs more efficient, more convenient method:
| Code: | OldMethod() {
static var
if !var
var := init_var()
...
}
NewMethod() {
static var := init_var()
...
} |
Second example - function library with automatic initialization and clean-up:
| Code: | ; ** Demo.ahk
Lib_Func()
; ** Lib\Lib.ahk:
Lib_Func() {
msgbox func
}
_Lib_init() {
static cookie := _Lib_init()
msgbox init
return Object("base", Object("__Delete", "_Lib_term"))
}
_Lib_term() {
msgbox term
} |
|
|
| 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
|