@@ -64,88 +64,32 @@ BOOLEAN EtpRefreshUnloadedDlls(
64
64
)
65
65
{
66
66
NTSTATUS status ;
67
- PULONG elementSize ;
68
- PULONG elementCount ;
69
- PVOID eventTrace ;
70
- HANDLE processHandle = NULL ;
71
- ULONG eventTraceSize ;
72
67
ULONG capturedElementSize ;
73
68
ULONG capturedElementCount ;
74
- PVOID capturedEventTracePointer ;
75
69
PVOID capturedEventTrace = NULL ;
76
70
ULONG i ;
77
71
PVOID currentEvent ;
78
72
HWND lvHandle ;
79
73
80
- lvHandle = GetDlgItem (hwndDlg , IDC_LIST );
81
-
82
- RtlGetUnloadEventTraceEx (& elementSize , & elementCount , & eventTrace );
83
-
84
- if (!NT_SUCCESS (status = PhOpenProcess (& processHandle , PROCESS_VM_READ , Context -> ProcessItem -> ProcessId )))
85
- goto CleanupExit ;
86
-
87
- // We have the pointers for the unload event trace information.
88
- // Since ntdll is loaded at the same base address across all processes,
89
- // we can read the information in.
90
-
91
- if (!NT_SUCCESS (status = NtReadVirtualMemory (
92
- processHandle ,
93
- elementSize ,
74
+ status = PhGetProcessUnloadedDlls (
75
+ Context -> ProcessItem -> ProcessId ,
76
+ & capturedEventTrace ,
94
77
& capturedElementSize ,
95
- sizeof (ULONG ),
96
- NULL
97
- )))
98
- goto CleanupExit ;
99
-
100
- if (!NT_SUCCESS (status = NtReadVirtualMemory (
101
- processHandle ,
102
- elementCount ,
103
- & capturedElementCount ,
104
- sizeof (ULONG ),
105
- NULL
106
- )))
107
- goto CleanupExit ;
108
-
109
- if (!NT_SUCCESS (status = NtReadVirtualMemory (
110
- processHandle ,
111
- eventTrace ,
112
- & capturedEventTracePointer ,
113
- sizeof (PVOID ),
114
- NULL
115
- )))
116
- goto CleanupExit ;
117
-
118
- if (!capturedEventTracePointer )
119
- goto CleanupExit ; // no events
120
-
121
- if (capturedElementCount > 0x4000 )
122
- capturedElementCount = 0x4000 ;
123
-
124
- eventTraceSize = capturedElementSize * capturedElementCount ;
125
-
126
- capturedEventTrace = PhAllocateSafe (eventTraceSize );
127
-
128
- if (!capturedEventTrace )
78
+ & capturedElementCount
79
+ );
80
+
81
+ if (!NT_SUCCESS (status ))
129
82
{
130
- status = STATUS_NO_MEMORY ;
131
- goto CleanupExit ;
83
+ PhShowStatus ( NULL , L"Unable to retrieve unload event trace information." , status , 0 ) ;
84
+ return FALSE ;
132
85
}
133
86
134
- if (!NT_SUCCESS (status = NtReadVirtualMemory (
135
- processHandle ,
136
- capturedEventTracePointer ,
137
- capturedEventTrace ,
138
- eventTraceSize ,
139
- NULL
140
- )))
141
- goto CleanupExit ;
142
-
143
- currentEvent = capturedEventTrace ;
144
-
87
+ lvHandle = GetDlgItem (hwndDlg , IDC_LIST );
145
88
ExtendedListView_SetRedraw (lvHandle , FALSE);
146
-
147
89
ListView_DeleteAllItems (lvHandle );
148
90
91
+ currentEvent = capturedEventTrace ;
92
+
149
93
for (i = 0 ; i < capturedElementCount ; i ++ )
150
94
{
151
95
PRTL_UNLOAD_EVENT_TRACE rtlEvent = currentEvent ;
@@ -199,20 +143,7 @@ BOOLEAN EtpRefreshUnloadedDlls(
199
143
200
144
Context -> CapturedEventTrace = capturedEventTrace ;
201
145
202
- CleanupExit :
203
-
204
- if (processHandle )
205
- NtClose (processHandle );
206
-
207
- if (NT_SUCCESS (status ))
208
- {
209
- return TRUE;
210
- }
211
- else
212
- {
213
- PhShowStatus (hwndDlg , L"Unable to retrieve unload event trace information" , status , 0 );
214
- return FALSE;
215
- }
146
+ return NT_SUCCESS (status );
216
147
}
217
148
218
149
static INT NTAPI EtpNumberCompareFunction (
0 commit comments