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

perf.c File Reference

#include <nt.h>
#include <ntrtl.h>
#include <nturtl.h>
#include "usercli.h"
#include <string.h>
#include "ntcsrdll.h"
#include "csuser.h"

Go to the source code of this file.

Typedefs

typedef CSR_QLPC_API_MSG * PCSRMSG
typedef PDWORD(* PINSTUBFUNC )(PDWORD, PDWORD, PDWORD, PDWORD)
typedef void(* POUTSTUBFUNC )(PDWORD, PDWORD)
typedef PDWORD(* PCSINFUNC )(PDWORD, PDWORD, PDWORD)
typedef PDWORD(* PCSOUTFUNC )(PDWORD, PDWORD)

Functions

PDWORD Copy4 (PDWORD psrc, PDWORD pdst, PDWORD pparam, PDWORD pmax)
PDWORD Copy5 (PDWORD psrc, PDWORD pdst, PDWORD pparam, PDWORD pmax)
PDWORD CopySTR (PDWORD psrc, PDWORD pdst, PDWORD pparam, PDWORD pmax)
void OutCopy4 (PDWORD psrc, PDWORD pdst)
PDWORD Copy6 (PDWORD psrc, PDWORD pdst, PDWORD pparam, PDWORD pmax)
PDWORD AIDoClientInStuff (PDWORD psrc, PDWORD pbase, PDWORD ptemplate, PDWORD pmax)
VOID AIDoClientOutStuff (PDWORD psrc, PDWORD pbase, PDWORD ptemplate)
PDWORD DoClientInStuff (PDWORD psrc, PDWORD pbase, PDWORD ptemplate, PDWORD pmax)
VOID DoClientOutStuff (PDWORD psrc, PDWORD pdst, PDWORD ptemplate)
DWORD MakeCSCall (DWORD findex, PDWORD psrc, PDWORD pInTemplate, PDWORD pOutTemplate)
DWORD CSMakeCall (DWORD findex, PDWORD psrc, PCSINFUNC pInFunc, PCSOUTFUNC pOutFunc)
DWORD ITestCall (HWND hwnd, int a, int b, int c, int d, int e)
DWORD AITestCall (HWND hwnd, int a, int b, int c, int d, int e)

Variables

DWORD InTestCall []


Typedef Documentation

typedef PDWORD(* PCSINFUNC)(PDWORD, PDWORD, PDWORD)
 

Definition at line 457 of file perf.c.

typedef PDWORD(* PCSOUTFUNC)(PDWORD, PDWORD)
 

Definition at line 458 of file perf.c.

typedef CSR_QLPC_API_MSG* PCSRMSG
 

Definition at line 25 of file perf.c.

Referenced by CSMakeCall(), and MakeCSCall().

typedef PDWORD(* PINSTUBFUNC)(PDWORD, PDWORD, PDWORD, PDWORD)
 

Definition at line 27 of file perf.c.

Referenced by DoClientInStuff().

typedef void(* POUTSTUBFUNC)(PDWORD, PDWORD)
 

Definition at line 28 of file perf.c.

Referenced by DoClientOutStuff().


Function Documentation

PDWORD AIDoClientInStuff PDWORD  psrc,
PDWORD  pbase,
PDWORD  ptemplate,
PDWORD  pmax
 

VOID AIDoClientOutStuff PDWORD  psrc,
PDWORD  pbase,
PDWORD  ptemplate
 

DWORD AITestCall HWND  hwnd,
int  a,
int  b,
int  c,
int  d,
int  e
 

Definition at line 603 of file perf.c.

References DWORD, InTestCall, MakeCSCall(), and NULL.

