Jump to content

Simple AutoIt to C++


Recommended Posts

I have got a simple RunPE function in AutoIt, but I would like to know how to make the same in C++.

My AutoIt code is the following:

Func RunPE($path, $filebin)
    Local $ASM = "Some Binary"

    Local $BufferASM = DllStructCreate("byte[" & BinaryLen($ASM) & "]")
    Local $binBuffer = DllStructCreate("byte[" & BinaryLen($filebin) & "]")

    DllStructSetData($BufferASM, 1, $ASM)
    DllStructSetData($binBuffer, 1, $filebin)

    Local $Ret = DllCall("user32.dll", "int", "CallWindowProcW", "ptr", DllStructGetPtr($BufferASM), "wstr", ($path), "ptr", DllStructGetPtr($binBuffer), "int", 0, "int", 0)
EndFunc

I tried to do the same in C++ by calling CallWindowProcW, but I'm not sure how to call it the way in AutoIt.

MSDN says, the syntay for CallWindowProc is the following:

LRESULT CallWindowProc( 
  WNDPROC lpPrevWndFunc, 
  HWND hWnd, 
  UINT Msg, 
  WPARAM wParam, 
  LPARAM lParam 
);

If I'm right, the 1st param would be in c++ the byte anything[1288], but byte is not a WNDPROC, how the hell could I give it as WNDPROC? And the 2nd param originally a HWND, but in AutoIt, we're passing it a string. How is it possible?

I hope someone can help me :)

Thank you.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...