T
2022-11-29 06:08:21 UTC
Hi All,
Windows 11 Pro 22H2
I program in Raku and can barely read C++
I pulled this off an M$ Forum. The idea was
to give you the size of a structure in bytes
of a structure:
This is the structure:
C++
typedef struct _WTS_SESSION_INFOA {
DWORD SessionId; # 4 bytes
LPSTR pWinStationName; # 4 or 8 bytes
WTS_CONNECTSTATE_CLASS State; # 4 bytes
} WTS_SESSION_INFOA, *PWTS_SESSION_INFOA;
This is the result:
int nSize1 = sizeof WTS_SESSION_INFOA; // 12 in x86, 24 in x64
// x64
int nSize1 = sizeof WTS_SESSION_INFOA; // 24
int nOffset1 = offsetof(WTS_SESSION_INFOA, SessionId); // 0
int nOffset2 = offsetof(WTS_SESSION_INFOA, pWinStationName); // 8
int nOffset3 = offsetof(WTS_SESSION_INFOA, State); // 16
I need these sizes to user Raku's NativeCall.
Would someone please throw together the C++ code
so I can duplicate it? (And use it for other
structure in the future.)
Also, when you do and if you have access to 32 bit
Windows, I need those results too (I have no
32 bit Windows at the moment.)
Many thanks,
-T
Windows 11 Pro 22H2
I program in Raku and can barely read C++
I pulled this off an M$ Forum. The idea was
to give you the size of a structure in bytes
of a structure:
This is the structure:
C++
typedef struct _WTS_SESSION_INFOA {
DWORD SessionId; # 4 bytes
LPSTR pWinStationName; # 4 or 8 bytes
WTS_CONNECTSTATE_CLASS State; # 4 bytes
} WTS_SESSION_INFOA, *PWTS_SESSION_INFOA;
This is the result:
int nSize1 = sizeof WTS_SESSION_INFOA; // 12 in x86, 24 in x64
// x64
int nSize1 = sizeof WTS_SESSION_INFOA; // 24
int nOffset1 = offsetof(WTS_SESSION_INFOA, SessionId); // 0
int nOffset2 = offsetof(WTS_SESSION_INFOA, pWinStationName); // 8
int nOffset3 = offsetof(WTS_SESSION_INFOA, State); // 16
I need these sizes to user Raku's NativeCall.
Would someone please throw together the C++ code
so I can duplicate it? (And use it for other
structure in the future.)
Also, when you do and if you have access to 32 bit
Windows, I need those results too (I have no
32 bit Windows at the moment.)
Many thanks,
-T