Sample StorPort Virtual Miniport (WDKStorPortVirtualMiniport)

The sample is a StorPort virtual miniport that presents the appearance of 1 or more Fibre Channel Host Bus Adapters (HBA). Under an HBA, the sample creates LUNs/disks, which can be formatted and used by a file system such as NTFS.

4.5 Star
Add to favorites
E-mail Twitter Digg Facebook
Sign in to ask a question

  • Disk device to LUN Mapping?
    1 Posts | Last post October 23, 2017
    • Hello All,
      I've modified this sample code to create/delete luns on demand through a user mode application. A unique GUID is passed down in the create IOCTL, which gets reported back in as SCSI page 0x83 identifier. After creating the lun, I would like to go ahead and partition/format the disk, for which I need to know which \\.\PhysicalDriveN: was created by the disk driver. One way to achieve this is to iterate through all the disk devices, query the SCSI page 0x83, and compare it with the GUID I sent down while creating the device. The other method would be to listen to PNP notification and then query page 0x83 on the newly arrived device to confirm that it is indeed the lun that was created.
      Is there a more direct method to find out the relationship between the disk and the lun which I should probably explore?
      I'm running the sample code on Windows 2016 with VS 2015.
  • Increasing disk size does not work
    1 Posts | Last post November 21, 2014
    • The driver works with two 16 MB drives (default parameters), but does not work with two 32 MB drives. Disk Manager fails to initialize them as MBR with this message:
      Virtual Disk Manager
      Incorrect function. 
      What a lemon.
  • Built against WDK 8.0?
    4 Posts | Last post January 23, 2014
    • I've been trying to build this against WDK 8 with Visual Studio 2012 and the WDK co-installer installed.  Despite the conversion reporting success, the build fails in numerous places.  Initially it was due to the need to cast several pointers to their assigned types, then due to missing #include statements.  Now it has issues with the MOF files and inx file.  
      Is there some trick to get this to compile with WDK 8?  
    • Maybe you can do it in the following ways.
      1.Edit the sources file, replace drivertype=wdm with KMDF_VERSION_MAJOR=1 and TARGET_DESTINATION=wdf
      2.Create a project by Convert sources/dirs in VS
      3.Do not include wdm.h, include ntddk.h,ntdddisk.h,ntdef.h,wdf.h in order.
      4.There're lots of errors in wmi.c, so I simply delete that file and removed anything related to wmi.
      This isn't the best solution, but I can get a sys file anyway.
    • Thanks.  I forgot to update this.  With a fair bit of work I actually got it compiling.  I had to pretty much create a completely new project inside VS2012 then add the components.  As you mentioned, I had to force KMDF_VERSION_MAJOR in the project settings as well as hack up the MOF file to get it to build the interfaces correctly and tweak the xml file to pull it all together.  
      I had tried the import but that only littered the xml project file with a bunch of junk settings related to wmi inclusion.  It was far easier to start fresh and use google to figure out what I had to hand-edit into the project xml to get everything building.  As you mentioned, getting the c/h files building correctly was fairly easy but getting the wmi stuff to be pulled in correctly took a few days.  
      Thanks again for the thoughts.
    • To compile this project under VS2013 and WDK8.1:
      1. download and extract (DO NOT CONVERT YET)
      2. edit sources
         Del DRIVERTYPE=wdm
         Edit NTTARGETFILE0=$(OBJ_PATH)\$(0)\hbaapi.mof replace hbaapi.mof with mpwmi.h
      3. edit
         remove lines 9-15 (not required since hbaapi.mof is included by mp.mof)
      4. copy hbaapi.mof from \windows\system32\wbem\hbaapi.mof to same dir as sources
      5. open vs2013, file->open->convert sources
      6. compile
  • Windwos x86 or x64
    3 Posts | Last post April 12, 2012
    • I have build this sample with WDK 7600.16385.1
      driver (x86 checked build) can load to Windows 2008 x86 but no storage disk present,
      the x64 checked build driver can load to Windows 2008 x64 but make system failed to boot.
    • Thank you for reporting this.  We’ll investigate it and if it’s a bug, we’ll get it fixed.  Sorry for the inconvenience, but we hope that you otherwise are enjoying the samples and finding them helpful.  In the meantime, if you need help solving a specific problem as you integrate the sample into your product, please consider using one of our normal support offerings and we will be happy to assist you with your specific issue.
    • The following assumes that the test system is Win7/Win2008 R2.  Can you make sure you are testing this on either Win7 or Server 2008 R2?  If this still fails let, post your results.  Thank you.