Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,22 @@

bool_t mono_debug_init_called = FALSE;
bool_t mono_is_net35 = FALSE;
static bool_t doorstop_bootstrapped = FALSE;

void mono_doorstop_bootstrap(void *mono_domain) {
if (getenv(TEXT("DOORSTOP_INITIALIZED"))) {
if (doorstop_bootstrapped) {
LOG("Doorstop already bootstrapped in this process, skipping!");
return;
}
// Steam (and other launchers) can leak DOORSTOP_INITIALIZED into a new
// game process, the same env-isolation issue ignore_disable_switch already
// covers for DOORSTOP_DISABLE. Honor that switch here; use the static flag
// above for genuine in-process re-entry.
if (getenv(TEXT("DOORSTOP_INITIALIZED")) && !config.ignore_disabled_env) {
LOG("DOORSTOP_INITIALIZED is set! Skipping!");
return;
}
doorstop_bootstrapped = TRUE;
setenv(TEXT("DOORSTOP_INITIALIZED"), TEXT("TRUE"), TRUE);

mono.thread_set_main(mono.thread_current());
Expand Down
5 changes: 5 additions & 0 deletions src/nix/entrypoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ int dup2_hook(int od, int nd) {
__attribute__((constructor)) void doorstop_ctor() {
init_logger();
load_config();
if (config.ignore_disabled_env) {
unsetenv("DOORSTOP_INITIALIZED");
unsetenv("DOORSTOP_DISABLE");
LOG("Cleared inherited DOORSTOP_INITIALIZED / DOORSTOP_DISABLE");
}

if (!config.enabled) {
LOG("Doorstop not enabled! Skipping!");
Expand Down
5 changes: 5 additions & 0 deletions src/windows/entrypoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,11 @@ BOOL WINAPI DllEntry(HINSTANCE hInstDll, DWORD reasonForDllLoad,

load_config();
LOG("Config loaded");
if (config.ignore_disabled_env) {
SetEnvironmentVariableW(L"DOORSTOP_INITIALIZED", NULL);
SetEnvironmentVariableW(L"DOORSTOP_DISABLE", NULL);
LOG("Cleared inherited DOORSTOP_INITIALIZED / DOORSTOP_DISABLE");
}

redirect_output_log(paths);

Expand Down
Loading