I've tried putting the DLL in both the starter apps folder as well as the System32 folder (WinXP). The dWord variable is something I statically changed when I was testing this. I would open the form, get it's ProcessID, and hardcode it to make sure I was getting the right ID, and try to inject that specific form. I notice the madCHook documentation it's looking for a ProcessHandle, is this different than a ProcessID?
For the below example, the ProcessID for the Form1 window (using MS SPY++) is 00000A98.
Anyways, here's my starter app using InjectLibrary:
Code: Select all
// Injection.cpp : Defines the entry point for the console application.
#include "stdafx.h"
#include "windows.h"
#include "madCHook.h"
int _tmain(int argc, _TCHAR* argv[])
{
InitializeMadCHook();
DWORD dWord = (DWORD)0x00000A98;
InjectLibrary(dWord,(LPCWSTR)"NSR_SM.dll");
FinalizeMadCHook();
return 0;
}
Code: Select all
// NSR_Shell.cpp : Defines the entry point for the console application.
#include "stdafx.h"
#include "windows.h"
#include "madCHook.h"
int _tmain(int argc, _TCHAR* argv[])
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
InitializeMadCHook();
CreateProcessEx("NSR_Form.exe", NULL, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi, "NSR_SM.dll");
FinalizeMadCHook();
return 0;
}
-Rolln