summaryrefslogtreecommitdiff
path: root/src/ToolBox/SOS/Strike/platformspecific.h
blob: d79a46055e5985f00174c2c61b176ed535cfacf4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

// ==++==
// 
 
// 
// ==--==

// Include platform specific declarations based on the target platform rather than the host platform.

#ifndef __PLATFORM_SPECIFIC_INCLUDED
#define __PLATFORM_SPECIFIC_INCLUDED

// The main debugger code already has target platform definitions for CONTEXT.
#include "../../../debug/inc/dbgtargetcontext.h"

#ifndef FEATURE_PAL

// The various OS structure definitions below tend to differ based soley on the size of pointers. DT_POINTER
// is a type whose size matches that of the target platform. It's integral rather than point since it is never
// legal to dereference one of these on the host.
#ifdef _TARGET_WIN64_
typedef ULONG64 DT_POINTER;
#else
typedef ULONG32 DT_POINTER;
#endif

struct DT_LIST_ENTRY
{
    DT_POINTER Flink;
    DT_POINTER Blink;
};

struct DT_UNICODE_STRING
{
    USHORT Length;
    USHORT MaximumLength;
    DT_POINTER Buffer;
};

#define DT_GDI_HANDLE_BUFFER_SIZE32  34
#define DT_GDI_HANDLE_BUFFER_SIZE64  60

#ifndef IMAGE_FILE_MACHINE_ARMNT
#define IMAGE_FILE_MACHINE_ARMNT             0x01c4  // ARM Thumb-2 Little-Endian 
#endif

#ifdef _TARGET_WIN64_
typedef ULONG DT_GDI_HANDLE_BUFFER[DT_GDI_HANDLE_BUFFER_SIZE64];
#else
typedef ULONG DT_GDI_HANDLE_BUFFER[DT_GDI_HANDLE_BUFFER_SIZE32];
#endif

struct DT_PEB
{
    BOOLEAN InheritedAddressSpace;
    BOOLEAN ReadImageFileExecOptions;
    BOOLEAN BeingDebugged;
    BOOLEAN SpareBool;
    DT_POINTER Mutant;
    DT_POINTER ImageBaseAddress;
    DT_POINTER Ldr;
    DT_POINTER ProcessParameters;
    DT_POINTER SubSystemData;
    DT_POINTER ProcessHeap;
    DT_POINTER FastPebLock;
    DT_POINTER SparePtr1;
    DT_POINTER SparePtr2;
    ULONG EnvironmentUpdateCount;
    DT_POINTER KernelCallbackTable;
    ULONG SystemReserved[1];
    struct _dummy {
        ULONG ExecuteOptions : 2;
        ULONG SpareBits : 30;
    };    
    DT_POINTER FreeList;
    ULONG TlsExpansionCounter;
    DT_POINTER TlsBitmap;
    ULONG TlsBitmapBits[2];
    DT_POINTER ReadOnlySharedMemoryBase;
    DT_POINTER ReadOnlySharedMemoryHeap;
    DT_POINTER ReadOnlyStaticServerData;
    DT_POINTER AnsiCodePageData;
    DT_POINTER OemCodePageData;
    DT_POINTER UnicodeCaseTableData;
    ULONG NumberOfProcessors;
    ULONG NtGlobalFlag;
    LARGE_INTEGER CriticalSectionTimeout;
    DT_POINTER HeapSegmentReserve;
    DT_POINTER HeapSegmentCommit;
    DT_POINTER HeapDeCommitTotalFreeThreshold;
    DT_POINTER HeapDeCommitFreeBlockThreshold;
    ULONG NumberOfHeaps;
    ULONG MaximumNumberOfHeaps;
    DT_POINTER ProcessHeaps;
    DT_POINTER GdiSharedHandleTable;
    DT_POINTER ProcessStarterHelper;
    ULONG GdiDCAttributeList;
    DT_POINTER LoaderLock;
    ULONG OSMajorVersion;
    ULONG OSMinorVersion;
    USHORT OSBuildNumber;
    USHORT OSCSDVersion;
    ULONG OSPlatformId;
    ULONG ImageSubsystem;
    ULONG ImageSubsystemMajorVersion;
    ULONG ImageSubsystemMinorVersion;
    DT_POINTER ImageProcessAffinityMask;
    DT_GDI_HANDLE_BUFFER GdiHandleBuffer;
    DT_POINTER PostProcessInitRoutine;
    DT_POINTER TlsExpansionBitmap;
    ULONG TlsExpansionBitmapBits[32];
    ULONG SessionId;
    ULARGE_INTEGER AppCompatFlags;
    ULARGE_INTEGER AppCompatFlagsUser;
    DT_POINTER pShimData;
    DT_POINTER AppCompatInfo;
    DT_UNICODE_STRING CSDVersion;
    DT_POINTER ActivationContextData;
    DT_POINTER ProcessAssemblyStorageMap;
    DT_POINTER SystemDefaultActivationContextData;
    DT_POINTER SystemAssemblyStorageMap;
    DT_POINTER MinimumStackCommit;
    DT_POINTER FlsCallback;
    DT_LIST_ENTRY FlsListHead;
    DT_POINTER FlsBitmap;
    ULONG FlsBitmapBits[FLS_MAXIMUM_AVAILABLE / (sizeof(ULONG) * 8)];
    ULONG FlsHighIndex;
};

struct DT_PEB_LDR_DATA
{
    BYTE Reserved1[8];
    DT_POINTER Reserved2[3];
    DT_LIST_ENTRY InMemoryOrderModuleList;
};

struct DT_CURDIR
{
    DT_UNICODE_STRING DosPath;
    DT_POINTER Handle;
};

struct DT_RTL_DRIVE_LETTER_CURDIR {
    USHORT Flags;
    USHORT Length;
    ULONG TimeStamp;
    STRING DosPath;
};

#define DT_RTL_MAX_DRIVE_LETTERS 32

struct DT_RTL_USER_PROCESS_PARAMETERS
{
    ULONG MaximumLength;
    ULONG Length;
    ULONG Flags;
    ULONG DebugFlags;
    DT_POINTER ConsoleHandle;
    ULONG  ConsoleFlags;
    DT_POINTER StandardInput;
    DT_POINTER StandardOutput;
    DT_POINTER StandardError;
    DT_CURDIR CurrentDirectory;
    DT_UNICODE_STRING DllPath;
    DT_UNICODE_STRING ImagePathName;
    DT_UNICODE_STRING CommandLine;
    DT_POINTER Environment;
    ULONG StartingX;
    ULONG StartingY;
    ULONG CountX;
    ULONG CountY;
    ULONG CountCharsX;
    ULONG CountCharsY;
    ULONG FillAttribute;
    ULONG WindowFlags;
    ULONG ShowWindowFlags;
    DT_UNICODE_STRING WindowTitle;
    DT_UNICODE_STRING DesktopInfo;
    DT_UNICODE_STRING ShellInfo;
    DT_UNICODE_STRING RuntimeData;
    DT_RTL_DRIVE_LETTER_CURDIR CurrentDirectores[ DT_RTL_MAX_DRIVE_LETTERS ];
};

#endif // !FEATURE_PAL

#define DT_OS_PAGE_SIZE   4096

#endif // !__PLATFORM_SPECIFIC_INCLUDED