CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: dll injection

  1. #1
    Join Date
    Aug 2005
    Location
    southampton, UK
    Posts
    1,320

    dll injection

    i have a dll i want to inject into another process. it conatains a function which overides an api function

    i was wondering what the nijection code should look like? something like
    Code:
    	HMODULE hinstDLL = LoadLibrary((LPCTSTR)"dll.dll");
        HOOKPROC hkprcSysMsg = (HOOKPROC)GetProcAddress(hinstDLL, "CallWndProc");   
    		
    	
        // Set the hook
    	DWORD ThreadIdCntrl = GetWindowThreadProcessId(windowHandle, 0);  
    	::SetWindowsHookEx(WH_CALLWNDPROC, hkprcSysMsg, hinstDLL, ThreadIdCntrl);
    ?
    With sufficient thrust, pigs fly just fine. However, this is not
    necessarily a good idea. It is hard to be sure where they are going to
    land, and it could be dangerous sitting under them as they fly
    overhead. -- RFC 1925

  2. #2
    Join Date
    Aug 1999
    Location
    <Classified>
    Posts
    6,882

    Re: dll injection

    Syntactically correct, but I am not sure if should work to inject the dll into another process.

    Does that work ?
    Regards,
    Ramkrishna Pawar

  3. #3
    Join Date
    May 2006
    Posts
    327

    Re: dll injection

    Actually, instead of (LPCTSTR)"dll.dll" you should use _T("dll.dll"). Otherwise it will not work in Unicode mode.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured