first commit
This commit is contained in:
38
Sonstiges/WTSAPI_ClientName.au3
Normal file
38
Sonstiges/WTSAPI_ClientName.au3
Normal file
@@ -0,0 +1,38 @@
|
||||
#NoTrayIcon
|
||||
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
|
||||
#AutoIt3Wrapper_Icon=Icon256-32.ico
|
||||
#AutoIt3Wrapper_Change2CUI=y
|
||||
#AutoIt3Wrapper_Res_SaveSource=y
|
||||
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
|
||||
Opt('MustDeclareVars', 1)
|
||||
Dim $h_DllErgebnis
|
||||
Dim $s_clientname
|
||||
Dim $s_ip
|
||||
Dim $a_DezimalIP[5]
|
||||
|
||||
Func _ANSI2OEM($text)
|
||||
$text = DllCall('user32.dll', 'Int', 'CharToOem', 'str', $text, 'str', '')
|
||||
Return $text[2]
|
||||
EndFunc ;==>_ANSI2OEM
|
||||
|
||||
RegDelete("HKEY_CURRENT_USER\Environment", "WTSAPI_ClientName")
|
||||
|
||||
ConsoleWrite(_ANSI2OEM("Call Wtsapi32.dll for Remote-Clientname ... "))
|
||||
$h_DllErgebnis = DllCall("Wtsapi32.dll","BOOL","WTSQuerySessionInformationW","int",0, "int", -1, "int", 10, "ptr*", 0, "DWORD*",0)
|
||||
If @error Or $h_DllErgebnis[0] = 0 Then
|
||||
ConsoleWrite(_ANSI2OEM("failed! (It's ok if this is a Console-Session)" & @CRLF & @CRLF))
|
||||
$s_clientname = ""
|
||||
Else
|
||||
$s_clientname = BinaryToString( DllStructGetData(DllStructCreate("byte[" & $h_DllErgebnis[5] & "]" , $h_DllErgebnis[4]),1) ,2)
|
||||
ConsoleWrite(_ANSI2OEM("success! Name is " & $s_clientname & @CRLF & @CRLF))
|
||||
DllCall("Wtsapi32.dll", "int", "WTSFreeMemory", "ptr", $h_DllErgebnis[4])
|
||||
EndIf
|
||||
|
||||
$s_clientname = _ANSI2OEM($s_clientname)
|
||||
ConsoleWrite(_ANSI2OEM("Setting %WTSAPI_ClientName% to '" & $s_clientname & "'" & @CRLF & @CRLF))
|
||||
EnvSet("WTSAPI_ClientName", $s_clientname)
|
||||
;~ RunWait(@ComSpec & "/C setx WTSAPI_ClientName " & $s_clientname)
|
||||
RegWrite("HKEY_CURRENT_USER\Environment", "WTSAPI_ClientName", "REG_SZ", $s_clientname)
|
||||
|
||||
;~ EnvUpdate()
|
||||
;~ MsgBox(0,"Clientname", @UserName & @CRLF & "COMPUTERNAME: " & @ComputerName & @CRLF & " RDP-Client: " & $s_clientname & " - " & $s_ip)
|
||||
BIN
Sonstiges/WTSAPI_ClientName.exe
Normal file
BIN
Sonstiges/WTSAPI_ClientName.exe
Normal file
Binary file not shown.
BIN
Sonstiges/calibre-portable.exe
Normal file
BIN
Sonstiges/calibre-portable.exe
Normal file
Binary file not shown.
Reference in New Issue
Block a user