// Get volume name
// Returns the label of a drive
// By DreamVB 12:49 17/09/2016

#include <iostream>
#include <Windows.h>

using namespace std;
using std::cout;
using std::endl;

string GetDriveName(char *Drive){
	char volname[196];
	//Return drive volume name
	if (GetVolumeInformationA(Drive, volname, 196, 0, 0, NULL, NULL, 0) != 0){
		return volname;
	}
	return "";
}

int main(int argc, char *argv[]){

	//Return the label names of my drives
	cout << "Drive C   " << GetDriveName("C:\\").c_str() << endl;
	cout << "Drive D   " << GetDriveName("D:\\").c_str() << endl;
	cout << "Drive G   " << GetDriveName("G:\\").c_str() << endl;
	cout << "Drive Z   " << GetDriveName("Z:\\").c_str() << endl;

	system("pause");
	return 0;
}