Page Menu
Home
desp's stash
Search
Configure Global Search
Log In
Files
F531021
NativeWinApi.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
NativeWinApi.cpp
View Options
#include
"NativeWinApi.h"
def_NtCreateThreadEx
NativeWinApi
::
NtCreateThreadEx
=
0
;
def_NtDuplicateObject
NativeWinApi
::
NtDuplicateObject
=
0
;
def_NtOpenProcess
NativeWinApi
::
NtOpenProcess
=
0
;
def_NtOpenThread
NativeWinApi
::
NtOpenThread
=
0
;
def_NtQueryObject
NativeWinApi
::
NtQueryObject
=
0
;
def_NtQueryInformationFile
NativeWinApi
::
NtQueryInformationFile
=
0
;
def_NtQueryInformationProcess
NativeWinApi
::
NtQueryInformationProcess
=
0
;
def_NtQueryInformationThread
NativeWinApi
::
NtQueryInformationThread
=
0
;
def_NtQuerySystemInformation
NativeWinApi
::
NtQuerySystemInformation
=
0
;
def_NtResumeThread
NativeWinApi
::
NtResumeThread
=
0
;
def_NtSetInformationThread
NativeWinApi
::
NtSetInformationThread
=
0
;
def_NtTerminateProcess
NativeWinApi
::
NtTerminateProcess
=
0
;
def_RtlNtStatusToDosError
NativeWinApi
::
RtlNtStatusToDosError
=
0
;
void
NativeWinApi
::
initialize
()
{
HMODULE
hModuleNtdll
=
GetModuleHandle
(
L
"ntdll.dll"
);
if
(
!
hModuleNtdll
)
{
return
;
}
NtCreateThreadEx
=
(
def_NtCreateThreadEx
)
GetProcAddress
(
hModuleNtdll
,
"NtCreateThreadEx"
);
NtDuplicateObject
=
(
def_NtDuplicateObject
)
GetProcAddress
(
hModuleNtdll
,
"NtDuplicateObject"
);
NtOpenProcess
=
(
def_NtOpenProcess
)
GetProcAddress
(
hModuleNtdll
,
"NtOpenProcess"
);
NtOpenThread
=
(
def_NtOpenThread
)
GetProcAddress
(
hModuleNtdll
,
"NtOpenThread"
);
NtQueryObject
=
(
def_NtQueryObject
)
GetProcAddress
(
hModuleNtdll
,
"NtQueryObject"
);
NtQueryInformationFile
=
(
def_NtQueryInformationFile
)
GetProcAddress
(
hModuleNtdll
,
"NtQueryInformationFile"
);
NtQueryInformationProcess
=
(
def_NtQueryInformationProcess
)
GetProcAddress
(
hModuleNtdll
,
"NtQueryInformationProcess"
);
NtQueryInformationThread
=
(
def_NtQueryInformationThread
)
GetProcAddress
(
hModuleNtdll
,
"NtQueryInformationThread"
);
NtQuerySystemInformation
=
(
def_NtQuerySystemInformation
)
GetProcAddress
(
hModuleNtdll
,
"NtQuerySystemInformation"
);
NtResumeThread
=
(
def_NtResumeThread
)
GetProcAddress
(
hModuleNtdll
,
"NtResumeThread"
);
NtSetInformationThread
=
(
def_NtSetInformationThread
)
GetProcAddress
(
hModuleNtdll
,
"NtSetInformationThread"
);
NtTerminateProcess
=
(
def_NtTerminateProcess
)
GetProcAddress
(
hModuleNtdll
,
"NtTerminateProcess"
);
RtlNtStatusToDosError
=
(
def_RtlNtStatusToDosError
)
GetProcAddress
(
hModuleNtdll
,
"RtlNtStatusToDosError"
);
}
PPEB
NativeWinApi
::
getCurrentProcessEnvironmentBlock
()
{
return
getProcessEnvironmentBlockAddress
(
GetCurrentProcess
());
}
PPEB
NativeWinApi
::
getProcessEnvironmentBlockAddress
(
HANDLE
processHandle
)
{
ULONG
lReturnLength
=
0
;
PROCESS_BASIC_INFORMATION
processBasicInformation
;
if
((
NtQueryInformationProcess
(
processHandle
,
ProcessBasicInformation
,
&
processBasicInformation
,
sizeof
(
PROCESS_BASIC_INFORMATION
),
&
lReturnLength
)
>=
0
)
&&
(
lReturnLength
==
sizeof
(
PROCESS_BASIC_INFORMATION
)))
{
//printf("NtQueryInformationProcess success %d\n",sizeof(PROCESS_BASIC_INFORMATION));
return
processBasicInformation
.
PebBaseAddress
;
}
else
{
//printf("NtQueryInformationProcess failed %d vs %d\n",lReturnLength,sizeof(PROCESS_BASIC_INFORMATION));
return
0
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Fri, Jan 9, 4:59 AM (16 h, 23 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
41/81/d539d299902077dbf864400ea0a7
Attached To
rSCY Scylla
Event Timeline
Log In to Comment