diff --git a/src/daemon/ntapi_dsr_init.c b/src/daemon/ntapi_dsr_init.c index afade50..3eae41c 100644 --- a/src/daemon/ntapi_dsr_init.c +++ b/src/daemon/ntapi_dsr_init.c @@ -34,9 +34,6 @@ int32_t __stdcall __ntapi_dsr_init(nt_daemon_params * params) ¶ms->exit_code_internal_client, NT_STATUS_PENDING); - at_locked_or((intptr_t *)params->port_name,0); - at_locked_or((intptr_t *)¶ms->port_name,0); - /* port_keys */ if (params->flags & NT_DSR_INIT_GENERATE_KEYS) if ((status = __ntapi->tt_port_generate_keys(params->port_keys))) @@ -90,6 +87,15 @@ int32_t __stdcall __ntapi_dsr_init(nt_daemon_params * params) (intptr_t)params->hevent_internal_client_ready); } + /* memory barrier */ + __ntapi->tt_aligned_block_memlock( + params, + sizeof(*params)); + + __ntapi->tt_aligned_block_memlock( + params->port_name, + sizeof(*params->port_name)); + /* daemon dedicated thread: general parameters */ __ntapi->tt_aligned_block_memset( &tparams,0,sizeof(tparams)); @@ -121,7 +127,7 @@ int32_t __stdcall __ntapi_dsr_init(nt_daemon_params * params) return status; /* verify the port's successful creation */ - if (params->exit_code_daemon_start) + if (at_locked_xadd_32(¶ms->exit_code_daemon_start,0)) return NT_STATUS_PORT_NOT_SET; /* internal connection task-specific thread */ @@ -145,7 +151,7 @@ int32_t __stdcall __ntapi_dsr_init(nt_daemon_params * params) return status; /* verify a successful internal connection */ - if (params->exit_code_internal_client) + if (at_locked_xadd_32(¶ms->exit_code_internal_client,0)) return params->exit_code_internal_client; /* all_done */