From 1367641d48d3b234ee0665138ddfd51d92a857bf Mon Sep 17 00:00:00 2001 From: Tom Schaefer Date: Fri, 12 Nov 2021 15:15:50 -0500 Subject: [PATCH] Added code to output version info on debug level change --- tr4w/src/MainUnit.pas | 17 ++++++++++++++++- tr4w/src/trdos/tree.pas | 14 ++++++++++++++ tr4w/src/uCFG.pas | 13 +++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/tr4w/src/MainUnit.pas b/tr4w/src/MainUnit.pas index fe4a5244..6fcd19ee 100644 --- a/tr4w/src/MainUnit.pas +++ b/tr4w/src/MainUnit.pas @@ -177,6 +177,7 @@ function DeviceIoControlHandler ULONG; pOutputLength: PULONG ): Cardinal; +function IsWin64: Boolean; function GetLocalComputerName : string; procedure CheckNumber; procedure RunPlugin(PluginNumber: integer); @@ -8195,10 +8196,24 @@ procedure ProcessImportedSRX_String(fieldValue: string; var exch: ContestExchang end; end; end; // case +end; + +function IsWin64: Boolean; +var + IsWow64Process : function(hProcess : THandle; var Wow64Process : BOOL): BOOL; stdcall; + Wow64Process : BOOL; +begin + Result := False; + IsWow64Process := GetProcAddress(GetModuleHandle(Kernel32), 'IsWow64Process'); + if Assigned(IsWow64Process) then begin + if IsWow64Process(GetCurrentProcess, Wow64Process) then begin + Result := Wow64Process; + end; + end; +end; -end; diff --git a/tr4w/src/trdos/tree.pas b/tr4w/src/trdos/tree.pas index e5d72cf6..8c354aaa 100644 --- a/tr4w/src/trdos/tree.pas +++ b/tr4w/src/trdos/tree.pas @@ -5283,6 +5283,20 @@ function GoodLookingRDA(rda: Str20): boolean; result := True; end; +function IsWin64: Boolean; +var + IsWow64Process : function(hProcess : THandle; var Wow64Process : BOOL): BOOL; stdcall; + Wow64Process : BOOL; +begin + Result := False; + IsWow64Process := GetProcAddress(GetModuleHandle(Kernel32), 'IsWow64Process'); + if Assigned(IsWow64Process) then begin + if IsWow64Process(GetCurrentProcess, Wow64Process) then begin + Result := Wow64Process; + end; + end; +end; + { procedure Congrats; var diff --git a/tr4w/src/uCFG.pas b/tr4w/src/uCFG.pas index 8fb93f0e..bd502ec8 100644 --- a/tr4w/src/uCFG.pas +++ b/tr4w/src/uCFG.pas @@ -1544,11 +1544,24 @@ procedure UpdateDebugLogLevel; // This is called when changed in the Config dial llFatal: logger.level := Fatal; llError: logger.Level := Error; llWarn: logger.Level := Warn; + llInfo: logger.Level := Info; llDebug: logger.Level := Debug; llTrace: logger.Level := Trace; else ; end; + // Log the version of the program under debug + if logger.IsInfoEnabled then + begin + logger.Info('TR4W Program Version %s (%s)',[ TR4W_CURRENTVERSION, TR4W_CURRENTVERSIONDATE]); + if MainUnit.IsWin64 then + begin + logger.Info('Running on 64 bit Windows'); + end; + logger.info('Windows version: %d',[tr4w_osverinfo.dwPlatformId]); + end; + + end; function F_UpdateWSJTXEnabled: boolean;