diff --git a/Main.vb b/Main.vb index 446e5eb..1c75a24 100644 --- a/Main.vb +++ b/Main.vb @@ -1,6 +1,7 @@ Imports System.Environment Imports System.Globalization Imports System.IO +Imports Microsoft.Win32 Public Class TSUserReporter @@ -83,14 +84,23 @@ Public Class TSUserReporter End Function Function getregkey() - Dim Reg As String = Nothing - If My.Computer.Registry.GetValue("HKEY_CURRENT_USER\Software\TeamViewer", "ClientIDOfTSUser", Nothing) Is Nothing Then - Reg = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\TeamViewer", "ClientID", Nothing) - Else - Reg = My.Computer.Registry.GetValue("HKEY_CURRENT_USER\Software\TeamViewer", "ClientIDOfTSUser", Nothing) - End If + Dim regObj As Object = Nothing + + ' 1. HKCU + regObj = Registry.GetValue("HKEY_CURRENT_USER\Software\TeamViewer", "ClientIDOfTSUser", Nothing) + If regObj IsNot Nothing Then Return regObj.ToString() + + ' 2. HKLM\WOW6432Node + regObj = Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\TeamViewer", "ClientID", Nothing) + If regObj IsNot Nothing Then Return regObj.ToString() + + ' 3. HKLM (Standard-Pfad, 64-bit) + regObj = Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\TeamViewer", "ClientID", Nothing) + If regObj IsNot Nothing Then Return regObj.ToString() + + ' Falls nichts gefunden + Return Nothing - Return Reg End Function Function Report() diff --git a/TSUserReporter.vbproj b/TSUserReporter.vbproj index 176f8ae..d092d8f 100644 --- a/TSUserReporter.vbproj +++ b/TSUserReporter.vbproj @@ -32,7 +32,7 @@ true - AnyCPU + x64 true full true