Click here to Skip to main content
15,921,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
What method can judge system is diskless system
Please give me some Suggestions
Posted

1 solution

I believe that this task would be OS specific and so would defer from OS to OS.

In Windows, you can use one of the following methods -

Use QueryDosDevice to list all the device names in the system.
The device names listed would be something like \Device\HarddiskVolume1, \Device\Floppy0 etc.
From this list you can check that if there is no Harddiskxxx, it means there is no hard disk in the system.

Use CreateFile to open physical drives like \\.\PhysicalDrive0, \\.\PhysicalDrive1 etc.
Check the return value to ensure that none of the disks exists.
 
Share this answer
 
Comments
SajeeshCheviry 7-Jan-13 3:29am    
good answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900