0x%.16X

Hi,

I have been using 0x%.16X for a long time in 64bit drivers without a second thought. I have just noticed that when I tried displaying 0x1122334455667788 through DbgView it displays 0x0000000055667788 when I use 0x%.16X.

Does anyone know what I am missing. I have tried searching.

Thankyou as always,

> Hi,

I have been using 0x%.16X for a long time in 64bit drivers without a second
thought. I have just noticed that when I tried displaying 0x1122334455667788
through DbgView it displays 0x0000000055667788 when I use 0x%.16X.

Does anyone know what I am missing. I have tried searching.

I use %I64d, so I assume %I64X, or %.16I64X or something like that is what you want.

It’s a bit of a pain… under Linux I’d just use %lx but that doesn’t work under Windows. WCHAR strings are different between the two too. I couldn’t find it anywhere when I searched either.

James

Hi,

Thankyou very much %.16I64X worked perfectly.

Thankyou again.

Hi, > > I have been using 0x%.16X for a long time in 64bit drivers without a second > thought. I have just noticed that when I tried displaying 0x1122334455667788 > through DbgView it displays 0x0000000055667788 when I use 0x%.16X. > > Does anyone know what I am missing. I have tried searching. > I use %I64d, so I assume %I64X, or %.16I64X or something like that is what you want. It’s a bit of a pain… under Linux I’d just use %lx but that doesn’t work under Windows. WCHAR strings are different between the two too. I couldn’t find it anywhere when I searched either. James

On 24-Sep-2012 12:27, James Harper wrote:

> Hi,
>
> I have been using 0x%.16X for a long time in 64bit drivers without a second
> thought. I have just noticed that when I tried displaying 0x1122334455667788
> through DbgView it displays 0x0000000055667788 when I use 0x%.16X.
>
> Does anyone know what I am missing. I have tried searching.
>

I use %I64d, so I assume %I64X, or %.16I64X or something like that is what you want.

It’s a bit of a pain… under Linux I’d just use %lx but that doesn’t work under Windows. WCHAR strings are different between the two too. I couldn’t find it anywhere when I searched either.

James

In Windows C type long is 32-bit. Always. And 64-bit is long long.
This is documented in MSDN, where the C compiler and library belong.
Newer kernels support also %ll prefix (long long, like
in VC++ 2008) but for backward compatibility with XP use only %I64.
Note that stdint.h defines correct format strings for various types,
but this wasn’t available in WDK, at least before win8.
– pa