steam_helper: Trigger EA Desktop reinstall if link2ea association is missing.

CW-Bug-Id: #21645
This commit is contained in:
Paul Gofman 2022-12-07 14:52:54 -06:00 committed by Arkadiusz Hiler
parent 5610e4538f
commit f7c895c287
2 changed files with 23 additions and 5 deletions

View file

@ -354,7 +354,7 @@ all-dist: $(DIST_WINEOPENXR_JSON64)
STEAMEXE_CFLAGS = -Wno-attributes STEAMEXE_CFLAGS = -Wno-attributes
STEAMEXE_CXXFLAGS = -Wno-attributes STEAMEXE_CXXFLAGS = -Wno-attributes
STEAMEXE_LDFLAGS = -L$(STEAMEXE_SRC)/32/ -L$(STEAMEXE_SRC)/64/ -lsteam_api -lole32 -ldl -static-libgcc -static-libstdc++ STEAMEXE_LDFLAGS = -L$(STEAMEXE_SRC)/32/ -L$(STEAMEXE_SRC)/64/ -lsteam_api -lmsi -lole32 -ldl -static-libgcc -static-libstdc++
STEAMEXE_WINEMAKER_ARGS = \ STEAMEXE_WINEMAKER_ARGS = \
"-I$(SRC)/lsteamclient/steamworks_sdk_142/" \ "-I$(SRC)/lsteamclient/steamworks_sdk_142/" \

View file

@ -61,6 +61,8 @@
#include "openvr.h" #include "openvr.h"
#include "../src/ivrclientcore.h" #include "../src/ivrclientcore.h"
#include <msi.h>
WINE_DEFAULT_DEBUG_CHANNEL(steam); WINE_DEFAULT_DEBUG_CHANNEL(steam);
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*a)) #define ARRAY_SIZE(a) (sizeof(a) / sizeof(*a))
@ -1058,13 +1060,13 @@ static BOOL should_use_shell_execute(const WCHAR *cmdline)
return use_shell_execute; return use_shell_execute;
} }
static HANDLE run_process(BOOL *should_await) static HANDLE run_process(BOOL *should_await, BOOL game_process)
{ {
WCHAR *cmdline = GetCommandLineW(); WCHAR *cmdline = GetCommandLineW();
STARTUPINFOW si = { sizeof(si) }; STARTUPINFOW si = { sizeof(si) };
PROCESS_INFORMATION pi; PROCESS_INFORMATION pi;
DWORD flags = CREATE_UNICODE_ENVIRONMENT; DWORD flags = CREATE_UNICODE_ENVIRONMENT;
BOOL use_shell_execute = TRUE; BOOL use_shell_execute = TRUE, link2ea = FALSE;
BOOL hide_window; BOOL hide_window;
/* skip argv[0] */ /* skip argv[0] */
@ -1176,6 +1178,7 @@ run:
HDESK desktop = GetThreadDesktop(GetCurrentThreadId()); HDESK desktop = GetThreadDesktop(GetCurrentThreadId());
DWORD timeout = 300; DWORD timeout = 300;
link2ea = TRUE;
if (!SetUserObjectInformationA(desktop, 1000, &timeout, sizeof(timeout))) if (!SetUserObjectInformationA(desktop, 1000, &timeout, sizeof(timeout)))
WINE_ERR("Failed to set desktop timeout, err %u.\n", GetLastError()); WINE_ERR("Failed to set desktop timeout, err %u.\n", GetLastError());
} }
@ -1193,8 +1196,23 @@ run:
if (use_shell_execute) if (use_shell_execute)
{ {
static const WCHAR verb[] = { 'o', 'p', 'e', 'n', 0 }; static const WCHAR verb[] = { 'o', 'p', 'e', 'n', 0 };
ShellExecuteW(NULL, verb, cmdline, NULL, NULL, hide_window ? SW_HIDE : SW_SHOWNORMAL); INT_PTR ret;
if ((ret = (INT_PTR)ShellExecuteW(NULL, verb, cmdline, NULL, NULL, hide_window ? SW_HIDE : SW_SHOWNORMAL)) < 32)
{
WINE_ERR("Failed to execture %s, ret %u.\n", wine_dbgstr_w(cmdline), (unsigned int)ret);
if (game_process && ret == SE_ERR_NOASSOC && link2ea)
{
/* Try to uninstall EA desktop so it is set up from prerequisites on the next run. */
UINT ret = MsiConfigureProductExW(L"{C2622085-ABD2-49E5-8AB9-D3D6A642C091}", 0, INSTALLSTATE_DEFAULT, L"REMOVE=ALL");
WINE_TRACE("MsiConfigureProductExW ret %u.\n", ret);
/* If uninstall failed this should trigger interactive repair window on the EA setup run. */
RegDeleteTreeW(HKEY_LOCAL_MACHINE, L"Software\\Classes\\link2ea");
RegDeleteTreeW(HKEY_LOCAL_MACHINE, L"Software\\Electronic Arts\\EA Desktop");
RegDeleteTreeW(HKEY_LOCAL_MACHINE, L"Software\\Electronic Arts\\EA Core");
}
}
return INVALID_HANDLE_VALUE; return INVALID_HANDLE_VALUE;
} }
else else
@ -1522,7 +1540,7 @@ int main(int argc, char *argv[])
if (game_process) if (game_process)
setup_vr_registry(); setup_vr_registry();
child = run_process(&should_await); child = run_process(&should_await, game_process);
if (should_await) if (should_await)
{ {