Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV
Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


Sharing File Handle between two different proceses

windows_driverwindows_driver Member Posts: 22

Suppose there are two processes p1 and p2 , p1 opens a handle to a file and shares this handle to p2 through shared memory, will the p2 able to use it?

Comments

  • Don_BurnDon_Burn Member - All Emails Posts: 1,710

    No, the second process cannot use the handle. Handles are process specific.

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 8,052

    and shares this handle to p2 through shared memory,

    Of course, Mr. Burn is correct... for the most commonly understood general meaning of your phrase.

    I just wanted to point out that if by "shares this handle to P2" you mean "take the value of the handle as returned to P1 from the file open operation"... then see Mr. Burn's answer.

    If you mean anything else, like if hiding in your question about a specific implementation technique there lives a question such as "Can P1 having opened a handle to a file, share that handle to another process so that the target process, P2, does not have to open the file"... the answer is "Yes, absolutely." In this case, see the docs for DuplicateHandle. You could, of course, have P1 create P2 and cause P2 to inherit P1's handles. For this see the docs for Inheritance.

    Peter

    Peter Viscarola
    OSR
    @OSRDrivers

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Writing WDF Drivers 7 Dec 2020 LIVE ONLINE
Internals & Software Drivers 25 Jan 2021 LIVE ONLINE
Developing Minifilters Early 2021 LIVE ONLINE