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

dllssstb.c File Reference

#include "dbgdllp.h"
#include "ldrp.h"

Go to the source code of this file.

Functions

NTSTATUS DbgSspConnectToDbg (VOID)
NTSTATUS DbgSspException (IN PDBGSS_CONTINUE_KEY ContinueKey, IN PCLIENT_ID AppClientId, IN PDBGKM_EXCEPTION Exception)
NTSTATUS DbgSspCreateThread (IN PDBGSS_CONTINUE_KEY ContinueKey, IN PCLIENT_ID AppClientId, IN PDBGKM_CREATE_THREAD NewThread)
NTSTATUS DbgSspCreateProcess (IN PDBGSS_CONTINUE_KEY ContinueKey, IN PCLIENT_ID AppClientId, IN PCLIENT_ID DebugUiClientId, IN PDBGKM_CREATE_PROCESS NewProcess)
NTSTATUS DbgSspExitThread (IN PDBGSS_CONTINUE_KEY ContinueKey, IN PCLIENT_ID AppClientId, IN PDBGKM_EXIT_THREAD ExitThread)
NTSTATUS DbgSspExitProcess (IN PDBGSS_CONTINUE_KEY ContinueKey, IN PCLIENT_ID AppClientId, IN PDBGKM_EXIT_PROCESS ExitProcess)
NTSTATUS DbgSspLoadDll (IN PDBGSS_CONTINUE_KEY ContinueKey, IN PCLIENT_ID AppClientId, IN PDBGKM_LOAD_DLL LoadDll)
NTSTATUS DbgSspUnloadDll (IN PDBGSS_CONTINUE_KEY ContinueKey, IN PCLIENT_ID AppClientId, IN PDBGKM_UNLOAD_DLL UnloadDll)
NTSTATUS DbgSsInitialize (IN HANDLE KmReplyPort, IN PDBGSS_UI_LOOKUP UiLookUpRoutine, IN PDBGSS_SUBSYSTEMKEY_LOOKUP SubsystemKeyLookupRoutine OPTIONAL, IN PDBGSS_DBGKM_APIMSG_FILTER KmApiMsgFilter OPTIONAL)
VOID DbgSsHandleKmApiMsg (IN PDBGKM_APIMSG ApiMsg, IN HANDLE ReplyEvent OPTIONAL)
NTSTATUS DbgSspSrvApiLoop (IN PVOID ThreadParameter)


Function Documentation

VOID DbgSsHandleKmApiMsg IN PDBGKM_APIMSG  ApiMsg,
IN HANDLE ReplyEvent  OPTIONAL
 

Definition at line 517 of file dllssstb.c.

References ASSERT, DBG_TAG, DbgPrint, DbgSspCreateProcess(), DbgSspCreateThread(), DbgSspException(), DbgSspExitProcess(), DbgSspExitThread(), DbgSspKmApiMsgFilter, DbgSspKmReplyPort, DbgSspLoadDll(), DbgSspSubsystemKeyLookupRoutine, DbgSspUiLookUpRoutine, DbgSspUnloadDll(), FALSE, MAKE_TAG, NT_SUCCESS, NtReplyPort(), NtSetEvent(), NTSTATUS(), NULL, RtlAllocateHeap, RtlFreeHeap, and TRUE.

