summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/driver/ptyc_driver_ctx.c32
-rw-r--r--src/internal/ptycon_driver_impl.h3
2 files changed, 24 insertions, 11 deletions
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 <ntcon/ntcon.h>
#include <ntapi/ntapi.h>
#include <ntapi/nt_atomic.h>
+#include <gdi/gdi.h>
#include <stdint.h>
@@ -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)))
diff --git a/src/internal/ptycon_driver_impl.h b/src/internal/ptycon_driver_impl.h
index c2a2475..a51c5a1 100644
--- a/src/internal/ptycon_driver_impl.h
+++ b/src/internal/ptycon_driver_impl.h
@@ -3,6 +3,7 @@
#include <ntapi/ntapi.h>
#include <ntcon/ntcon.h>
+#include <gdi/gdi.h>
#include <stdint.h>
#include <stdio.h>
@@ -13,9 +14,11 @@
extern const struct argv_option ptyc_default_options[];
extern const ntapi_vtbl * ptyc_ntapi;
extern const ntcon_vtbl * const ptyc_ntcon;
+extern const gdi_vtbl * const ptyc_gdi;
#define ntapi ptyc_ntapi
#define ntcon ptyc_ntcon
+#define gdi ptyc_gdi
enum app_tags {
TAG_HELP,