From 74eafc5a244ec602451998c53615c6fee10f581a Mon Sep 17 00:00:00 2001 From: midipix Date: Wed, 6 Jul 2016 16:22:45 -0400 Subject: driver: gdi accessor table integration. --- src/driver/ptyc_driver_ctx.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'src/driver') diff --git a/src/driver/ptyc_driver_ctx.c b/src/driver/ptyc_driver_ctx.c index e21e7ab..cd038ee 100644 --- a/src/driver/ptyc_driver_ctx.c +++ b/src/driver/ptyc_driver_ctx.c @@ -7,6 +7,7 @@ #include #include #include +#include #include @@ -27,6 +28,10 @@ const ntapi_vtbl * ptyc_ntapi; static ntcon_vtbl ptyc_ntcon_vtbl; const ntcon_vtbl * const ptyc_ntcon = &ptyc_ntcon_vtbl; +/* gdi accessor table */ +static gdi_vtbl ptyc_gdi_vtbl; +const gdi_vtbl * const ptyc_gdi = &ptyc_gdi_vtbl; + /* package info */ static const struct ptyc_source_version ptyc_src_version = { PTYC_TAG_VER_MAJOR, @@ -42,32 +47,37 @@ struct ptyc_driver_ctx_alloc { const char * units[]; }; -static int32_t ptyc_ntcon_once = 0; +static int32_t ptyc_once = 0; -static int32_t ptyc_ntcon_init(void) +static int32_t ptyc_vtbl_init(void) { int32_t status; nt_timeout timeout; - switch (at_locked_cas_32(&ptyc_ntcon_once,0,1)) { + switch (at_locked_cas_32(&ptyc_once,0,1)) { case 0: if ((status = ntcon_vtbl_init(&ptyc_ntcon_vtbl))) { - at_locked_add_32(&ptyc_ntcon_once,2); + at_locked_add_32(&ptyc_once,2); + return status; + } + + if ((status = gdi_vtbl_init(&ptyc_gdi_vtbl))) { + at_locked_add_32(&ptyc_once,2); return status; - } else { - at_locked_inc_32(&ptyc_ntcon_once); - return 0; } + at_locked_inc_32(&ptyc_once); + return 0; + case 1: timeout.quad = -10; - for (; (at_locked_cas_32(&ptyc_ntcon_once,0,1) == 1); ) + for (; (at_locked_cas_32(&ptyc_once,0,1) == 1); ) ntapi->zw_delay_execution( NT_SYNC_ALERTABLE, &timeout); - return (ptyc_ntcon_once == 2) + return (ptyc_once == 2) ? 0 : -1; case 2: @@ -166,7 +176,7 @@ int ptyc_get_driver_ctx( if (ptyc_init()) return -1; - if (ptyc_ntcon_init()) + if (ptyc_vtbl_init()) return -1; options = ptyc_default_options; @@ -233,7 +243,7 @@ int ptyc_create_driver_ctx( if (ptyc_init()) return -1; - if (ptyc_ntcon_init()) + if (ptyc_vtbl_init()) return -1; if (!(meta = argv_get(argv,ptyc_default_options,0))) -- cgit v1.2.3