Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C++
What method can judge system is diskless system
Please give me some Suggestions
Posted 6-Jan-13 21:01pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.
SajeeshCheviry at 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)

  Print Answers RSS
0 OriginalGriff 448
1 Sergey Alexandrovich Kryukov 290
2 PhilLenoir 95
3 Uma Shankar Patel 80
4 CB Sharma 79
0 Sergey Alexandrovich Kryukov 6,532
1 OriginalGriff 5,976
2 CPallini 2,473
3 Richard MacCutchan 1,687
4 Abhinav S 1,550

Advertise | Privacy | Mobile
Web01 | 2.8.140821.2 | Last Updated 7 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100