How to hook functions (MinHook, x86 and x64)

Sdílet
Vložit
  • čas přidán 27. 08. 2024
  • We learn how to use the MinHook library to hook/detour functions in x86 and x64
    - Music: Alchemorph - Memories
    - Code: github.com/Cas...
    - Community Discord: / discord
    Resources:
    - MinHook: github.com/Tsu...
    - Help from Fyrahh and tomsa ;)

Komentáře • 81

  • @jeffylikespugs
    @jeffylikespugs Před 3 lety +7

    This channel is a gem. Keep up the videos

  • @crapyguy1234
    @crapyguy1234 Před 3 lety +5

    woo hoo, another video! Keep the great work up!!!

    • @casualgamer1791
      @casualgamer1791  Před 3 lety

      ty :) I'll try to not slack for too long before the next one

  • @_ntds
    @_ntds Před 3 lety +2

    That's what i was waiting for! Great job, m8! Keep it up!

  • @zyzzfh
    @zyzzfh Před 3 lety +2

    sheesh u just keep uploading tysm I love these vids u explain well

  • @Bruiserjoe
    @Bruiserjoe Před 3 lety +2

    You always drop banger videos

  • @idk--7443
    @idk--7443 Před 3 lety +2

    Glad your back!

    • @casualgamer1791
      @casualgamer1791  Před 3 lety +1

      was I gone? ^^ one month since the last legit video.. not too bad for me :P

    • @idk--7443
      @idk--7443 Před 3 lety

      @@casualgamer1791 Glad your posting regularly again =)

  • @brianneish1769
    @brianneish1769 Před 3 lety +8

    Can you create a vid on how to reverse and call functions. I am having a hard time understanding a few things. Btw great vid.

  • @joelbloxx3647
    @joelbloxx3647 Před 3 lety +2

    Ahh finally fresh video

  • @zataritamods7499
    @zataritamods7499 Před rokem +2

    Question: when hooking the function from a memory address, I don't see you get the modules base address. Does min hook handle this for you when it hooked the function? Should I use the relative address?

    • @Pro_Lab
      @Pro_Lab Před 9 měsíci +1

      nope. because its an internal c++ hack, the dll is in the process itself means we're the processor we can just use the address without a problem. he made a video about that
      self loading dll: czcams.com/video/uuMg7CeJF1k/video.html

  • @topeque6993
    @topeque6993 Před 3 lety +1

    Keep going i love your videos :3

  • @FirstName-nf4fx
    @FirstName-nf4fx Před rokem +1

    @10:14 did you ever make a video explaining how to reverse functions?

  • @IntoTechMods
    @IntoTechMods Před 3 lety +1

    ♥️Great Dude ;)

  • @Frag.
    @Frag. Před 3 lety

    Thank you very much man ! You are the best

  • @freezieundso5135
    @freezieundso5135 Před 2 lety +2

    __asm doesn't work for x64 sadly. Does someone know an alternative?
    Edit: look up rtlcapturecontext

    • @Squirrelies1
      @Squirrelies1 Před 8 měsíci

      Afaik it works if you use gcc/g++ instead of MSVC.

  • @andris1337
    @andris1337 Před 3 lety +1

    another banger

  • @ruinenlust_
    @ruinenlust_ Před rokem

    This doesn't work - first I found out I couldn't call AllocConsole from my dll, my debug prints showed that, but after removing that the code says everything is fine even though _nothing_ hints at the function being hooked.

  • @EinStGate
    @EinStGate Před 3 lety +1

    10:00
    i tried this, and i tried to get the value of eax register using the inline asm mov operation and compare it in CE. it's not the same. why is that?

    • @casualgamer1791
      @casualgamer1791  Před 3 lety +1

      EAX is a register. You can think of it kind of like a global variable as such it changes all the time.

    • @EinStGate
      @EinStGate Před 3 lety

      @@casualgamer1791 thanks for replying.
      I was trying to hook a function in another game I'm playing, and without changing anything just immediately call the original function, the game crash.
      After debugging with the disassembly window visual studio provided, i noticed that the registers has been changed before calling the actual original function, which i think is causing the game crash.
      And the value passed to the hooked function has changed too before calling the original function.

    • @casualgamer1791
      @casualgamer1791  Před 3 lety +1

      That could be. Most likely it is the calling convention tho. Have you made sure the function you detour and the detour function have the same calling convention? In my case i restore ecx after cout because with my function cx is a parameter eventho the calling convention would not suggest it is but that is kinda unusual

    • @EinStGate
      @EinStGate Před 3 lety

      @@casualgamer1791 yes, I'm sure the calling convention is right, which is __fastcall.
      Or maybe it's not.
      Anyway thanks for replying, i will look more into this calling convention thing😁

    • @casualgamer1791
      @casualgamer1791  Před 3 lety

      Feel free to post the asm in the discord server in case u get stuck

  • @samansamani4477
    @samansamani4477 Před 2 lety +1

    Hey, thank you for great tutorials, love em.
    but can you please consider to create one that teach us how to find certain function that we want to hook? thank you.

    • @coldblackice
      @coldblackice Před rokem +2

      Great idea!

    • @casualgamer1791
      @casualgamer1791  Před rokem +2

      I'll make at least an introduction into that. But be warned a lot of practice goes into reversing which realy can not be replaced by watching tutorials ^^

    • @samansamani4477
      @samansamani4477 Před rokem

      @@casualgamer1791 thank you, yes I know, but we at least need to know what to practice... 😅
      so giving us an starting point would be awsome.

  • @chxnt4202
    @chxnt4202 Před 2 lety

    Hello great video as always could you please explain what the last parameter of create hook does?

  • @richsosa5045
    @richsosa5045 Před 3 lety

    Ngl your pretty good at teaching when I’m done with learning cpp I might have to make videos like you

    • @casualgamer1791
      @casualgamer1791  Před 3 lety

      tyvm :) both my parents are teachers guess I learned a bit from them

  • @_____666______
    @_____666______ Před rokem +1

    make full hooking tutorial for beginners.
    thanks in advance

  • @papst5
    @papst5 Před 3 lety

    nicely explained ty

  • @hyjarion6972
    @hyjarion6972 Před 2 lety

    Hi! Thank you for this video! Does this library supports Trampoline method of hooking functions?

  • @vaka984
    @vaka984 Před 3 lety +1

    Thank you for your interesting videos.
    Could you record a video about how to use opencv to write a program that can be manually trained to recognize characters (letters). Let's say the symbol J is on the screen(it can be of different colors or sizes), you need to save it and at the next similar symbol, the program will recognize this symbol J and pressed the corresponding key?(for mini-games) (If, of course, I have clearly translated my thought through a translator, and this topic may be interesting to you and the audience).

    • @vaka984
      @vaka984 Před 3 lety

      (Example, not advertising) czcams.com/video/qb3UuQrHmbY/video.html

    • @casualgamer1791
      @casualgamer1791  Před 3 lety +1

      Interesting idea but i am not sure if opencv is the best library for that. Maybe tesseract?

    • @vaka984
      @vaka984 Před 3 lety

      Here I found: czcams.com/video/CK0OCeCN9zg/video.html
      But this is designed for a ready-made database, and not training it in real time

  • @SyntexKavindu
    @SyntexKavindu Před 2 lety

    Bro How to fix Linker Tools Error LNK1181 can’t open file libminhook.lib

  • @TailsFinance777
    @TailsFinance777 Před 2 lety

    thanks easy to explanation

  • @Gamer-xk8bk
    @Gamer-xk8bk Před 11 měsíci

    can you also add new character in the game and add code to it using hooking

  • @SpartaVandros
    @SpartaVandros Před 2 lety

    Hey, not sure if your still active. Could you please provide some insight on hooking and return values from registers on a 32-Bit game. I'd really appreciate it.

    • @casualgamer1791
      @casualgamer1791  Před 2 lety +1

      I am and I will. Just very buissy atm ;(

    • @SpartaVandros
      @SpartaVandros Před 2 lety

      @@casualgamer1791 Hopefully it's soon. I'm trying to finish a cheat I'm creating but have no idea how to go about hooking externally. For me the entity is in the register EDX when I debug. Anyways though I been researching and going through open source code but, It's just not clicking in my brain at the moment. Hopefully it will come to me very soon.

    • @casualgamer1791
      @casualgamer1791  Před 2 lety

      Gl m8. You can always ask for help on the discord server :)

  • @reoteuray9823
    @reoteuray9823 Před 2 lety

    can i hook a function which not window function ?

    • @casualgamer1791
      @casualgamer1791  Před 2 lety +1

      certainly, "just" gotta figure out the location and calling convention

    • @reoteuray9823
      @reoteuray9823 Před 2 lety

      @@casualgamer1791 MinHook can hooking internal functions in C# ?

  • @emailgames1508
    @emailgames1508 Před 2 lety

    Still waiting for the how to reverse functions video :D

    • @casualgamer1791
      @casualgamer1791  Před 2 lety

      Still learning myself. Most of it is practice. The general theroy aint that deep

  • @mateokladaric
    @mateokladaric Před 3 lety

    What about mid function hooks.. can Minhook do that too?

    • @casualgamer1791
      @casualgamer1791  Před 3 lety

      I do not think it is intended for that purpose no but you could try it just passing the pointer to the location inside the function instead of the beginning

    • @mateokladaric
      @mateokladaric Před 3 lety

      @@casualgamer1791 That is exactly my plan, the only problem is the calling convention, do I make it the same as the start of the func or because it is the middle it should change maybe??

    • @mateokladaric
      @mateokladaric Před 2 lety

      @darwin because calling arguments on the start of the hook of a func, set registries to be X Y Z... through the func the registry changes and now you are telling me that I can pull a fast call with arguments in the middle of no where

    • @mateokladaric
      @mateokladaric Před 2 lety

      @darwin i didnt ask if the impossible was possible in my question i just asked for a possible way

    • @chxnt4202
      @chxnt4202 Před rokem +2

      @@mateokladaric i know this comment is a year old but you can do a midfunction hook by doing everything in this video except your detour function must be a declspec naked with no paramateres and the type def for the function should be a void return type with no pararmetres one final reaquirment is inside the detour function you must use inline assembly and do a jump(jmp) to the orignal function pointer

  • @68fk
    @68fk Před 2 lety

    Bro i have esp andlua can crack ?

  • @alieeeeennnnnn
    @alieeeeennnnnn Před 3 lety

    epic stuff

  • @cuongpt5556
    @cuongpt5556 Před 3 lety

    Make tutorial Edit Packets Game Online please Bro. Thank you

  • @boredduck231
    @boredduck231 Před 3 lety +1

    ;-; you were to late i learned minhook like 2 days ago
    it was a pain

  • @Antonizz
    @Antonizz Před 2 lety

    can you make one for directx 11 pls ?

  • @aname0
    @aname0 Před 2 lety

    10:24 memo

  • @trad_rashtra_sevak
    @trad_rashtra_sevak Před 3 lety

    Discord link expired

  • @yousafkhan481
    @yousafkhan481 Před 3 lety

    Bro make a video in gameloop emulator hooking

  • @bbcbshdbeijxhs50
    @bbcbshdbeijxhs50 Před 3 lety

    Will this allow me to inject into warzone?

  • @unperson37
    @unperson37 Před 3 lety

    Please make bot for clash of clans to android

  • @RandomRepository1024
    @RandomRepository1024 Před rokem

    dllinject failed. "MinHook.x86.dll", the system cannot find the specific file. ç.ç

    • @Pro_Lab
      @Pro_Lab Před 9 měsíci

      don't make the same mistake as I did; instead of putting the lib and include folder in \source
      epos\TestDll I put them in \source
      epos\TestDll\TestDll