CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2009
    Posts
    1

    INVALID_HANDLE on DuplicateHandle of current Process

    Hello:

    I've googled about this and I'm still struggling, I need a Handle of the actual process, not the pseudo Handle returned by GetCurrentThread(), but the actual one.

    I've learned that I need to get the pseudo handle, and then use the DuplicateHandle to get the real one. So I did this but unfortunately I keep getting the error 16 - INVALID_HANDLE:

    HANDLE _handle = GetCurrentThread();
    HANDLE _handle2;
    bool x = DuplicateHandle(_handle,_handle,_handle,
    &_handle2,
    GENERIC_WRITE|GENERIC_READ,
    TRUE,DUPLICATE_SAME_ACCESS);

    if(!x)
    {
    cout << "Last Error: " << GetLastError() << endl;
    }

    I think the error might be around the _handle,_handle_handle, but I'm still stuck, any ideas?

    Greetings

    Alejandro

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: INVALID_HANDLE on DuplicateHandle of current Process

    See OpenProcess in msdn.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured