60 lines
2.7 KiB
C++
60 lines
2.7 KiB
C++
#include <iostream>
|
|
#include <Windows.h>
|
|
#include <Wbemidl.h>
|
|
#pragma comment(lib, "wbemuuid.lib")
|
|
#include "query.cpp"
|
|
|
|
using namespace std;
|
|
|
|
int main(int argc, char** argv) {
|
|
|
|
// Najde ldisky a zobrazi jejich SW serial no.
|
|
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:\\"};
|
|
|
|
DWORD drives = GetLogicalDrives();
|
|
DWORD disk_serialINT;
|
|
cout << "Connected logical drives: " << endl;
|
|
for (int i = 0; i < 26; i++)
|
|
{
|
|
if (drives & (1 << i))
|
|
{
|
|
if (GetVolumeInformationA(drive_names[i], NULL, NULL, &disk_serialINT, NULL,
|
|
NULL, NULL, NULL))
|
|
{
|
|
cout << drive_names[i] << " VolumeID: " << hex << disk_serialINT << endl;
|
|
}
|
|
else
|
|
{
|
|
cout << drive_names[i] << " VolumeID: " << "Empty" << endl;
|
|
}
|
|
}
|
|
}
|
|
cout << endl;
|
|
|
|
// Najde hardware serial no a vyrobce vsech komponentu
|
|
cout << "--Win32_Processor--" << endl << "ProcessorID: " << GetHWIDs("Win32_Processor", L"ProcessorID") << endl;
|
|
cout << "UniqueID: " << GetHWIDs("Win32_Processor", L"UniqueID") << endl;
|
|
cout << "Manufacturer: " << GetHWIDs("Win32_Processor", L"Manufacturer") << endl << endl;
|
|
|
|
cout << "--Win32_OnBoardDevice--" << endl << "SerialNumber: " << GetHWIDs("Win32_OnBoardDevice", L"SerialNumber") << endl;
|
|
cout << "Manufacturer: " << GetHWIDs("Win32_OnBoardDevice", L"Manufacturer") << endl << endl;
|
|
|
|
cout << "--Win32_BaseBoard--" << endl << "SerialNumber: " << GetHWIDs("Win32_BaseBoard", L"SerialNumber") << endl;
|
|
cout << "Manufacturer: " << GetHWIDs("Win32_BaseBoard", L"Manufacturer") << endl << endl;
|
|
|
|
cout << "--Win32_BIOS--" << endl << "SerialNumber: " << GetHWIDs("Win32_BIOS", L"SerialNumber") << endl;
|
|
cout << "Manufacturer: " << GetHWIDs("Win32_BIOS", L"Manufacturer") << endl << endl;
|
|
|
|
cout << "--Win32_NetworkAdapter--" << endl << "MACAddress: " << GetHWIDs("Win32_NetworkAdapter", L"MACAddress") << endl;
|
|
cout << "Manufacturer: " << GetHWIDs("Win32_NetworkAdapter", L"Manufacturer") << endl << endl;
|
|
|
|
cout << "--Win32_DiskDrive--" << endl << "SerialNumber: " << GetHWIDs("Win32_DiskDrive", L"SerialNumber") << endl;
|
|
cout << "Manufacturer: " << GetHWIDs("Win32_DiskDrive", L"Manufacturer") << endl << endl;
|
|
|
|
cout << "--Win32_VideoController--" << endl << "PNPDeviceID: " << GetHWIDs("Win32_VideoController", L"PNPDeviceID") << endl;
|
|
cout << "Manufacturer: " << GetHWIDs("Win32_VideoController", L"Manufacturer") << endl << endl;
|
|
|
|
cin.ignore();
|
|
|
|
return 0;
|
|
} |