@@ -124,61 +124,7 @@ void CreateLogFile() {
124124 _time64 (&ModAPI::logFileStartTime);
125125
126126 wchar_t log_path_buf[MAX_PATH ] = { 0 };
127-
128- // try to find parent process
129- PROCESSENTRY32 processEntry = { 0 };
130- processEntry.dwSize = sizeof (PROCESSENTRY32 );
131- const int pid = GetCurrentProcessId ();
132- HANDLE toolHelpHandle = CreateToolhelp32Snapshot (TH32CS_SNAPPROCESS , 0 );
133- bool foundParentProccess = false ;
134- bool hasParentProcessPath = false ;
135- DWORD parentProcessId = 0 ;
136-
137- if (toolHelpHandle != INVALID_HANDLE_VALUE &&
138- Process32First (toolHelpHandle, &processEntry))
139- {
140- do
141- {
142- if (processEntry.th32ProcessID == pid)
143- {
144- parentProcessId = processEntry.th32ParentProcessID ;
145- foundParentProccess = true ;
146- break ;
147- }
148- } while (Process32Next (toolHelpHandle, &processEntry));
149- }
150-
151- // attempt to retrieve the module file path
152- if (foundParentProccess && parentProcessId != 0 )
153- {
154- HANDLE parentProcessHandle = OpenProcess (PROCESS_QUERY_INFORMATION | PROCESS_VM_READ , FALSE , parentProcessId);
155- if (parentProcessHandle != INVALID_HANDLE_VALUE )
156- {
157- if (GetModuleFileNameExW (parentProcessHandle, 0 , log_path_buf, _countof (log_path_buf)) != 0 )
158- {
159- hasParentProcessPath = true ;
160- }
161- CloseHandle (parentProcessHandle);
162- }
163- }
164-
165- // when we've found the parent process, ensure we have an allowed filename
166- // currently, only the launcher kit & SMM are allowed
167- if (hasParentProcessPath)
168- {
169- if (wcsstr (log_path_buf, L" Spore ModAPI Launcher.exe" ) == nullptr &&
170- wcsstr (log_path_buf, L" Launch Spore.exe" ) == nullptr )
171- {
172- hasParentProcessPath = false ;
173- }
174- }
175-
176- // when we don't have the parent process' path,
177- // fallback to the executable path
178- if (!hasParentProcessPath)
179- {
180- GetModuleFileNameW (nullptr , log_path_buf, _countof (log_path_buf));
181- }
127+ GetModuleFileNameW (nullptr , log_path_buf, _countof (log_path_buf));
182128
183129 eastl::string16 log_path;
184130 log_path.reserve (MAX_PATH );
0 commit comments