InjectAhkDll - Fix malformed VirtualFreeEx calls #11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
MEM_RELEASE
inDllCall("VirtualFreeEx","PTR",hProc,"PTR",pBufferRemote,"PTR",nDirLength,MEM_RELEASE)
is missing itsDWORD
type. This causes the value ofMEM_RELEASE
to be incorrectly interpreted as being the calling convention/return type for theDllCall
, causingInjectAhkDll
to throw wheneverVirtualFreeEx
is called.The
Struct
definition_MODULEENTRY32
was changed to useFormat
for populating the array sizes, instead of relying on the continuation section. I imagine you wanted to keep the V1 and V2 versions as similar as possible, but that's not how continuation sections work in V2. Instead of passing in the correct array size, a string is passed. The struct size reported later on bysizeof
is, therefore, wrong, which is likely what has been causing the crashes on 64-bit.The example has also been updated. It injects into
notepad x86
on x86 systems, andnotepad x86/64
on x64 systems, depending on the bitness of the interpreter.I need to know what your intentions were regarding constructs such as:
In V1 the result of
MessageBox
will be returned, whereas in V2, the result of evaluating the last expression will be returned. What did you intend to return here? I'd guess theMessageBox
result. Is there an explicit reason forCloseHandle
to be called afterMessageBox
? If not, I'd recommend restructuring these bits.Lastly, I understand you want to keep both versions similar, but aren't checks like
A_IsUnicode ? 2 : 1
pointless, since the V2 interpreters are Unicode only?