From cd4191db5ebcb3ca96c5d5eb4336eddd895445bf Mon Sep 17 00:00:00 2001 From: midipix Date: Mon, 16 Jan 2017 02:32:54 +0000 Subject: daemon initialization: establish SEH frames for the daemon and internal thread. --- src/daemon/ntapi_dsr_init.c | 12 ++++++++++-- src/daemon/ntapi_dsr_internal_connection.c | 11 ++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) (limited to 'src/daemon') diff --git a/src/daemon/ntapi_dsr_init.c b/src/daemon/ntapi_dsr_init.c index 317a421..b54131e 100644 --- a/src/daemon/ntapi_dsr_init.c +++ b/src/daemon/ntapi_dsr_init.c @@ -12,6 +12,8 @@ #include #include "ntapi_impl.h" +int32_t __ntapi_tt_seh_frame(void *, void *, void *, int32_t (*)(nt_daemon_params *)); + static int32_t __stdcall __ntapi_dsr_once(nt_daemon_params * params); int32_t __stdcall __ntapi_dsr_init(nt_daemon_params * params) @@ -139,7 +141,7 @@ int32_t __stdcall __ntapi_dsr_init(nt_daemon_params * params) /* __ntapi_dsr_start executes in the daemon's dedicated thread */ -int32_t __stdcall __ntapi_dsr_start_impl(nt_daemon_params * params) +static int32_t __ntapi_dsr_start_impl(nt_daemon_params * params) { int32_t status; void * ctx; @@ -161,7 +163,7 @@ int32_t __stdcall __ntapi_dsr_start_impl(nt_daemon_params * params) return NT_STATUS_SUCCESS; } -int32_t __stdcall __ntapi_dsr_start(nt_daemon_params * params) +static int32_t __ntapi_dsr_start_routine(nt_daemon_params * params) { at_store_32( ¶ms->exit_code_daemon_loop, @@ -172,6 +174,12 @@ int32_t __stdcall __ntapi_dsr_start(nt_daemon_params * params) __ntapi_dsr_start_impl(params)); } +int32_t __stdcall __ntapi_dsr_start(nt_daemon_params * params) +{ + return __ntapi_tt_seh_frame( + params,0,0, + __ntapi_dsr_start_routine); +} /* __ntapi_dsr_once executes in the daemon's dedicated thread */ static int32_t __stdcall __ntapi_dsr_once(nt_daemon_params * params) diff --git a/src/daemon/ntapi_dsr_internal_connection.c b/src/daemon/ntapi_dsr_internal_connection.c index 2d6e39f..109ea43 100644 --- a/src/daemon/ntapi_dsr_internal_connection.c +++ b/src/daemon/ntapi_dsr_internal_connection.c @@ -12,6 +12,8 @@ #include #include "ntapi_impl.h" +int32_t __ntapi_tt_seh_frame(void *, void *, void *, int32_t (*)(nt_daemon_params *)); + static int32_t __stdcall __ntapi_dsr_internal_client_connect_fail( nt_daemon_params * params, int32_t status) @@ -82,7 +84,7 @@ int32_t __stdcall __ntapi_dsr_connect_internal_client(nt_daemon_params * params) /* __ntapi_dsr_internal_client_connect executes in its own temporary thread */ -int32_t __stdcall __ntapi_dsr_internal_client_connect(nt_daemon_params * params) +static int32_t __ntapi_dsr_internal_client_connect_impl(nt_daemon_params * params) { int32_t status; nt_unicode_string server_name; @@ -143,3 +145,10 @@ int32_t __stdcall __ntapi_dsr_internal_client_connect(nt_daemon_params * params) NT_CURRENT_THREAD_HANDLE, status); } + +int32_t __stdcall __ntapi_dsr_internal_client_connect(nt_daemon_params * params) +{ + return __ntapi_tt_seh_frame( + params,0,0, + __ntapi_dsr_internal_client_connect_impl); +} \ No newline at end of file -- cgit v1.2.3