write in PureBasic...Thorium wrote: sorry english is not my nativ language.


write in PureBasic...Thorium wrote: sorry english is not my nativ language.
I think I get it now, thanks for the explanation. 6 Bytes are not enough if you want to 'copy and paste' the instruction elsewhere, to be able to call the original procedure.Thorium wrote:I hope thats better understandable, sorry english is not my nativ language.
Also, I wonder, when you say "If you hook API functions", what is the hooking method you're talking about?Thorium wrote:If you hook API functions you can just put the parameter in the hook procedure as normal parameters. No assembler needed, if it's StdCall.
There are different methods, like altering the import table, but thats not what i meant. I said API functions, because they use the SdtCall call convention which PB procedurs use, so they are compatible. If you jump (not call) right from the start of the API function to the PB function you dont need to care about the parameters, because they are on the stack the same way if the procedure would have called normal. If you use a call you mess up the stack because it pushes the return address to the stack.Jihugen wrote:Also, I wonder, when you say "If you hook API functions", what is the hooking method you're talking about?Thorium wrote:If you hook API functions you can just put the parameter in the hook procedure as normal parameters. No assembler needed, if it's StdCall.
Is it a different method that doesn't rely on patching the executable in memory?
Cleanest way would be to allocate a memory block and change access rights to #PAGE_EXECUTE_READWRITE.Jihugen wrote: Just by curiosity, where would you write the backuped bytes. In a new allocated memory area, or right at the beginning of the hook procedure?
In the later case, how do you reserve some space to write the 6 (or more) bytes at the beginning of the hook procedure?
Code: Select all
code
code
code
code
ReservedSpace:
!nop
!nop
!nop
!nop
!nop
!nop
!nop
!nop
!nop
code
code
code
code
Code: Select all
MOV rax, address
JMP rax
Code: Select all
MOV eax, address
JMP eax
Try to disassemble MessageBoxA. Right on the first instruction the result is "invalid".Jihugen wrote:I don't know what wrong for you with the onerror lib.
Code: Select all
DisableDebugger ; do not disassemble any debugger related instructions
Code_Start:
; Place code to be disassembled here
!mov edi, edi
Code_End:
Text$ = "Disassembled code: " + Chr(13)
If ExamineAssembly(?Code_Start, ?Code_End)
While NextInstruction()
Text$ + RSet(Hex(InstructionAddress()), SizeOf(Integer)*2, "0")
Text$ + " " + InstructionString() + Chr(13)
Wend
EndIf
MessageRequester("Result", Text$)
Another way i used to fool detection isDarkDragon wrote: And it doesn't use the E9 JMP. It useson 64bit systems andCode: Select all
MOV rax, address JMP rax
on 32bit systems.Code: Select all
MOV eax, address JMP eax
Code: Select all
!push const
!ret
very good job.....DarkDragon wrote: http://www.bradan.eu/files/hook.zip
Fool detection by what?Thorium wrote: Another way i used to fool detection isCode: Select all
!push const !ret
Good job on this by the way.DarkDragon wrote: http://www.bradan.eu/files/hook.zip
By the code you quoted.SFSxOI wrote:Fool detection by what?Thorium wrote: Another way i used to fool detection isCode: Select all
!push const !ret
Do whatever you want to do with ituweb wrote:@Daniel :
grandiose job !!!
is it allowed to use it in (or in collaboration with) a close-source?
my project would become a more multifaceted usage with your hook.