Jump to content
Sign in to follow this  
fenhanxue

app crash when dllcall CallWindowProc

Recommended Posts

fenhanxue
Posted (edited)

here's my code:

#AutoIt3Wrapper_UseX64 = n
_Base64Encode('test')

Func _Base64Encode($Data, $LineBreak = 76)

        Local $Opcode = "0x5589E5FF7514535657E8410000004142434445464748494A4B4C4D4E4F505152535455565758595A6162636465666768696A6B6C6D6E6F707172737475767778797A303132333435363738392B2F005A8B5D088B7D108B4D0CE98F0000000FB633C1EE0201D68A06880731C083F901760C0FB6430125F0000000C1E8040FB63383E603C1E60409C601D68A0688470183F90176210FB6430225C0000000C1E8060FB6730183E60FC1E60209C601D68A06884702EB04C647023D83F90276100FB6730283E63F01D68A06884703EB04C647033D8D5B038D7F0483E903836DFC04750C8B45148945FC66B80D0A66AB85C90F8F69FFFFFFC607005F5E5BC9C21000"
        Local $CodeBuffer = DllStructCreate("byte[" & BinaryLen($Opcode) & "]")
        DllStructSetData($CodeBuffer, 1, $Opcode)
        $Data = Binary($Data)
        Local $Input = DllStructCreate("byte[" & BinaryLen($Data) & "]")
        DllStructSetData($Input, 1, $Data)
        $LineBreak = Floor($LineBreak / 4) * 4
        Local $OputputSize = Ceiling(BinaryLen($Data) * 4 / 3)
        $OputputSize = $OputputSize + Ceiling($OputputSize / $LineBreak) * 2 + 4
        Local $Ouput = DllStructCreate("char[" & $OputputSize & "]")
        
        
      DllCall("user32.dll", "none", "CallWindowProc", "ptr", DllStructGetPtr($CodeBuffer), _
                "ptr", DllStructGetPtr($Input), _
                "int", BinaryLen($Data), _
                "ptr", DllStructGetPtr($Ouput), _
                "uint", $LineBreak)
                
                
        Return DllStructGetData($Ouput, 1)

EndFunc   ;==>_Base64Encode

 I  find  the code can not go through  this line:

DllCall("user32.dll", "none", "CallWindowProc", "ptr", DllStructGetPtr($CodeBuffer), _
                "ptr", DllStructGetPtr($Input), _
                "int", BinaryLen($Data), _
                "ptr", DllStructGetPtr($Ouput), _
                "uint", $LineBreak)

Can anyone help me ?

Edited by fenhanxue

Share this post


Link to post
Share on other sites
Earthshine
Posted (edited)

what is this for? could you be less vague with the details? 

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
funkey

Don't know, but I think you should start your script as x86 not as x64 application


Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Share this post


Link to post
Share on other sites
fenhanxue
8 hours ago, Earthshine said:

what is this for? could you be less vague with the details? 


DllCall("user32.dll", "none", "CallWindowProc", "ptr", DllStructGetPtr($CodeBuffer), _
                "ptr", DllStructGetPtr($Input), _
                "int", BinaryLen($Data), _
                "ptr", DllStructGetPtr($Ouput), _
                "uint", $LineBreak)

not all the computers can this code works in.     forgive me  my  poor  english   ,   the iss is about  "CallWindowProc

in some of my friends cumputers , the code can work

but  in my computer, when the code cames to this line ,it  accurs app crash.

 

Share this post


Link to post
Share on other sites
trancexx

The code to run should be marked as executable code. On modern systems you can't just run random bytes. Search for VirtualProtect and PAGE_EXECUTE.

On top of that CallWindowProc is old way of running code, check DllCallAddress.


♡♡♡

.

eMyvnE

Share this post


Link to post
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
Sign in to follow this  

×