Aar*_*ron 4 c++ x86 winapi windbg
注意:
/*
* Trivial code
*/
wchar_t *greeting = L"Hello World!";
char *greeting_ = "Hello World!";
Run Code Online (Sandbox Code Playgroud)
WinDbg的:
0:000> ?? greeting
wchar_t * 0x00415810
"Hello World!"
0:000> ?? greeting_
char * 0x00415800
"Hello World!"
0:000> db 0x00415800
00415800 48 65 6c 6c 6f 20 57 6f-72 6c 64 21 00 00 00 00 Hello World!....
00415810 48 00 65 00 6c 00 6c 00-6f 00 20 00 57 00 6f 00 H.e.l.l.o. .W.o.
00415820 72 00 6c 00 64 00 21 00-00 00 00 00 00 00 00 00 r.l.d.!.........
Run Code Online (Sandbox Code Playgroud)
题:
00
以ASCII字符之间wchar_t
- 的Win32?Mic*_*ael 10
wchar_t
是一个宽字符串,因此每个字符占用2个字节的存储空间.'H'为a wchar_t
0x0048.由于x86是little-endian,因此你会看到内存中的字节数为48 00.
windbg中的db将转储字节并提供它被视为ASCII字符串的方式,因此您看到的是HEL ...输出.您可以使用'du'将内存转储为unicode字符串.