add GetMachineId
This commit is contained in:
@@ -24,6 +24,11 @@ public:
|
||||
*/
|
||||
static RString GetPreferredLanguage();
|
||||
|
||||
/*
|
||||
* A string that uniquely identifies the machine in some way
|
||||
*/
|
||||
virtual RString GetMachineId() { return RString(); }
|
||||
|
||||
/*
|
||||
* If this is a second instance, return true. Optionally, give focus to the existing
|
||||
* window.
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "archutils/win32/DebugInfoHunt.h"
|
||||
#include "archutils/win32/RestartProgram.h"
|
||||
#include "archutils/win32/GotoURL.h"
|
||||
#include "archutils/Win32/RegistryAccess.h"
|
||||
|
||||
static HANDLE g_hInstanceMutex;
|
||||
static bool g_bIsMultipleInstance = false;
|
||||
@@ -72,6 +73,16 @@ static BOOL CALLBACK GetEnabledPopup( HWND hWnd, LPARAM lParam )
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static const RString CURRENT_VERSION_KEY = "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion";
|
||||
|
||||
RString ArchHooks_Win32::GetMachineId()
|
||||
{
|
||||
RString s;
|
||||
if( RegistryAccess::GetRegValue( CURRENT_VERSION_KEY, "ProductID", s ) )
|
||||
return s;
|
||||
return RString();
|
||||
}
|
||||
|
||||
bool ArchHooks_Win32::CheckForMultipleInstances()
|
||||
{
|
||||
if( !g_bIsMultipleInstance )
|
||||
|
||||
@@ -12,6 +12,7 @@ public:
|
||||
RString GetArchName() { return "Windows"; }
|
||||
void DumpDebugInfo();
|
||||
void RestartProgram();
|
||||
RString GetMachineId();
|
||||
bool CheckForMultipleInstances();
|
||||
|
||||
int OldThreadPriority;
|
||||
|
||||
Reference in New Issue
Block a user