MAINT-7541 Not able to save login credentials on clean install

master
pavelkproductengine 2017-07-10 17:22:12 +03:00
parent 5478f2a223
commit 530f69ff33
2 changed files with 24 additions and 12 deletions

View File

@ -1041,6 +1041,7 @@ Nicholaz Beresford
Nick Rhodes
NickyD
MAINT-873
MAINT-7541
Nicky Dasmijn
VWR-29228
MAINT-1392

View File

@ -37,6 +37,28 @@ using namespace std;
unsigned char static_unique_id[] = {0,0,0,0,0,0};
bool static has_static_unique_id = false;
#if LL_WINDOWS
class LLComInitialize
{
HRESULT mHR;
public:
LLComInitialize()
{
mHR = CoInitializeEx(0, COINIT_MULTITHREADED);
if (FAILED(mHR))
LL_DEBUGS("AppInit") << "Failed to initialize COM library. Error code = 0x" << hex << mHR << LL_ENDL;
}
~LLComInitialize()
{
if (SUCCEEDED(mHR))
CoUninitialize();
}
};
#endif //LL_WINDOWS
// get an unique machine id.
// NOT THREAD SAFE - do before setting up threads.
// MAC Address doesn't work for Windows 7 since the first returned hardware MAC address changes with each reboot, Go figure??
@ -59,12 +81,7 @@ S32 LLMachineID::init()
// Step 1: --------------------------------------------------
// Initialize COM. ------------------------------------------
hres = CoInitializeEx(0, COINIT_MULTITHREADED);
if (FAILED(hres))
{
LL_DEBUGS("AppInit") << "Failed to initialize COM library. Error code = 0x" << hex << hres << LL_ENDL;
return 1; // Program has failed.
}
LLComInitialize comInit;
// Step 2: --------------------------------------------------
// Set general COM security levels --------------------------
@ -89,7 +106,6 @@ S32 LLMachineID::init()
if (FAILED(hres))
{
LL_WARNS("AppInit") << "Failed to initialize security. Error code = 0x" << hex << hres << LL_ENDL;
CoUninitialize();
return 1; // Program has failed.
}
@ -107,7 +123,6 @@ S32 LLMachineID::init()
if (FAILED(hres))
{
LL_WARNS("AppInit") << "Failed to create IWbemLocator object." << " Err code = 0x" << hex << hres << LL_ENDL;
CoUninitialize();
return 1; // Program has failed.
}
@ -134,7 +149,6 @@ S32 LLMachineID::init()
{
LL_WARNS("AppInit") << "Could not connect. Error code = 0x" << hex << hres << LL_ENDL;
pLoc->Release();
CoUninitialize();
return 1; // Program has failed.
}
@ -160,7 +174,6 @@ S32 LLMachineID::init()
LL_WARNS("AppInit") << "Could not set proxy blanket. Error code = 0x" << hex << hres << LL_ENDL;
pSvc->Release();
pLoc->Release();
CoUninitialize();
return 1; // Program has failed.
}
@ -181,7 +194,6 @@ S32 LLMachineID::init()
LL_WARNS("AppInit") << "Query for operating system name failed." << " Error code = 0x" << hex << hres << LL_ENDL;
pSvc->Release();
pLoc->Release();
CoUninitialize();
return 1; // Program has failed.
}
@ -236,7 +248,6 @@ S32 LLMachineID::init()
pLoc->Release();
if (pEnumerator)
pEnumerator->Release();
CoUninitialize();
ret_code=0;
#else
unsigned char * staticPtr = (unsigned char *)(&static_unique_id[0]);