Win32_ComputerSystem

Win32_ComputerSystemクラスは、Windowsが実行されているコンピュータの情報を持つ。

Win32_ComputerSystem class - Win32 apps | Microsoft Docs

Win32_ComputerSystem.cppで、

NameとUserNameを取得する。

CoCreateInstance OK!
pLocator = 0x0047e280
pLocator->ConnectServer OK!
pServices = 0x00487a58
CoSetProxyBlanket OK!
pServices->ExecQuery OK!
pEnumerator = 0x0048bcc8
pEnumerator->Next OK!
pClassObject = 0x00493758
pClassObject->Get OK!
Name: DESKTOP-PUSH7HT
pClassObject->Get OK!
UserName: DESKTOP-PUSH7HT\bg1

こうなる。

Sample/wmi/Win32_ComputerSystem/Win32_ComputerSystem/src/Win32_ComputerSystem at master · bg1bgst333/Sample · GitHub