Using Struct() to provide multiple parameters for CreateRemoteThread?

Post AHK_H specific scripts & libraries and discuss the usage and development of HotKeyIt's fork/branch
crocodile
Posts: 98
Joined: 28 Dec 2020, 13:41

Using Struct() to provide multiple parameters for CreateRemoteThread?

10 Jun 2022, 07:27

I'm trying to get InjectAhkDll() to support all the parameters of NewThread() when creating a new thread: code/options/title
and I have found the relevant information, but unfortunately I can't read the C code in it. How can I convert it to ahk please?

I tried to modify it like this, but apparently this is not correct

Code: Select all

    if script
  {
 	scr:=Struct("LPTSTR code, opt, title", ,{code: "MsgBox 123", opt: "opt", title: "test"})


    if !pBufferScript := DllCall("VirtualAllocEx", "Ptr", hProc, "Ptr", 0, "Ptr", scr.size, "UInt", MEM_COMMIT, "UInt", PAGE_EXECUTE_READWRITE, "Ptr")
      return (DllCall("MessageBox", "Ptr", 0, "Str", "Could not reserve memory for process.", "Str", "Error", "UInt", 0)
            , DllCall("CloseHandle", "Ptr", hProc))

    ; Write script to remote process memory
    DllCall("WriteProcessMemory", "Ptr", hProc, "Ptr", pBufferScript, "Ptr", scr.ptr, "Ptr", scr.size, "Ptr", 0)

Return to “AutoHotkey_H”

Who is online

Users browsing this forum: No registered users and 54 guests