00524 : 00525 00526 This function is called by a subsystem upon receipt of a message whose 00527 type is LPC_DEBUG_EVENT. The purpose of this function is to propagate 00528 the debug event message to the debug server. 00529 00530 A number of callouts are performed prior to propagating the message: 00531 00532 - For all messages, the KmApiMsgFilter is called (if it was 00533 supplied during DbgSsInitialize. If this returns anything other 00534 that DBG_CONTINUE, the message is not propagated by this 00535 function. The caller is responsible for event propagation, and 00536 for replying to the thread reporting the debug event. 00537 00538 - For create process messages, the UiLookupRoutine is called. If 00539 a success code is returned than message is propagated. 00540 Otherwise, a reply is generated to the thread reporting the 00541 debug event. 00542 00543 - For create process and create thread messages, 00544 SubsystemKeyLookupRoutine is called. Failure does not effect 00545 propagation. It simply inhibits the update of messages 00546 SubSystemKey field. 00547 00548 Based on the debug event type, a DBGSS_APIMSG is formated and sent 00549 as a datagram to the debug server. 00550 00551 Arguments: 00552 00553 ApiMsg - Supplies the debug event message to propagate to the debug 00554 server. 00555 00556 ReplyEvent - An optional parameter, that if specified supplies a handle 00557 to an event that is to be signaled rather that generating a reply 00558 to this message. 00559 00560 Return Value: 00561 00562 None. 00563 00564 --*/ 00565 00566 00567 { 00568 NTSTATUS st; 00569 CLIENT_ID DebugUiClientId; 00570 ULONG SubsystemKey; 00571 PDBGSS_CONTINUE_KEY ContinueKey; 00572 00573 ApiMsg->ReturnedStatus = STATUS_PENDING; 00574 00575 #if DBG && 0 00576 if (ApiMsg->ApiNumber >= DbgKmMaxApiNumber ) { 00577 ApiMsg->ApiNumber = DbgKmMaxApiNumber; 00578 } 00579 DbgPrint( "DBG: %s Api Request received from %lx.%lx\n", 00580 DbgpKmApiName[ ApiMsg->ApiNumber ], 00581 ApiMsg->h.ClientId.UniqueProcess, 00582 ApiMsg->h.ClientId.UniqueThread 00583 ); 00584 #endif // DBG 00585 00586 if (DbgSspKmApiMsgFilter) { 00587 if ( (DbgSspKmApiMsgFilter)(ApiMsg) != DBG_CONTINUE ) { 00588 return; 00589 } 00590 } 00591 00592 ContinueKey = (PDBGSS_CONTINUE_KEY) RtlAllocateHeap(RtlProcessHeap(), MAKE_TAG( DBG_TAG ), sizeof(*ContinueKey)); 00593 if ( !ContinueKey ) { 00594 ApiMsg->ReturnedStatus = STATUS_NO_MEMORY; 00595 if ( ARGUMENT_PRESENT(ReplyEvent) ) { 00596 st = NtSetEvent(ReplyEvent,NULL); 00597 } else { 00598 st = NtReplyPort(DbgSspKmReplyPort, 00599 (PPORT_MESSAGE)ApiMsg 00600 ); 00601 } 00602 ASSERT(NT_SUCCESS(st)); 00603 return; 00604 } 00605 ContinueKey->KmApiMsg = *ApiMsg; 00606 00607 ContinueKey->ReplyEvent = ReplyEvent; 00608 00609 switch (ApiMsg->ApiNumber) { 00610 00611 case DbgKmExceptionApi : 00612 st = DbgSspException( 00613 ContinueKey, 00614 &ApiMsg->h.ClientId, 00615 &ApiMsg->u.Exception 00616 ); 00617 00618 break; 00619 00620 case DbgKmCreateThreadApi : 00621 00622 if ( DbgSspSubsystemKeyLookupRoutine ) { 00623 00624 st = (DbgSspSubsystemKeyLookupRoutine)( 00625 &ApiMsg->h.ClientId, 00626 &SubsystemKey, 00627 FALSE 00628 ); 00629 00630 if ( NT_SUCCESS(st) ) { 00631 ApiMsg->u.CreateThread.SubSystemKey = SubsystemKey; 00632 } 00633 } 00634 00635 st = DbgSspCreateThread( 00636 ContinueKey, 00637 &ApiMsg->h.ClientId, 00638 &ApiMsg->u.CreateThread 00639 ); 00640 00641 break; 00642 00643 case DbgKmCreateProcessApi : 00644 00645 st = (DbgSspUiLookUpRoutine)( 00646 &ApiMsg->h.ClientId, 00647 &DebugUiClientId 00648 ); 00649 if ( !NT_SUCCESS(st) ) { 00650 break; 00651 } 00652 00653 if ( DbgSspSubsystemKeyLookupRoutine ) { 00654 00655 st = (DbgSspSubsystemKeyLookupRoutine)( 00656 &ApiMsg->h.ClientId, 00657 &SubsystemKey, 00658 TRUE 00659 ); 00660 00661 if ( NT_SUCCESS(st) ) { 00662 ApiMsg->u.CreateProcessInfo.SubSystemKey = SubsystemKey; 00663 } 00664 00665 st = (DbgSspSubsystemKeyLookupRoutine)( 00666 &ApiMsg->h.ClientId, 00667 &SubsystemKey, 00668 FALSE 00669 ); 00670 00671 if ( NT_SUCCESS(st) ) { 00672 ApiMsg->u.CreateProcessInfo.InitialThread.SubSystemKey = SubsystemKey; 00673 } 00674 } 00675 00676 st = DbgSspCreateProcess( 00677 ContinueKey, 00678 &ApiMsg->h.ClientId, 00679 &DebugUiClientId, 00680 &ApiMsg->u.CreateProcessInfo 00681 ); 00682 break; 00683 00684 00685 case DbgKmExitThreadApi : 00686 st = DbgSspExitThread( 00687 ContinueKey, 00688 &ApiMsg->h.ClientId, 00689 &ApiMsg->u.ExitThread 00690 ); 00691 break; 00692 00693 case DbgKmExitProcessApi : 00694 st = DbgSspExitProcess( 00695 ContinueKey, 00696 &ApiMsg->h.ClientId, 00697 &ApiMsg->u.ExitProcess 00698 ); 00699 break; 00700 00701 case DbgKmLoadDllApi : 00702 st = DbgSspLoadDll( 00703 ContinueKey, 00704 &ApiMsg->h.ClientId, 00705 &ApiMsg->u.LoadDll 00706 ); 00707 break; 00708 00709 case DbgKmUnloadDllApi : 00710 st = DbgSspUnloadDll( 00711 ContinueKey, 00712 &ApiMsg->h.ClientId, 00713 &ApiMsg->u.UnloadDll 00714 ); 00715 break; 00716 00717 default : 00718 st = STATUS_NOT_IMPLEMENTED; 00719 } 00720 00721 if ( !NT_SUCCESS(st) ) { 00722 ApiMsg->ReturnedStatus = st; 00723 RtlFreeHeap(RtlProcessHeap(), 0, ContinueKey); 00724 if ( ARGUMENT_PRESENT(ReplyEvent) ) { 00725 st = NtSetEvent(ReplyEvent,NULL); 00726 } else { 00727 st = NtReplyPort(DbgSspKmReplyPort, 00728 (PPORT_MESSAGE)ApiMsg 00729 ); 00730 } 00731 ASSERT(NT_SUCCESS(st)); 00732 } 00733 }

NTSTATUS DbgSsInitialize IN HANDLE  KmReplyPort,
IN PDBGSS_UI_LOOKUP  UiLookUpRoutine,
IN PDBGSS_SUBSYSTEMKEY_LOOKUP SubsystemKeyLookupRoutine  OPTIONAL,
IN PDBGSS_DBGKM_APIMSG_FILTER KmApiMsgFilter  OPTIONAL
 

Definition at line 429 of file dllssstb.c.

References ASSERT, DbgSspConnectToDbg(), DbgSspKmApiMsgFilter, DbgSspKmReplyPort, DbgSspSrvApiLoop(), DbgSspSubsystemKeyLookupRoutine, DbgSspUiLookUpRoutine, FALSE, L, NT_SUCCESS, NTSTATUS(), NULL, and RtlCreateUserThread().

00438 : 00439 00440 This function is called by a subsystem to initialize 00441 portions of the debug subsystem dll. The main purpose of 00442 this function is to set up callouts that are needed in order 00443 to use DbgSsHandleKmApiMsg, and to connect to the debug server. 00444 00445 Arguments: 00446 00447 KmReplyPort - Supplies a handle to the port that the subsystem 00448 receives DbgKm API messages on. 00449 00450 UiLookupRoutine - Supplies the address of a function that will 00451 be called upon receipt of a process creation message. The 00452 purpose of this function is to identify the client id of the 00453 debug ui controlling the process. 00454 00455 SubsystemKeyLookupRoutine - Supplies the address of a function that 00456 will be called upon receipt of process creation and thread 00457 creation messages. The purpose of this function is to allow a 00458 subsystem to correlate a key value with a given process or 00459 thread. 00460 00461 KmApiMsgFilter - Supplies the address of a function that will be 00462 called upon receipt of a DbgKm Api message. This function can 00463 take any action. If it returns any value other than DBG_CONTINUE, 00464 DbgSsHandleKmApiMsg will not process the message. This function 00465 is called before any other call outs occur. 00466 00467 Return Value: 00468 00469 Return code of DbgSsConnectToDbg. 00470 00471 --*/ 00472 00473 { 00474 NTSTATUS st; 00475 00476 st = DbgSspConnectToDbg(); 00477 00478 if (NT_SUCCESS(st)) { 00479 DbgSspKmReplyPort = KmReplyPort; 00480 DbgSspUiLookUpRoutine = UiLookUpRoutine; 00481 DbgSspSubsystemKeyLookupRoutine = SubsystemKeyLookupRoutine; 00482 DbgSspKmApiMsgFilter = KmApiMsgFilter; 00483 00484 st = RtlCreateUserThread( 00485 NtCurrentProcess(), 00486 NULL, 00487 FALSE, 00488 0L, 00489 0L, 00490 0L, 00491 DbgSspSrvApiLoop, 00492 NULL, 00493 NULL, 00494 NULL 00495 ); 00496 ASSERT( NT_SUCCESS(st) ); 00497 } 00498 00499 return st; 00500 }

NTSTATUS DbgSspConnectToDbg VOID   ) 
 

Definition at line 25 of file dllssstb.c.

References DbgSspApiPort, DynamicQos, L, NtConnectPort(), NTSTATUS(), NULL, PortName, RtlInitUnicodeString(), and TRUE.

Referenced by DbgSsInitialize().

00029 : 00030 00031 This routine makes a connection between the caller and the 00032 DbgSs port in the Dbg subsystem. 00033 00034 Arguments: 00035 00036 None. 00037 00038 Return Value: 00039 00040 TBD. 00041 00042 --*/ 00043 00044 { 00045 NTSTATUS st; 00046 UNICODE_STRING PortName; 00047 SECURITY_QUALITY_OF_SERVICE DynamicQos; 00048 00049 // 00050 // Set up the security quality of service parameters to use over the 00051 // port. Use the most efficient (least overhead) - which is dynamic 00052 // rather than static tracking. 00053 // 00054 00055 DynamicQos.ImpersonationLevel = SecurityImpersonation; 00056 DynamicQos.ContextTrackingMode = SECURITY_DYNAMIC_TRACKING; 00057 DynamicQos.EffectiveOnly = TRUE; 00058 00059 00060 RtlInitUnicodeString(&PortName,L"\\DbgSsApiPort"); 00061 st = NtConnectPort( 00062 &DbgSspApiPort, 00063 &PortName, 00064 &DynamicQos, 00065 NULL, 00066 NULL, 00067 NULL, 00068 NULL, 00069 0L 00070 ); 00071 00072 return st; 00073 00074 }

NTSTATUS DbgSspCreateProcess IN PDBGSS_CONTINUE_KEY  ContinueKey,
IN PCLIENT_ID  AppClientId,
IN PCLIENT_ID  DebugUiClientId,
IN PDBGKM_CREATE_PROCESS  NewProcess
 

Definition at line 176 of file dllssstb.c.

References DbgSspApiPort, NtRequestPort(), and NTSTATUS().

Referenced by DbgSsHandleKmApiMsg().

00185 : 00186 00187 This function is called by emulation subsystems to report the 00188 creation of a new process to the Dbg subsystem. It is the 00189 responsibility of individual subsystems to track a process and its 00190 controlling DebugUi. 00191 00192 Arguments: 00193 00194 ContinueKey - Supplies the captured DbgKm API message that needs a reply 00195 should this API complete successfully. 00196 00197 AppClientId - Supplies the address of the new thread's ClientId. 00198 00199 DebugUiClientId - Supplies the address of the ClientId of the user 00200 interface controlling the new thread. 00201 00202 NewProcess - Supplies the address of the NewProcess message as sent through 00203 the applications DebugPort. The calling subsystem may modify the 00204 SubSystemKey fields of this message. 00205 00206 Return Value: 00207 00208 TBD 00209 00210 --*/ 00211 00212 { 00213 00214 NTSTATUS st; 00215 DBGSS_APIMSG ApiMsg; 00216 00217 PDBGSS_CREATE_PROCESS args; 00218 00219 args = &ApiMsg.u.CreateProcessInfo; 00220 00221 DBGSS_FORMAT_API_MSG(ApiMsg,DbgSsCreateProcessApi,sizeof(*args),AppClientId,ContinueKey); 00222 00223 args->DebugUiClientId = *DebugUiClientId; 00224 args->NewProcess = *NewProcess; 00225 00226 st = NtRequestPort(DbgSspApiPort, (PPORT_MESSAGE) &ApiMsg); 00227 00228 return st; 00229 00230 }

NTSTATUS DbgSspCreateThread IN PDBGSS_CONTINUE_KEY  ContinueKey,
IN PCLIENT_ID  AppClientId,
IN PDBGKM_CREATE_THREAD  NewThread
 

Definition at line 126 of file dllssstb.c.

References DbgSspApiPort, NtRequestPort(), and NTSTATUS().

Referenced by DbgSsHandleKmApiMsg().

00134 : 00135 00136 This function is called by emulation subsystems to report the 00137 creation of a new thread to the Dbg subsystem. 00138 00139 Arguments: 00140 00141 ContinueKey - Supplies the captured DbgKm API message that needs a reply 00142 should this API complete successfully. 00143 00144 AppClientId - Supplies the address of the new thread's ClientId. 00145 00146 NewThread - Supplies the address of the NewThread message as sent through 00147 the applications DebugPort. The calling subsystem may modify the 00148 SubSystemKey field of this message. 00149 00150 Return Value: 00151 00152 TBD 00153 00154 --*/ 00155 00156 { 00157 00158 NTSTATUS st; 00159 DBGSS_APIMSG ApiMsg; 00160 00161 PDBGKM_CREATE_THREAD args; 00162 00163 args = &ApiMsg.u.CreateThread; 00164 00165 DBGSS_FORMAT_API_MSG(ApiMsg,DbgSsCreateThreadApi,sizeof(*args),AppClientId, ContinueKey); 00166 00167 *args = *NewThread; 00168 00169 st = NtRequestPort(DbgSspApiPort, (PPORT_MESSAGE) &ApiMsg); 00170 00171 return st; 00172 }

NTSTATUS DbgSspException IN PDBGSS_CONTINUE_KEY  ContinueKey,
IN PCLIENT_ID  AppClientId,
IN PDBGKM_EXCEPTION  Exception
 

Definition at line 77 of file dllssstb.c.

References DbgSspApiPort, NtRequestPort(), and NTSTATUS().

Referenced by DbgSsHandleKmApiMsg().

00085 : 00086 00087 This function is called by emulation subsystems to report that 00088 an exception occured in a thread. 00089 00090 Arguments: 00091 00092 ContinueKey - Supplies the captured DbgKm API message that needs a reply 00093 should this API complete successfully. 00094 00095 AppClientId - Supplies the address of the ClientId of the thread that 00096 encountered an exception. 00097 00098 Exception - Supplies the address of the Exception message as sent 00099 through the applications DebugPort. 00100 00101 Return Value: 00102 00103 TBD 00104 00105 --*/ 00106 00107 { 00108 00109 NTSTATUS st; 00110 DBGSS_APIMSG ApiMsg; 00111 00112 PDBGKM_EXCEPTION args; 00113 00114 args = &ApiMsg.u.Exception; 00115 00116 DBGSS_FORMAT_API_MSG(ApiMsg,DbgSsExceptionApi,sizeof(*args),AppClientId,ContinueKey); 00117 00118 *args = *Exception; 00119 00120 st = NtRequestPort(DbgSspApiPort, (PPORT_MESSAGE) &ApiMsg); 00121 00122 return st; 00123 }

NTSTATUS DbgSspExitProcess IN PDBGSS_CONTINUE_KEY  ContinueKey,
IN PCLIENT_ID  AppClientId,
IN PDBGKM_EXIT_PROCESS  ExitProcess
 

Definition at line 281 of file dllssstb.c.

References DbgSspApiPort, NtRequestPort(), and NTSTATUS().

Referenced by DbgSsHandleKmApiMsg().

00289 : 00290 00291 This function is called by emulation subsystems to report that 00292 a process is exiting. 00293 00294 Arguments: 00295 00296 ContinueKey - Supplies the captured DbgKm API message that needs a reply 00297 should this API complete successfully. 00298 00299 AppClientId - Supplies the address of the ClientId of the last thread 00300 in the process to exit. 00301 00302 ExitProcess - Supplies the address of the ExitProcess message as sent 00303 through the applications DebugPort. 00304 00305 Return Value: 00306 00307 TBD 00308 00309 --*/ 00310 00311 { 00312 00313 NTSTATUS st; 00314 DBGSS_APIMSG ApiMsg; 00315 00316 PDBGKM_EXIT_PROCESS args; 00317 00318 args = &ApiMsg.u.ExitProcess; 00319 00320 DBGSS_FORMAT_API_MSG(ApiMsg,DbgSsExitProcessApi,sizeof(*args),AppClientId,ContinueKey); 00321 00322 *args = *ExitProcess; 00323 00324 st = NtRequestPort(DbgSspApiPort, (PPORT_MESSAGE) &ApiMsg); 00325 00326 return st; 00327 }

NTSTATUS DbgSspExitThread IN PDBGSS_CONTINUE_KEY  ContinueKey,
IN PCLIENT_ID  AppClientId,
IN PDBGKM_EXIT_THREAD  ExitThread
 

Definition at line 233 of file dllssstb.c.

References DbgSspApiPort, NtRequestPort(), and NTSTATUS().

Referenced by DbgSsHandleKmApiMsg().

00241 : 00242 00243 This function is called by emulation subsystems to report that 00244 a thread is exiting. 00245 00246 Arguments: 00247 00248 ContinueKey - Supplies the captured DbgKm API message that needs a reply 00249 should this API complete successfully. 00250 00251 AppClientId - Supplies the address of the exiting thread's ClientId. 00252 00253 ExitThread - Supplies the address of the ExitThread message as sent 00254 through the applications DebugPort. 00255 00256 Return Value: 00257 00258 TBD 00259 00260 --*/ 00261 00262 { 00263 00264 NTSTATUS st; 00265 DBGSS_APIMSG ApiMsg; 00266 00267 PDBGKM_EXIT_THREAD args; 00268 00269 args = &ApiMsg.u.ExitThread; 00270 00271 DBGSS_FORMAT_API_MSG(ApiMsg,DbgSsExitThreadApi,sizeof(*args),AppClientId,ContinueKey); 00272 00273 *args = *ExitThread; 00274 00275 st = NtRequestPort(DbgSspApiPort, (PPORT_MESSAGE) &ApiMsg); 00276 00277 return st; 00278 }

NTSTATUS DbgSspLoadDll IN PDBGSS_CONTINUE_KEY  ContinueKey,
IN PCLIENT_ID  AppClientId,
IN PDBGKM_LOAD_DLL  LoadDll
 

Definition at line 330 of file dllssstb.c.

References DbgSspApiPort, NtRequestPort(), and NTSTATUS().

Referenced by DbgSsHandleKmApiMsg().

00338 : 00339 00340 This function is called by emulation subsystems to report that 00341 a a process has loaded a DLL 00342 00343 Arguments: 00344 00345 ContinueKey - Supplies the captured DbgKm API message that needs a reply 00346 should this API complete successfully. 00347 00348 AppClientId - Supplies the address of the ClientId of the thread 00349 that mapped the section. 00350 00351 LoadDll - Supplies the address of the LoadDll message as sent 00352 through the applications DebugPort. 00353 00354 Return Value: 00355 00356 TBD 00357 00358 --*/ 00359 00360 { 00361 00362 NTSTATUS st; 00363 DBGSS_APIMSG ApiMsg; 00364 00365 PDBGKM_LOAD_DLL args; 00366 00367 args = &ApiMsg.u.LoadDll; 00368 00369 DBGSS_FORMAT_API_MSG(ApiMsg,DbgSsLoadDllApi,sizeof(*args),AppClientId,ContinueKey); 00370 00371 *args = *LoadDll; 00372 00373 st = NtRequestPort(DbgSspApiPort, (PPORT_MESSAGE) &ApiMsg); 00374 00375 return st; 00376 }

NTSTATUS DbgSspSrvApiLoop IN PVOID  ThreadParameter  ) 
 

Definition at line 737 of file dllssstb.c.

References ASSERT, DbgSspApiPort, DbgSspKmReplyPort, FALSE, _DBGSS_CONTINUE_KEY::KmApiMsg, NT_SUCCESS, NtReplyPort(), NtReplyWaitReceivePort(), NtSetEvent(), NTSTATUS(), NULL, _DBGSS_CONTINUE_KEY::ReplyEvent, and RtlFreeHeap.

Referenced by DbgSsInitialize().

00743 : 00744 00745 This loop services Dbg Subsystem server originated messages. 00746 00747 Arguments: 00748 00749 ThreadParameter - Not used. 00750 00751 Return Value: 00752 00753 None. 00754 00755 --*/ 00756 00757 { 00758 DBGSRV_APIMSG DbgSrvApiMsg; 00759 PDBGSS_CONTINUE_KEY ContinueKey; 00760 NTSTATUS st; 00761 00762 for(;;) { 00763 00764 st = NtReplyWaitReceivePort( 00765 DbgSspApiPort, 00766 NULL, 00767 NULL, 00768 (PPORT_MESSAGE) &DbgSrvApiMsg 00769 ); 00770 00771 if (!NT_SUCCESS( st )) { 00772 continue; 00773 } 00774 00775 ASSERT(DbgSrvApiMsg.ApiNumber < DbgSrvMaxApiNumber); 00776 00777 switch (DbgSrvApiMsg.ApiNumber ) { 00778 case DbgSrvContinueApi : 00779 00780 // 00781 // Might want to implement continue status based callout 00782 // like DBG_TERMINATE_PROCESS/THREAD 00783 // 00784 00785 ContinueKey = (PDBGSS_CONTINUE_KEY) DbgSrvApiMsg.ContinueKey; 00786 ContinueKey->KmApiMsg.ReturnedStatus = DbgSrvApiMsg.ReturnedStatus; 00787 00788 if ( ContinueKey->ReplyEvent ) { 00789 st = NtSetEvent(ContinueKey->ReplyEvent,NULL); 00790 } else { 00791 st = NtReplyPort(DbgSspKmReplyPort, 00792 (PPORT_MESSAGE) &ContinueKey->KmApiMsg 00793 ); 00794 } 00795 00796 RtlFreeHeap(RtlProcessHeap(), 0, ContinueKey); 00797 break; 00798 default : 00799 ASSERT(FALSE); 00800 } 00801 } 00802 00803 // 00804 // Make the compiler happy 00805 // 00806 00807 return st; 00808 } }

NTSTATUS DbgSspUnloadDll IN PDBGSS_CONTINUE_KEY  ContinueKey,
IN PCLIENT_ID  AppClientId,
IN PDBGKM_UNLOAD_DLL  UnloadDll
 

Definition at line 379 of file dllssstb.c.

References DbgSspApiPort, NtRequestPort(), and NTSTATUS().

Referenced by DbgSsHandleKmApiMsg().

00387 : 00388 00389 This function is called by emulation subsystems to report that 00390 a a process has un-mapped a view of a section 00391 00392 Arguments: 00393 00394 ContinueKey - Supplies the captured DbgKm API message that needs a reply 00395 should this API complete successfully. 00396 00397 AppClientId - Supplies the address of the ClientId of the thread 00398 that mapped the section. 00399 00400 UnloadDll - Supplies the address of the UnloadDll message as sent 00401 through the applications DebugPort. 00402 00403 Return Value: 00404 00405 TBD 00406 00407 --*/ 00408 00409 { 00410 00411 NTSTATUS st; 00412 DBGSS_APIMSG ApiMsg; 00413 00414 PDBGKM_UNLOAD_DLL args; 00415 00416 args = &ApiMsg.u.UnloadDll; 00417 00418 DBGSS_FORMAT_API_MSG(ApiMsg,DbgSsUnloadDllApi,sizeof(*args),AppClientId,ContinueKey); 00419 00420 *args = *UnloadDll; 00421 00422 st = NtRequestPort(DbgSspApiPort, (PPORT_MESSAGE) &ApiMsg); 00423 00424 return st; 00425 }


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