From 25b65d742ad772757481b6e4ad08df0769239092 Mon Sep 17 00:00:00 2001 From: robertpopa22 Date: Sat, 14 Mar 2026 12:59:42 +0200 Subject: [PATCH] fix: set InternalName to 'PuTTYNG' via APPNAME override in version.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PuTTY's resource files use the APPNAME macro for InternalName. Since PuTTYNG.ps1 modifies version.h but not the APPNAME define, the compiled PuTTYNG.exe reports InternalName='PuTTY' instead of 'PuTTYNG'. This breaks mRemoteNG's PuttyTypeDetector which checks InternalName to enable PuTTYNG-specific features like -hwndparent (embedded window mode — the main reason PuTTYNG exists). Fix: append an APPNAME define override to version.h after the other version modifications, so the compiled .rc resource uses 'PuTTYNG'. --- PuTTYNG.ps1 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/PuTTYNG.ps1 b/PuTTYNG.ps1 index 36805e91..abc4eb94 100644 --- a/PuTTYNG.ps1 +++ b/PuTTYNG.ps1 @@ -133,6 +133,16 @@ if (Test-Path -LiteralPath $workFolder) { (Get-Content $workFile).Replace('-Unidentified-Local-Build', '-Release-mRemoteNG-Build') | Set-Content $workFile (Get-Content $workFile).Replace('0,0,0,0', $setNewVersion) | Set-Content $workFile Write-Host "Code block replaced successfully in '$workFile'." + + # Fix InternalName: PuTTY uses APPNAME macro for InternalName in the .rc resource. + # Patch version.h to define a custom APPNAME so the compiled exe reports "PuTTYNG" + # instead of "PuTTY". This is needed for mRemoteNG's PuttyTypeDetector to identify + # the embedded PuTTYNG and enable -hwndparent (embedded window mode). + $versionContent = Get-Content $workFile -Raw + if ($versionContent -notmatch 'PUTTYNG_APPNAME') { + Add-Content $workFile "`n/* Override InternalName for mRemoteNG detection */`n#define APPNAME `"PuTTYNG`"`n" + Write-Host "Added APPNAME override to '$workFile'." + } #=================================================================================================== #Add mRemoteNG required changes