|
I am not 100% sure. Try reading about WM_DeviceChanged message. I hope this helps.
|
|
|
|
|
The difference is there because the card readers are usually composite devices (i.e. a device that contains other devices), while USB disks are usually (but not always) the final device.
You always eject at the final device level, which in the card reader's case, is the card. (You wouldn't want to get hit by the card reader square in the face, would you).
If you want to get rid of the whole cardreader, you'll have to disable it at the device level. Uninstall will only cause it to be re-detected at the next PNP scan).
|
|
|
|
|
How would I determine that? Just look up if there's more than one dependent drive on to the USB Mass Storage device? But I want to account for cases in which the card reader is only able to read one type of card, and I'm not sure how this is distinguishable in WMI.
|
|
|
|
|
That might prove difficult, or even impossible. This depends on the manufacturer and the driver. USUALLY the device chain will indicate separate disk drives for each card type in the card reader, but this is no guarantee. Some card readers have multi-format slots which accept more than one card format through some hardware interlocking mechanism. Whether these appear as a separate disk drive or not is entirely up to the driver. My hunch is that most drivers will show one card format per card type (except for the SD format, where even the card type cannot be determined by hardware: SD/mini-SC/micro-SD can be converted to one another with conversion sleeves).
At the end of the chain, the only thing you see is a device with USBClass Disk, and USBClass RAW. The type of disk will only be determined when a card is physically inserted into a slot.
|
|
|
|
|
I've noticed in Device Manager that the Mass Storage Devices for the multi-card readers I own have a "Bus reported device description" of "Mass Storage Device" -- a generic name -- but the one for the USB drive instead has the description of the device name.
Is this at all significant? And where does the "Bus reported device description" come from?
|
|
|
|
|
Educated guesswork, don't quote me on this :
Real hard disk devices have firmware, and it's the firmware that reports this. (it will usually correspond to the 'friendly device name', I think). Disk drive producers will often include free utilities (such as some backup crapware), which will only run on their kit. The software has to check if their kit is connected, and it will do that by checking this field. Often, firmware must also be updated, usually using specific IOCTLs, and the firmware update utilities must be sure they don't clobber some other manufacturer's. This field may help in checking the origin of the kit before they issue their 'zap and destroy' IOCTLs. Some USB disk assemblies also offer firmware RAID configurations, and this may help their raid configuration utilities in determining the command set to configure them.
A storage card has no firmware, and so cannot report anything here (there may be exceptions, but I haven't come across any). If there's anything firmware worth reporting, it will be at the composite device level. Anyway, a storage card can only report anything when it's inserted, so this probably wouldn't serve your purpose.
|
|
|
|
|
Actually it kind of would serve my purpose -- I just want to determine whether a logical disk is hosted by a card reader, or is hosted by a USB drive. If I could determine the 'bus reported' description for any given USB Mass Storage Device.. but I don't know how to do that.
Can you help?
|
|
|
|
|
I'll dig around a bit, don't expect anything today, bedtime coming soon in my timezone
|
|
|
|
|
Based on the devices that I have, I figured out that you can expect a USB Flash Drive to have PDCAP_D2_SUPPORTED under "Power data" in Device Manager, but not a memory card.
So I used a PInvoke to DevicePowerEnumDevices in PowrProf.dll ( http://msdn.microsoft.com/en-us/library/aa372681(VS.85).aspx[^] ). That allowed me to filter by the device name in Win32_DiskDrive.Model and the PDCAP_D2_SUPPORTED flag.
|
|
|
|
|
Sounds reasonable. This would probably correspond to a 'spin-down' on USB disks, which makes no sense on flash cards (they are only required to support D0 and D3, fully ON and fully OFF). Wonder what an SSD would have in this case?
|
|
|
|
|
Actually, this doesn't seem to be working.. I thought it was, but I must have been mistaken. The internal card readers don't support D2, but the external card readers do.
|
|
|
|
|
I figured out what I did wrong --- you have to do a check on the Logical Disk name, not the Disk Drive name. The Disk Drive for the card reader supports more power states, and the Portable Device (listed in Device Manager) supports even more, including D1.
|
|
|
|
|
Except that only seems to work for one flash drive I have and not another. I'll continue to investigate that.
|
|
|
|
|
It was my error; the problem was it didn't find a drive with that drive letter because it was referring to the Portable Device, and thats listed by the Volume name if there is one.
But I finally found something that works! If you enumerate the hardware ID strings for the devices that support D2, the only ones that show up are the ones for flash drives. The memory cards are enumerated I think, but a query for the hardware ID returns an empty string. So you have to find the PnPEntity associated with the DiskDrive, and take the first indexed HardwareID.
No problems with this so far..
|
|
|
|
|
Just so people reading this know... it turns out the original solution I found is working again. I don't know if it was a glitch in how my system was reporting the information or whether the second, more thorough method is just more fool-proof. I'm getting the power data through setupapi.dll rather than through powerprof.dll though, since I'm trying to move away from WMI.
|
|
|
|
|
Hi all ,
I want to pass the table name as parameter to the method to obtain the result.
The code is as follows:-
<br />
private static String GetText(int id , String tableName)<br />
{ <br />
tbTest myTest = new tbTest();
<br />
myTest = dataContext.tbTests.Single(table => table.Test_id == id);<br />
<br />
return myTest.Test_Text;<br />
<br />
}<br />
Is there anyway where-in I can pass the id and table name to obtain the corresponding text (probably by strings ??) ?
I hope it makes sense.
thanks,
|
|
|
|
|
What? Is this a database question? We need more information.
|
|
|
|
|
I want to create and execute a dynamic query in the method by passing in the table name and ID.
I hope it makes sense.?
|
|
|
|
|
It makes sense, but it isn't enough information.
|
|
|
|
|
Please let me know wat info do u require?
<br />
private static String GetText(int id , String tableName)<br />
{ <br />
<br />
tbTest myTest = new tbTest();
<br />
myTest = dataContext.tbTests.Single(table => table.Test_id == id); <br />
<br />
return myTest.Test_Text;<br />
<br />
}<br />
I want the code to return the appropriate Text depending on the parameters passed ie tableName and ID
|
|
|
|
|
What you've presented is gibberish to me.
I want to know what you are trying to accomplish, not how you are trying to accomplish it (especially if it doesn't work).
0) Is there a database?
1) Is there a table in the database?
2) Are you trying to retrieve some information from that database table?
3) What is the schema of the table?
|
|
|
|
|
If you mean that the parameter tableName will be the name of class whose object you need to create, you can make use of reflection.
|
|
|
|
|
Reflection? I havnt used that before...can u elaborate on it plz. Thanks
|
|
|
|
|
|
Hi,
I am trying to set the IPConnectionMetric parameter of a network adapter in Windows 7. The method that I need to use is the "SetIPConnectionMetric" in the Win32_NetworkAdapterConfiguration class.
The problem is that the method returns an error code of 91 - Access Denied in Windows 7. However, this method works fine on Windows XP.
Can someone give me pointers to a solution? I played around with the Local Security Policies, but couldn't find anything
Here is more information about the method: http://msdn.microsoft.com/en-us/library/aa393303%28v=VS.85%29.aspx[^]
Thanks,
Karthik
|
|
|
|