ReactOS  0.4.14-dev-614-gbfd8a84
debug.c File Reference
#include <rtl.h>
#include <ndk/kdfuncs.h>
#include <debug.h>
Include dependency graph for debug.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

ULONG NTAPI DebugPrint (IN PSTRING DebugString, IN ULONG ComponentId, IN ULONG Level)
 
ULONG NTAPI DebugPrompt (IN PSTRING Output, IN PSTRING Input)
 
ULONG NTAPI vDbgPrintExWithPrefixInternal (IN PCCH Prefix, IN ULONG ComponentId, IN ULONG Level, IN PCCH Format, IN va_list ap, IN BOOLEAN HandleBreakpoint)
 
ULONG NTAPI vDbgPrintExWithPrefix (IN PCCH Prefix, IN ULONG ComponentId, IN ULONG Level, IN PCCH Format, IN va_list ap)
 
ULONG NTAPI vDbgPrintEx (IN ULONG ComponentId, IN ULONG Level, IN PCCH Format, IN va_list ap)
 
ULONG __cdecl DbgPrint (PCCH Format,...)
 
ULONG __cdecl DbgPrintEx (IN ULONG ComponentId, IN ULONG Level, IN PCCH Format,...)
 
ULONG __cdecl DbgPrintReturnControlC (PCCH Format,...)
 
ULONG NTAPI DbgPrompt (IN PCCH Prompt, OUT PCH Response, IN ULONG MaximumResponseLength)
 
NTSTATUS NTAPI DbgQueryDebugFilterState (IN ULONG ComponentId, IN ULONG Level)
 
NTSTATUS NTAPI DbgSetDebugFilterState (IN ULONG ComponentId, IN ULONG Level, IN BOOLEAN State)
 
VOID NTAPI DbgLoadImageSymbols (IN PSTRING Name, IN PVOID Base, IN ULONG_PTR ProcessId)
 
VOID NTAPI DbgUnLoadImageSymbols (IN PSTRING Name, IN PVOID Base, IN ULONG_PTR ProcessId)
 
VOID NTAPI DbgCommandString (IN PCCH Name, IN PCCH Command)
 
VOID NTAPI RtlPopFrame (IN PTEB_ACTIVE_FRAME Frame)
 
VOID NTAPI RtlPushFrame (IN PTEB_ACTIVE_FRAME Frame)
 
PTEB_ACTIVE_FRAME NTAPI RtlGetFrame (VOID)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 16 of file debug.c.

Function Documentation

◆ DbgCommandString()

VOID NTAPI DbgCommandString ( IN PCCH  Name,
IN PCCH  Command 
)

Definition at line 380 of file debug.c.

