Click here to Skip to main content
15,891,184 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionGdplus::Color to DWORD Pin
csrss12-Mar-11 8:56
csrss12-Mar-11 8:56 
AnswerRe: Gdplus::Color to DWORD Pin
bob1697212-Mar-11 9:37
bob1697212-Mar-11 9:37 
AnswerRe: Gdplus::Color to DWORD Pin
Luc Pattyn12-Mar-11 10:05
sitebuilderLuc Pattyn12-Mar-11 10:05 
GeneralRe: Gdplus::Color to DWORD Pin
bob1697212-Mar-11 11:06
bob1697212-Mar-11 11:06 
GeneralRe: Gdplus::Color to DWORD Pin
csrss12-Mar-11 19:46
csrss12-Mar-11 19:46 
QuestionDebug Error While Running Program on Other Computer Pin
AmbiguousName12-Mar-11 7:20
AmbiguousName12-Mar-11 7:20 
AnswerRe: Debug Error While Running Program on Other Computer Pin
Code-o-mat12-Mar-11 8:53
Code-o-mat12-Mar-11 8:53 
QuestionUSB devices list [modified] Pin
fasked12-Mar-11 3:12
fasked12-Mar-11 3:12 
How can I get the list of USB mass storage devices of kind "C:\, D:\" and etc, using C and WINAPI? I tried to do it with SetupDi* functions and got the friendly name and full path to device, but it isn't that needed.

#include <stdio.h>
#include <tchar.h>

#include <windows.h>
#include <setupapi.h>
#include <winioctl.h>

#pragma comment(lib, "setupapi")

int _tmain()
{
    DWORD i = 0;
    DWORD required_size = 0;

    PSP_INTERFACE_DEVICE_DETAIL_DATA interface_details;
    SP_INTERFACE_DEVICE_DATA interface_info;
    HDEVINFO dev_info;

    dev_info = SetupDiGetClassDevs (&GUID_DEVINTERFACE_DISK, NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
    if (dev_info == INVALID_HANDLE_VALUE) 
    {
        // ERROR
        return EXIT_FAILURE;
    }

    ZeroMemory (&interface_info, sizeof (interface_info));
    interface_info.cbSize = sizeof (interface_info);

    for (i = 0; SetupDiEnumDeviceInterfaces (dev_info, NULL, &GUID_DEVINTERFACE_DISK, i, &interface_info); ++i)
    {
        SetupDiGetInterfaceDeviceDetail (dev_info, &interface_info, NULL, 0, &required_size, NULL);
        interface_details = (PSP_INTERFACE_DEVICE_DETAIL_DATA) LocalAlloc (0, required_size);
        interface_details->cbSize = sizeof (*interface_details);

        SetupDiGetInterfaceDeviceDetail (dev_info, &interface_info, interface_details, required_size, NULL, NULL);

        // 
        // interface_details->DevicePath include full path to device
        //
        
        LocalFree (interface_details);
        interface_details = NULL;
    }

    SetupDiDestroyDeviceInfoList (dev_info);
    return EXIT_SUCCESS;
}


Can you help me with this question?

Best Regards,
Alexander S.
modified on Saturday, March 12, 2011 11:20 AM

AnswerRe: USB devices list Pin
Hans Dietrich12-Mar-11 4:53
mentorHans Dietrich12-Mar-11 4:53 
GeneralRe: USB devices list Pin
fasked12-Mar-11 5:23
fasked12-Mar-11 5:23 
AnswerRe: USB devices list Pin
Luc Pattyn12-Mar-11 6:05
sitebuilderLuc Pattyn12-Mar-11 6:05 
QuestionHow to create a process with a different, really restricted user account? Pin
Member 774798412-Mar-11 1:56
Member 774798412-Mar-11 1:56 
AnswerRe: How to create a process with a different, really restricted user account? Pin
Hans Dietrich12-Mar-11 4:57
mentorHans Dietrich12-Mar-11 4:57 
QuestionMove items in ListControl Pin
rjkg11-Mar-11 19:59
rjkg11-Mar-11 19:59 
AnswerRe: Move items in ListControl Pin
Richard MacCutchan11-Mar-11 22:16
mveRichard MacCutchan11-Mar-11 22:16 
GeneralRe: Move items in ListControl Pin
rjkg11-Mar-11 22:44
rjkg11-Mar-11 22:44 
GeneralRe: Move items in ListControl Pin
Richard MacCutchan11-Mar-11 23:15
mveRichard MacCutchan11-Mar-11 23:15 
AnswerRe: Move items in ListControl Pin
Hans Dietrich12-Mar-11 5:23
mentorHans Dietrich12-Mar-11 5:23 
QuestionCannot change the bitmap Pin
leorex11-Mar-11 15:10
leorex11-Mar-11 15:10 
AnswerRe: Cannot change the bitmap Pin
bob1697211-Mar-11 16:36
bob1697211-Mar-11 16:36 
QuestionWM_LBUTTONDBLCLK not being sent? Pin
softwaremonkey11-Mar-11 12:02
softwaremonkey11-Mar-11 12:02 
AnswerRe: WM_LBUTTONDBLCLK not being sent? Pin
Hans Dietrich11-Mar-11 13:19
mentorHans Dietrich11-Mar-11 13:19 
AnswerRe: WM_LBUTTONDBLCLK not being sent? Pin
Joan M12-Mar-11 4:59
professionalJoan M12-Mar-11 4:59 
GeneralRe: WM_LBUTTONDBLCLK not being sent - Solved! Pin
softwaremonkey12-Mar-11 5:48
softwaremonkey12-Mar-11 5:48 
GeneralRe: WM_LBUTTONDBLCLK not being sent - Solved! Pin
Joan M13-Mar-11 22:22
professionalJoan M13-Mar-11 22:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.