Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

badapp.c File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

VOID CtxBadAppDelay (ULONG counttype)
BOOL CtxUserYieldTask (VOID)
BOOL CtxUserWaitMessage (VOID)

Variables

BOOL G_bFirstCount = TRUE
BADAPP G_UserBadApp


Function Documentation

VOID CtxBadAppDelay ULONG  counttype  ) 
 

Definition at line 54 of file badapp.c.

References DbgPrint, FALSE, G_bFirstCount, G_UserBadApp, GetClientInfo, gpsi, NtDelayExecution(), NULL, PCLIENTINFO, TRUE, and VOID().

Referenced by CtxUserYieldTask().

00055 { 00056 ULONG delaycount; 00057 PCLIENTINFO pci; 00058 PTEB pTeb; 00059 LARGE_INTEGER BadAppDelay; 00060 00061 pci = GetClientInfo(); 00062 pTeb = NtCurrentTeb(); 00063 if ( (pci != NULL) && ((pci->CitrixcSpins) == 0) ) { 00064 G_bFirstCount = TRUE; 00065 } 00066 00067 if (G_UserBadApp.BadAppFlags & CITRIX_COMPAT_BADAPPVALID) { 00068 if (G_bFirstCount) { 00069 delaycount = G_UserBadApp.BadAppFirstCount; 00070 } else { 00071 delaycount = G_UserBadApp.BadAppNthCount; 00072 } 00073 BadAppDelay = G_UserBadApp.BadAppTimeDelay; 00074 } else if (pTeb->CtxCompatFlags & CITRIX_COMPAT_BADAPPVALID) { 00075 if (G_bFirstCount) { 00076 delaycount = pTeb->BadAppFirstCount; 00077 } else { 00078 delaycount = pTeb->BadAppNthCount; 00079 } 00080 BadAppDelay = pTeb->BadAppTimeDelay; 00081 } else { 00082 if (G_bFirstCount) { 00083 delaycount = gpsi->BadAppFirstCount; 00084 } 00085 else delaycount = gpsi->BadAppNthCount; 00086 BadAppDelay = gpsi->BadAppTimeDelay; 00087 } 00088 00089 if ( (pTeb->CitrixTEBcSpins) > delaycount ) { 00090 (pTeb->CitrixTEBcSpins) = 0; 00091 00092 #ifdef BADAPPTRACE 00093 if (counttype) { 00094 DbgPrint("j.k. CtxBadAppDelay YIELD, bFirstCount=%u\n",(ULONG) bFirstCount); 00095 } 00096 else DbgPrint("j.k. CtxBadAppDelay PEEK, bFirstCount=%u\n",(ULONG) bFirstCount); 00097 #endif 00098 00099 G_bFirstCount = FALSE; 00100 NtDelayExecution( 00101 FALSE, 00102 &BadAppDelay); 00103 } 00104 return; 00105 UNREFERENCED_PARAMETER(counttype); 00106 }

BOOL CtxUserWaitMessage VOID   ) 
 

Definition at line 147 of file badapp.c.

References G_bFirstCount, NtUserWaitMessage(), and TRUE.

00148 { 00149 //since waiting, we can reset to firstcount 00150 G_bFirstCount = TRUE; 00151 00152 return ( NtUserWaitMessage() ); 00153 }

BOOL CtxUserYieldTask VOID   ) 
 

Definition at line 113 of file badapp.c.

References BOOL, CtxBadAppDelay(), GetClientInfo, NtUserYieldTask(), and NULL.

00114 { 00115 ULONG cSpins; 00116 PCLIENTINFO pci; 00117 BOOL Result; 00118 00119 //every yield is bad news 00120 //server side increments so if not reset should move our count 00121 pci = GetClientInfo(); 00122 if (pci != NULL) { 00123 cSpins = pci->CitrixcSpins; 00124 } 00125 00126 Result = NtUserYieldTask(); 00127 00128 if ( pci != NULL) { 00129 if (cSpins >= pci->CitrixcSpins) { 00130 //in this case the server side reset cspins so we reset our count 00131 (NtCurrentTeb()->CitrixTEBcSpins) = pci->CitrixcSpins; 00132 } 00133 else { 00134 (NtCurrentTeb()->CitrixTEBcSpins) += pci->CitrixcSpins - cSpins; 00135 CtxBadAppDelay(1); //show yield. 00136 } 00137 } 00138 00139 return( Result ); 00140 }


Variable Documentation

BOOL G_bFirstCount = TRUE
 

Definition at line 11 of file badapp.c.

Referenced by CtxBadAppDelay(), and CtxUserWaitMessage().

BADAPP G_UserBadApp
 

Definition at line 12 of file badapp.c.

Referenced by CtxBadAppDelay().


Generated on Sat May 15 19:42:57 2004 for test by doxygen 1.3.7