Guest User

Untitled

a guest
May 26th, 2022
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.76 KB | None | 0 0
  1. diff --git a/steam_helper/steam.cpp b/steam_helper/steam.cpp
  2. index 79fa95d24c5..e97281b3f81 100644
  3. --- a/steam_helper/steam.cpp
  4. +++ b/steam_helper/steam.cpp
  5. @@ -952,7 +952,9 @@ static BOOL should_use_shell_execute(const WCHAR *cmdline)
  6.  
  7. static HANDLE run_process(BOOL *should_await)
  8. {
  9. - WCHAR *cmdline = GetCommandLineW();
  10. + typedef HRESULT (WINAPI *PathCchRemoveFileSpecFunc)(WCHAR *path, SIZE_T size);
  11. + PathCchRemoveFileSpecFunc pPathCchRemoveFileSpec;
  12. + WCHAR *cmdline = GetCommandLineW(), *current_directory = NULL;
  13. STARTUPINFOW si = { sizeof(si) };
  14. PROCESS_INFORMATION pi;
  15. DWORD flags = CREATE_UNICODE_ENVIRONMENT;
  16. @@ -983,7 +985,7 @@ static HANDLE run_process(BOOL *should_await)
  17. WCHAR *scratchW;
  18. char *scratchA;
  19. WCHAR *start, *end, *dos, *remainder, *new_cmdline;
  20. - size_t argv0_len;
  21. + size_t argv0_len, length;
  22. int r;
  23. DWORD_PTR console;
  24. SHFILEINFOW sfi;
  25. @@ -1054,11 +1056,17 @@ static HANDLE run_process(BOOL *should_await)
  26. lstrcatW(new_cmdline, dquoteW);
  27. lstrcatW(new_cmdline, remainder);
  28.  
  29. + pPathCchRemoveFileSpec = (PathCchRemoveFileSpecFunc)GetProcAddress(LoadLibraryA("kernelbase.dll"), "PathCchRemoveFileSpec");
  30. + length = lstrlenW(dos) + 1;
  31. + current_directory = (WCHAR *)HeapAlloc(GetProcessHeap(), 0, length * sizeof(WCHAR));
  32. + lstrcpyW(current_directory, dos);
  33. + pPathCchRemoveFileSpec(current_directory, length);
  34. +
  35. cmdline = new_cmdline;
  36. }
  37.  
  38. run:
  39. - WINE_TRACE("Running command %s\n", wine_dbgstr_w(cmdline));
  40. + WINE_TRACE("Running command %s in %s\n", wine_dbgstr_w(cmdline), wine_dbgstr_w(current_directory));
  41.  
  42. SetConsoleCtrlHandler( console_ctrl_handler, TRUE );
  43.  
  44. @@ -1077,7 +1085,7 @@ run:
  45. if (use_shell_execute)
  46. {
  47. static const WCHAR verb[] = { 'o', 'p', 'e', 'n', 0 };
  48. - ShellExecuteW(NULL, verb, cmdline, NULL, NULL, hide_window ? SW_HIDE : SW_SHOWNORMAL);
  49. + ShellExecuteW(NULL, verb, cmdline, NULL, current_directory, hide_window ? SW_HIDE : SW_SHOWNORMAL);
  50.  
  51. return INVALID_HANDLE_VALUE;
  52. }
  53. @@ -1089,7 +1097,7 @@ run:
  54. si.wShowWindow = SW_HIDE;
  55. }
  56.  
  57. - if (!CreateProcessW(NULL, cmdline, NULL, NULL, FALSE, flags, NULL, NULL, &si, &pi))
  58. + if (!CreateProcessW(NULL, cmdline, NULL, NULL, FALSE, flags, NULL, current_directory, &si, &pi))
  59. {
  60. WINE_ERR("Failed to create process %s: %u\n", wine_dbgstr_w(cmdline), GetLastError());
  61. return INVALID_HANDLE_VALUE;
  62. diff --git a/wine b/wine
  63. --- a/wine
  64. +++ b/wine
  65. @@ -1 +1 @@
  66. -Subproject commit df982e6865c2041ae994ee20ed2a2075ae7ddfb7
  67. +Subproject commit df982e6865c2041ae994ee20ed2a2075ae7ddfb7-dirty
  68.  
Advertisement
Add Comment
Please, Sign In to add comment