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

dlluistb.c File Reference

#include "dbgdllp.h"

Go to the source code of this file.

Defines

#define DbgStateChangeSemaphore   (NtCurrentTeb()->DbgSsReserved[0])
#define DbgUiApiPort   (NtCurrentTeb()->DbgSsReserved[1])

Functions

NTSTATUS DbgUiConnectToDbg (VOID)
NTSTATUS DbgUiWaitStateChange (OUT PDBGUI_WAIT_STATE_CHANGE StateChange, IN PLARGE_INTEGER Timeout OPTIONAL)
NTSTATUS DbgUiContinue (IN PCLIENT_ID AppClientId, IN NTSTATUS ContinueStatus)


Define Documentation

#define DbgStateChangeSemaphore   (NtCurrentTeb()->DbgSsReserved[0])
 

Definition at line 23 of file dlluistb.c.

Referenced by DbgUiConnectToDbg(), and DbgUiWaitStateChange().

#define DbgUiApiPort   (NtCurrentTeb()->DbgSsReserved[1])
 

Definition at line 24 of file dlluistb.c.

Referenced by DbgUiConnectToDbg(), DbgUiContinue(), and DbgUiWaitStateChange().


Function Documentation

NTSTATUS DbgUiConnectToDbg VOID   ) 
 

Definition at line 27 of file dlluistb.c.

References DbgStateChangeSemaphore, DbgUiApiPort, DynamicQos, L, NT_SUCCESS, NtConnectPort(), NtRegisterThreadTerminatePort(), NTSTATUS(), NULL, PortName, RtlInitUnicodeString(), and TRUE.

00031 : 00032 00033 This routine makes a connection between the caller and the DbgUi 00034 port in the Dbg subsystem. In addition to returning a handle to a 00035 port object, a handle to a state change semaphore is returned. This 00036 semaphore is used in DbgUiWaitStateChange APIs. 00037 00038 Arguments: 00039 00040 None. 00041 00042 Return Value: 00043 00044 TBD. 00045 00046 --*/ 00047 00048 { 00049 NTSTATUS st; 00050 UNICODE_STRING PortName; 00051 ULONG ConnectionInformationLength; 00052 SECURITY_QUALITY_OF_SERVICE DynamicQos; 00053 00054 // 00055 // if app is already connected, don't reconnect 00056 // 00057 st = STATUS_SUCCESS; 00058 if ( !DbgUiApiPort ) { 00059 // 00060 // Set up the security quality of service parameters to use over the 00061 // port. Use the most efficient (least overhead) - which is dynamic 00062 // rather than static tracking. 00063 // 00064 00065 DynamicQos.ImpersonationLevel = SecurityImpersonation; 00066 DynamicQos.ContextTrackingMode = SECURITY_DYNAMIC_TRACKING; 00067 DynamicQos.EffectiveOnly = TRUE; 00068 00069 00070 RtlInitUnicodeString(&PortName,L"\\DbgUiApiPort"); 00071 ConnectionInformationLength = sizeof(DbgStateChangeSemaphore); 00072 st = NtConnectPort( 00073 &DbgUiApiPort, 00074 &PortName, 00075 &DynamicQos, 00076 NULL, 00077 NULL, 00078 NULL, 00079 (PVOID)&DbgStateChangeSemaphore, 00080 &ConnectionInformationLength 00081 ); 00082 if ( NT_SUCCESS(st) ) { 00083 NtRegisterThreadTerminatePort(DbgUiApiPort); 00084 } else { 00085 DbgUiApiPort = NULL; 00086 } 00087 } 00088 return st; 00089 00090 }

NTSTATUS DbgUiContinue IN PCLIENT_ID  AppClientId,
IN NTSTATUS  ContinueStatus
 

Definition at line 160 of file dlluistb.c.

References DbgPrint, DbgUiApiPort, NT_SUCCESS, NtRequestWaitReplyPort(), and NTSTATUS().

00167 : 00168 00169 This function continues an application thread whose state change was 00170 previously reported through DbgUiWaitStateChange. 00171 00172 Arguments: 00173 00174 AppClientId - Supplies the address of the ClientId of the 00175 application thread being continued. This must be an application 00176 thread that previously notified the caller through 00177 DbgUiWaitStateChange but has not yet been continued. 00178 00179 ContinueStatus - Supplies the continuation status to the thread 00180 being continued. valid values for this are: 00181 00182 DBG_EXCEPTION_HANDLED 00183 DBG_EXCEPTION_NOT_HANDLED 00184 DBG_TERMINATE_THREAD 00185 DBG_TERMINATE_PROCESS 00186 DBG_CONTINUE 00187 00188 Return Value: 00189 00190 STATUS_SUCCESS - Successful call to DbgUiContinue 00191 00192 STATUS_INVALID_CID - An invalid ClientId was specified for the 00193 AppClientId, or the specified Application was not waiting 00194 for a continue. 00195 00196 STATUS_INVALID_PARAMETER - An invalid continue status was specified. 00197 00198 --*/ 00199 00200 { 00201 NTSTATUS st; 00202 DBGUI_APIMSG ApiMsg; 00203 PDBGUI_CONTINUE args; 00204 00205 00206 args = &ApiMsg.u.Continue; 00207 args->AppClientId = *AppClientId; 00208 args->ContinueStatus = ContinueStatus; 00209 00210 DBGUI_FORMAT_API_MSG(ApiMsg,DbgUiContinueApi,sizeof(*args)); 00211 00212 st = NtRequestWaitReplyPort( 00213 DbgUiApiPort, 00214 (PPORT_MESSAGE) &ApiMsg, 00215 (PPORT_MESSAGE) &ApiMsg 00216 ); 00217 00218 if ( NT_SUCCESS(st) ) { 00219 if ( !(NT_SUCCESS(ApiMsg.ReturnedStatus))) { 00220 DbgPrint("NTDLL: DbgUiContinue success with status %x\n", ApiMsg.ReturnedStatus); 00221 } 00222 return ApiMsg.ReturnedStatus; 00223 } else { 00224 DbgPrint("NTDLL: DbgUiContinue failing with status %x\n", st); 00225 return st; 00226 } 00227 } }

