28#define DbgSsSetThreadData(d) \
29 NtCurrentTeb()->DbgSsReserved[0] = d
31#define DbgSsGetThreadData() \
32 ((PDBGSS_THREAD_DATA)NtCurrentTeb()->DbgSsReserved[0])
116 if (pDaclBuf ==
NULL)
171 if (psidAdministrators)
RtlFreeSid(psidAdministrators);
383 if (!(pbDebuggerPresent) || !(
hProcess))
399 *pbDebuggerPresent = DebugPort !=
NULL;
558 State = KillOnExit != 0;
634 switch (lpDebugEvent->dwDebugEventCode)
641 lpDebugEvent->dwThreadId,
642 lpDebugEvent->u.CreateThread.hThread);
650 lpDebugEvent->u.CreateProcessInfo.hProcess);
654 lpDebugEvent->dwThreadId,
655 lpDebugEvent->u.CreateProcessInfo.hThread);
713 static BOOL s_bDBMonMutexTriedOpen =
FALSE;
716 volatile HANDLE hDBMonMutex = s_hDBMonMutex;
733 if (hDBMonMutex ==
NULL && !s_bDBMonMutexTriedOpen)
738 s_hDBMonMutex = hDBMonMutex;
746 if (hDBMonMutex ==
NULL)
749 s_bDBMonMutexTriedOpen =
TRUE;
763 if (hDBMonBuffer ==
NULL)
break;
773 if (pDBMonBuffer ==
NULL)
break;
779 if (hDBMonBufferReady ==
NULL)
break;
794 volatile SIZE_T nRoundLen;
797 volatile SIZE_T nOutputStringLen;
800 nOutputStringLen =
strlen(_OutputString);
823 nRoundLen = nOutputStringLen;
826 memcpy(pDBMonBuffer->Buffer, _OutputString, nRoundLen);
829 pDBMonBuffer->Buffer[nRoundLen] = 0;
842 DbgPrint(
"OutputDebugStringA: Failed\n");
847 if (nOutputStringLen > 510)
850 nRoundLen = nOutputStringLen;
853 memcpy(a_cBuffer, _OutputString, nRoundLen);
856 a_cBuffer[nRoundLen] = 0;
869 _OutputString += nRoundLen;
870 nOutputStringLen -= nRoundLen;
873 while (nOutputStringLen > 0);
882 DbgPrint(
"\nOutputDebugString faulted during output\n");
889 if (hDBMonBufferReady)
CloseHandle(hDBMonBufferReady);
895 if (hDBMonDataReady !=
NULL)
ACPI_SIZE strlen(const char *String)
#define UlongToHandle(ul)
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
#define STATUS_INVALID_HANDLE
NTSTATUS NTAPI NtSetInformationDebugObject(IN HANDLE DebugHandle, IN DEBUGOBJECTINFOCLASS DebugObjectInformationClass, IN PVOID DebugInformation, IN ULONG DebugInformationLength, OUT PULONG ReturnLength OPTIONAL)
@ DebugObjectKillProcessOnExitInformation
NTSTATUS NTAPI DbgUiContinue(IN PCLIENT_ID ClientId, IN NTSTATUS ContinueStatus)
NTSTATUS NTAPI DbgUiConvertStateChangeStructure(IN PDBGUI_WAIT_STATE_CHANGE WaitStateChange, OUT PVOID Win32DebugEvent)
NTSTATUS NTAPI DbgUiDebugActiveProcess(IN HANDLE Process)
NTSTATUS NTAPI DbgUiIssueRemoteBreakin(IN HANDLE Process)
NTSTATUS NTAPI DbgUiStopDebugging(IN HANDLE Process)
NTSTATUS NTAPI DbgUiConnectToDbg(VOID)
NTSTATUS NTAPI DbgUiWaitStateChange(OUT PDBGUI_WAIT_STATE_CHANGE WaitStateChange, IN PLARGE_INTEGER TimeOut OPTIONAL)
HANDLE NTAPI DbgUiGetThreadDebugObject(VOID)
#define NT_SUCCESS(StatCode)
#define ERROR_INVALID_PARAMETER
#define HeapFree(x, y, z)
#define ERROR_ACCESS_DENIED
BOOL WINAPI DebugSetProcessKillOnExit(IN BOOL KillOnExit)
VOID WINAPI CloseAllProcessHandles(IN DWORD dwProcessId)
VOID WINAPI MarkProcessHandle(IN DWORD dwProcessId)
VOID WINAPI SaveThreadHandle(IN DWORD dwProcessId, IN DWORD dwThreadId, IN HANDLE hThread)
VOID WINAPI RemoveHandles(IN DWORD dwProcessId, IN DWORD dwThreadId)
BOOL WINAPI DebugActiveProcessStop(IN DWORD dwProcessId)
BOOL WINAPI ContinueDebugEvent(IN DWORD dwProcessId, IN DWORD dwThreadId, IN DWORD dwContinueStatus)
BOOL WINAPI DebugActiveProcess(IN DWORD dwProcessId)
struct _DBGSS_THREAD_DATA * PDBGSS_THREAD_DATA
VOID WINAPI SaveProcessHandle(IN DWORD dwProcessId, IN HANDLE hProcess)
static HANDLE K32CreateDBMonMutex(VOID)
VOID WINAPI OutputDebugStringW(IN LPCWSTR OutputString)
BOOL WINAPI DebugBreakProcess(IN HANDLE Process)
#define DbgSsSetThreadData(d)
HANDLE WINAPI ProcessIdToHandle(IN DWORD dwProcessId)
BOOL WINAPI WaitForDebugEvent(IN LPDEBUG_EVENT lpDebugEvent, IN DWORD dwMilliseconds)
VOID WINAPI OutputDebugStringA(IN LPCSTR _OutputString)
VOID WINAPI MarkThreadHandle(IN DWORD dwThreadId)
#define DbgSsGetThreadData()
struct _DBGSS_THREAD_DATA DBGSS_THREAD_DATA
BOOL WINAPI CheckRemoteDebuggerPresent(IN HANDLE hProcess, OUT PBOOL pbDebuggerPresent)
VOID WINAPI RaiseException(_In_ DWORD dwExceptionCode, _In_ DWORD dwExceptionFlags, _In_ DWORD nNumberOfArguments, _In_opt_ const ULONG_PTR *lpArguments)
PLARGE_INTEGER WINAPI BaseFormatTimeOut(OUT PLARGE_INTEGER Timeout, IN DWORD dwMilliseconds)
static const WCHAR Cleanup[]
HANDLE NTAPI OpenFileMappingW(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCWSTR lpName)
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
#define PROCESS_SUSPEND_RESUME
#define PROCESS_QUERY_INFORMATION
#define PROCESS_CREATE_THREAD
#define PROCESS_VM_OPERATION
NTSYSAPI NTSTATUS WINAPI RtlAddAccessAllowedAce(PACL, DWORD, DWORD, PSID)
NTSYSAPI NTSTATUS WINAPI RtlSetDaclSecurityDescriptor(PSECURITY_DESCRIPTOR, BOOLEAN, PACL, BOOLEAN)
#define EXCEPTION_EXECUTE_HANDLER
#define EXCEPTION_CONTINUE_SEARCH
_In_ BOOL _In_ HANDLE hProcess
#define memcpy(s1, s2, n)
#define ERROR_FILE_NOT_FOUND
#define InitializeObjectAttributes(p, n, a, r, s)
#define MUTANT_ALL_ACCESS
#define MUTANT_QUERY_STATE
NTSYSAPI NTSTATUS NTAPI RtlCreateAcl(PACL Acl, ULONG AclSize, ULONG AclRevision)
NTSYSAPI ULONG NTAPI RtlLengthSid(IN PSID Sid)
NTSYSAPI NTSTATUS NTAPI RtlCreateSecurityDescriptor(_Out_ PSECURITY_DESCRIPTOR SecurityDescriptor, _In_ ULONG Revision)
NTSYSAPI PVOID NTAPI RtlFreeSid(_In_ _Post_invalid_ PSID Sid)
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
#define SECTION_MAP_WRITE
NTSYSAPI VOID NTAPI RtlFreeAnsiString(PANSI_STRING AnsiString)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
NTSYSAPI NTSTATUS NTAPI RtlAllocateAndInitializeSid(IN PSID_IDENTIFIER_AUTHORITY IdentifierAuthority, IN UCHAR SubAuthorityCount, IN ULONG SubAuthority0, IN ULONG SubAuthority1, IN ULONG SubAuthority2, IN ULONG SubAuthority3, IN ULONG SubAuthority4, IN ULONG SubAuthority5, IN ULONG SubAuthority6, IN ULONG SubAuthority7, OUT PSID *Sid)
NTSTATUS NTAPI NtOpenProcess(OUT PHANDLE ProcessHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN PCLIENT_ID ClientId)
NTSTATUS NTAPI NtQueryInformationProcess(_In_ HANDLE ProcessHandle, _In_ PROCESSINFOCLASS ProcessInformationClass, _Out_ PVOID ProcessInformation, _In_ ULONG ProcessInformationLength, _Out_opt_ PULONG ReturnLength)
#define DBG_UNABLE_TO_PROVIDE_HANDLE
#define STATUS_ACCESS_VIOLATION
#define DBG_PRINTEXCEPTION_C
#define _SEH2_GetExceptionCode()
#define _SEH2_EXCEPT(...)
DWORD BaseSetLastNTError(IN NTSTATUS Status)
HANDLE NTAPI CsrGetProcessId(VOID)
struct _DBGSS_THREAD_DATA * Next
HANDLE WINAPI DECLSPEC_HOTPATCH OpenEventW(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCWSTR lpName)
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateMutexW(IN LPSECURITY_ATTRIBUTES lpMutexAttributes OPTIONAL, IN BOOL bInitialOwner, IN LPCWSTR lpName OPTIONAL)
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseMutex(IN HANDLE hMutex)
HANDLE WINAPI DECLSPEC_HOTPATCH OpenMutexW(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCWSTR lpName)
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
#define FIELD_OFFSET(t, f)
DWORD WINAPI GetLastError(void)
#define CREATE_PROCESS_DEBUG_EVENT
#define LOAD_DLL_DEBUG_EVENT
#define EVENT_MODIFY_STATE
DWORD WINAPI GetCurrentProcessId(void)
#define EXIT_PROCESS_DEBUG_EVENT
#define OUTPUT_DEBUG_STRING_EVENT
#define EXCEPTION_DEBUG_EVENT
#define CREATE_THREAD_DEBUG_EVENT
#define UNLOAD_DLL_DEBUG_EVENT
BOOL WINAPI IsDebuggerPresent(void)
#define EXIT_THREAD_DEBUG_EVENT
#define ERROR_SEM_TIMEOUT
_Out_ PCLIENT_ID ClientId
#define SECURITY_BUILTIN_DOMAIN_RID
#define SECURITY_WORLD_SID_AUTHORITY
#define SECURITY_WORLD_RID
#define SECURITY_LOCAL_SYSTEM_RID
#define SECURITY_NT_AUTHORITY
#define SECURITY_DESCRIPTOR_REVISION
#define DOMAIN_ALIAS_RID_ADMINS