Hi, everyone.
How to open process audiodg.exe in RING3?
Thanks in advance.
How to open process audiodg.exe in RING3?
Thanks in advance.
A forum for reverse engineering, OS internals and malware analysis
type
PROCESS_EXTENDED_BASIC_INFORMATION = record
Size: SIZE_T;
ProcessBasicInformation: PROCESS_BASIC_INFORMATION;
Flags: DWORD;
end;
function DECODE_BITFIELD(const dwBitField: DWORD; BitIndex: Byte): Byte;
begin
result := (dwBitField shr (BitIndex shr 8)) and ((1 shl BitIndex) - 1);
end;
function IsBitSet(const dwBitField: DWORD; BitIndex: Byte): BOOL;
begin
result := DECODE_BITFIELD(dwBitField, BitIndex) <> 0;
end;
function IsProtectedProcess(const dwProcessId: DWORD): BOOL;
var
pebi: PROCESS_EXTENDED_BASIC_INFORMATION;
hProcess: THandle;
const
IsProtectedProcessBit = 1;
IsWow64ProcessBit = 2;
IsProcessDeletingBit = 3;
IsCrossSessionCreateBit = 4;
{SPARE 28 bits < Windows 8 else}
IsFrozenBit = 5;
IsBackgroundBit = 6;
IsStronglyNamedBit = 7;
{SPARE 25 bits = Windows 8/8.1}
begin
result := False;
// Protected processes and PROCESS_QUERY_LIMITED_INFORMATION access_mask
// are only supported on Windows Vista+
if Byte(GetVersion()) < 6 then
Exit;
hProcess := OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION,
False,
dwProcessId);
if (hProcess <> 0) then
begin
pebi.Size := sizeof(pebi);
if (NtQueryInformationProcess(hProcess,
ProcessBasicInformation,
@pebi,
sizeof(pebi),
nil) = STATUS_SUCCESS) then
result := IsBitSet(pebi.Flags, IsProtectedProcessBit);
CloseHandle(hProcess);
end;
end;