how to get the bits of system?

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?
 
M

Mattias Sjögren

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
 
B

Bill Gates

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top