382 {
383  STRING NameString, CommandString;
384 
385  /* Setup the strings */
386  NameString.Buffer = (PCHAR)Name;
387  NameString.Length = (USHORT)strlen(Name);
388  CommandString.Buffer = (PCHAR)Command;
389  CommandString.Length = (USHORT)strlen(Command);
390 
391  /* Send them to the debugger */
392  DebugService2(&NameString, &CommandString, BREAKPOINT_COMMAND_STRING);
393 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
Definition: shell.h:41
VOID NTAPI DebugService2(PVOID Arg1, PVOID Arg2, ULONG Service)
Definition: debug.c:39
#define PCHAR
Definition: match.c:90
std::wstring STRING
Definition: fontsub.cpp:33
unsigned short USHORT
Definition: pedump.c:61
#define BREAKPOINT_COMMAND_STRING
Definition: kdtypes.h:55

◆ DbgLoadImageSymbols()

VOID NTAPI DbgLoadImageSymbols ( IN PSTRING  Name,
IN PVOID  Base,
IN ULONG_PTR  ProcessId 
)

Definition at line 325 of file debug.c.

328 {
329  PIMAGE_NT_HEADERS NtHeader;
330  KD_SYMBOLS_INFO SymbolInfo;
331 
332  /* Setup the symbol data */
333  SymbolInfo.BaseOfDll = Base;
334  SymbolInfo.ProcessId = ProcessId;
335 
336  /* Get NT Headers */
337  NtHeader = RtlImageNtHeader(Base);
338  if (NtHeader)
339  {
340  /* Get the rest of the data */
341  SymbolInfo.CheckSum = NtHeader->OptionalHeader.CheckSum;
342  SymbolInfo.SizeOfImage = NtHeader->OptionalHeader.SizeOfImage;
343  }
344  else
345  {
346  /* No data available */
347  SymbolInfo.CheckSum =
348  SymbolInfo.SizeOfImage = 0;
349  }
350 
351  /* Load the symbols */
353 }
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
Definition: fatprocs.h:2697
ULONG SizeOfImage
Definition: kdtypes.h:173
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2343
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: ntddk_ex.h:184
PVOID BaseOfDll
Definition: kdtypes.h:170
VOID NTAPI DebugService2(PVOID Arg1, PVOID Arg2, ULONG Service)
Definition: debug.c:39
ULONG CheckSum
Definition: kdtypes.h:172
#define BREAKPOINT_LOAD_SYMBOLS
Definition: kdtypes.h:53
#define RtlImageNtHeader
Definition: compat.h:465
ULONG_PTR ProcessId
Definition: kdtypes.h:171

◆ DbgPrint()

ULONG __cdecl DbgPrint ( PCCH  Format,
  ... 
)

Definition at line 205 of file debug.c.

207 {
208  ULONG Status;
209  va_list ap;
210 
211  /* Call the internal routine that also handles ControlC */
212  va_start(ap, Format);
214  -1,
216  Format,
217  ap,
218  TRUE);
219  va_end(ap);
220  return Status;
221 }
#define TRUE
Definition: types.h:120
ULONG NTAPI vDbgPrintExWithPrefixInternal(IN PCCH Prefix, IN ULONG ComponentId, IN ULONG Level, IN PCCH Format, IN va_list ap, IN BOOLEAN HandleBreakpoint)
Definition: debug.c:52
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
Status
Definition: gdiplustypes.h:24
#define DPFLTR_ERROR_LEVEL
Definition: main.cpp:32
#define va_start(ap, A)
Definition: acmsvcex.h:91
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
unsigned int ULONG
Definition: retypes.h:1

◆ DbgPrintEx()

ULONG __cdecl DbgPrintEx ( IN ULONG  ComponentId,
IN ULONG  Level,
IN PCCH  Format,
  ... 
)

Definition at line 228 of file debug.c.

232 {
233  ULONG Status;
234  va_list ap;
235 
236  /* Call the internal routine that also handles ControlC */
237  va_start(ap, Format);
239  ComponentId,
240  Level,
241  Format,
242  ap,
243  TRUE);
244  va_end(ap);
245  return Status;
246 }
#define TRUE
Definition: types.h:120
ULONG NTAPI vDbgPrintExWithPrefixInternal(IN PCCH Prefix, IN ULONG ComponentId, IN ULONG Level, IN PCCH Format, IN va_list ap, IN BOOLEAN HandleBreakpoint)
Definition: debug.c:52
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:55
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char UINT32 ComponentId
Definition: acpixf.h:1270
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
Status
Definition: gdiplustypes.h:24
#define va_start(ap, A)
Definition: acmsvcex.h:91
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
unsigned int ULONG
Definition: retypes.h:1

◆ DbgPrintReturnControlC()

ULONG __cdecl DbgPrintReturnControlC ( PCCH  Format,
  ... 
)

Definition at line 253 of file debug.c.

255 {
256  ULONG Status;
257  va_list ap;
258 
259  /* Call the internal routine that also handles ControlC */
260  va_start(ap, Format);
262  -1,
264  Format,
265  ap,
266  FALSE);
267  va_end(ap);
268  return Status;
269 }
ULONG NTAPI vDbgPrintExWithPrefixInternal(IN PCCH Prefix, IN ULONG ComponentId, IN ULONG Level, IN PCCH Format, IN va_list ap, IN BOOLEAN HandleBreakpoint)
Definition: debug.c:52
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
Status
Definition: gdiplustypes.h:24
#define DPFLTR_ERROR_LEVEL
Definition: main.cpp:32
#define va_start(ap, A)
Definition: acmsvcex.h:91
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
unsigned int ULONG
Definition: retypes.h:1

◆ DbgPrompt()

ULONG NTAPI DbgPrompt ( IN PCCH  Prompt,
OUT PCH  Response,
IN ULONG  MaximumResponseLength 
)

Definition at line 276 of file debug.c.

279 {
280  STRING Output;
281  STRING Input;
282 
283  /* Setup the input string */
284  Input.MaximumLength = (USHORT)MaximumResponseLength;
285  Input.Buffer = Response;
286 
287  /* Setup the output string */
288  Output.Length = (USHORT)strlen(Prompt);
289  Output.Buffer = (PCHAR)Prompt;
290 
291  /* Call the system service */
292  return DebugPrompt(&Output, &Input);
293 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
Definition: arc.h:84
ULONG NTAPI DebugPrompt(IN PSTRING Output, IN PSTRING Input)
Definition: debug.c:37
#define PCHAR
Definition: match.c:90
_In_ ULONG MaximumResponseLength
Definition: kdfuncs.h:11
std::wstring STRING
Definition: fontsub.cpp:33
Definition: arc.h:85
unsigned short USHORT
Definition: pedump.c:61
struct Response Response

◆ DbgQueryDebugFilterState()

NTSTATUS NTAPI DbgQueryDebugFilterState ( IN ULONG  ComponentId,
IN ULONG  Level 
)

Definition at line 300 of file debug.c.

302 {
303  /* Call the Nt routine */
305 }
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:55
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char UINT32 ComponentId
Definition: acpixf.h:1270
NTSTATUS NTAPI NtQueryDebugFilterState(_In_ ULONG ComponentId, _In_ ULONG Level)
Definition: kdapi.c:2334

◆ DbgSetDebugFilterState()

NTSTATUS NTAPI DbgSetDebugFilterState ( IN ULONG  ComponentId,
IN ULONG  Level,
IN BOOLEAN  State 
)

Definition at line 312 of file debug.c.

315 {
316  /* Call the Nt routine */
318 }
NTSTATUS NTAPI NtSetDebugFilterState(_In_ ULONG ComponentId, _In_ ULONG Level, _In_ BOOLEAN State)
Definition: kdapi.c:2388
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:55
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char UINT32 ComponentId
Definition: acpixf.h:1270

◆ DbgUnLoadImageSymbols()

VOID NTAPI DbgUnLoadImageSymbols ( IN PSTRING  Name,
IN PVOID  Base,
IN ULONG_PTR  ProcessId 
)

Definition at line 360 of file debug.c.

363 {
364  KD_SYMBOLS_INFO SymbolInfo;
365 
366  /* Setup the symbol data */
367  SymbolInfo.BaseOfDll = Base;
368  SymbolInfo.ProcessId = ProcessId;
369  SymbolInfo.CheckSum = SymbolInfo.SizeOfImage = 0;
370 
371  /* Load the symbols */
373 }
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
Definition: fatprocs.h:2697
ULONG SizeOfImage
Definition: kdtypes.h:173
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2343
#define BREAKPOINT_UNLOAD_SYMBOLS
Definition: kdtypes.h:54
PVOID BaseOfDll
Definition: kdtypes.h:170
VOID NTAPI DebugService2(PVOID Arg1, PVOID Arg2, ULONG Service)
Definition: debug.c:39
ULONG CheckSum
Definition: kdtypes.h:172
ULONG_PTR ProcessId
Definition: kdtypes.h:171

◆ DebugPrint()

ULONG NTAPI DebugPrint ( IN PSTRING  DebugString,
IN ULONG  ComponentId,
IN ULONG  Level 
)

Definition at line 23 of file debug.c.

26 {
27  /* Call the Debug Service */
29  DebugString->Buffer,
30  UlongToPtr(DebugString->Length),
32  UlongToPtr(Level));
33 }
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:55
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char UINT32 ComponentId
Definition: acpixf.h:1270
#define UlongToPtr(u)
Definition: config.h:106
#define BREAKPOINT_PRINT
Definition: kdtypes.h:51
ULONG NTAPI DebugService(ULONG Service, PVOID Argument1, PVOID Argument1, PVOID Argument3, PVOID Argument4)
Definition: debug.c:15
CCHAR DebugString[256]
Definition: cmdline.c:22

