Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than kernel32, prefix the name with the module name and a period.
struct BYTES
{
public byte BaseMid;
public byte Flags1;
public byte Flags2;
public byte BaseHi;
}
struct BITS
{
int Value;
/// <summary>
/// Max set value is 255 (11111111b)
/// </summary>
public int BaseMid {
get {
return ( Value & 0xFF );
}
set {
Value = ( Value & unchecked( (int)0xFFFFFF00 ) ) | ( value & 0xFF );
}
}
/// <summary>
/// Max set value is 31 (11111b)
/// </summary>
public int Type {
get {
return ( Value & 0x1F00 ) >> 8;
}
set {
Value = ( Value & unchecked( (int)0xFFFFE0FF ) ) | ( ( value & 0x1F ) << 8 );
}
}
/// <summary>
/// Max set value is 3 (11b)
/// </summary>
public int Dpl {
get {
return ( Value & 0x6000 ) >> 13;
}
set {
Value = ( Value & unchecked( (int)0xFFFF9FFF ) ) | ( ( value & 0x3 ) << 13 );
}
}
/// <summary>
/// Max set value is 1 (1b)
/// </summary>
public int Pres {
get {
return ( Value & 0x4000 ) >> 15;
}
set {
Value = ( Value & unchecked( (int)0xFFFFBFFF ) ) | ( ( value & 0x1 ) << 15 );
}
}
/// <summary>
/// Max set value is 15 (1111b)
/// </summary>
public int LimitHi {
get {
return ( Value & 0xF0000 ) >> 16;
}
set {
Value = ( Value & unchecked( (int)0xFFF0FFFF ) ) | ( ( value & 0xF ) << 16 );
}
}
/// <summary>
/// Max set value is 1 (1b)
/// </summary>
public int Sys {
get {
return ( Value & 0x100000 ) >> 20;
}
set {
Value = ( Value & unchecked( (int)0xFFEFFFFF ) ) | ( ( value & 0x1 ) << 20 );
}
}
/// <summary>
/// Max set value is 1 (1b)
/// </summary>
public int Reserved_0 {
get {
return ( Value & 0x200000 ) >> 21;
}
set {
Value = ( Value & unchecked( (int)0xFFDFFFFF ) ) | ( ( value & 0x1 ) << 21 );
}
}
/// <summary>
/// Max set value is 1 (1b)
/// </summary>
public int Default_Big {
get {
return ( Value & 0x400000 ) >> 22;
}
set {
Value = ( Value & unchecked( (int)0xFFBFFFFF ) ) | ( ( value & 0x1 ) << 22 );
}
}
/// <summary>
/// Max set value is 1 (1b)
/// </summary>
public int Granularity {
get {
return ( Value & 0x800000 ) >> 23;
}
set {
Value = ( Value & unchecked( (int)0xFF7FFFFF ) ) | ( ( value & 0x1 ) << 23 );
}
}
/// <summary>
/// Max set value is 255 (11111111b)
/// </summary>
public int BaseHi {
get {
return ( Value & unchecked( (int)0xFF000000 ) ) >> 24;
}
set {
Value = ( Value & unchecked( (int)0xFFFFFF ) ) | ( ( value & 0xFF ) << 24 );
}
}
}
[StructLayout( LayoutKind.Explicit )]
struct HIGHWORD
{
[FieldOffset( 0 )]
public BYTES Bytes;
[FieldOffset( 0 )]
public BITS Bits;
}
struct LDT_ENTRY
{
public ushort LimitLow;
public ushort BaseLow;
public HIGHWORD HighWord;
}
Notes:
None.
Tips & Tricks:
Please add some!
Sample Code:
C# Signature:
var cntx = new CONTEXT();
LDT_ENTRY ldt;
cntx.ContextFlags = CONTEXT_ALL;
if ( !GetThreadContext( GetCurrentThread(), ref cntx ) )
throw new Exception();
if ( !GetThreadSelectorEntry( GetCurrentThread(), cntx.SegDs, out ldt ) )
throw new Exception();
Alternative Managed API:
Do you know one? Please contribute it!
The GetThreadSelectorEntry API
9/3/2011 7:40:01 PM - -95.52.95.11
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).