Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Process Handle

Process Handle

Scheduled Pinned Locked Moved C / C++ / MFC
c++jsonhelptutorialquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Phil Benson
    wrote on last edited by
    #1

    I´m having problems getting the my process handle, using GetCurrentProcess() I always get 0xfffffff... back. I need to get my own process handle to pass on to a watchdog process to monitor, has anyone any idea how to get to grips with this problem ? ps, I´m using ATL/WTL and API NO MFC

    Who the F*** is general failure and why is he reading my hard drive?

    A R 2 Replies Last reply
    0
    • P Phil Benson

      I´m having problems getting the my process handle, using GetCurrentProcess() I always get 0xfffffff... back. I need to get my own process handle to pass on to a watchdog process to monitor, has anyone any idea how to get to grips with this problem ? ps, I´m using ATL/WTL and API NO MFC

      A Offline
      A Offline
      adara
      wrote on last edited by
      #2

      The return value is a pseudo handle , to get the real handle use GetCurrentProcess() with DuplicateHandle() or call to OpenProcess() :rose:

      P 1 Reply Last reply
      0
      • A adara

        The return value is a pseudo handle , to get the real handle use GetCurrentProcess() with DuplicateHandle() or call to OpenProcess() :rose:

        P Offline
        P Offline
        Phil Benson
        wrote on last edited by
        #3

        Thanks, I used the following code HANDLE hHandle; DuplicateHandle(GetCurrentProcess(), GetCurrentProcess(), GetCurrentProcess(), &hHandle, PROCESS_ALL_ACCESS | STANDARD_RIGHTS_REQUIRED |THREAD_ALL_ACCESS, FALSE,NULL); CloseHandle(hHandle); That worked...

        Who the F*** is general failure and why is he reading my hard drive?

        1 Reply Last reply
        0
        • P Phil Benson

          I´m having problems getting the my process handle, using GetCurrentProcess() I always get 0xfffffff... back. I need to get my own process handle to pass on to a watchdog process to monitor, has anyone any idea how to get to grips with this problem ? ps, I´m using ATL/WTL and API NO MFC

          R Offline
          R Offline
          Ram Cronus
          wrote on last edited by
          #4

          The 0xff thing is correct as in the doc however u may want to use the PID instead i.e. GetCurrentProcessId() Until the process terminates, the process identifier uniquely identifies the process throughout the system

          P 1 Reply Last reply
          0
          • R Ram Cronus

            The 0xff thing is correct as in the doc however u may want to use the PID instead i.e. GetCurrentProcessId() Until the process terminates, the process identifier uniquely identifies the process throughout the system

            P Offline
            P Offline
            Phil Benson
            wrote on last edited by
            #5

            That´s true, but as far as I Know (read) you can not terminate or kill a process with the PricossID, just with the Process handle. But any way, I ´ve solved that problem, know I have to change the Token on NT/XP/2000 system to Terminate/Kill the process, and Shutdown or reboot, and the MSDN is not very helpfull at all :( :confused:

            Who the F*** is general failure and why is he reading my hard drive?

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups