forked from winsiderss/systeminformer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsymprv_std.cpp
More file actions
84 lines (71 loc) · 1.46 KB
/
Copy pathsymprv_std.cpp
File metadata and controls
84 lines (71 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
* Copyright (c) 2022 Winsider Seminars & Solutions, Inc. All rights reserved.
*
* This file is part of System Informer.
*
* Authors:
*
* dmex 2023
*
*/
#include <ph.h>
#include <ref.h>
#include <refp.h>
#include <stacktrace>
using namespace std;
EXTERN_C VOID PhPrintCurrentStacktrace(
VOID
)
{
#ifdef DEBUG
stacktrace trace = stacktrace::current(1);
string result = to_string(trace);
OutputDebugStringA(result.c_str());
#endif
}
EXTERN_C PPH_STRING PhGetStacktraceAsString(
VOID
)
{
#ifdef DEBUG
stacktrace trace = stacktrace::current(1);
string result = to_string(trace);
return PhConvertUtf8ToUtf16(result.c_str());
#else
return NULL;
#endif
}
EXTERN_C PPH_STRING PhGetStacktraceSymbolFromAddress(
_In_ PVOID Address
)
{
#ifdef DEBUG
string result;
__std_stacktrace_address_to_string(
Address,
&result,
_Stacktrace_string_fill_impl
);
return PhConvertUtf8ToUtf16(result.c_str());
#else
return NULL;
#endif
}
EXTERN_C PPH_STRING PhGetObjectTypeStacktraceToString(
_In_ PVOID Object
)
{
#ifdef DEBUG
PPH_OBJECT_HEADER objectHeader = PhObjectToObjectHeader(Object);
string result;
__std_stacktrace_to_string(
objectHeader->StackBackTrace,
ARRAYSIZE(objectHeader->StackBackTrace),
&result,
_Stacktrace_string_fill_impl
);
return PhConvertUtf8ToUtf16(result.c_str());
#else
return NULL;
#endif
}