GetModuleHandleA("CShell.dll")


DWORD Crossfire = NULL;
DWORD dwPID[100] = {NULL};
DWORD CShell = NULL;
HMODULE hModule[100] = {NULL};
DWORD cbNeeded = NULL;
char FileName[100] = {NULL};
//lets find the crossfire.exe pid first
//we will loop untill we can find it
do
{
//i will use EnumProcesses to retrive all opened processes pids
EnumProcesses(dwPID, 100, &cbNeeded);
//now lets check which one is Crossfire.exe
for (int i=0; i<100; i++)
{
//Open the process
HANDLE hProc = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, dwPID[i]);
//Get the executable name
GetProcessImageFileNameA(hProc, FileName, 100);
//no need for the handle now :P
ProcessClose(hProc);
//lets check the name we just got
if (!(stricmp(FileName, "crossfire.exe")))
{
//we got the pid
Crossfire = dwPID[i]
}
}
//just to lower the lag
Sleep(100);
} while (Crossfire == NULL);
//lets open the process again
//this time i will use PROCESS_ALL_ACCESS access right because you are going to edit memory later ; )
HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, Crossfire);
//now lets find the CShell handle
//again i will loop until i have this handle
do
{
//i will use EnumOricessModules to retrive all modules in the process
EnumProcessModules(hProc, hModule, 100, &cbNeeded);
//now lets check which one is CShell.dll
for (int i=0; i<100; i++)
{
//Get the module name
GetModuleBaseNameA(hProc, hModule[i], FileName, 100);
//lets check the name we just got
if (!(stricmp(FileName, "CShell.dll")))
{
//we got the handle
CShell = (DWORD)hModule[i];
}
}
//just to lower the lag
Sleep(100);
} while (CShell == NULL);
//you have just got the handle
//you still want to use this method?
//i hope you dont.. it seems very hard.. even for me..
