Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- am i calling it right, this was just a test no errors compile time or run time, it just closes, why isent that function hooking them? Nothing happens, and i know for a fact all the dlls i need are being loaded via symbols. its pissing me off DEAD!!!! Help me brother. If so you can come on my teamviewer and take a look. But id rather not, if you can see a error or something?
- #include "ntStructures.h"
- typedef BOOL(__stdcall *waBeep)(unsigned int);
- int _tmain(int argc, wchar_t* argv[]) {
- waBeep hook;
- waLoadLibandGetProcAddrHook(L"User32.dll", "MessageBeep", NULL, (void *)hook);
- hook(0xFFFFFFFF);
- getchar();
- return 0;
- }
- .h
- //WINAPI Hooks -TODO: WriteProcessMemory or NT WriteVirtualMemory
- typedef HINSTANCE (__stdcall *waLoadLib)(LPCTSTR);
- typedef HINSTANCE (__stdcall *waGetModH)(LPCTSTR);
- VOID waLoadLibandGetProcAddrHook(LPCTSTR dllName, LPCSTR functionName, LPCTSTR libName, PVOID hookName) {
- waLoadLib LoadLibHook = (waLoadLib)GetProcAddress(LoadLibrary(L"Kernel32.dll"), "LoadLibrary");
- waGetModH GetProcHook = (waGetModH)GetProcAddress(LoadLibHook(L"Kernel32.dll"), "GetModuleHandle");
- if(LoadLibHook == NULL) {
- printf("Error - %d - Function Failed..Returning..", GetLastError());
- return;
- }
- if(GetProcHook == NULL) {
- printf("Error - %d - Function Failed..Returning..", GetLastError());
- return;
- }
- if(libName != NULL) {
- void *activateHookWithLoadLib = GetProcAddress(LoadLibHook(libName), functionName);
- hookName = activateHookWithLoadLib;
- if(hookName == NULL) {
- printf("Hook Failed");
- return;
- }
- return hookName;
- }
- else if(libName == NULL) {
- void *activateHookWithGetModH = GetProcAddress(GetProcHook(dllName), functionName);
- hookName = activateHookWithGetModH;
- if(hookName == NULL) {
- printf("Hook Failed!");
- return;
- }
- return hookName;
- }
- return hookName;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement