'KPCR' ElectricFence-protected for debugging.
authorshort <>
Tue, 16 Sep 2003 08:48:57 +0000 (08:48 +0000)
committershort <>
Tue, 16 Sep 2003 08:48:57 +0000 (08:48 +0000)
src/libcaptive/ps/ps_reactos.c

index 6233853..7a858d3 100644 (file)
 #include "config.h"
 
 #include "captive/ps_reactos.h"        /* self */
+#include "captive/macros.h"
 
 
-static captive_KPCR captive_KeGetCurrentKPCR_KPCR_static;
+/* Do not use static variable here:
+ * We would not get ElectricFence checks on accesses
+ * in original ReactOS 'KPCR'/'IKPCR' structure manner.
+ */
+static captive_KPCR *captive_KeGetCurrentKPCR_KPCR;
 
 /**
  * captive_KeGetCurrentKPCR:
@@ -41,5 +46,7 @@ static captive_KPCR captive_KeGetCurrentKPCR_KPCR_static;
 captive_PKPCR captive_KeGetCurrentKPCR(void)
 {
        /* TODO:thread */
-       return &captive_KeGetCurrentKPCR_KPCR_static;
+       if (!captive_KeGetCurrentKPCR_KPCR)
+               captive_new0(captive_KeGetCurrentKPCR_KPCR);
+       return captive_KeGetCurrentKPCR_KPCR;
 }