update widows getPath to only output the path, not the path and exe filename, to correspond with the linux versions

develop
belal 2010-09-16 21:44:38 -04:00
parent 6661d7e1f7
commit 3dfbc5fb21
2 changed files with 4 additions and 2 deletions

@ -937,7 +937,8 @@ string SHMProcess::getPath()
HANDLE hProcess = OpenProcess( PROCESS_ALL_ACCESS, FALSE, d->process_ID ); //get the handle from the process ID HANDLE hProcess = OpenProcess( PROCESS_ALL_ACCESS, FALSE, d->process_ID ); //get the handle from the process ID
EnumProcessModules(hProcess, &hmod, 1 * sizeof(HMODULE), &junk); //get the module from the handle EnumProcessModules(hProcess, &hmod, 1 * sizeof(HMODULE), &junk); //get the module from the handle
GetModuleFileNameEx(hProcess,hmod,String,sizeof(String)); //get the filename from the module GetModuleFileNameEx(hProcess,hmod,String,sizeof(String)); //get the filename from the module
return(string(String)); string out(String);
return(out.substr(0,out.find_last_of("\\")));
} }
// get module index by name and version. bool 0 = error // get module index by name and version. bool 0 = error
bool SHMProcess::getModuleIndex (const char * name, const uint32_t version, uint32_t & OUTPUT) bool SHMProcess::getModuleIndex (const char * name, const uint32_t version, uint32_t & OUTPUT)

@ -512,5 +512,6 @@ string NormalProcess::getPath()
char String[255]; char String[255];
EnumProcessModules(d->my_handle, &hmod, 1 * sizeof(HMODULE), &junk); //get the module from the handle EnumProcessModules(d->my_handle, &hmod, 1 * sizeof(HMODULE), &junk); //get the module from the handle
GetModuleFileNameEx(d->my_handle,hmod,String,sizeof(String)); //get the filename from the module GetModuleFileNameEx(d->my_handle,hmod,String,sizeof(String)); //get the filename from the module
return(string(String)); string out(String);
return(out.substr(0,out.find_last_of("\\")));
} }