Referenced by AtapiCallBack(), AtapiFindController(), AtapiFindNativeModeController(), AtapiFindPCIController(), AtapiHwInitialize(), AtapiInterrupt(), AtapiResetController(), AtapiSendCommand(), AtapiStartIo(), BT958HwAdapterControl(), BT958HwFindAdapter(), BT958HwResetBus(), BT958HwStartIO(), BusLogic_CheckHostAdapter(), BusLogic_ComputeResultCode(), BusLogic_HardwareResetHostAdapter(), Buslogic_InitBT958(), BusLogic_InitializeHostAdapter(), BusLogic_ProbeHostAdapter(), BusLogic_ProcessCompletedCCBs(), BusLogic_QueueCommand(), BusLogic_ReadHostAdapterConfiguration(), BusLogic_ScanIncomingMailboxes(), BusLogic_SendBusDeviceReset(), BusLogic_TargetDeviceInquiry(), CdRomCheckRegistryForMediaChangeValue(), CdRomClassIoctlCompletion(), CdRomDeviceControl(), CdRomDeviceControlCompletion(), CdRomDeviceControlDispatch(), CdRomMediaChangeCompletion(), CdRomPickDvdRegion(), CdRomSetVolumeIntermediateCompletion(), CdRomSwitchModeCompletion(), CdRomTickHandler(), CdRomUpdateGeometryCompletion(), CdRomXACompletion(), ClassAcquireRemoveLockEx(), ClassCheckMediaState(), ClassCheckVerifyComplete(), ClassClaimDevice(), ClassCompleteRequest(), ClassCreateDeviceObject(), ClassDeviceControl(), ClassDisableMediaChangeDetection(), ClassDispatchPnp(), ClassEnableMediaChangeDetection(), ClassGetDescriptor(), ClassInitialize(), ClassInitializeMediaChangeDetection(), ClassInterpretSenseInfo(), ClassInvalidateBusRelations(), ClassIoComplete(), ClassIoCompleteAssociated(), ClassNotifyFailurePredicted(), ClasspAllocateReleaseQueueIrp(), ClasspBuildRequestEx(), ClasspCleanupDisableMcn(), ClasspCleanupProtectedLocks(), ClasspCreateClose(), ClasspDisableTimer(), ClasspEjectionControl(), ClasspEnableTimer(), ClasspFailurePredict(), ClasspInternalSetMediaChangeState(), ClasspIsMediaChangeDisabledDueToHardwareLimitation(), ClasspIsMediaChangeDisabledForClass(), ClasspMediaChangeDeviceInstanceOverride(), ClasspMediaChangeRegistryCallBack(), ClassPnpStartDevice(), ClasspPerfIncrementErrorCount(), ClasspPerfIncrementSuccessfulIo(), ClasspPowerDownCompletion(), ClasspPowerHandler(), ClasspPowerUpCompletion(), ClasspRetryDpcTimer(), ClasspRetryRequestDpc(), ClasspSendMediaStateIrp(), ClasspSendSynchronousCompletion(), ClasspTimerTick(), ClassQueryTimeOutRegistryValue(), ClassReadDriveCapacity(), ClassReleaseRemoveLock(), ClassRemoveDevice(), ClassRetrieveDeviceRelations(), ClassRetryRequest(), ClassScanForSpecial(), ClassSendIrpSynchronous(), ClassSendSrbSynchronous(), ClassSetFailurePredictionPoll(), ClassSpinDownPowerHandler(), ClassStopUnitPowerHandler(), ClassUnload(), ClassUpdateInformationInRegistry(), CreateCdRomDeviceObject(), CreateDiskDeviceObject(), CreateFlopDeviceObject(), CreatePartitionDeviceObjects(), DisableWriteCache(), DiskAddDevice(), DiskCreateFdo(), DiskCreatePdo(), DiskCreateSymbolicLinks(), DiskDetectFailurePrediction(), DiskDetermineMediaTypes(), DiskDeviceControl(), DiskFdoExecuteWmiMethod(), DiskFdoQueryWmiDataBlock(), DiskFdoSetWmiDataBlock(), DiskFdoSetWmiDataItem(), DiskFindAdjacentPartition(), DiskFindContainingPartition(), DiskGenerateDeviceName(), DiskGetCacheInformation(), DiskGetIdentifyInfo(), DiskGetInfoExceptionInformation(), DiskInfoExceptionCheck(), DiskInfoExceptionComplete(), DiskInitFdo(), DiskInitPdo(), DiskInvalidatePartitionTable(), DiskIoctlVerify(), DiskPdoFindPartitionEntry(), DiskPostReregisterRequest(), DiskReadPartitionTableEx(), DiskReadWriteVerification(), DiskReregWorker(), DiskSetCacheInformation(), DiskSetInfoExceptionInformation(), DiskSetPartitionInformation(), DiskSetPartitionInformationEx(), DiskSetSpecialHacks(), DiskShutdownFlush(), DiskStartFdo(), DiskUpdatePartitions(), DiskUpdateRemovablePartitions(), DiskVerifyPartitionTable(), DiskWmiFunctionControl(), DiskWritePartitionTableEx(), DriverEntry(), EnumerateBusKey(), FindBrokenController(), FindDevices(), FindScsiAdapter(), FindScsiDisks(), HitachProcessError(), IdeMediaStatus(), IdeReadWrite(), IdeSendCommand(), IdeSendSmartCommand(), IdeVerify(), IsFloppyDevice(), IssueIdentify(), IsThisAMultiLunDevice(), MapError(), ReportToMountMgr(), ResetBus(), ResetScsiBus(), RetryPowerRequest(), ScanForSpecial(), ScsiCdRomFindDevices(), ScsiCdRomReadVerification(), ScsiCdRomStartIo(), ScsiClassBuildRequest(), ScsiClassCheckVerifyComplete(), ScsiClassClaimDevice(), ScsiClassCreateDeviceObject(), ScsiClassDeviceControl(), ScsiClassInitialize(), ScsiClassInterpretSenseInfo(), ScsiClassIoComplete(), ScsiClassIoCompleteAssociated(), ScsiClassQueryTimeOutRegistryValue(), ScsiClassReadDriveCapacity(), ScsiClassReadWrite(), ScsiClassSendSrbSynchronous(), ScsiClassSplitRequest(), ScsiDiskDeviceControl(), ScsiDiskShutdownFlush(), ScsiFlopDeviceControl(), ScsiFlopInitDevice(), ScsiFlopProcessError(), ScsiFlopRemoveDevice(), ScsiFlopStartDevice(), SetDriveParameters(), UpdateDeviceObjects(), UpdateGeometry(), USBFlopFormatTracks(), USBFlopGetMediaTypes(), and vDbgPrintExWithPrefixInternal().

