test: w32/ntuser/kernel/debug.c File Reference

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

# debug.c File Reference

`#include "precomp.h"`
`#include "ntcsrmsg.h"`
`#include "csrmsg.h"`

Go to the source code of this file.

## Functions

BOOL | xxxActivateDebugger (UINT fsModifiers)
DWORD | GetRipComponent (VOID)
DWORD | GetDbgTagFlags (int tag)
DWORD | GetRipPID (VOID)
DWORD | GetRipFlags (VOID)
VOID | SetRipFlags (DWORD dwRipFlags, DWORD dwRipPID)
VOID | SetDbgTag (int tag, DWORD dwBitFlags)

## Function Documentation

DWORD GetDbgTagFlags | ( | int | tag | ) |

Definition at line 118 of file w32/ntuser/kernel/debug.c.

References DWORD, gpsi, and NULL.

    00119 {
    00120 #if DEBUGTAGS
    00121     return (gpsi != NULL ? gpsi->adwDBGTAGFlags[tag] : 0);
    00122 #else
    00123     return 0;
    00124     UNREFERENCED_PARAMETER(tag);
    00125 #endif // DEBUGTAGS
    00126 }

DWORD GetRipComponent | ( | VOID |  | ) |

Definition at line 116 of file w32/ntuser/kernel/debug.c.

References DWORD.

    00116 { return RIP_USERKRNL; }

DWORD GetRipFlags | ( | VOID |  | ) |

Definition at line 129 of file w32/ntuser/kernel/debug.c.

References DWORD, gpsi, NULL, RIPF_DEFAULT, and tagSERVERINFO::wRIPFlags.

    00129 { return (gpsi != NULL ? gpsi->wRIPFlags : RIPF_DEFAULT); }

DWORD GetRipPID | ( | VOID |  | ) |

Definition at line 128 of file w32/ntuser/kernel/debug.c.

References DWORD, gpsi, NULL, and tagSERVERINFO::wRIPPID.

    00128 { return (gpsi != NULL ? gpsi->wRIPPID : 0); }

VOID SetDbgTag | ( | int | tag,
|  | DWORD | dwBitFlags
| ) |

Definition at line 136 of file w32/ntuser/kernel/debug.c.

References _SetDbgTag(), and VOID().

    00137 {
    00138     _SetDbgTag(tag, dwBitFlags);
    00139 }

VOID SetRipFlags | ( | DWORD | dwRipFlags,
|  | DWORD | dwRipPID
| ) |

Definition at line 131 of file w32/ntuser/kernel/debug.c.

References _SetRipFlags(), and VOID().

    00132 {
    00133     _SetRipFlags(dwRipFlags, dwRipPID);
    00134 }

BOOL xxxActivateDebugger | ( | UINT | fsModifiers | ) |

Definition at line 32 of file w32/ntuser/kernel/debug.c.

References _USER_API_MSG::ApiNumber, BOOL, _USER_API_MSG::CaptureBuffer, _ACTIVATEDEBUGGERMSG::ClientId, CsrApiPort, _EPROCESS::DebugPort, EnterCrit, FALSE, gpepCSRSS, gpqForeground, _USER_API_MSG::h, LeaveCrit, LockProcessByClientId(), LpcRequestPort(), NT_SUCCESS, NTSTATUS(), NULL, tagQ::ptiKeyboard, Status, TRUE, _USER_API_MSG::u, _EPROCESS::UniqueProcessId, UnlockProcess, and UserpActivateDebugger.

Referenced by xxxDoHotKeyStuff().

    00034 {
    00035     ULONG ArgLength;
    00036     USER_API_MSG m;
    00037     PACTIVATEDEBUGGERMSG a = &m.u.ActivateDebugger;
    00038     PEPROCESS Process;
    00039     HANDLE hDebugPort;
    00040     NTSTATUS Status;
    00041     if (fsModifiers & MOD_CONTROL) {
    00042 #if DBG
    00043         if (RipOutput(0, RIP_WARNING, "User debugger", 0, "Debug prompt", NULL)) {
    00044             DbgBreakPoint();
    00045         }
    00046 #endif
    00047         return FALSE;
    00048     } else if (fsModifiers & MOD_SHIFT) {
    00049
    00050         /*
    00051          * Bail out if the process is not being debugged.
    00052          */
    00053         if (gpepCSRSS->DebugPort == NULL)
    00054             return FALSE;
    00055
    00056         a->ClientId.UniqueProcess = gpepCSRSS->UniqueProcessId;
    00057     } else {
    00058
    00059         if ((gpqForeground == NULL) || (gpqForeground->ptiKeyboard == NULL))
    00060             return FALSE;
    00061
    00062         a->ClientId = gpqForeground->ptiKeyboard->pEThread->Cid;
    00063
    00064         LeaveCrit();
    00065         Status = LockProcessByClientId(a->ClientId.UniqueProcess, &Process);
    00066         EnterCrit();
    00067
    00068         /*
    00069          * Bail out if the process is not being debugged or the process id
    00070          * is invalid.
    00071          */
    00072         if (!NT_SUCCESS(Status))
    00073             return FALSE;
    00074
    00075         hDebugPort = Process->DebugPort;
    00076         UnlockProcess(Process);
    00077
    00078         if (hDebugPort == NULL)
    00079             return FALSE;
    00080     }
    00081
    00082     /*
    00083      * Send the datagram to CSR
    00084      */
    00085     if (CsrApiPort != NULL) {
    00086         ArgLength = sizeof(*a);
    00087         ArgLength |= (ArgLength << 16);
    00088         ArgLength +=     ((sizeof( CSR_API_MSG ) - sizeof( m.u )) << 16) |
    00089                         (FIELD_OFFSET( CSR_API_MSG, u ) - sizeof( m.h ));
    00090         m.h.u1.Length = ArgLength;
    00091         m.h.u2.ZeroInit = 0;
    00092         m.CaptureBuffer = NULL;
    00093         m.ApiNumber = CSR_MAKE_API_NUMBER( USERSRV_SERVERDLL_INDEX,
    00094                                            UserpActivateDebugger);
    00095         LeaveCrit();
    00096         Status = LpcRequestPort(CsrApiPort, (PPORT_MESSAGE)&m);
    00097         EnterCrit();
    00098         UserAssert(NT_SUCCESS(Status));
    00099     }
    00100
    00101     /*
    00102      * Don't eat this event unless we are breaking into CSR! Since we have
    00103      * choosen an arbitrary hot key like F12 for the debug key, we need to
    00104      * pass on the key to the application, or apps that want this key would
    00105      * never see it. If we had an api for installing a debug hot key
    00106      * (export or MOD_DEBUG flag to RegisterHotKey()), then it would be ok
    00107      * to eat because the user selected the hot key. But it is not ok to
    00108      * eat it as long as we've picked an arbitrary hot key. scottlu.
    00109      */
    00110     if (fsModifiers & MOD_SHIFT)
    00111         return TRUE;
    00112     else
    00113         return FALSE;
    00114 }