Ask Experts Questions for FREE Help !
Ask
    idelsoni3647's Avatar
    idelsoni3647 Posts: 1, Reputation: 1
    New Member
     
    #1

    Sep 4, 2009, 08:11 AM
    How to use WMI to get info provided in STORAGE_DEVICE_DESCRIPTOR structure
    I have C++ code that I am converting to C#. The C++ code uses the following code
    status = DeviceIoControl(hDevice, IOCTL_STORAGE_QUERY_PROPERTY,
    &query, sizeof(STORAGE_PROPERTY_QUERY),
    &buf, 512, &length, NULL);
    if ( status )
    {
    PSTORAGE_DEVICE_DESCRIPTOR device = (PSTORAGE_DEVICE_DESCRIPTOR)buf;
    media.Bus = BusType[device->BusType];
    media.DeviceType = device->DeviceType;
    media.Removable = (bool)device->RemovableMedia;
    if (device->VendorIdOffset)
    media.Vendor = &buf[device->VendorIdOffset];
    else
    media.Vendor = BusType[0]; //unknown
    if (device->ProductIdOffset)
    media.Product = &buf[device->ProductIdOffset];
    else
    media.Product = BusType[0]; //unknown
    if (device->ProductRevisionOffset)
    media.Revision = &buf[device->ProductRevisionOffset];
    else
    media.Revision = BusType[0]; //unknown
    if (device->SerialNumberOffset)
    media.SerialNum = &buf[device->SerialNumberOffset];
    else
    media.SerialNum = BusType[0]; //unknown

    After much thought I have decided that it would be better to use WMI in the new code instead of trying to "PInvoke" the Win32 API calls. I can not find any equivalent in the WMI world to get values like VendorID offset, BusType, SerialNumber offse.

    Can anyone offer any help?

Check out some similar questions!

Looking for two songs - lyrics provided [ 2 Answers ]

I am looking for song names or artist names. 1st song ------------------------- Ooh every time you try I want to say goodbye Ooh even if you cry Then I just tell you why, why We're done, bar none (then rap)

Recorded services provided [ 1 Answers ]

Recorded services provided on account for the period October 1-12, $5,750

Stove never provided after promise [ 2 Answers ]

Rented 4/2/08 Gas stove had been removed. Landlord promise installation of electric stove. Numerous delays. Now he says he will install gas stove after I pay for meter reinstalled. First, can he continue to delay me about the stove and second, Am I responsibly to pay for meter?

What Band is This? Descriptions Provided [ 16 Answers ]

Hi, Everyone, I hope you are doing well. My friend is trying to figure out a specific American band in a music video he saw, and the following are the descriptions he provided: -5 members in the band -Members are White/Caucasian -Members are wearing black band clothing -They are performing...

Bank has not provided title [ 2 Answers ]

I purchased a vehicle from a private individual and financed it with my credit union. The title was held by the owner's bank and joint payment was made to the individual and the bank. It has now been 4 months and the individual's bank has not produced a title. I have been without a car before I...


View more questions Search
 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.