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/


sybolic link name problem

OSR_Community_UserOSR_Community_User Member Posts: 110,217
Hello ,
I'm developing a Windows 2000 pnp function driver . In the AddDevice routine
I use IoRegisterDeviceInterface() API which returns the symbolic link name
for my driver. Thus I get the symbolic name in the driver. But the problem
is that how to inform this name to my application .
I want to get the handle of the driver from my application to call IOCTL
functions. I use CreateFile() call which needs Symbolic name for the driver.
How should I get the symbolic name ?
Initially I hardcoded the symbolic name. However as I change the PCI slot of
the card for which I'm writing the driver, the symbolic name changes. So
there should be some appropriate way to get the symbolic name.
Your suggestions will be helpful,
Thanks in advance,
Aparna

Comments

  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    Use SetupDiGetDeviceInterfaceDetail() to get the symbolic name of ur device,
    from the guid.
    Look at the other arguments to this function in DDK.
    HTH,
    Sajeev.



    > -----Original Message-----
    > From: Aparna Argade [SMTP:[email protected]]
    > Sent: Wednesday, March 15, 2000 4:21 PM
    > To: NT Developers Interest List
    > Subject: [ntdev] sybolic link name problem
    >
    > Hello ,
    > I'm developing a Windows 2000 pnp function driver . In the AddDevice
    > routine
    > I use IoRegisterDeviceInterface() API which returns the symbolic link name
    > for my driver. Thus I get the symbolic name in the driver. But the
    > problem
    > is that how to inform this name to my application .
    > I want to get the handle of the driver from my application to call IOCTL
    > functions. I use CreateFile() call which needs Symbolic name for the
    > driver.
    > How should I get the symbolic name ?
    > Initially I hardcoded the symbolic name. However as I change the PCI slot
    > of
    > the card for which I'm writing the driver, the symbolic name changes. So
    > there should be some appropriate way to get the symbolic name.
    > Your suggestions will be helpful,
    > Thanks in advance,
    > Aparna
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    > ---
    > You are currently subscribed to ntdev as: [email protected]
    > To unsubscribe send a blank email to $subst('Email.Unsub')
  • Aparna,

    As the saying goes: RTFM


    "Device Interfaces

    Device drivers provide a uniform and extensible way for applications and the
    system to interact with them programmatically, known as a device interface.
    Drivers expose, register, and enable device interfaces. A driver can expose
    zero, one, or more than one interface for a particular device. A device
    interface is represented by a GUID.

    Each device interface is a member of a device interface class. A device
    interface class is a group of device interfaces with the same functionality.
    For example, all the joysticks on a system could be members of the joystick
    device interface class. A device interface class is identified by a class
    GUID.

    When an application must communicate with a device, it searches for a device
    that exports the required interface. To perform the search, use the
    following steps.

    Call the SetupDiGetClassDevs or SetupDiGetClassDevsEx function to obtain a
    list of all devices in a specified device class. This list is known as a
    device information set.
    Call the SetupDiEnumDeviceInterfaces function to enumerate all devices of
    the specified class that export the interface.
    To communicate with the device, call the SetupDiGetDeviceInterfaceDetail
    function. This function returns device information in an
    SP_DEVICE_INTERFACE_DETAIL_DATA structure. The DevicePath member provides
    the symbolic link name, which can be used in the CreateFile function to
    access the device.

    Built on Wednesday, November 10, 1999"

    The Platform SDK.

    It would of course be much easier to name your own symbolic link and open
    that name in your application. But I suppose that somehow this would be
    WRONG. If you aren't at the top of a stack it would in fact be mildly
    inappropriate.


    =
    Mark Roddy

    Windows 2000/Windows NT Consulting:

    [email protected]
    www.hollistech.com

    =


    > -----Original Message-----
    > From: [email protected]
    > [mailto:[email protected]]On Behalf Of Aparna Argade
    > Sent: Wednesday, March 15, 2000 5:51 AM
    > To: NT Developers Interest List
    > Subject: [ntdev] sybolic link name problem
    >
    >
    > Hello ,
    > I'm developing a Windows 2000 pnp function driver . In the
    > AddDevice routine
    > I use IoRegisterDeviceInterface() API which returns the symbolic link name
    > for my driver. Thus I get the symbolic name in the driver. But
    > the problem
    > is that how to inform this name to my application .
    > I want to get the handle of the driver from my application to call IOCTL
    > functions. I use CreateFile() call which needs Symbolic name for
    > the driver.
    > How should I get the symbolic name ?
    > Initially I hardcoded the symbolic name. However as I change the
    > PCI slot of
    > the card for which I'm writing the driver, the symbolic name changes. So
    > there should be some appropriate way to get the symbolic name.
    > Your suggestions will be helpful,
    > Thanks in advance,
    > Aparna
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    > ---
    > You are currently subscribed to ntdev as: [email protected]
    > To unsubscribe send a blank email to $subst('Email.Unsub')
    >
    >
  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    > functions. I use CreateFile() call which needs Symbolic name for the
    driver.
    > How should I get the symbolic name ?

    AFAIK PnP sends a Windows message when the device interface arrives or
    removes.

    Max
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

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!
Kernel Debugging 30 January 2023 Live, Online
Developing Minifilters 20 March 2023 Live, Online
Internals & Software Drivers 17 April 2023 Live, Online
Writing WDF Drivers 22 May 2023 Live, Online