Skip to content

Commit

Permalink
fixed DarthTon#379: don't use process pseudo-handle
Browse files Browse the repository at this point in the history
  • Loading branch information
DarthTon committed Jun 5, 2020
1 parent 5eb0732 commit ed951df
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/BlackBone/Process/ProcessCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ NTSTATUS ProcessCore::Open( HANDLE handle )
_hProcess = handle;
_pid = GetProcessId( _hProcess );

// Some routines in win10 do not support pseudo handle
if (IsWindows10OrGreater() && _pid == GetCurrentProcessId())
_hProcess = OpenProcess( PROCESS_ALL_ACCESS, FALSE, _pid );

return Init();
}

Expand Down
4 changes: 4 additions & 0 deletions src/Samples/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ void MapCmdFromMem();

int main( int /*argc*/, char* /*argv[]*/ )
{
blackbone::Process _process;
_ASSERT( NT_SUCCESS( _process.Attach( GetCurrentProcess() ) ) );
auto m = _process.modules().GetMainModule();

// List all process PIDs matching name
auto pids = Process::EnumByName( L"explorer.exe" );

Expand Down

0 comments on commit ed951df

Please sign in to comment.