mirror of
https://github.com/overte-org/overte.git
synced 2025-07-16 01:36:46 +02:00
More CR feedback
Breaking into 2 functions - one public, one private, so I can avoid nested control structures and so on in dealing with errors on the windows side of things. So, no more namespace, back to a class with 2 static functions, one public one private
This commit is contained in:
parent
dc47c5fc0c
commit
562cd12bca
3 changed files with 22 additions and 8 deletions
|
@ -583,7 +583,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
Model::setAbstractViewStateInterface(this); // The model class will sometimes need to know view state details from us
|
Model::setAbstractViewStateInterface(this); // The model class will sometimes need to know view state details from us
|
||||||
|
|
||||||
// TODO: This is temporary, while developing
|
// TODO: This is temporary, while developing
|
||||||
fingerprint::getMachineFingerprint();
|
FingerprintUtils::getMachineFingerprint();
|
||||||
// End TODO
|
// End TODO
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
|
|
||||||
|
|
|
@ -24,11 +24,8 @@
|
||||||
#endif //Q_OS_MAC
|
#endif //Q_OS_MAC
|
||||||
|
|
||||||
static const QString FALLBACK_FINGERPRINT_KEY = "fallbackFingerprint";
|
static const QString FALLBACK_FINGERPRINT_KEY = "fallbackFingerprint";
|
||||||
|
QString FingerprintUtils::getMachineFingerprintString() {
|
||||||
QUuid fingerprint::getMachineFingerprint() {
|
|
||||||
|
|
||||||
QString uuidString;
|
QString uuidString;
|
||||||
|
|
||||||
#ifdef Q_OS_LINUX
|
#ifdef Q_OS_LINUX
|
||||||
// sadly need to be root to get smbios guid from linux, so
|
// sadly need to be root to get smbios guid from linux, so
|
||||||
// for now lets do nothing.
|
// for now lets do nothing.
|
||||||
|
@ -56,6 +53,7 @@ QUuid fingerprint::getMachineFingerprint() {
|
||||||
|
|
||||||
if (FAILED(hres)) {
|
if (FAILED(hres)) {
|
||||||
qDebug() << "Failed to initialize WbemLocator";
|
qDebug() << "Failed to initialize WbemLocator";
|
||||||
|
return uuidString;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connect to WMI through the IWbemLocator::ConnectServer method
|
// Connect to WMI through the IWbemLocator::ConnectServer method
|
||||||
|
@ -78,6 +76,7 @@ QUuid fingerprint::getMachineFingerprint() {
|
||||||
if (FAILED(hres)) {
|
if (FAILED(hres)) {
|
||||||
pLoc->Release();
|
pLoc->Release();
|
||||||
qDebug() << "Failed to connect to WMI";
|
qDebug() << "Failed to connect to WMI";
|
||||||
|
return uuidString;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set security levels on the proxy
|
// Set security levels on the proxy
|
||||||
|
@ -96,6 +95,7 @@ QUuid fingerprint::getMachineFingerprint() {
|
||||||
pSvc->Release();
|
pSvc->Release();
|
||||||
pLoc->Release();
|
pLoc->Release();
|
||||||
qDebug() << "Failed to set security on proxy blanket";
|
qDebug() << "Failed to set security on proxy blanket";
|
||||||
|
return uuidString;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use the IWbemServices pointer to grab the Win32_BIOS stuff
|
// Use the IWbemServices pointer to grab the Win32_BIOS stuff
|
||||||
|
@ -111,6 +111,7 @@ QUuid fingerprint::getMachineFingerprint() {
|
||||||
pSvc->Release();
|
pSvc->Release();
|
||||||
pLoc->Release();
|
pLoc->Release();
|
||||||
qDebug() << "query to get Win32_ComputerSystemProduct info";
|
qDebug() << "query to get Win32_ComputerSystemProduct info";
|
||||||
|
return uuidString;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the SerialNumber from the Win32_BIOS data
|
// Get the SerialNumber from the Win32_BIOS data
|
||||||
|
@ -150,8 +151,17 @@ QUuid fingerprint::getMachineFingerprint() {
|
||||||
qDebug() << "Windows BIOS UUID: " << uuidString;
|
qDebug() << "Windows BIOS UUID: " << uuidString;
|
||||||
#endif //Q_OS_WIN
|
#endif //Q_OS_WIN
|
||||||
|
|
||||||
|
return uuidString;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
QUuid FingerprintUtils::getMachineFingerprint() {
|
||||||
|
|
||||||
|
QString uuidString = getMachineFingerprintString();
|
||||||
|
|
||||||
// now, turn into uuid. A malformed string will
|
// now, turn into uuid. A malformed string will
|
||||||
// return QUuid() ("{00000...}")
|
// return QUuid() ("{00000...}"), which handles
|
||||||
|
// any errors in getting the string
|
||||||
QUuid uuid(uuidString);
|
QUuid uuid(uuidString);
|
||||||
if (uuid == QUuid()) {
|
if (uuid == QUuid()) {
|
||||||
// read fallback key (if any)
|
// read fallback key (if any)
|
||||||
|
|
|
@ -15,8 +15,12 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
|
|
||||||
namespace fingerprint {
|
class FingerprintUtils {
|
||||||
QUuid getMachineFingerprint();
|
public:
|
||||||
|
static QUuid getMachineFingerprint();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static QString getMachineFingerprintString();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_FingerprintUtils_h
|
#endif // hifi_FingerprintUtils_h
|
||||||
|
|
Loading…
Reference in a new issue