00604 { 00605 #if defined(_MIPS_) || defined(_PPC_) 00606 return AIMakeCSCall( 00607 #else 00608 return MakeCSCall( 00609 #endif 00610 CSR_MAKE_API_NUMBER(4,FI_CTESTCALL), 00611 (PDWORD)&hwnd, 00612 InTestCall, 00613 NULL 00614 ); 00615 }

PDWORD Copy4 PDWORD  psrc,
PDWORD  pdst,
PDWORD  pparam,
PDWORD  pmax
 

Definition at line 45 of file perf.c.

00050 { 00051 if (pdst + 5 <= pmax) { 00052 pdst[0] = psrc[0]; 00053 pdst[1] = psrc[1]; 00054 pdst[2] = psrc[2]; 00055 pdst[3] = psrc[3]; 00056 return pdst + 4; 00057 } 00058 return 0; 00059 pparam; 00060 }

PDWORD Copy5 PDWORD  psrc,
PDWORD  pdst,
PDWORD  pparam,
PDWORD  pmax
 

Definition at line 62 of file perf.c.

00067 { 00068 if (pdst + 5 <= pmax) { 00069 pdst[0] = psrc[0]; 00070 pdst[1] = psrc[1]; 00071 pdst[2] = psrc[2]; 00072 pdst[3] = psrc[3]; 00073 pdst[4] = psrc[4]; 00074 return pdst + 5; 00075 } 00076 return 0; 00077 pparam; 00078 }

PDWORD Copy6 PDWORD  psrc,
PDWORD  pdst,
PDWORD  pparam,
PDWORD  pmax
 

Definition at line 80 of file perf.c.

00085 { 00086 if (pdst + 6 <= pmax) { 00087 pdst[0] = psrc[0]; 00088 pdst[1] = psrc[1]; 00089 pdst[2] = psrc[2]; 00090 pdst[3] = psrc[3]; 00091 pdst[4] = psrc[4]; 00092 pdst[5] = psrc[5]; 00093 return pdst + 6; 00094 } 00095 return 0; 00096 pparam; 00097 }

PDWORD CopySTR PDWORD  psrc,
PDWORD  pdst,
PDWORD  pparam,
PDWORD  pmax
 

Definition at line 99 of file perf.c.

References DWORD, and PBYTE.

00104 { 00105 PBYTE length = (PBYTE)psrc; 00106 00107 while (*length) 00108 length++; 00109 00110 length = (length - (PBYTE)psrc + (PBYTE)pdst); 00111 length = (PBYTE)(((DWORD)length +3 ) & ~3); 00112 00113 if (length <= (PBYTE)pmax) { 00114 while ((PBYTE)pdst != (PBYTE)length) { 00115 *pdst = *psrc; 00116 pdst++; 00117 psrc++; 00118 } 00119 return (PDWORD)length; 00120 } 00121 return 0; 00122 pparam; 00123 }

DWORD CSMakeCall DWORD  findex,
PDWORD  psrc,
PCSINFUNC  pInFunc,
PCSOUTFUNC  pOutFunc
 

Definition at line 461 of file perf.c.

References DWORD, NULL, PBYTE, and PCSRMSG.

00467 { 00468 PCSR_QLPC_TEB pteb = (PCSR_QLPC_TEB)NtCurrentTeb()->CsrQlpcTeb; 00469 PCSR_QLPC_STACK pstack; 00470 PCSRMSG pmsg; 00471 ULONG retval; 00472 PDWORD pbase; 00473 PDWORD pdst; 00474 PDWORD plast; 00475 PDWORD pmax; 00476 00477 // 00478 // connect to the server 00479 // 00480 00481 if (pteb == NULL) { 00482 pteb = CsrClientThreadConnect(); 00483 if (pteb == NULL) { 00484 return 0; 00485 } 00486 } 00487 00488 pstack = pteb->MessageStack; 00489 if (pstack->BatchCount) { 00490 CsrClientSendMessage(); 00491 pbase = (PDWORD)((PBYTE)pstack + pstack->Base); 00492 } else { 00493 pbase = (PDWORD)((PBYTE)pstack + pstack->Current); 00494 } 00495 pmax = (PDWORD)((PBYTE)pstack + pstack->Limit); 00496 pmsg = (PCSRMSG)(pbase+1); 00497 00498 // 00499 // is there enough space left on the stack? 00500 // 00501 00502 pdst = (PDWORD)(pmsg + 1); 00503 if (pdst <= pmax) { 00504 00505 // 00506 // copy the data to shared memory 00507 // 00508 00509 if (pInFunc) { 00510 plast = pInFunc(psrc, pdst, pmax); 00511 } else { 00512 plast = pdst; 00513 } 00514 00515 if (plast) { 00516 00517 // 00518 // Make the call 00519 // 00520 00521 pmsg->Length = (PBYTE)plast - (PBYTE)pmsg; 00522 pmsg->ApiNumber = findex; 00523 *pbase = pstack->Base; 00524 pstack->Base = pstack->Current+4; 00525 pstack->Current = (PBYTE)pdst - (PBYTE)pstack; 00526 pstack->BatchCount = 1; 00527 00528 retval = CsrClientSendMessage(); 00529 00530 pstack->Current = pstack->Base - 4; 00531 pstack->Base = *pbase; 00532 00533 // 00534 // Do any post call copies 00535 // 00536 00537 if (pOutFunc) { 00538 pOutFunc(pdst, psrc); 00539 } 00540 00541 return retval; 00542 } 00543 } 00544 00545 // 00546 // an error occured 00547 // 00548 00549 return 0; 00550 }

PDWORD DoClientInStuff PDWORD  psrc,
PDWORD  pbase,
PDWORD  ptemplate,
PDWORD  pmax
 

Definition at line 140 of file perf.c.

References NULL, PBYTE, and PINSTUBFUNC.

Referenced by MakeCSCall().

00145 { 00146 PDWORD pparam; 00147 PDWORD param; 00148 PDWORD pdst; 00149 00150 if (ptemplate[0]) { 00151 pdst = ((PINSTUBFUNC)ptemplate[0])(psrc, pbase, NULL, pmax); 00152 if (!pdst) { 00153 return 0; 00154 } 00155 ptemplate++; 00156 00157 while (ptemplate[0]) { 00158 pparam = (PDWORD)((PBYTE)pbase + ptemplate[1]); 00159 param = (PDWORD)*pparam; 00160 *pparam = (PBYTE)pdst - (PBYTE)pbase; 00161 pdst = ((PINSTUBFUNC)ptemplate[0])(param, pdst, pparam, pmax); 00162 if (!pdst) { 00163 return 0; 00164 } 00165 ptemplate += 2; 00166 } 00167 } 00168 }

VOID DoClientOutStuff PDWORD  psrc,
PDWORD  pdst,
PDWORD  ptemplate
 

Definition at line 170 of file perf.c.

References PBYTE, POUTSTUBFUNC, and VOID().

Referenced by MakeCSCall().

00174 { 00175 PDWORD pparam; 00176 00177 while (ptemplate[0]) { 00178 pparam = (PDWORD)((PBYTE)psrc + ptemplate[1]); 00179 ((POUTSTUBFUNC)ptemplate[0])( 00180 (PDWORD)((PBYTE)psrc + *pparam), 00181 *(PDWORD *)((PBYTE)pdst + ptemplate[1]) 00182 ); 00183 ptemplate += 2; 00184 } 00185 }

DWORD ITestCall HWND  hwnd,
int  a,
int  b,
int  c,
int  d,
int  e
 

Definition at line 593 of file perf.c.

References DWORD, InTestCall, MakeCSCall(), and NULL.

00594 { 00595 return MakeCSCall( 00596 CSR_MAKE_API_NUMBER(4,FI_CTESTCALL), 00597 (PDWORD)&hwnd, 00598 InTestCall, 00599 NULL 00600 ); 00601 }

DWORD MakeCSCall DWORD  findex,
PDWORD  psrc,
PDWORD  pInTemplate,
PDWORD  pOutTemplate
 

Definition at line 190 of file perf.c.

References DoClientInStuff(), DoClientOutStuff(), DWORD, NULL, PBYTE, and PCSRMSG.

Referenced by AITestCall(), and ITestCall().

00196 { 00197 PCSR_QLPC_TEB pteb = (PCSR_QLPC_TEB)NtCurrentTeb()->CsrQlpcTeb; 00198 PCSR_QLPC_STACK pstack; 00199 PCSRMSG pmsg; 00200 ULONG retval; 00201 PDWORD pbase; 00202 PDWORD pdst; 00203 PDWORD plast; 00204 PDWORD pmax; 00205 00206 // 00207 // connect to the server 00208 // 00209 00210 if (pteb == NULL) { 00211 pteb = CsrClientThreadConnect(); 00212 if (pteb == NULL) { 00213 return 0; 00214 } 00215 } 00216 00217 pstack = pteb->MessageStack; 00218 if (pstack->BatchCount) { 00219 CsrClientSendMessage(); 00220 pbase = (PDWORD)((PBYTE)pstack + pstack->Base); 00221 } else { 00222 pbase = (PDWORD)((PBYTE)pstack + pstack->Current); 00223 } 00224 pmax = (PDWORD)((PBYTE)pstack + pstack->Limit); 00225 pmsg = (PCSRMSG)(pbase+1); 00226 00227 // 00228 // is there enough space left on the stack? 00229 // 00230 00231 pdst = (PDWORD)(pmsg + 1); 00232 if (pdst <= pmax) { 00233 00234 // 00235 // copy the data to shared memory 00236 // 00237 00238 if (pInTemplate) { 00239 plast = DoClientInStuff(psrc, pdst, pInTemplate, pmax); 00240 } else { 00241 plast = pdst; 00242 } 00243 00244 if (plast) { 00245 00246 // 00247 // Make the call 00248 // 00249 00250 pmsg->Length = (PBYTE)plast - (PBYTE)pmsg; 00251 pmsg->ApiNumber = findex; 00252 *pbase = pstack->Base; 00253 pstack->Base = pstack->Current+4; 00254 pstack->Current = (PBYTE)pdst - (PBYTE)pstack; 00255 pstack->BatchCount = 1; 00256 00257 retval = CsrClientSendMessage(); 00258 00259 pstack->Current = pstack->Base - 4; 00260 pstack->Base = *pbase; 00261 00262 // 00263 // Do any post call copies 00264 // 00265 00266 if (pOutTemplate) { 00267 DoClientOutStuff(pdst, psrc, pOutTemplate); 00268 } 00269 00270 return retval; 00271 } 00272 } 00273 00274 // 00275 // an error occured 00276 // 00277 00278 return 0; 00279 }

void OutCopy4 PDWORD  psrc,
PDWORD  pdst
 

Definition at line 35 of file perf.c.

00038 { 00039 pdst[0] = psrc[0]; 00040 pdst[1] = psrc[1]; 00041 pdst[2] = psrc[2]; 00042 pdst[3] = psrc[3]; 00043 }


Variable Documentation

DWORD InTestCall[]
 

Initial value:

{ (DWORD)Copy6, 0 }

Definition at line 588 of file perf.c.

Referenced by AITestCall(), and ITestCall().


Generated on Sat May 15 19:45:02 2004 for test by doxygen 1.3.7