1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4//*****************************************************************************
5// File: stdafx.h
6//
7
8//
9//*****************************************************************************
10/* XXX Fri 10/14/2005
11 * prevent winioctl from defining something called "Unknown"
12 */
13#define _WINIOCTL_
14
15// Define ALLOW_VMPTR_ACCESS to grant DAC access to VMPTR
16#define ALLOW_VMPTR_ACCESS
17
18// Prevent the inclusion of Random.h from disabling rand(). rand() is used by some other headers we include
19// and there's no reason why DAC should be forbidden from using it.
20#define DO_NOT_DISABLE_RAND
21
22#define USE_COM_CONTEXT_DEF
23
24#include <stddef.h>
25#include <stdint.h>
26#include <windows.h>
27
28#include <winwrap.h>
29
30#include <dbghelp.h>
31
32#include <wchar.h>
33#include <stdio.h>
34
35#include <dbgtargetcontext.h>
36
37#include <cor.h>
38#include <dacprivate.h>
39#include <sospriv.h>
40
41#include <common.h>
42#include <codeman.h>
43#include <debugger.h>
44#include <controller.h>
45#include <eedbginterfaceimpl.h>
46#include <methoditer.h>
47
48#include <xcordebug.h>
49#include "dacimpl.h"
50
51
52#define STRSAFE_NO_DEPRECATE
53#include <strsafe.h>
54#undef _ftcscat
55#undef _ftcscpy
56
57// from ntstatus.h
58#define STATUS_STOWED_EXCEPTION ((NTSTATUS)0xC000027BL)
59
60// unpublished Windows structures. these will be published soon in a new header.
61// copying here for now and we'll use the windows header when it's available.
62// this is tracked with issue 824225
63#ifndef _STOWED_EXCEPTION_TEMP_DEFINITION
64#define _STOWED_EXCEPTION_TEMP_DEFINITION
65
66typedef struct _STOWED_EXCEPTION_INFORMATION_HEADER {
67 ULONG Size;
68 ULONG Signature;
69} STOWED_EXCEPTION_INFORMATION_HEADER, *PSTOWED_EXCEPTION_INFORMATION_HEADER;
70
71typedef struct _STOWED_EXCEPTION_INFORMATION_V2 {
72 STOWED_EXCEPTION_INFORMATION_HEADER Header;
73
74 HRESULT ResultCode;
75
76 struct {
77 DWORD ExceptionForm : 2;
78 DWORD ThreadId : 30;
79 };
80
81 union {
82 struct {
83 PVOID ExceptionAddress;
84
85 ULONG StackTraceWordSize; // sizeof (PVOID)
86 ULONG StackTraceWords; // number of words pointed to by StackTrace
87 PVOID StackTrace; // StackTrace buffer
88 };
89 struct {
90 PWSTR ErrorText;
91 };
92 };
93
94 ULONG NestedExceptionType;
95 PVOID NestedException; // opaque exception addendum
96} STOWED_EXCEPTION_INFORMATION_V2, *PSTOWED_EXCEPTION_INFORMATION_V2;
97
98//
99// Nested exception: type definition macro (byte swap). Assumes little-endian.
100//
101#define STOWED_EXCEPTION_NESTED_TYPE(t) ((((((ULONG)(t)) >> 24) & 0xFF) << 0) | \
102 (((((ULONG)(t)) >> 16) & 0xFF) << 8) | \
103 (((((ULONG)(t)) >> 8) & 0xFF) << 16) | \
104 (((((ULONG)(t)) >> 0) & 0xFF) << 24))
105
106#define STOWED_EXCEPTION_INFORMATION_V2_SIGNATURE 'SE02'
107#define STOWED_EXCEPTION_NESTED_TYPE_LEO STOWED_EXCEPTION_NESTED_TYPE('LEO1') // language exception object
108
109#endif // _STOWED_EXCEPTION_TEMP_DEFINITION
110