summaryrefslogtreecommitdiff
path: root/src/burn/engine/approvedexe.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/burn/engine/approvedexe.cpp')
-rw-r--r--src/burn/engine/approvedexe.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/burn/engine/approvedexe.cpp b/src/burn/engine/approvedexe.cpp
index 2a96868e..d8bd956b 100644
--- a/src/burn/engine/approvedexe.cpp
+++ b/src/burn/engine/approvedexe.cpp
@@ -148,6 +148,7 @@ extern "C" HRESULT ApprovedExesLaunch(
148 LPWSTR sczCommand = NULL; 148 LPWSTR sczCommand = NULL;
149 LPWSTR sczCommandObfuscated = NULL; 149 LPWSTR sczCommandObfuscated = NULL;
150 LPWSTR sczExecutableDirectory = NULL; 150 LPWSTR sczExecutableDirectory = NULL;
151 size_t cchExecutableDirectory = 0;
151 STARTUPINFOW si = { }; 152 STARTUPINFOW si = { };
152 PROCESS_INFORMATION pi = { }; 153 PROCESS_INFORMATION pi = { };
153 154
@@ -177,9 +178,17 @@ extern "C" HRESULT ApprovedExesLaunch(
177 // Try to get the directory of the executable so we can set the current directory of the process to help those executables 178 // Try to get the directory of the executable so we can set the current directory of the process to help those executables
178 // that expect stuff to be relative to them. Best effort only. 179 // that expect stuff to be relative to them. Best effort only.
179 hr = PathGetDirectory(pLaunchApprovedExe->sczExecutablePath, &sczExecutableDirectory); 180 hr = PathGetDirectory(pLaunchApprovedExe->sczExecutablePath, &sczExecutableDirectory);
181 if (SUCCEEDED(hr))
182 {
183 // CreateProcessW has undocumented MAX_PATH restriction for lpCurrentDirectory even when long path support is enabled.
184 hr = ::StringCchLengthW(sczExecutableDirectory, MAX_PATH - 1, &cchExecutableDirectory);
185 }
186
180 if (FAILED(hr)) 187 if (FAILED(hr))
181 { 188 {
182 ReleaseNullStr(sczExecutableDirectory); 189 ReleaseNullStr(sczExecutableDirectory);
190
191 hr = S_OK;
183 } 192 }
184 193
185 LogId(REPORT_STANDARD, MSG_LAUNCHING_APPROVED_EXE, pLaunchApprovedExe->sczExecutablePath, sczCommandObfuscated); 194 LogId(REPORT_STANDARD, MSG_LAUNCHING_APPROVED_EXE, pLaunchApprovedExe->sczExecutablePath, sczCommandObfuscated);