NTSTATUS DbgUiWaitStateChange OUT PDBGUI_WAIT_STATE_CHANGE  StateChange,
IN PLARGE_INTEGER Timeout  OPTIONAL
 

Definition at line 93 of file dlluistb.c.

References DbgPrint, DbgStateChangeSemaphore, DbgUiApiPort, NT_SUCCESS, NtRequestWaitReplyPort(), NTSTATUS(), NtWaitForSingleObject(), and TRUE.

00100 : 00101 00102 This function causes the calling user interface to wait for a 00103 state change to occur in one of it's application threads. The 00104 wait is ALERTABLE. 00105 00106 Arguments: 00107 00108 StateChange - Supplies the address of state change record that 00109 will contain the state change information. 00110 00111 Return Value: 00112 00113 TBD 00114 00115 --*/ 00116 00117 { 00118 NTSTATUS st; 00119 DBGUI_APIMSG ApiMsg; 00120 PDBGUI_WAIT_STATE_CHANGE args; 00121 00122 00123 // 00124 // Wait for a StateChange to occur 00125 // 00126 00127 top: 00128 st = NtWaitForSingleObject(DbgStateChangeSemaphore,TRUE,Timeout); 00129 if ( st != STATUS_SUCCESS ) { 00130 return st; 00131 } 00132 00133 // 00134 // Pick up the state change 00135 // 00136 00137 args = &ApiMsg.u.WaitStateChange; 00138 00139 DBGUI_FORMAT_API_MSG(ApiMsg,DbgUiWaitStateChangeApi,sizeof(*args)); 00140 st = NtRequestWaitReplyPort( 00141 DbgUiApiPort, 00142 (PPORT_MESSAGE) &ApiMsg, 00143 (PPORT_MESSAGE) &ApiMsg 00144 ); 00145 00146 if ( NT_SUCCESS(st) ) { 00147 if ( ApiMsg.ReturnedStatus == DBG_NO_STATE_CHANGE ) { 00148 DbgPrint("DBGUISTB: Waring No State Change\n"); 00149 goto top; 00150 } 00151 *StateChange = *args; 00152 return ApiMsg.ReturnedStatus; 00153 } else { 00154 DbgPrint("NTDLL: DbgUiWaitStateChange failing with status %x\n", st); 00155 return st; 00156 } 00157 }


Generated on Sat May 15 19:43:28 2004 for test by doxygen 1.3.7