Re: Process ID lifetime and how to marshal a kernel object handle

Tech-Archive recommends: Speed Up your PC by fixing your registry



Is there a reason why you can't just open a new handle (by name) in the
second process?



One reliable way to keep a process around is to keep a handle open. The
process won't be cleaned up by the OS, and the ID won't be reused, until all
handles are closed.


"Arno Schoedl" <aschoedl@xxxxxxxxxxxxxx> wrote in message
news:3abb4347-a208-4d2b-8fb5-1981025468f4@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello,

I want to COM-marshal a kernel object handle from one process to
another. In IMarshal::MarshalInterface, I duplicate the handle within
the source process to hold a reference to the kernel object that I am
marshaling. In IMarshal::UnmarshalInterface, I duplicate the handle
from the source process to the destination process with
DUPLICATE_CLOSE_SOURCE.

The problem is that in doing that, I make use of the source process ID
stored in my marshal data. I am worried that in cases when the source
process has terminated, its process ID may be reused, and thus I may
end up duplicating some random handle. Is this worry warranted? Does
anyone have an idea on how to COM-marshal a handle correctly?

Arno


.



Relevant Pages

  • Re: Process ID lifetime and how to marshal a kernel object handle
    ... I want to COM-marshal a kernel object handle from one process to ... I duplicate the handle within ... the source process to hold a reference to the kernel object that I am ... stored in my marshal data. ...
    (microsoft.public.win32.programmer.kernel)
  • Process ID lifetime and how to marshal a kernel object handle
    ... I want to COM-marshal a kernel object handle from one process to ... I duplicate the handle within ... the source process to hold a reference to the kernel object that I am ... stored in my marshal data. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: How do you marshal a kernel object handle?
    ... a kernel object handle, say a file handle or a mutex handle. ... DuplicateHandle to the target process. ... I am marshalling a file handle. ... that at the time I am accessing the source process, ...
    (microsoft.public.win32.programmer.ole)
  • Re: Process ID lifetime and how to marshal a kernel object handle
    ... to duplicate the handle at all. ... What is the 1st process just opens the ... Here is solution I just thought of: I could open a GUID-named mutex in ... got must be the one of the source process. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: How do you marshal a kernel object handle?
    ... a kernel object handle, say a file handle or a mutex handle. ... DuplicateHandle to the target process. ... that at the time I am accessing the source process, ... during the marshalling operation. ...
    (microsoft.public.win32.programmer.ole)