When I am compiling in visual c++ 2008 express edition I am receiving these two errors
main.cpp(224) : error C2664: '_stricmp' : cannot convert parameter 1 from 'WCHAR [260]' to 'const char *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
main.cpp(269) : error C2664: 'strcmp' : cannot convert parameter 2 from 'WCHAR [256]' to 'const char *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
the 2 lines of code that is giving error is
if(_stricmp(lppe.szExeFile,process)==0)
if (strcmp(DllName,me32.szModule) == 0){
which is part of the functions
- DWORD GetPIDForProcess (char* process)
-
{
-
BOOL working=0;
-
PROCESSENTRY32 lppe= {0};
-
DWORD targetPid=0;
-
-
HANDLE hSnapshot=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS ,0);
-
if (hSnapshot)
-
{
-
lppe.dwSize=sizeof(lppe);
-
working=Process32First(hSnapshot,&lppe);
-
while (working)
-
{
-
if(_stricmp(lppe.szExeFile,process)==0)
-
{
-
targetPid=lppe.th32ProcessID;
-
break;
-
}
-
working=Process32Next(hSnapshot,&lppe);
-
}
-
}
-
-
CloseHandle( hSnapshot );
-
return targetPid;
-
}
and
- DWORD GetDLLBase(char* DllName, DWORD tPid)
-
{
-
HANDLE snapMod;
-
MODULEENTRY32 me32;
-
-
if (tPid == 0) return 0;
-
snapMod = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, tPid);
-
me32.dwSize = sizeof(MODULEENTRY32);
-
if (Module32First(snapMod, &me32)){
-
do{
-
if (strcmp(DllName,me32.szModule) == 0){
-
CloseHandle(snapMod);
-
return (DWORD) me32.modBaseAddr;
-
}
-
}while(Module32Next(snapMod,&me32));
-
}
-
-
CloseHandle(snapMod);
-
return 0;
-
-
}
Can someone edited my code so I can compile correctly?