diff options
Diffstat (limited to 'src/burn/engine/core.cpp')
-rw-r--r-- | src/burn/engine/core.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/burn/engine/core.cpp b/src/burn/engine/core.cpp index 716e5af1..90bbc8f6 100644 --- a/src/burn/engine/core.cpp +++ b/src/burn/engine/core.cpp | |||
@@ -12,6 +12,7 @@ struct BURN_CACHE_THREAD_CONTEXT | |||
12 | }; | 12 | }; |
13 | 13 | ||
14 | 14 | ||
15 | static PFN_CREATEPROCESSW vpfnCreateProcessW = ::CreateProcessW; | ||
15 | static PFN_PROCWAITFORCOMPLETION vpfnProcWaitForCompletion = ProcWaitForCompletion; | 16 | static PFN_PROCWAITFORCOMPLETION vpfnProcWaitForCompletion = ProcWaitForCompletion; |
16 | 17 | ||
17 | 18 | ||
@@ -1947,12 +1948,46 @@ LExit: | |||
1947 | } | 1948 | } |
1948 | 1949 | ||
1949 | extern "C" void CoreFunctionOverride( | 1950 | extern "C" void CoreFunctionOverride( |
1951 | __in_opt PFN_CREATEPROCESSW pfnCreateProcessW, | ||
1950 | __in_opt PFN_PROCWAITFORCOMPLETION pfnProcWaitForCompletion | 1952 | __in_opt PFN_PROCWAITFORCOMPLETION pfnProcWaitForCompletion |
1951 | ) | 1953 | ) |
1952 | { | 1954 | { |
1955 | vpfnCreateProcessW = pfnCreateProcessW; | ||
1953 | vpfnProcWaitForCompletion = pfnProcWaitForCompletion; | 1956 | vpfnProcWaitForCompletion = pfnProcWaitForCompletion; |
1954 | } | 1957 | } |
1955 | 1958 | ||
1959 | extern "C" HRESULT CoreCreateProcess( | ||
1960 | __in_opt LPCWSTR wzApplicationName, | ||
1961 | __inout_opt LPWSTR sczCommandLine, | ||
1962 | __in BOOL fInheritHandles, | ||
1963 | __in DWORD dwCreationFlags, | ||
1964 | __in_opt LPCWSTR wzCurrentDirectory, | ||
1965 | __in WORD wShowWindow, | ||
1966 | __out LPPROCESS_INFORMATION pProcessInformation | ||
1967 | ) | ||
1968 | { | ||
1969 | HRESULT hr = S_OK; | ||
1970 | STARTUPINFOW si = { }; | ||
1971 | size_t cchCurrentDirectory = 0; | ||
1972 | |||
1973 | // CreateProcessW has undocumented MAX_PATH restriction for lpCurrentDirectory even when long path support is enabled. | ||
1974 | if (wzCurrentDirectory && FAILED(::StringCchLengthW(wzCurrentDirectory, MAX_PATH - 1, &cchCurrentDirectory))) | ||
1975 | { | ||
1976 | wzCurrentDirectory = NULL; | ||
1977 | } | ||
1978 | |||
1979 | si.cb = sizeof(si); | ||
1980 | si.wShowWindow = wShowWindow; | ||
1981 | |||
1982 | if (!vpfnCreateProcessW(wzApplicationName, sczCommandLine, NULL, NULL, fInheritHandles, dwCreationFlags, NULL, wzCurrentDirectory, &si, pProcessInformation)) | ||
1983 | { | ||
1984 | ExitWithLastError(hr, "CreateProcessW failed with return code: %d", Dutil_er); | ||
1985 | } | ||
1986 | |||
1987 | LExit: | ||
1988 | return hr; | ||
1989 | } | ||
1990 | |||
1956 | extern "C" HRESULT DAPI CoreWaitForProcCompletion( | 1991 | extern "C" HRESULT DAPI CoreWaitForProcCompletion( |
1957 | __in HANDLE hProcess, | 1992 | __in HANDLE hProcess, |
1958 | __in DWORD dwTimeout, | 1993 | __in DWORD dwTimeout, |