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. the full path name in device driver

the full path name in device driver

Scheduled Pinned Locked Moved C / C++ / MFC
question
2 Posts 2 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.
  • Y Offline
    Y Offline
    yanping wang
    wrote on last edited by
    #1

    IoCreateDevice's third parameter is DeviceName, while IoCreateSymbolicLink's first parameter is SymbolicLinkName. what is their full path name? I don't known the difference between "\\Device\\DrvFltIp","\\DosDevices\\DrvFltIp" or "\\??\\DrvFltIp"

    A 1 Reply Last reply
    0
    • Y yanping wang

      IoCreateDevice's third parameter is DeviceName, while IoCreateSymbolicLink's first parameter is SymbolicLinkName. what is their full path name? I don't known the difference between "\\Device\\DrvFltIp","\\DosDevices\\DrvFltIp" or "\\??\\DrvFltIp"

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

      Not quite a full answer, but here's code I use to work with a FILE_DEVICE_UNKNOWN device that just needs simple start/open/read/close ops. I use the following code to setup names for my device - "\\Device\\TestDriver4" is used to identify the device for the CreateService calls 'name of service' - (TestDriver4), while "\\DosDevices\\TDRV4" enables opening of the device with CreateFile as "\\.\TDRV4".

      // internal device name - season to taste
      #define TDRV4_INTERNAL_NAME L"\\Device\\TestDriver4"

      // symbolic link name - seems to be necessary to use 'DosDevices'
      // once in place (see call to IoCreateSymbolicLink in TDrv1_CreateDevice0)
      // the CreateFile() API will be able to open our device as
      // "\\\\.\\TDRV4" [ i.e. "\\.\TDRV4"]
      #define TDRV4_SYMBOLICLINK_NAME L"\\DosDevices\\TDRV4"

      In my drivers TDrv4_CreateDevice0 fn, the internal name is used in IoCreateDevice, and the symbolic name (aka file name) is used in the call to IoCreateSymbolicLink.

      RtlInitUnicodeString( &ustrInternalName, TDRV4\_INTERNAL\_NAME);   
      
      // create the device
      result = IoCreateDevice( pDriverObj,                // From DriverEntry.
      
                  sizeof(TDRV4\_DEVICE\_EXTENSION), // Make us a block of non-paged pool 
                                                  // large enough to store our extension data.
                                          
                  &ustrInternalName,      // Any device object that can be 
                                          // the target of an I/O request or 
                                          // that a higher-level driver can 
                                          // connect to must have a DeviceName. 
                                          // An unnamed device object is visible 
                                          // only to the driver that created it 
                                          // or to an FSD through a volume parameter block (VPB).
                                          // (ref \[NTDDK\])
      
                  FILE\_DEVICE\_UNKNOWN,       // (We'd use FILE\_DEVICE\_SERIAL for a serial filter, e.g.)
                  0,                         // DeviceCharacteristics ignored.
                  FALSE,                     // Exclusive - if TRUE, thread IO calls serialized.
                  &pDevObj);                 // On return, will hold pointer to the new device object.
      
      if(NT\_SUCCESS(result)) {
      
          // stop chain
          pDevObj->NextDevice = NULL;
          pDevObj->AttachedDevice = NULL;
      
          ////
      
      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