◆ DebugPrompt()

ULONG NTAPI DebugPrompt ( IN PSTRING  Output,
IN PSTRING  Input 
)

Definition at line 37 of file debug.c.

39 {
40  /* Call the Debug Service */
42  Output->Buffer,
43  UlongToPtr(Output->Length),
44  Input->Buffer,
45  UlongToPtr(Input->MaximumLength));
46 }
Definition: arc.h:84
#define BREAKPOINT_PROMPT
Definition: kdtypes.h:52
#define UlongToPtr(u)
Definition: config.h:106
Definition: arc.h:85
ULONG NTAPI DebugService(ULONG Service, PVOID Argument1, PVOID Argument1, PVOID Argument3, PVOID Argument4)
Definition: debug.c:15

Referenced by DbgPrompt().

◆ RtlGetFrame()

PTEB_ACTIVE_FRAME NTAPI RtlGetFrame ( VOID  )

Definition at line 420 of file debug.c.

421 {
422  /* Return the frame that's currently active */
423  return NtCurrentTeb()->ActiveFrame;
424 }
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420

◆ RtlPopFrame()

VOID NTAPI RtlPopFrame ( IN PTEB_ACTIVE_FRAME  Frame)

Definition at line 400 of file debug.c.

401 {
402  /* Restore the previous frame as the active one */
403  NtCurrentTeb()->ActiveFrame = Frame->Previous;
404 }
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420

