-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathnotes2
31 lines (29 loc) · 879 Bytes
/
notes2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#define _WIN32_WINNT 0x0501
#include <windows.h>
#include <stdio.h>
int main() {
char DeviceName[256]="";
char VolumeName[256]="";
char FileSystemName[256]="";
HANDLE handle;
BOOL flag = TRUE;
BOOL gotInfo = FALSE;
long SerialNumber;
handle = FindFirstVolumeA((LPCSTR)DeviceName, 256);
if (handle != INVALID_HANDLE_VALUE) {
flag = TRUE;
do {
gotInfo = GetVolumeInformationA((LPCSTR)DeviceName, VolumeName, 256, &SerialNumber, NULL, NULL, FileSystemName, 256 );
printf("DeviceName: %s\n", DeviceName);
if (gotInfo) {
printf(" VolumeName: %s\t SerialNumber: %X\n", VolumeName, SerialNumber);
} else {
puts(" No Info Returned...\n");
}
flag = FindNextVolumeA(handle, (LPCSTR)DeviceName, 256);
} while (flag == TRUE);
FindVolumeClose(handle);
}
system("pause");
return 0;
}