Here is a sample C code which prints Windows version directly from address of KUSER_SHARED_DATA. Tested in Windows 10 only. The raw memory address differ in Windows version but that's not the point.
#include <stdio.h>
int main(void)
{
wprintf(
L"Version: %lu.%lu.%lu\n",
*(unsigned int *)(0x7FFE0000 + 0x026C),
*(unsigned int *)(0x7FFE0000 + 0x0270),
*(unsigned int *)(0x7FFE0000 + 0x0260)
);
}
Here are the decompiled code:
In GHIDRA:
int main(int _Argc,char **_Argv,char **_Env)
{
wprintf(L"Version: %lu.%lu.%lu\n",
(ulonglong)_DAT_7ffe026c,
(ulonglong)_DAT_7ffe0270,
(ulonglong)_DAT_7ffe0260);
return 0;
}
In IDA Pro + Hex-Rays:
int __fastcall main()
{
wprintf(L"Version: %lu.%lu.%lu\n",
MEMORY[0x7FFE026C],
MEMORY[0x7FFE0270],
MEMORY[0x7FFE0260]);
return 0;
}
My question: In decompiled code, is it possible to show the memory address as
the member of KUSER_SHARED_DATA? For example, I want to show MEMORY[0x7FFE0260]
as SharedData.NtBuildNumber
or something similar to it.