mirror of
https://gitea.tendokyu.moe/Dniel97/segatools.git
synced 2024-11-23 21:10:57 +01:00
Fix hook startup failure path
Returning from the EXE PE entry point merely terminates the main thread and leaves the process hanging. We need to explicitly exit from the process since the NTDLL RTL Start code won't do it for us.
This commit is contained in:
parent
1d6b7591ef
commit
972b3a5de8
@ -1,6 +1,5 @@
|
||||
#include <windows.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "amex/amex.h"
|
||||
@ -73,25 +72,25 @@ static DWORD CALLBACK chuni_pre_startup(void)
|
||||
chuni_hook_mod);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
return EXIT_FAILURE;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hr = amex_hook_init(&chuni_hook_cfg.amex, chunithm_jvs_init);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
return EXIT_FAILURE;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hr = slider_hook_init(&chuni_hook_cfg.slider);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
return EXIT_FAILURE;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hr = sg_reader_hook_init(&chuni_hook_cfg.aime, 12);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
return EXIT_FAILURE;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Initialize debug helpers */
|
||||
@ -103,6 +102,9 @@ static DWORD CALLBACK chuni_pre_startup(void)
|
||||
/* Jump to EXE start address */
|
||||
|
||||
return chuni_startup();
|
||||
|
||||
fail:
|
||||
ExitProcess(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
BOOL WINAPI DllMain(HMODULE mod, DWORD cause, void *ctx)
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include <windows.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "amex/amex.h"
|
||||
@ -48,25 +47,25 @@ static DWORD CALLBACK diva_pre_startup(void)
|
||||
diva_hook_mod);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
return EXIT_FAILURE;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hr = amex_hook_init(&diva_hook_cfg.amex, diva_jvs_init);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
return EXIT_FAILURE;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hr = sg_reader_hook_init(&diva_hook_cfg.aime, 10);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
return EXIT_FAILURE;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hr = slider_hook_init(&diva_hook_cfg.slider);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
return EXIT_FAILURE;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Initialize debug helpers */
|
||||
@ -78,6 +77,9 @@ static DWORD CALLBACK diva_pre_startup(void)
|
||||
/* Jump to EXE start address */
|
||||
|
||||
return diva_startup();
|
||||
|
||||
fail:
|
||||
ExitProcess(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
BOOL WINAPI DllMain(HMODULE mod, DWORD cause, void *ctx)
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include <windows.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "amex/amex.h"
|
||||
@ -49,19 +48,19 @@ static DWORD CALLBACK idz_pre_startup(void)
|
||||
idz_hook_mod);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
return hr;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hr = amex_hook_init(&idz_hook_cfg.amex, idz_jvs_init);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
return hr;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hr = sg_reader_hook_init(&idz_hook_cfg.aime, 10);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
return hr;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Initialize debug helpers */
|
||||
@ -73,6 +72,9 @@ static DWORD CALLBACK idz_pre_startup(void)
|
||||
/* Jump to EXE start address */
|
||||
|
||||
return idz_startup();
|
||||
|
||||
fail:
|
||||
ExitProcess(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
BOOL WINAPI DllMain(HMODULE mod, DWORD cause, void *ctx)
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include <windows.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "amex/config.h"
|
||||
#include "amex/ds.h"
|
||||
|
||||
@ -20,6 +22,7 @@ static DWORD CALLBACK app_pre_startup(void)
|
||||
struct clock_config clock_cfg;
|
||||
struct ds_config ds_cfg;
|
||||
struct nusec_config nusec_cfg;
|
||||
HRESULT hr;
|
||||
|
||||
dprintf("--- Begin %s ---\n", __func__);
|
||||
|
||||
@ -28,13 +31,30 @@ static DWORD CALLBACK app_pre_startup(void)
|
||||
nusec_config_load(&nusec_cfg, L".\\segatools.ini");
|
||||
spike_hook_init(L".\\segatools.ini");
|
||||
|
||||
clock_hook_init(&clock_cfg);
|
||||
nusec_hook_init(&nusec_cfg, "SSSS", "AAV0");
|
||||
ds_hook_init(&ds_cfg);
|
||||
hr = clock_hook_init(&clock_cfg);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hr = nusec_hook_init(&nusec_cfg, "SSSS", "AAV0");
|
||||
|
||||
if (FAILED(hr)) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hr = ds_hook_init(&ds_cfg);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
dprintf("--- End %s ---\n", __func__);
|
||||
|
||||
return app_startup();
|
||||
|
||||
fail:
|
||||
ExitProcess(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
BOOL WINAPI DllMain(HMODULE mod, DWORD cause, void *ctx)
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include <windows.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "board/io4.h"
|
||||
#include "board/sg-reader.h"
|
||||
#include "board/vfd.h"
|
||||
@ -45,25 +47,25 @@ static DWORD CALLBACK mu3_pre_startup(void)
|
||||
mu3_hook_mod);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
return hr;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hr = sg_reader_hook_init(&mu3_hook_cfg.aime, 1);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
return hr;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hr = vfd_hook_init(2);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
return hr;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hr = mu3_io4_hook_init();
|
||||
|
||||
if (FAILED(hr)) {
|
||||
return hr;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Initialize Unity native plugin DLL hooks
|
||||
@ -82,6 +84,9 @@ static DWORD CALLBACK mu3_pre_startup(void)
|
||||
/* Jump to EXE start address */
|
||||
|
||||
return mu3_startup();
|
||||
|
||||
fail:
|
||||
ExitProcess(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
BOOL WINAPI DllMain(HMODULE mod, DWORD cause, void *ctx)
|
||||
|
Loading…
Reference in New Issue
Block a user