Unc3nZureD Posted July 12, 2014 Posted July 12, 2014 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.
FaridAgl Posted July 12, 2014 Posted July 12, 2014 There are better ways of running bytecodes in C++. Check this out: http://stackoverflow.com/questions/9960721/how-to-get-c-code-to-execute-hex-bytecode http://faridaghili.ir
Richard Robertson Posted July 14, 2014 Posted July 14, 2014 WNDPROC is a function pointer and HWND is a generic pointer. C++ calling conventions don't really care what you pass. It's the actual function that does.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now