how to get the bits of system?

  • Thread starter Thread starter Bill Gates
  • Start date Start date
B

Bill Gates

the size of kernel object depends on the bits of system, but how can get the
bits of system?

for example, when using unmanaged method such as Win32 APIs, some struct
should
be translate to be C# form, how to arrange the bit offset of the members?
 
the size of kernel object depends on the bits of system, but how can get the
bits of system?

Do you mean if it's a 32-bit or 64-bit? One way to do that is to check
System.IntPtr.Size. But that returns the bitness of the application,
not the operating system, so for example in a 32-bit application
running on Win64 it would return 4 (bytes = 32 bits).

for example, when using unmanaged method such as Win32 APIs, some struct
should
be translate to be C# form, how to arrange the bit offset of the members?

If you use IntPtr, reference types or real pointers wherever platform
specific types are used, it's usually possible to write struct
declarations that work on both platforms.


Mattias
 
Thanks! :>

"Mattias Sj?gren"
Do you mean if it's a 32-bit or 64-bit? One way to do that is to check
System.IntPtr.Size. But that returns the bitness of the application,
not the operating system, so for example in a 32-bit application
running on Win64 it would return 4 (bytes = 32 bits).



If you use IntPtr, reference types or real pointers wherever platform
specific types are used, it's usually possible to write struct
declarations that work on both platforms.


Mattias
 
Back
Top