diff options
Diffstat (limited to 'src/daemon/ptyc_daemon_loop.c')
-rw-r--r-- | src/daemon/ptyc_daemon_loop.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/daemon/ptyc_daemon_loop.c b/src/daemon/ptyc_daemon_loop.c index cacc879..b5a9538 100644 --- a/src/daemon/ptyc_daemon_loop.c +++ b/src/daemon/ptyc_daemon_loop.c @@ -22,8 +22,51 @@ static ptyc_daemon_routine * ptyc_daemon_vtbl[PTYC_VTBL_ELEMENTS] = { 0 }; +static int ptyc_init_pidmap_target_symlink(struct ptyc_daemon_ctx * dctx) +{ + int status; + void * hkeydir; + + struct ptyc_driver_ctx_impl * ictx = ptyc_get_driver_ictx(dctx->driver_ctx); + + if ((status = ntapi->tt_create_keyed_object_directory( + &hkeydir, + NT_SYMBOLIC_LINK_ALL_ACCESS, + ictx->rtdata->hpidmapdir, + pe_get_current_process_id()))) + return status; + + if ((status = ntapi->zw_set_information_object( + hkeydir, + NT_OBJECT_HANDLE_INFORMATION, + &(nt_object_handle_information){0,0}, + sizeof(nt_object_handle_information)))) + return status; + + return ntapi->tt_create_keyed_object_directory_entry( + &ictx->hntpipc, + NT_SYMBOLIC_LINK_ALL_ACCESS, + hkeydir, + dctx->hport_daemon,0, + pe_get_current_process_id()); +} + +static int ptyc_init_ntpipc_target_symlink(struct ptyc_daemon_ctx * dctx) +{ + struct ptyc_driver_ctx_impl * ictx = ptyc_get_driver_ictx(dctx->driver_ctx); + + return ntapi->tt_create_keyed_object_directory_entry( + &ictx->hntpipc, + NT_SYMBOLIC_LINK_ALL_ACCESS, + ictx->rtdata->hntpipcdir, + dctx->hport_daemon,0, + pe_get_current_process_id()); +} + int32_t __stdcall ptyc_daemon_loop(void * ctx) { + int status; + struct ptyc_daemon_ctx * dctx; nt_rtdata * rtdata; @@ -41,6 +84,14 @@ int32_t __stdcall ptyc_daemon_loop(void * ctx) dctx = (struct ptyc_daemon_ctx *)ctx; + /* pidmap daemon symlink */ + if ((status = ptyc_init_pidmap_target_symlink(dctx))) + return status; + + /* ntpipc daemon symlink */ + if ((status = ptyc_init_ntpipc_target_symlink(dctx))) + return status; + /* init */ request = &inbuf; ntapi->tt_aligned_block_memset( |