Skip to content

Commit

Permalink
Merge pull request #13084 from keymanapp/feat/windows/tsysinfo-report…
Browse files Browse the repository at this point in the history
…-on-processor

feat(windows): report on processor type in tsysinfo
  • Loading branch information
mcdurdin authored Jan 30, 2025
2 parents e9f72f3 + 30b5c80 commit 6db4fd3
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 2 deletions.
17 changes: 17 additions & 0 deletions windows/src/engine/tsysinfo/si_overview.pas
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ class function TSI_Overview.GetCaption: String;
Result := 'Overview';
end;

type
TIsWow64Process2 = function(hProcess: THandle; out pProcessMachine: USHORT; out pNativeMachine: USHORT): BOOL; stdcall;

function TSI_Overview.DoCollect: Boolean;
var
n, nn, node: IXMLDOMNode;
Expand All @@ -55,6 +58,9 @@ function TSI_Overview.DoCollect: Boolean;
buf: array[0..1023] of char;
freespace, totalspace, totalfree: Int64;
stat: TMemoryStatus;
processMachine: USHORT;
nativeMachine: USHORT;
IsWow64Process2: TIsWow64Process2;
begin
{
SYSTEM INFO:
Expand Down Expand Up @@ -85,6 +91,17 @@ function TSI_Overview.DoCollect: Boolean;
then xmlSetAttribute(n,'x64', 'true')
else xmlSetAttribute(n,'x64', 'false');

IsWow64Process2 := GetProcAddress(GetModuleHandle(kernel32), 'IsWow64Process2');
if Assigned(IsWow64Process2) then
begin
if IsWow64Process2(GetCurrentProcess, processMachine, nativeMachine) then
begin
// https://learn.microsoft.com/en-us/windows/win32/sysinfo/image-file-machine-constants
xmlSetAttribute(n, 'ProcessMachine', IntToHex(processMachine, 4));
xmlSetAttribute(n, 'NativeMachine', IntToHex(nativeMachine, 4));
end;
end;

{ Free disk space }

n := xmlAddChild(node,'DiskSpace');
Expand Down
42 changes: 40 additions & 2 deletions windows/src/engine/tsysinfo/si_overview.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</tbody>
</table>
</xsl:template>


<xsl:template match="HardDrive">
<tr>
Expand Down Expand Up @@ -128,8 +128,46 @@
<xsl:value-of select="@x64"/>
</td>
</tr>
<tr>
<th>Native Machine</th>
<td>
<xsl:choose>
<xsl:when test="@NativeMachine = '014C'">Intel 386</xsl:when>
<xsl:when test="@NativeMachine = '0162'">MIPS R3000</xsl:when>
<xsl:when test="@NativeMachine = '0160'">MIPS R3000</xsl:when>
<xsl:when test="@NativeMachine = '0166'">MIPS R4000</xsl:when>
<xsl:when test="@NativeMachine = '0168'">MIPS R10000</xsl:when>
<xsl:when test="@NativeMachine = '0169'">MIPS WCE v2</xsl:when>
<xsl:when test="@NativeMachine = '0184'">Alpha AXP</xsl:when>
<xsl:when test="@NativeMachine = '01A2'">SH3</xsl:when>
<xsl:when test="@NativeMachine = '01A3'">SH3 DSP</xsl:when>
<xsl:when test="@NativeMachine = '01A4'">SH3E</xsl:when>
<xsl:when test="@NativeMachine = '01A6'">SH4</xsl:when>
<xsl:when test="@NativeMachine = '01A8'">SH5</xsl:when>
<xsl:when test="@NativeMachine = '01C0'">ARM</xsl:when>
<xsl:when test="@NativeMachine = '01C2'">ARM Thumb</xsl:when>
<xsl:when test="@NativeMachine = '01C4'">ARM Thumb 2</xsl:when>
<xsl:when test="@NativeMachine = '01D3'">TAM33BD</xsl:when>
<xsl:when test="@NativeMachine = '01F0'">PowerPC</xsl:when>
<xsl:when test="@NativeMachine = '01F1'">PowerPC FP</xsl:when>
<xsl:when test="@NativeMachine = '0200'">Intel IA64</xsl:when>
<xsl:when test="@NativeMachine = '0266'">MIPS 16</xsl:when>
<xsl:when test="@NativeMachine = '0284'">Alpha 64</xsl:when>
<xsl:when test="@NativeMachine = '0366'">MIPSFPU</xsl:when>
<xsl:when test="@NativeMachine = '0466'">AXP64</xsl:when>
<xsl:when test="@NativeMachine = '0520'">Infineon</xsl:when>
<xsl:when test="@NativeMachine = '0CEF'">CEF</xsl:when>
<xsl:when test="@NativeMachine = '0EBC'">EBC (EFI Byte Code)</xsl:when>
<xsl:when test="@NativeMachine = '8664'">AMD64</xsl:when>
<xsl:when test="@NativeMachine = '9041'">M32R</xsl:when>
<xsl:when test="@NativeMachine = 'AA64'">ARM64</xsl:when>
<xsl:when test="@NativeMachine = 'C0EE'">CEE</xsl:when>
<xsl:otherwise><xsl:value-of select="@NativeMachine" /></xsl:otherwise>
</xsl:choose>
</td>
</tr>
</tbody>
</table>
</xsl:template>

</xsl:stylesheet>
</xsl:stylesheet>

0 comments on commit 6db4fd3

Please sign in to comment.