◆ RtlPushFrame()

VOID NTAPI RtlPushFrame ( IN PTEB_ACTIVE_FRAME  Frame)

Definition at line 411 of file debug.c.

412 {
413  /* Save the current frame and set the new one as active */
414  Frame->Previous = NtCurrentTeb()->ActiveFrame;
415  NtCurrentTeb()->ActiveFrame = Frame;
416 }
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420

◆ vDbgPrintEx()

ULONG NTAPI vDbgPrintEx ( IN ULONG  ComponentId,
IN ULONG  Level,
IN PCCH  Format,
IN va_list  ap 
)

Definition at line 186 of file debug.c.

190 {
191  /* Call the internal routine that also handles ControlC */
193  ComponentId,
194  Level,
195  Format,
196  ap,
197  TRUE);
198 }
#define TRUE
Definition: types.h:120
ULONG NTAPI vDbgPrintExWithPrefixInternal(IN PCCH Prefix, IN ULONG ComponentId, IN ULONG Level, IN PCCH Format, IN va_list ap, IN BOOLEAN HandleBreakpoint)
Definition: debug.c:52
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:55
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char UINT32 ComponentId
Definition: acpixf.h:1270
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32

◆ vDbgPrintExWithPrefix()

ULONG NTAPI vDbgPrintExWithPrefix ( IN PCCH  Prefix,
IN ULONG  ComponentId,
IN ULONG  Level,
IN PCCH  Format,
IN va_list  ap 
)

Definition at line 166 of file debug.c.

171 {
172  /* Call the internal routine that also handles ControlC */
174  ComponentId,
175  Level,
176  Format,
177  ap,
178  TRUE);
179 }
#define TRUE
Definition: types.h:120
_In_ __drv_aliasesMem PSTRING Prefix
Definition: rtlfuncs.h:1631
ULONG NTAPI vDbgPrintExWithPrefixInternal(IN PCCH Prefix, IN ULONG ComponentId, IN ULONG Level, IN PCCH Format, IN va_list ap, IN BOOLEAN HandleBreakpoint)
Definition: debug.c:52
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:55
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char UINT32 ComponentId
Definition: acpixf.h:1270
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32

◆ vDbgPrintExWithPrefixInternal()

ULONG NTAPI vDbgPrintExWithPrefixInternal ( IN PCCH  Prefix,
IN ULONG  ComponentId,
IN ULONG  Level,
IN PCCH  Format,
IN va_list  ap,
IN BOOLEAN  HandleBreakpoint 
)

Definition at line 52 of file debug.c.

