From 6dec2dad731953dbfaacb57bc22e08df10a4fae4 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 29 Apr 2019 10:45:28 +0100 Subject: [PATCH] Remove unused code getParentExe --- renderdoccmd/renderdoccmd_win32.cpp | 51 ----------------------------- 1 file changed, 51 deletions(-) diff --git a/renderdoccmd/renderdoccmd_win32.cpp b/renderdoccmd/renderdoccmd_win32.cpp index e3fcbd35d..905eb2e01 100644 --- a/renderdoccmd/renderdoccmd_win32.cpp +++ b/renderdoccmd/renderdoccmd_win32.cpp @@ -710,48 +710,6 @@ struct GlobalHookCommand : public Command } }; -// from http://stackoverflow.com/q/29939893/4070143 -// and http://stackoverflow.com/a/4570213/4070143 - -std::string getParentExe() -{ - DWORD pid = GetCurrentProcessId(); - HANDLE h = NULL; - PROCESSENTRY32 pe = {0}; - DWORD ppid = 0; - pe.dwSize = sizeof(PROCESSENTRY32); - h = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); - if(Process32First(h, &pe)) - { - do - { - if(pe.th32ProcessID == pid) - { - ppid = pe.th32ParentProcessID; - break; - } - } while(Process32Next(h, &pe)); - } - CloseHandle(h); - - if(ppid == 0) - return ""; - - h = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, ppid); - if(h) - { - char buf[MAX_PATH]; - if(GetModuleFileNameExA(h, 0, buf, MAX_PATH)) - { - CloseHandle(h); - return buf; - } - CloseHandle(h); - } - - return ""; -} - // ignore the argc/argv we get here, convert from wide to be sure we're unicode safe. int main(int, char *) { @@ -771,15 +729,6 @@ int main(int, char *) LocalFree(wargv); - // if launched from cmd.exe, be friendly and redirect output - std::string parent = getParentExe(); - for(size_t i = 0; i < parent.length(); i++) - { - parent[i] = tolower(parent[i]); - if(parent[i] == '\\') - parent[i] = '/'; - } - hInstance = GetModuleHandleA(NULL); WNDCLASSEX wc;