Open
Description
After the exception is caught here, does the program loop call, as in the example, cause a handle or memory leak:
int main(int /argc/, char */args/[])
{
try {
Win32_ComputerSystem computer = retrieveWmi<Win32_ComputerSystem>();
Win32_ComputerSystemProduct product = retrieveWmi<Win32_ComputerSystemProduct>();
SoftwareLicensingService liscense = retrieveWmi();
Win32_OperatingSystem os_info = retrieveWmi<Win32_OperatingSystem>();
cout<<"Computername: "<<computer.Name<<" Domaind:"<<computer.Domain<<endl;
cout<<"Product: "<<product.Name<<" UUID:"<<product.UUID<<endl;
cout<<"Architecture: "<<os_info.OSArchitecture<<std::endl;
cout<<"Roles: "<<endl;
for(const string role : computer.Roles)
{
cout<<" - "<<role<<std::endl;
}
cout<<endl;
cout<<"Installed services:"<<endl;
for(const Win32_Service &service : retrieveAllWmi<Win32_Service>())
{
cout<<service.Caption<<endl;
}
} catch (const WmiException &ex) {
cerr<<"Wmi error: "<<ex.errorMessage<<", Code: "<<ex.hexErrorCode()<<endl;
return 1;
}
return 0;
}
Metadata
Metadata
Assignees
Labels
No labels