58 {
61  CHAR Buffer[512];
62  SIZE_T Length, PrefixLength;
63  EXCEPTION_RECORD ExceptionRecord;
64 
65  /* Check if we should print it or not */
66  if ((ComponentId != MAXULONG) &&
68  {
69  /* This message is masked */
70  return STATUS_SUCCESS;
71  }
72 
73  /* For user mode, don't recursively DbgPrint */
74  if (RtlpSetInDbgPrint()) return STATUS_SUCCESS;
75 
76  /* Guard against incorrect pointers */
77  _SEH2_TRY
78  {
79  /* Get the length and normalize it */
80  PrefixLength = strlen(Prefix);
81  if (PrefixLength > sizeof(Buffer)) PrefixLength = sizeof(Buffer);
82 
83  /* Copy it */
84  strncpy(Buffer, Prefix, PrefixLength);
85 
86  /* Do the printf */
87  Length = _vsnprintf(Buffer + PrefixLength,
88  sizeof(Buffer) - PrefixLength,
89  Format,
90  ap);
91  }
93  {
94  /* In user-mode, clear the InDbgPrint Flag */
96  /* Fail */
98  }
99  _SEH2_END;
100 
101  /* Check if we went past the buffer */
102  if (Length == MAXULONG)
103  {
104  /* Terminate it if we went over-board */
105  Buffer[sizeof(Buffer) - 1] = '\n';
106 
107  /* Put maximum */
108  Length = sizeof(Buffer);
109  }
110  else
111  {
112  /* Add the prefix */
113  Length += PrefixLength;
114  }
115 
116  /* Build the string */
117  DebugString.Length = (USHORT)Length;
118  DebugString.Buffer = Buffer;
119 
120  /* First, let the debugger know as well */
122  {
123  /* Fill out an exception record */
124  ExceptionRecord.ExceptionCode = DBG_PRINTEXCEPTION_C;
125  ExceptionRecord.ExceptionRecord = NULL;
126  ExceptionRecord.NumberParameters = 2;
127  ExceptionRecord.ExceptionFlags = 0;
128  ExceptionRecord.ExceptionInformation[0] = DebugString.Length + 1;
129  ExceptionRecord.ExceptionInformation[1] = (ULONG_PTR)DebugString.Buffer;
130 
131  /* Raise the exception */
132  RtlRaiseException(&ExceptionRecord);
133 
134  /* In user-mode, clear the InDbgPrint Flag */
136  return STATUS_SUCCESS;
137  }
138 
139  /* Call the Debug Print routine */
141 
142  /* Check if this was with Control-C */
143  if (HandleBreakpoint)
144  {
145  /* Check if we got a breakpoint */
146  if (Status == STATUS_BREAKPOINT)
147  {
148  /* Breakpoint */
151  }
152  }
153 
154  /* In user-mode, clear the InDbgPrint Flag */
156 
157  /* Return */
158  return Status;
159 }
#define TRUE
Definition: types.h:120
_In_ __drv_aliasesMem PSTRING Prefix
Definition: rtlfuncs.h:1631
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:427
char CHAR
Definition: xmlstorage.h:175
LONG NTSTATUS
Definition: precomp.h:26
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:55
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char UINT32 ComponentId
Definition: acpixf.h:1270
NTSYSAPI VOID NTAPI RtlRaiseException(_In_ PEXCEPTION_RECORD ExceptionRecord)
_SEH2_TRY
Definition: create.c:4250
VOID NTAPI RtlpClearInDbgPrint(VOID)
Definition: libsupp.c:45
DWORD ExceptionCode
Definition: compat.h:196
NTSTATUS NTAPI NtQueryDebugFilterState(_In_ ULONG ComponentId, _In_ ULONG Level)
Definition: kdapi.c:2334
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
#define STATUS_BREAKPOINT
Definition: ntstatus.h:172
Definition: bufpool.h:45
ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]
Definition: compat.h:201
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
std::wstring STRING
Definition: fontsub.cpp:33
BOOLEAN NTAPI RtlpCheckForActiveDebugger(VOID)
Definition: libsupp.c:25
#define DBG_PRINTEXCEPTION_C
Definition: ntstatus.h:53
ULONG NTAPI DebugPrint(IN PSTRING DebugString, IN ULONG ComponentId, IN ULONG Level)
Definition: debug.c:23
Status
Definition: gdiplustypes.h:24
struct _EXCEPTION_RECORD * ExceptionRecord
Definition: compat.h:198
#define MAXULONG
Definition: typedefs.h:250
ULONG_PTR SIZE_T
Definition: typedefs.h:78
_SEH2_END
Definition: create.c:4424
unsigned short USHORT
Definition: pedump.c:61
#define _vsnprintf
Definition: xmlstorage.h:202
BOOLEAN NTAPI RtlpSetInDbgPrint(VOID)
Definition: libsupp.c:33
#define DBG_STATUS_CONTROL_C
Definition: kdtypes.h:39
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
#define ULONG_PTR
Definition: config.h:101
DWORD ExceptionFlags
Definition: compat.h:197
CCHAR DebugString[256]
Definition: cmdline.c:22
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
DWORD NumberParameters
Definition: compat.h:200
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:2938
NTKERNELAPI VOID DbgBreakPointWithStatus(ULONG Status)
Definition: debug.c:10

Referenced by DbgPrint(), DbgPrintEx(), DbgPrintReturnControlC(), vDbgPrintEx(), and vDbgPrintExWithPrefix().