diff --git a/IWbemClassObject/main.cpp b/IWbemClassObject/main.cpp index a54d379..168d1b6 100644 --- a/IWbemClassObject/main.cpp +++ b/IWbemClassObject/main.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #pragma comment(lib, "wbemuuid.lib") @@ -8,6 +9,40 @@ using namespace std; int main(int argc, char** argv) { +// Najde ldisky + const char* drive_names[] = {"A:\\", "B:\\", "C:\\", "D:\\", "E:\\", "F:\\", "G:\\", "H:\\", "I:\\", "J:\\", "K:\\", "L:\\", "M:\\", "N:\\", "O:\\", "P:\\", "Q:\\", "R:\\", "S:\\", "T:\\", "U:\\", "V:\\", "W:\\", "X:\\", "Y:\\", "Z:\\"}; + + std::vector< const char* > ldisks; + + DWORD drives = GetLogicalDrives(); + cout << "Connected logical drives: "; + for (int i = 0; i < 26; i++) + { + if (drives & (1 << i)) + { + ldisks.push_back(drive_names[i]); + cout << drive_names[i] << " "; + } + } + cout << endl; + +// Serial ID ldisku + DWORD disk_serialINT; + + auto ldisks_count = size(ldisks); + ldisks_count = ldisks_count-1 + + + if (!GetVolumeInformationA("C:\\", NULL, NULL, &disk_serialINT, NULL, + NULL, NULL, NULL)) + { + std::cout << "Failed: " << GetLastError() << std::endl; + return 1; + } + + std::cout << "Current directory volume serial numnber: " << std::hex << disk_serialINT << std::endl; + +// IWbem HWIDs cout << GetVideoCardDriverVersion() << endl; return 0; diff --git a/IWbemClassObject/query.cpp b/IWbemClassObject/query.cpp index c41acf6..5f6eeb7 100644 --- a/IWbemClassObject/query.cpp +++ b/IWbemClassObject/query.cpp @@ -41,7 +41,7 @@ std::string GetVideoCardDriverVersion() { } if (!FAILED(hr) && uReturned) { - hr = pObj->Get(L"DriverVersion", 0, &var, NULL, NULL); + hr = pObj->Get(L"PNPDeviceID", 0, &var, NULL, NULL); if (SUCCEEDED(hr)) { char str[MAX_PATH]; WideCharToMultiByte(CP_ACP, 0, var.bstrVal, -1, str, sizeof(str), NULL, NULL);