32-bit / 64-bit solution
For a quick test, I often use
lm m wow64
which checks if the WOW64 layer has been loaded. If so, this is a 32-bit process.
This approach works in many cases, because today the OS is most likely 64 bits. However, you can also have a 32-bit dump of a 32-bit OS, in which case this approach does not work.
More authoritarian approach
.load wow64exts !info
which, unfortunately, gives a lot of results, so it will be difficult to use in a script.
32-bit output looks like
0:000> !info PEB32: 0xe4d000 PEB64: 0xe4c000 Wow64 information for current thread: TEB32: 0xe50000 TEB64: 0xe4e000 [...]
In the case of 64 bits, this
0:000> !info Could not get the address of the 32bit PEB, error 0 PEB32: 0 PEB64: 0x6b33c50000 Wow64 information for current thread: TEB32: 0 TEB64: 0x6b33c51000 [...]
I don't have a 32-bit dump of Windows OS, but I'm sure
- If PEB32 is not 0, this is a 32-bit process.
- If PEB64 is 0, it is a 32-bit OS
If you know the name of the module, you can also check the file headers:
0:000> .shell -ci "!dh -f notepad" findstr "machine" 8664 machine (X64) .shell: Process exited
Things that don't work
vertarget , as suggested in the comments, does not work well for 64-bit crash dumps of 32-bit applications.
$ptrsize would be so nice, but it depends on the debugger mode:
0:000> ? $ptrsize Evaluate expression: 8 = 00000000`00000008 0:000> .effmach x86 Effective machine: x86 compatible (x86) 0:000:x86> ? $ptrsize Evaluate expression: 4 = 00000004
.NET Solution
Like the WOW64 layer, you can check .NET:
lm m mscorwks lm m clr lm m coreclr
Of course, it would be possible to load such a DLL through LoadLibrary() from native code directly and not use .NET, but I think this is a rare use of someone who wants to trick you.