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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. what changes can i make???

what changes can i make???

Scheduled Pinned Locked Moved C / C++ / MFC
helpsharepointquestion
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.
  • S Offline
    S Offline
    Subrat Patnaik
    wrote on last edited by
    #1

    hi all, i am placing here a piece of code which was a function used to retrieve the drive letter of a USB from the corresponding device ID. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// BOOL GetSpecificDrive(LPTSTR lpDevID, TCHAR* DrvName) { DebugLog("entered GetSpecificDrive"); HDEVINFO hVolInfo; GUID guid; BYTE buffer[BUFFER_SIZE]; DWORD dwRequiredSize ; TCHAR buf[BUFFER_SIZE],buf1[BUFFER_SIZE]; DEVINST devInstParent; DWORD dwIndex; TCHAR volume[BUFFER_SIZE]; int nLength; DWORD size; ULONG Status,Problem; SP_DEVINFO_LIST_DETAIL_DATA devInfoListDetail; SP_DEVICE_INTERFACE_DATA devInterfaceData; SP_DEVINFO_DATA devInfoData,devInfo; PSP_DEVICE_INTERFACE_DETAIL_DATA pDevDetail; TCHAR TargetPath[BUFFER_SIZE]= {0}; if(!lpDevID) { DebugLog("!lpDevId"); return 0; } // GUID_DEVINTERFACE_VOLUME is interface Guid for Volume class devices. guid = GUID_DEVINTERFACE_VOLUME; // Get device Information handle for Volume interface hVolInfo = SetupDiGetClassDevs(&guid, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT); if(hVolInfo == INVALID_HANDLE_VALUE) { DebugLog("hVolInfo == INVALID_HANDLE_VALUE"); return 0; } // Loop until device interfaces are found. for(dwIndex = 0; ;dwIndex ++) { ZeroMemory(&devInterfaceData, sizeof(devInterfaceData)); devInterfaceData.cbSize = sizeof(devInterfaceData); // Get device Interface data. char errorCondition[100] = {0}; if(!SetupDiEnumDeviceInterfaces(hVolInfo, NULL, &guid,dwIndex,&devInterfaceData)) { sprintf(errorCondition,"error code returned : %d ",GetLastError()); DebugLog("!SetupDiEnumDeviceInterfaces"); DebugLog(errorCondition); break; } ZeroMemory(&devInfoData, sizeof(devInfoData)); devInfoData.cbSize = sizeof(devInfoData); pDevDetail = (PSP_DEVICE_INTERFACE_DETAIL_DATA)buffer; pDevDetail->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA); // Get device interface detail data to get // Device Instance from SP_DEVINF

    S 1 Reply Last reply
    0
    • S Subrat Patnaik

      hi all, i am placing here a piece of code which was a function used to retrieve the drive letter of a USB from the corresponding device ID. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// BOOL GetSpecificDrive(LPTSTR lpDevID, TCHAR* DrvName) { DebugLog("entered GetSpecificDrive"); HDEVINFO hVolInfo; GUID guid; BYTE buffer[BUFFER_SIZE]; DWORD dwRequiredSize ; TCHAR buf[BUFFER_SIZE],buf1[BUFFER_SIZE]; DEVINST devInstParent; DWORD dwIndex; TCHAR volume[BUFFER_SIZE]; int nLength; DWORD size; ULONG Status,Problem; SP_DEVINFO_LIST_DETAIL_DATA devInfoListDetail; SP_DEVICE_INTERFACE_DATA devInterfaceData; SP_DEVINFO_DATA devInfoData,devInfo; PSP_DEVICE_INTERFACE_DETAIL_DATA pDevDetail; TCHAR TargetPath[BUFFER_SIZE]= {0}; if(!lpDevID) { DebugLog("!lpDevId"); return 0; } // GUID_DEVINTERFACE_VOLUME is interface Guid for Volume class devices. guid = GUID_DEVINTERFACE_VOLUME; // Get device Information handle for Volume interface hVolInfo = SetupDiGetClassDevs(&guid, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT); if(hVolInfo == INVALID_HANDLE_VALUE) { DebugLog("hVolInfo == INVALID_HANDLE_VALUE"); return 0; } // Loop until device interfaces are found. for(dwIndex = 0; ;dwIndex ++) { ZeroMemory(&devInterfaceData, sizeof(devInterfaceData)); devInterfaceData.cbSize = sizeof(devInterfaceData); // Get device Interface data. char errorCondition[100] = {0}; if(!SetupDiEnumDeviceInterfaces(hVolInfo, NULL, &guid,dwIndex,&devInterfaceData)) { sprintf(errorCondition,"error code returned : %d ",GetLastError()); DebugLog("!SetupDiEnumDeviceInterfaces"); DebugLog(errorCondition); break; } ZeroMemory(&devInfoData, sizeof(devInfoData)); devInfoData.cbSize = sizeof(devInfoData); pDevDetail = (PSP_DEVICE_INTERFACE_DETAIL_DATA)buffer; pDevDetail->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA); // Get device interface detail data to get // Device Instance from SP_DEVINF

      S Offline
      S Offline
      SandipG
      wrote on last edited by
      #2

      - Please do not shout(i.e. do not use bold and bigger fonts.) - Please format your code using code block button at the bottom

      Regards, Sandip.

      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