symbolic link and IoGetDeviceObjectPointer

Discussion in 'Windows Vista Drivers' started by crimson13, Jul 2, 2003.

  1. crimson13

    crimson13 Guest

    Hello all,

    I have a problem with drivers calling each other. There are 3 drivers. Two
    of those drivers need to ask driver nr 1 some things.
    Nr 1 does the following in his AddDevice method:
    RtlInitUnicodeString(&devname, L"\\Device\\NAME");
    RtlInitUnicodeString(&win32DeviceName, L"\\DosDevices\\NAME");
    IoCreateSymbolicLink( &win32DeviceName, &devname);

    Nr 2 and 3 then try:
    RtlInitUnicodeString(&devName, L"\\Device\\NAME");
    status=IoGetDeviceObjectPointer(&devName, FILE_ALL_ACCESS, &fileObj,

    The problem is that nr 2 does this first (but definitely after the addentry
    method of nr 1), but always gets c0000e as error code (device not found). Nr
    3 first has to load some files and asks stuff to nr 1 later (and he IS
    In other words: there seems to be a delay between the IoCreateSymbolicLink
    and the time when the driver can actually attempt to get a handle to it.
    (Note: I'm a newbie, so forgive me if I say stupid things :)
    Is this true? Can I alter the loading order, so nr 2 is called after nr 3 (I
    don't think so, both are PnP drivers and I think I read you can't specify a
    load order)?

    thx in advance for all help,
    crimson13, Jul 2, 2003
    1. Advertisements

  2. if you use device interfaces instead of symbolic link names, the load order
    does not matter. you can register for device interface arrivals through

    Doron Holan [MS], Jul 2, 2003
    1. Advertisements

  3. crimson13

    crimson13 Guest


    Thx for your answer, but could you provide some more info?

    The current order of things is:
    - driver 2's DriverEntry is called
    - driver 3's DriverEntry is called
    - driver 1's DriverEntry is called
    - driver 1's AddDevice is called (in which the symbolic links are created)
    and exits
    - driver 2's HwInitialise is called (which needs to access that link to send
    IRP's, but fails)
    - driver 3's HwInitialise is called (which also needs to access that link to
    send IRP's and succeeds)

    First of all, i don't understand this:
    - driver 1 is specified in the registry as start 1 (SERVICE_SYSTEM_START),
    while the others are start 3 (SERVICE_DEMAND_START), yet driver 2 and 3's
    DriverEntry are called first
    - driver 1's AddDevice exits before HwInitialise of driver 2 is called, why
    can't it get a handle to the first driver then?

    If I would alter it to use IoRegisterPlugPlayNotification, when would I
    recieve this notification, after the AddDevice of driver 1? How would that
    help, as it is currently already the case that driver 1's AddDevice is
    finished before the call to HwInitialise of driver 2? Or do you suggest that
    I send those IRP's in a different way then using
    IoBuildDeviceIoControlRequest en CallDriver (if that is possible)?
    I've also tried altering the Start and Tag entries in the registry, but that
    didn't help.

    thx in advance,
    crimson13, Jul 3, 2003
  4. you didn't mention the order in which you recieve the start device for
    driver 1 w/respect to your code flow. the i/o subsystem blocks all creates
    until the stack has received a start irp. if you use device interfaces, you
    specify a function callback, this function is called when the interface
    becomes available. once you have the interface string, you can use the same
    apis to open the device as if you had a \device\xxxx name.

    Doron Holan [MS], Jul 3, 2003
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.