add GetMachineId

This commit is contained in:
Chris Danford
2006-05-04 05:13:06 +00:00
parent d284692d64
commit 3cb84a61b5
3 changed files with 17 additions and 0 deletions
+5
View File
@@ -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;