user1488334
user1488334

Reputation: 25

how do i retrieve hard disk information which is connected to server?Example C /C code?

I am very new to Windows programming. so can you help me to get sample program(C/C++) which i can get all the hard disk information which is connected to my server.

I am using windows 2008 R2 sp1 server and also connected more than one hard disk to server.

Please help me to get this information.

Thanks, Deepesh C.P

Upvotes: 0

Views: 3880

Answers (3)

Bharath Ravindra
Bharath Ravindra

Reputation: 81

Following API's must be useful

DisplayVolumePaths GetDiskFreeSpace CreateFile

Refer these links aswell

http://social.msdn.microsoft.com/Forums/en-CA/vcgeneral/thread/1d4fda3c-885f-46e2-bc32-80c4426510dc

Upvotes: 1

lebox
lebox

Reputation: 56

As a start I would read up on the Windows API.

To get all logical drives on a windows system use

DWORD WINAPI GetLogicalDrives(void);

or

DWORD WINAPI GetLogicalDriveStrings(
  __in   DWORD nBufferLength,
  __out  LPTSTR lpBuffer
);

As see on http://msdn.microsoft.com/en-us/library/windows/desktop/aa364972(v=vs.85).aspx

Upvotes: 0

Sach
Sach

Reputation: 659

You can use WMI query to extract disk information.

SELECT Name,VolumeName from Win32_LogicalDisk WHERE DriveType='3'

Search fro WMI API using with you can execute above command from C/C++ code. here is more details and sample code.

Upvotes: 1

Related Questions